summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorBob Gilligan <gilligan@vyatta.com>2009-09-04 02:50:16 -0700
committerBob Gilligan <gilligan@vyatta.com>2009-09-04 02:54:20 -0700
commit824ce98534adf36ddc51c22bf8c103cf1b519644 (patch)
treec90277ecf71ed9d9b47516f19fe77b02cbe9b819 /scripts
parentde6ccee222ea7eee70c82d00aa11525f4a481a58 (diff)
downloadvyatta-cfg-system-824ce98534adf36ddc51c22bf8c103cf1b519644.tar.gz
vyatta-cfg-system-824ce98534adf36ddc51c22bf8c103cf1b519644.zip
Bugfix 4916, 4917: Exit correctly when vyatta user doesn't exist. Add timeout.
(cherry picked from commit 852e99ad758daa6db8f47fa0b3610e8ddf884f7a)
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/standalone_root_pw_reset22
1 files changed, 20 insertions, 2 deletions
diff --git a/scripts/standalone_root_pw_reset b/scripts/standalone_root_pw_reset
index b75d19df..b9a28c4b 100755
--- a/scripts/standalone_root_pw_reset
+++ b/scripts/standalone_root_pw_reset
@@ -30,6 +30,10 @@ set_encrypted_password() {
-e "/ user $1 {/,/}/s/encrypted-password .*\$/encrypted-password \"$2\"/" $3
}
+
+# How long to wait for user to respond, in seconds
+TIME_TO_WAIT=30
+
change_password() {
local user=$1
local pwd1="1"
@@ -68,7 +72,18 @@ fi
# user.
#
echo "Do you wish to reset the admin password?"
-read response
+
+read -t $TIME_TO_WAIT response
+if [ "$?" != "0" ]; then
+ echo
+ echo "Response not received in time."
+ echo "The admin password will not be reset."
+ echo "Rebooting in 5 seconds..."
+ sleep 5
+ echo
+ /sbin/reboot -f
+fi
+
response=${response:0:1}
if [ "$response" != "y" -a "$response" != "Y" ]; then
echo "OK, the admin password will not be reset."
@@ -93,7 +108,10 @@ fi
if ! grep -q " user $ADMIN " $CF
then
echo "Administrator account $ADMIN missing..."
- exit 1
+ echo -n "Rebooting in 5 seconds..."
+ sleep 5
+ echo
+ /sbin/reboot -f
fi
echo "Saving backup copy of config.boot..."