Fixed destroyjails so it can destroy multiple jails. Minor formatting cleanup around usage code.

This commit is contained in:
Thorsten Behrens 2020-04-06 22:27:24 -04:00 committed by kjeld Schouten-Lebbing
parent 77f1589701
commit 3193319d2c

View File

@ -46,24 +46,24 @@ while getopts ":i:r:u:d:g:h" opt
;; ;;
u ) updatejails=("$OPTARG") u ) updatejails=("$OPTARG")
until [[ $(eval "echo \${$OPTIND}") =~ ^-.* ]] || [ -z $(eval "echo \${$OPTIND}") ]; do until [[ $(eval "echo \${$OPTIND}") =~ ^-.* ]] || [ -z $(eval "echo \${$OPTIND}") ]; do
updateljails+=($(eval "echo \${$OPTIND}")) updatejails+=($(eval "echo \${$OPTIND}"))
OPTIND=$((OPTIND + 1)) OPTIND=$((OPTIND + 1))
done done
;; ;;
d ) destroyjails=("$OPTARG") d ) destroyjails=("$OPTARG")
until [[ $(eval "echo \${$OPTIND}") =~ ^-.* ]] || [ -z $(eval "echo \${$OPTIND}") ]; do until [[ $(eval "echo \${$OPTIND}") =~ ^-.* ]] || [ -z $(eval "echo \${$OPTIND}") ]; do
deletejails+=($(eval "echo \${$OPTIND}")) destroyjails+=($(eval "echo \${$OPTIND}"))
OPTIND=$((OPTIND + 1)) OPTIND=$((OPTIND + 1))
done done
;; ;;
g ) upgradejails=("$OPTARG") g ) upgradejails=("$OPTARG")
until [[ $(eval "echo \${$OPTIND}") =~ ^-.* ]] || [ -z $(eval "echo \${$OPTIND}") ]; do until [[ $(eval "echo \${$OPTIND}") =~ ^-.* ]] || [ -z $(eval "echo \${$OPTIND}") ]; do
upgradejails+=($(eval "echo \${$OPTIND}")) upgradejails+=($(eval "echo \${$OPTIND}"))
OPTIND=$((OPTIND + 1)) OPTIND=$((OPTIND + 1))
done done
;; ;;
h ) h )
echo "Usage:" echo "Usage:"
echo "$0 -i " echo "$0 -i "
echo "$0 -r " echo "$0 -r "
echo "$0 -u " echo "$0 -u "
@ -72,15 +72,15 @@ while getopts ":i:r:u:d:g:h" opt
echo "" echo ""
echo " -i to install jails, listed by name, space seperated like this: jackett plex sonarr" echo " -i to install jails, listed by name, space seperated like this: jackett plex sonarr"
echo " -r to reinstall jails, listed by name, space seperated like this: jackett plex sonarr" echo " -r to reinstall jails, listed by name, space seperated like this: jackett plex sonarr"
echo " -u to update jails, listed by name, space seperated like this: jackett plex sonarr" echo " -u to update jails, listed by name, space seperated like this: jackett plex sonarr"
echo " -d to destroy jails, listed by name, space seperated like this: jackett plex sonarrt" echo " -d to destroy jails, listed by name, space seperated like this: jackett plex sonarrt"
echo " -g to upgrade jails, listed by name, space seperated like this: jackett plex sonarr" echo " -g to upgrade jails, listed by name, space seperated like this: jackett plex sonarr"
echo " -h help (this output)" echo " -h help (this output)"
exit 0 exit 0
;;
? ) echo "Error: Invalid option was specified -$OPTARG"
exit 0
;; ;;
? ) echo "Error: Invalid option was specified -$OPTARG"
exit 0
;;
esac esac
done done