commit 3f6c34cd8ffe65d8166d3b74abbcdcf0af0de2ae
parent 59d77bed3d85769f57cd1aed7397e42b0bbd0339
Author: gearsix <gearsix@tuta.io>
Date: Fri, 25 Jun 2021 13:38:24 +0100
Merge branch 'master' of https://notabug.org/gearsix/scripts
Diffstat:
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/install b/install
@@ -16,7 +16,8 @@ dir=0
all=0
force=0
verbose=0
-default_destination=/usr/local/bin/ # default install directory
+default_destination=$HOME/.local/bin
+if [[ $USER == "root" ]]; then default_destination=/usr/local/bin/; fi
source=./src/*.*
depreciated_src=./src/depreciated/*.*
scripts=()
@@ -51,7 +52,6 @@ install_script () {
else # ln the file
echo "ln -s $src -> $dest"
chmod +x $src
- mkdir -p $(dirname $dest)
ln -sf $(readlink -f $src) $dest
fi
}
@@ -140,7 +140,7 @@ while [[ $# -gt 0 ]]; do
done
## check install destination
-if [[ dir -eq 0 ]]; then
+if [[ $dir -eq 0 ]]; then
printf "install destination (default = $default_destination): "
read destination
## set to default if empty input
@@ -148,11 +148,11 @@ if [[ dir -eq 0 ]]; then
destination=$default_destination
else
destination=${destination/"~"/"/home/$USER"}
- if [[ ! -e $destination ]]; then mkdir -vp $destination; fi
fi
## check if need root permission to r/w
if [ ! -w $destination ]; then echo "$destination: Permission denied"; exit 1; fi
fi
+mkdir -p $destination
## install all $scripts
if [ ${#scripts[@]} -eq 0 ]; then scripts=$source; fi