Detect admin user for usb restore

This commit is contained in:
Bob Mottram 2015-12-08 09:46:38 +00:00
parent 95919f5627
commit acfab98045
1 changed files with 5 additions and 2 deletions

View File

@ -3398,14 +3398,17 @@ function create_restore_script {
echo '#!/bin/bash' > /usr/bin/$RESTORE_SCRIPT_NAME
echo '' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo "COMPLETION_FILE=$COMPLETION_FILE" >> /usr/bin/$RESTORE_SCRIPT_NAME
echo '' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo "USB_DRIVE=$USB_DRIVE" >> /usr/bin/$RESTORE_SCRIPT_NAME
echo 'if [ $1 ]; then' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo ' USB_DRIVE=/dev/${1}1' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo 'fi' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo "USB_MOUNT=$USB_MOUNT" >> /usr/bin/$RESTORE_SCRIPT_NAME
echo '' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo "ADMIN_USERNAME=$MY_USERNAME" >> /usr/bin/$RESTORE_SCRIPT_NAME
echo "MY_USERNAME=$MY_USERNAME" >> /usr/bin/$RESTORE_SCRIPT_NAME
echo -n 'ADMIN_USERNAME=$(cat $COMPLETION_FILE | grep "Admin user" | ' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo "awk -F ':' '{print $2}')" >> /usr/bin/$RESTORE_SCRIPT_NAME
echo 'MY_USERNAME=$ADMIN_USERNAME' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo 'if [ $2 ]; then' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo ' MY_USERNAME=$2' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo 'fi' >> /usr/bin/$RESTORE_SCRIPT_NAME