commit 001af1c199b01886a6794a44b3feffee46b49a1b
parent dbd1cb75f5b9cff1d3863518b688f73f35888902
Author: gearsix <gearsix@tuta.io>
Date: Tue, 9 Mar 2021 13:30:52 +0000
install: added mkdir check && replace for ~ -> /home/gearsix
Diffstat:
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/install b/install
@@ -1,4 +1,5 @@
-#!/bin/bash
+#!/usr/bin/env bash
+
#===========
# g6scripts
#===========
@@ -143,7 +144,12 @@ if [[ dir -eq 0 ]]; then
printf "install destination (default = $default_destination): "
read destination
## set to default if empty input
- if [ -z $destination ]; then destination=$default_destination; fi
+ if [ -z $destination ]; 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
@@ -158,7 +164,7 @@ for script in $scripts; do
fi
done
-## install depreciated scripts
+## install depreciated scripts
while [[ $depreciated -eq 0 ]]; do
printf "install depreciated scripts (default = no) [yes/no/info]? "
read yn