@@ -17,6 +17,20 @@ abort () {
1717 exec echo " Installation aborted"
1818}
1919sudo mkdir -p $( dirname $CONF_PATH ) || abort
20+
21+ # check if "-y" or "--yes" is passed as an argument
22+ YES=false
23+ while test $# -gt 0
24+ do
25+ case " $1 " in
26+ -y) YES=true
27+ ;;
28+ --yes) YES=true
29+ ;;
30+ esac
31+ shift
32+ done
33+
2034sudo chown $USER $( dirname $CONF_PATH )
2135if [ ! -f $CONF_PATH ]; then
2236 if [ ! -f $OLD_CONF_PATH ]; then
@@ -30,15 +44,17 @@ if [ ! -f $CONF_PATH ]; then
3044else
3145 # config file found, ask user if overwrite
3246 echo " Old conf file found in $CONF_PATH "
33- read -r -p " Keep the old conf file? (default: yes) [Y/n] " response
34- response=${response,,} # tolower
35- if [[ " $response " =~ ^(no| n)$ ]]; then
36- read -r -p " Conf file will be overwritten. Are you sure? [Y/n] " response
37- response=${response,,}
38- if [[ " $response " =~ ^(yes| y)$ ]]; then
39- cat $DCONF_PATH > $CONF_PATH || abort
40- else
41- abort
47+ if [ $YES == false ]; then
48+ read -r -p " Keep the old conf file? (default: yes) [Y/n] " response
49+ response=${response,,} # tolower
50+ if [[ " $response " =~ ^(no| n)$ ]]; then
51+ read -r -p " Conf file will be overwritten. Are you sure? [Y/n] " response
52+ response=${response,,}
53+ if [[ " $response " =~ ^(yes| y)$ ]]; then
54+ cat $DCONF_PATH > $CONF_PATH || abort
55+ else
56+ abort
57+ fi
4258 fi
4359 fi
4460fi
0 commit comments