Add default -y flag to install
This commit is contained in:
parent
16742495eb
commit
1c9b497b56
16
install
16
install
@ -17,6 +17,20 @@ abort () {
|
|||||||
exec echo "Installation aborted"
|
exec echo "Installation aborted"
|
||||||
}
|
}
|
||||||
sudo mkdir -p $(dirname $CONF_PATH) || abort
|
sudo mkdir -p $(dirname $CONF_PATH) || abort
|
||||||
|
|
||||||
|
# check if "-y" or "--yes" is passed as an argument
|
||||||
|
YES=false
|
||||||
|
while test $# -gt 0
|
||||||
|
do
|
||||||
|
case "$1" in
|
||||||
|
-y) YES=true
|
||||||
|
;;
|
||||||
|
--yes) YES=true
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
shift
|
||||||
|
done
|
||||||
|
|
||||||
sudo chown $USER $(dirname $CONF_PATH)
|
sudo chown $USER $(dirname $CONF_PATH)
|
||||||
if [ ! -f $CONF_PATH ]; then
|
if [ ! -f $CONF_PATH ]; then
|
||||||
if [ ! -f $OLD_CONF_PATH ]; then
|
if [ ! -f $OLD_CONF_PATH ]; then
|
||||||
@ -30,6 +44,7 @@ if [ ! -f $CONF_PATH ]; then
|
|||||||
else
|
else
|
||||||
# config file found, ask user if overwrite
|
# config file found, ask user if overwrite
|
||||||
echo "Old conf file found in $CONF_PATH"
|
echo "Old conf file found in $CONF_PATH"
|
||||||
|
if [ $YES == false ]; then
|
||||||
read -r -p "Keep the old conf file? (default: yes) [Y/n] " response
|
read -r -p "Keep the old conf file? (default: yes) [Y/n] " response
|
||||||
response=${response,,} # tolower
|
response=${response,,} # tolower
|
||||||
if [[ "$response" =~ ^(no|n)$ ]]; then
|
if [[ "$response" =~ ^(no|n)$ ]]; then
|
||||||
@ -42,6 +57,7 @@ else
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
echo "Installing..."
|
echo "Installing..."
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user