|
@@ -23,7 +23,7 @@ inst_out 'Script begins'
|
|
|
if [ $# -lt 1 ]
|
|
|
then
|
|
|
inst_fatal 'No script provided'
|
|
|
- inst_out 'Usage : inst <script> [user] [target]'
|
|
|
+ inst_out 'Usage : inst <script> [user] [target] [prompting:enable|disable]'
|
|
|
exit 1
|
|
|
fi
|
|
|
|
|
@@ -31,6 +31,7 @@ fi
|
|
|
script=$1
|
|
|
user=$USER
|
|
|
target='/usr/local/bin/'
|
|
|
+prompting='enable'
|
|
|
|
|
|
if [ $# -gt 1 ] && [ ! -z $2 ]
|
|
|
then
|
|
@@ -42,7 +43,12 @@ then
|
|
|
target=$3
|
|
|
fi
|
|
|
|
|
|
-# Check file existance
|
|
|
+if [ $# -gt 3 ] && [ ! -z $4 ]
|
|
|
+then
|
|
|
+ prompting=$4
|
|
|
+fi
|
|
|
+
|
|
|
+# Check file existence
|
|
|
if [ ! -e $script ]
|
|
|
then
|
|
|
inst_fatal "$script does not exist"
|
|
@@ -50,11 +56,16 @@ then
|
|
|
fi
|
|
|
|
|
|
# Prompt before installation
|
|
|
-inst_out 'Ready for installation'
|
|
|
-inst_out "script : $script"
|
|
|
-inst_out "user : $user"
|
|
|
-inst_out "target : $target"
|
|
|
-read -p 'Confirm installation ? [Y/n] > ' choice
|
|
|
+if [ $prompting = 'enable' ]
|
|
|
+then
|
|
|
+ inst_out 'Ready for installation'
|
|
|
+ inst_out "script : $script"
|
|
|
+ inst_out "user : $user"
|
|
|
+ inst_out "target : $target"
|
|
|
+ read -p 'Confirm installation ? [Y/n] > ' choice
|
|
|
+else
|
|
|
+ choice='Y'
|
|
|
+fi
|
|
|
|
|
|
if [ ! -z $choice ] && [ "$choice" != 'Y' ]
|
|
|
then
|
|
@@ -135,4 +146,4 @@ fi
|
|
|
|
|
|
# End
|
|
|
inst_out 'Script finished'
|
|
|
-exit $?
|
|
|
+exit $?
|