bin: Improve the run-as-root confirmation prompt

* Send the prompt to stderr
  * Print "> " without a newline so the user knows it is a prompt
  * Wrap long lines
  * Use a here-document
pull/4072/head
Richard Hansen 2020-05-14 19:21:11 -04:00
parent 18fb75968a
commit 4f0b1fa7ec
1 changed files with 6 additions and 2 deletions

View File

@ -18,8 +18,12 @@ done
# Stop the script if it's started as root # Stop the script if it's started as root
if [ "$(id -u)" -eq 0 ] && [ "$ignoreRoot" -eq 0 ]; then if [ "$(id -u)" -eq 0 ] && [ "$ignoreRoot" -eq 0 ]; then
echo "You shouldn't start Etherpad as root!" cat <<EOF >&2
echo "Please type 'Etherpad rocks my socks' or supply the '--root' argument if you still want to start it as root" You shouldn't start Etherpad as root!
Please type 'Etherpad rocks my socks' (or restart with the '--root'
argument) if you still want to start it as root:
EOF
printf "> " >&2
read rocks read rocks
[ "$rocks" = "Etherpad rocks my socks" ] || fatal "Your input was incorrect" [ "$rocks" = "Etherpad rocks my socks" ] || fatal "Your input was incorrect"
fi fi