From acfab980452215632558a4469c6c3dd447c8f08b Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Tue, 8 Dec 2015 09:46:38 +0000 Subject: [PATCH] Detect admin user for usb restore --- src/freedombone | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/freedombone b/src/freedombone index 6b402836..3376890c 100755 --- a/src/freedombone +++ b/src/freedombone @@ -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