diff --git a/scripts/redis-upgrade.sh b/scripts/redis-upgrade.sh index b023a52b9..d7bf02021 100755 --- a/scripts/redis-upgrade.sh +++ b/scripts/redis-upgrade.sh @@ -1,11 +1,27 @@ #!/usr/bin/env bash +parseparams() +{ + while getopts "hy" opt; do + case "${opt}" in + y) + Y=true + ;; + *) + usage + ;; + esac + done + shift $((OPTIND-1)) +} + config() { + YES_ALL=${Y:-false} if [ "$(whoami)" = "root" ] then echo "It is not recommended to run this script as root. As a normal user, elevation will be prompted if needed." - read -rp "Continue anyway? (Y/n) " confirm &2 + exit 1 +} + function trap_ctrlc() { echo "Ctrl^C, exiting..." @@ -73,8 +98,9 @@ function trap_ctrlc() upgrade_redis() { + parseparams "$@" config - read -rp "Continue with upgrading? (y/N) " confirm