Create a install script
In order to use 'pokemonsay', I need it installed somewhere. I think a simple script is enough for that. The install script copies the essential files to the '.config' folder in 'home', and creates a script in the '~/bin' directory that will run 'pokemonsay'. I wonder if it could have been done in any better way.
This commit is contained in:
35
install.sh
Executable file
35
install.sh
Executable file
@@ -0,0 +1,35 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Define install directories and names
|
||||
install_path="$HOME/.config/pokemonsay/"
|
||||
bin_install_path="$HOME/bin/"
|
||||
|
||||
# Make sure the directories exist
|
||||
mkdir -p $install_path
|
||||
mkdir -p $install_path/cows/
|
||||
mkdir -p $bin_install_path
|
||||
|
||||
# Copy the cows and the main script to the install path.
|
||||
cp ./cows/*.cow $install_path/cows/
|
||||
cp ./pokemonsay.sh $install_path
|
||||
|
||||
# Create a main script in the home bin directory.
|
||||
cat > $bin_install_path/pokemonsay <<- EOF
|
||||
#!/bin/sh
|
||||
|
||||
# This script changes to the pokemonsay installation directory,
|
||||
# runs the main script for running the pokemonsay, and changes
|
||||
# back to the previous directory.
|
||||
|
||||
current_path=`pwd`
|
||||
cd $install_path
|
||||
./pokemonsay.sh
|
||||
cd \$current_path
|
||||
EOF
|
||||
|
||||
# Change permission of the main script
|
||||
chmod +x $bin_install_path/pokemonsay
|
||||
|
||||
echo "The files were installed to '$install_path'."
|
||||
echo "The 'pokemonsay' script was created in '$bin_install_path'."
|
||||
echo "It may be necessary to logout and login back again in order to have the 'pokemonsay' available in your path."
|
||||
Reference in New Issue
Block a user