[email_account] Ask about restart after sudoing

Ask if the user is ready to restart only after performing the eventual
sudo
master
Thomas Preud'homme 14 years ago committed by Thomas Preud'homme
parent 779c586029
commit f1c6ab699b

@ -62,7 +62,7 @@ ask_user_default_no ()
# Test number of argument is correct and their value are correct also.
test_args ()
{
local - user domain first_ask next_ask
local - user domain
if [ \( $# -ge 1 -a "$1" = "-h" -a $# -gt 1 \) -o $# -gt 2 ]
then
echo "Error! Too many arguments." >&2
@ -89,14 +89,6 @@ test_args ()
fi
fi
fi
first_ask="Be aware that you'll need to restart cyrus twice and postfix once. Are you ready?"
next_ask="Incorrect answer. Are you ready to restart cyrus and postfix?"
ask_user_default_no "$first_ask" "$next_ask"
if [ $? -eq 1 ]
then
echo "Ok, exiting…"
exit 1
fi
}
# Are we root?
@ -122,6 +114,21 @@ try_sudo ()
exit $ret
}
# Warn user that cyrus will need to restart twice and postfix will have
# to reload its configuration once and ask him if he is ok for that
test_ready_for_restarts ()
{
local - first_ask next_ask
first_ask="Be aware that you'll need to restart cyrus twice and to make postfix reload its configuration once. Are you ready?"
next_ask="Incorrect answer. Are you ready to restart cyrus and make postfix reload its configuration?"
ask_user_default_no "$first_ask" "$next_ask"
if [ $? -eq 1 ]
then
echo "Ok, exiting…"
exit 1
fi
}
# Test cyrus password is OK.
test_cyrus_admin ()
{
@ -377,6 +384,7 @@ main ()
then
try_sudo "$@"
fi
test_ready_for_restarts
test_cyrus_admin
save_cyrus_state_and_become_cyradm_ready
if [ $? -eq 0 ]

Loading…
Cancel
Save