Don't use if around case

This commit is contained in:
Sam A. 2023-03-29 20:41:30 +02:00
parent ac25b9b73a
commit a4bc8582e8
Signed by: samsapti
GPG key ID: CBBBE7371E81C4EA

View file

@ -20,31 +20,29 @@ install_modules() {
cd "$(dirname "$0")" || exit 255
BASE_CMD="ansible-playbook playbook.yml --ask-vault-pass --ask-become-pass"
if [ -z "$1" ]; then
$BASE_CMD
else
case $1 in
os|docker)
install_modules; $BASE_CMD --tags "$1" ;;
reboot)
install_modules
if [ "$2" = "-f" ] || [ "$2" = "--force" ]; then
$BASE_CMD --tags "$1" --extra-vars "force_reboot=true"
else
$BASE_CMD --tags "$1"
fi
;;
services)
install_modules
if [ -z "$2" ]; then
$BASE_CMD --tags "$1"
else
$BASE_CMD --tags "$1" --extra-vars "single_service=$2"
fi
;;
-h|--help)
usage ;;
*)
usage >&2; exit 1 ;;
esac
fi
case $1 in
"")
install_modules; $BASE_CMD ;;
os|docker)
install_modules; $BASE_CMD --tags "$1" ;;
reboot)
install_modules
if [ "$2" = "-f" ] || [ "$2" = "--force" ]; then
$BASE_CMD --tags "$1" --extra-vars "force_reboot=true"
else
$BASE_CMD --tags "$1"
fi
;;
services)
install_modules
if [ -z "$2" ]; then
$BASE_CMD --tags "$1"
else
$BASE_CMD --tags "$1" --extra-vars "single_service=$2"
fi
;;
-h|--help)
usage ;;
*)
usage >&2; exit 1 ;;
esac