diff options
| author | Bob Gilligan <gilligan@vyatta.com> | 2009-09-04 02:50:16 -0700 | 
|---|---|---|
| committer | Bob Gilligan <gilligan@vyatta.com> | 2009-09-04 02:54:20 -0700 | 
| commit | 824ce98534adf36ddc51c22bf8c103cf1b519644 (patch) | |
| tree | c90277ecf71ed9d9b47516f19fe77b02cbe9b819 | |
| parent | de6ccee222ea7eee70c82d00aa11525f4a481a58 (diff) | |
| download | vyatta-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)
| -rwxr-xr-x | scripts/standalone_root_pw_reset | 22 | 
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..." | 
