-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
script for linux installation #63
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ | |
|
||
Pantheon CMD is a Python-based command-line tool that allows you to generate a rendered preview of modular documentation using the new HAML templates. | ||
|
||
Installing Pantheon CMD using RPM allows you to perform actions using the predefined aliases such as: | ||
Installing Pantheon CMD using RPM allows you to perform actions using the predefined aliases such as: | ||
* `pcmd validate` | ||
* `pcmd build` | ||
* `pcmd preview` | ||
|
@@ -24,58 +24,23 @@ A script used to package the script as an RPM-based package that can be installe | |
**PantheonCMD** | ||
A directory containing the source files for the script, and the man page file. | ||
|
||
## Updating the Script | ||
All additions and updates to the script are welcome. | ||
|
||
## Packaging the Script | ||
## Packaging and Installing Pantheon CMD on RHEL and Fedora | ||
After you update Pantheon CMD and test the changes, build an RPM-based package for the script to be installed on systems that use *yum* or *dnf*. | ||
|
||
* Prerequisites: | ||
* A user has registered their SSH keys with GitHub. | ||
|
||
1. Install the `svn` and `rpmbuild` packages on your system: | ||
```shell | ||
# on RHEL | ||
$ sudo yum install subversion | ||
$ sudo yum install rpm-build | ||
|
||
# on Fedora | ||
$ sudo dnf install subversion | ||
$ sudo dnf install rpm-build | ||
``` | ||
2. Clone this repository. | ||
1. Clone this repository. | ||
```shell | ||
$ git clone [email protected]:redhataccess/pantheon-cmd.git | ||
``` | ||
3. Open *./build/pantheon-cmd.spec*. | ||
4. Increment the value of the *Release* number. | ||
As an example, `Release: 1%{?dist}` increments the version of the build to `1.0.1`, where `{?dist}` identifies of your Linux distribution. | ||
5. Run the build script: | ||
```shell | ||
$ sh make.sh 1.0 | ||
``` | ||
As a result, the `build/pantheon-cmd-1.0-X.<your-distribution-and-version>.noarch.rpm` file is generated in the root of the repository. This file will be used in the following step. | ||
|
||
## Installing Pantheon CMD | ||
|
||
Install Pantheon CMD on a local system. | ||
|
||
## Installing Pantheon CMD on RHEL and Fedora | ||
|
||
Install the RPM and all Ruby gem dependencies. | ||
|
||
1. Install the RPM: | ||
```shell | ||
$ sudo dnf localinstall build/pantheon-cmd-1.0-X.el8.noarch.rpm | ||
``` | ||
Note that your `rpm` filename might differ based on your Linux distribution. | ||
* Example: | ||
* `el8` for RHEL 8 | ||
* `fc34` for Fedora 34 | ||
|
||
2. Install Ruby gem dependencies: | ||
2. Navigate to the `pantheon-cmd` directory: | ||
```shell | ||
$ cd pantheon-cmd | ||
``` | ||
3. Run the `linux-cmd-intallation.sh` packaging and installation script: | ||
```shell | ||
$ sudo gem install asciidoctor concurrent-ruby haml tilt | ||
$ sh linux-cmd-intallation.sh | ||
``` | ||
|
||
The script is installed on your local machine. | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
#!/bin/bash | ||
|
||
# Error handling | ||
trap 'last_command=$current_command; current_command=$BASH_COMMAND' DEBUG | ||
terminate() | ||
{ | ||
echo >&2 ' | ||
*** terminated *** | ||
' | ||
echo "\"$last_command\" command failed with exit code $?." | ||
exit 1 | ||
} | ||
|
||
trap 'terminate' 0 | ||
|
||
set -e | ||
|
||
# install required packages | ||
echo 'Installing package dependencies...' | ||
sudo dnf install python3 ruby subversion rpm-build | ||
|
||
echo 'Installing ruby gem dependencies...' | ||
sudo gem install asciidoctor concurrent-ruby haml tilt | ||
# do we still need pygit2? | ||
pip3 install pygit2 | ||
|
||
echo 'Creating resources directories...' | ||
for dir in "PantheonCMD/haml" "PantheonCMD/locales"; do if [ ! -d "$dir" ]; then mkdir $dir; fi; done | ||
|
||
echo 'Getting HAML templates...' | ||
svn checkout https://github.com/redhataccess/pantheon/trunk/pantheon-bundle/src/main/resources/apps/pantheon/templates/haml/html5 PantheonCMD/haml | ||
|
||
echo 'Getting locales...' | ||
svn checkout https://github.com/asciidoctor/asciidoctor/trunk/data/locale PantheonCMD/locales | ||
rm -rf PantheonCMD/{haml,locales}/.svn | ||
|
||
echo 'Updating styling references...' | ||
sed -i 's/^-\ pantheonCssPath.*/-\ pantheonCssPath\ \=\ \"resources\/rhdocs.min.css\"/' PantheonCMD/haml/document.html.haml | ||
sed -i 's/href\=\"https\:\/\/static\.redhat\.com\/libs\/redhat\/redhat-font\/2\/webfonts\/red-hat-font\.css/href\=\"resources\/red-hat-font.css/' PantheonCMD/haml/document.html.haml | ||
|
||
echo 'Copying the source files to the local binaries directory...' | ||
sudo cp -r PantheonCMD /usr/local/bin | ||
|
||
# do we need to account for different shells? | ||
# exit code is 0 so setting +e | ||
echo 'Adding an alias to the current shell...' | ||
if [[ $SHELL = '/bin/bash' ]]; then | ||
set +e && alias pcmd='/usr/bin/python3 /usr/local/bin/PantheonCMD/pcmd.py $@' && source ~/.bashrc | ||
elif [[ $SHELL = '/bin/tcsh' ]]; then | ||
set +e && alias pcmd '/usr/bin/python3 /usr/local/bin/PantheonCMD/pcmd.py $@' && source ~/.tcshrc | ||
elif [[ $SHELL = '/bin/csh' ]]; then | ||
set +e && alias pcmd '/usr/bin/python3 /usr/local/bin/PantheonCMD/pcmd.py $@' && source ~/.cshrc | ||
fi | ||
Comment on lines
+47
to
+53
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not sure if we should account for various shells or just roll with bash |
||
|
||
rm -rf PantheonCMD/{haml,locales} | ||
|
||
trap : 0 | ||
|
||
echo >&2 ' | ||
*** DONE *** | ||
' |
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -63,7 +63,7 @@ cp -r PantheonCMD /usr/local/bin | |||||
|
||||||
echo 'Adding an alias to ~/.zshrc file...' | ||||||
|
||||||
alias pcmd="/usr/local/bin/python3 /usr/local/bin/PantheonCMD/pcmd.py $@" | ||||||
alias pcmd="/usr/bin/python3 /usr/local/bin/PantheonCMD/pcmd.py $@" | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. in linux this command gives an exit code 0, which terminates the script. is it the same on mac? in which case I can change it to this:
Suggested change
|
||||||
|
||||||
echo 'Sourcing your ~/.zshrc file...' | ||||||
|
||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
smth here isn't quite right, I get a deprecation message
DEPRECATION: Configuring installation scheme with distutils config files is deprecated and will no longer work in the near future. If you are using a Homebrew or Linuxbrew Python, please see discussion at https://github.com/Homebrew/homebrew-core/issues/76621 Requirement already satisfie