generated from me/template-mit
Change script to actually install the Node,js file, including in the global bin.
This commit is contained in:
1 parent
64e9abb85c
commit
cde66dcd67
1 file changed
+54
-3
+54
-3
@@ -2,10 +2,61 @@
|
||||
# 20260912 - Hyperling
|
||||
# "Install" script to get this program runnable from anywhere on the system.
|
||||
|
||||
## Variables ##
|
||||
|
||||
DIR="$(cd "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)"
|
||||
LOCAL=~/bin
|
||||
GLOBAL=/usr/local/bin
|
||||
|
||||
mkdir -pv $LOCAL
|
||||
name_short="nomad"
|
||||
name_long="nomadic-weather"
|
||||
name_abs="weather-list"
|
||||
|
||||
ln -svf "$DIR"/prototype.js $LOCAL/nomad
|
||||
ln -svf "$DIR"/prototype.js $LOCAL/nomadic-weather
|
||||
## Functions ##
|
||||
|
||||
## Parameters ##
|
||||
|
||||
while getopts ":gslah" arg; do
|
||||
case $arg in
|
||||
g) global="Y" ;;
|
||||
s) short="Y" ;;
|
||||
l) long="Y" ;;
|
||||
a) abstract="Y" ;;
|
||||
h) usage ;;
|
||||
*) echo "ERROR: Parameter $OPTARG was not recognized." && usage 1 ;;
|
||||
esac
|
||||
done
|
||||
|
||||
## Processing ##
|
||||
|
||||
name=""
|
||||
if [[ "$short" == "Y" ]]; then
|
||||
name="$name $name_short"
|
||||
fi
|
||||
if [[ "$long" == "Y" ]]; then
|
||||
name="$name $name_long"
|
||||
fi
|
||||
if [[ "$abstract" == "Y" || ( -z "$short" && -z "$long" ) ]]; then
|
||||
name="$name $name_abs"
|
||||
fi
|
||||
|
||||
cmd=""
|
||||
dir="$LOCAL"
|
||||
if [[ "$global" == "Y" ]]; then
|
||||
dir="$GLOBAL"
|
||||
cmd="sudo"
|
||||
echo "Requesting sudo privileges... "
|
||||
sudo echo "Success!"
|
||||
fi
|
||||
|
||||
## Main ##
|
||||
|
||||
for prog in $name; do
|
||||
mkdir -pv $dir
|
||||
$cmd cp -v -svf "$DIR"/prototype.js $dir/$prog
|
||||
done
|
||||
|
||||
## Finish ##
|
||||
|
||||
echo "Done!"
|
||||
exit 0
|
||||
Reference in new issue
Block a user