Detect admin user for usb backups

This commit is contained in:
Bob Mottram 2015-12-08 09:44:06 +00:00
parent 70d115a2dd
commit 95919f5627
1 changed files with 5 additions and 2 deletions

View File

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