mirror of
https://github.com/buanet/ioBroker.docker.git
synced 2025-12-19 11:29:01 +02:00
testing
This commit is contained in:
54
debian/scripts/maintenance.sh
vendored
54
debian/scripts/maintenance.sh
vendored
@@ -5,6 +5,7 @@
|
||||
############################
|
||||
|
||||
autoconfirm=no # yould be set to true by commandline option
|
||||
switch=none
|
||||
|
||||
|
||||
####################################
|
||||
@@ -14,8 +15,9 @@ autoconfirm=no # yould be set to true by commandline option
|
||||
# display help text
|
||||
display_help() {
|
||||
echo "This script is build to manage your ioBroker container!"
|
||||
echo "Usage: maintenance [ COMMAND ] [ OPTIONS ]"
|
||||
echo " maint [ COMMAND ] [ OPTIONS ]"
|
||||
echo ''
|
||||
echo "Usage: maintenance [ COMMAND ] [ OPTION ]"
|
||||
echo " maint [ COMMAND ] [ OPTION ]"
|
||||
echo ''
|
||||
echo "COMMANDS"
|
||||
echo "------------------"
|
||||
@@ -23,11 +25,12 @@ display_help() {
|
||||
echo " on > switches mantenance mode ON"
|
||||
echo " off > switches mantenance mode OFF and shuts down/ restarts container"
|
||||
echo " upgrade > will put container to maintenance mode and upgrade iobroker"
|
||||
echo " help > shows this help"
|
||||
echo ''
|
||||
echo "OPTIONS"
|
||||
echo "------------------"
|
||||
echo " -h|--help > shows this help"
|
||||
echo " -y|--yes > confirms the used command without asking"
|
||||
echo " -h|--help > shows this help"
|
||||
echo ''
|
||||
exit 0
|
||||
}
|
||||
@@ -129,37 +132,54 @@ upgrade() {
|
||||
fi
|
||||
}
|
||||
|
||||
##############################
|
||||
##### parsing parameters #####
|
||||
##############################
|
||||
########################################
|
||||
##### parsing commands and options #####
|
||||
########################################
|
||||
|
||||
while :; do
|
||||
case $1 in
|
||||
-h|--help)
|
||||
# reading all arguments and putting them in reverse
|
||||
reverse=
|
||||
for i in "$@"; do
|
||||
reverse="$i $reverse"
|
||||
done
|
||||
|
||||
# checking the arguments
|
||||
for i in $reverse; do
|
||||
case $i in
|
||||
help|-h|--help)
|
||||
display_help # calling function to display help text
|
||||
exit
|
||||
;;
|
||||
-y|--yes)
|
||||
autoconfirm=yes # answers prompts with "yes"
|
||||
;;
|
||||
status)
|
||||
check_status # calling function to check maintenance mode status
|
||||
;;
|
||||
on|-on)
|
||||
on)
|
||||
switch_on # calling function to switch maintenance mode on
|
||||
exit
|
||||
;;
|
||||
off)
|
||||
switch_off # calling function to switch maintenance mode off
|
||||
;;
|
||||
upgrade)
|
||||
upgrade # calling function to upgrade js-controller
|
||||
;;
|
||||
-y|--yes)
|
||||
autoconfirm=yes # setting autoconfrm option to "yes"
|
||||
;;
|
||||
-a=*|--argument=*) # dummy exaple for parsing option with value
|
||||
ARGUMENT="${i#*=}"
|
||||
shift
|
||||
;;
|
||||
--) # End of all options.
|
||||
shift
|
||||
break
|
||||
;;
|
||||
-?*)
|
||||
printf 'WARN: Unknown option (ignored): %s\n' "$1"
|
||||
-?*|?*)
|
||||
echo 'WARN: Unknown parameter. Please try again or see help (-h|--help).'
|
||||
break
|
||||
;;
|
||||
*) # Default case: No more options, so break out of the loop.
|
||||
break
|
||||
;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
||||
exit 0
|
||||
|
||||
Reference in New Issue
Block a user