|  | @@ -857,7 +857,10 @@ function backup_data {
 | 
	
		
			
			| 857 | 857 |      dialog --title $"Backup data to USB" \
 | 
	
		
			
			| 858 | 858 |             --msgbox $"Plug in a LUKS encrypted USB drive" 6 40
 | 
	
		
			
			| 859 | 859 |      clear
 | 
	
		
			
			| 860 |  | -    echo ' '
 | 
	
		
			
			|  | 860 | +    detect_usb_drive
 | 
	
		
			
			|  | 861 | +    echo ''
 | 
	
		
			
			|  | 862 | +    echo $"Detected USB drive $USB_DRIVE"
 | 
	
		
			
			|  | 863 | +    echo ''
 | 
	
		
			
			| 861 | 864 |      echo $'Enter the passphrase for your LUKS encrypted backup drive:'
 | 
	
		
			
			| 862 | 865 |      ${PROJECT_NAME}-backup-local
 | 
	
		
			
			| 863 | 866 |      any_key
 | 
	
	
		
			
			|  | @@ -873,22 +876,7 @@ function restore_data_from_storage {
 | 
	
		
			
			| 873 | 876 |          restore_command="${PROJECT_NAME}-restore-remote $remote_domain_name configuration;;"
 | 
	
		
			
			| 874 | 877 |      else
 | 
	
		
			
			| 875 | 878 |          remote_domain_name="$1"
 | 
	
		
			
			| 876 |  | -        if [ ! -b $USB_DRIVE ]; then
 | 
	
		
			
			| 877 |  | -            if [ -b /dev/sdb1 ]; then
 | 
	
		
			
			| 878 |  | -                USB_DRIVE=/dev/sdb1
 | 
	
		
			
			| 879 |  | -            fi
 | 
	
		
			
			| 880 |  | -            if [ -b /dev/sdc1 ]; then
 | 
	
		
			
			| 881 |  | -                USB_DRIVE=/dev/sdc1
 | 
	
		
			
			| 882 |  | -            fi
 | 
	
		
			
			| 883 |  | -            if [ -b /dev/sdd1 ]; then
 | 
	
		
			
			| 884 |  | -                USB_DRIVE=/dev/sdd1
 | 
	
		
			
			| 885 |  | -            fi
 | 
	
		
			
			| 886 |  | -            if [ -b /dev/sde1 ]; then
 | 
	
		
			
			| 887 |  | -                USB_DRIVE=/dev/sde1
 | 
	
		
			
			| 888 |  | -            fi
 | 
	
		
			
			| 889 |  | -            write_config_param USB_DRIVE "$USB_DRIVE"
 | 
	
		
			
			| 890 |  | -        fi
 | 
	
		
			
			| 891 |  | -
 | 
	
		
			
			|  | 879 | +        detect_usb_drive
 | 
	
		
			
			| 892 | 880 |          restore_command="${PROJECT_NAME}-restore-local $USB_DRIVE"
 | 
	
		
			
			| 893 | 881 |      fi
 | 
	
		
			
			| 894 | 882 |  
 | 
	
	
		
			
			|  | @@ -1122,34 +1110,13 @@ function reset_tripwire {
 | 
	
		
			
			| 1122 | 1110 |  }
 | 
	
		
			
			| 1123 | 1111 |  
 | 
	
		
			
			| 1124 | 1112 |  function format_drive {
 | 
	
		
			
			| 1125 |  | -    drive=
 | 
	
		
			
			|  | 1113 | +    detect_usb_drive
 | 
	
		
			
			| 1126 | 1114 |      data=$(tempfile 2>/dev/null)
 | 
	
		
			
			| 1127 | 1115 |      trap "rm -f $data" 0 1 2 5 15
 | 
	
		
			
			| 1128 |  | -    dialog --backtitle $"Freedombone Control Panel" \
 | 
	
		
			
			| 1129 |  | -           --title $"Format a USB drive (LUKS encrypted)" \
 | 
	
		
			
			| 1130 |  | -           --radiolist $"Choose a drive:" 12 70 5 \
 | 
	
		
			
			| 1131 |  | -           1 $"sda (Beaglebone Black)" off \
 | 
	
		
			
			| 1132 |  | -           2 $"sdb" off \
 | 
	
		
			
			| 1133 |  | -           3 $"sdc" off \
 | 
	
		
			
			| 1134 |  | -           4 $"sdd" off \
 | 
	
		
			
			| 1135 |  | -           5 $"Back to Backup and Restore menu" on 2> $data
 | 
	
		
			
			| 1136 |  | -    sel=$?
 | 
	
		
			
			| 1137 |  | -    case $sel in
 | 
	
		
			
			| 1138 |  | -        1) return;;
 | 
	
		
			
			| 1139 |  | -        255) return;;
 | 
	
		
			
			| 1140 |  | -    esac
 | 
	
		
			
			| 1141 |  | -    case $(cat $data) in
 | 
	
		
			
			| 1142 |  | -        1) drive='sda';;
 | 
	
		
			
			| 1143 |  | -        2) drive='sdb';;
 | 
	
		
			
			| 1144 |  | -        3) drive='sdc';;
 | 
	
		
			
			| 1145 |  | -        4) drive='sdd';;
 | 
	
		
			
			| 1146 |  | -        5) return;;
 | 
	
		
			
			| 1147 |  | -    esac
 | 
	
		
			
			| 1148 |  | -
 | 
	
		
			
			| 1149 |  | -    dialog --title $"Format USB drive" \
 | 
	
		
			
			|  | 1116 | +    dialog --title $"Format USB drive $USB_DRIVE" \
 | 
	
		
			
			| 1150 | 1117 |             --backtitle $"Freedombone Control Panel" \
 | 
	
		
			
			| 1151 | 1118 |             --defaultno \
 | 
	
		
			
			| 1152 |  | -           --yesno $"\nPlease confirm that you wish to format drive\n\n    ${drive}\n\nAll current data on the drive will be lost, and you will be prompted to give a password used to encrypt the drive.\n\nDANGER: If you screw up here and format the wrong drive it's your own fault!" 16 60
 | 
	
		
			
			|  | 1119 | +           --yesno $"\nPlease confirm that you wish to format drive\n\n    ${USB_DRIVE}\n\nAll current data on the drive will be lost, and you will be prompted to give a password used to encrypt the drive.\n\nDANGER: If you screw up here and format the wrong drive it's your own fault!" 16 60
 | 
	
		
			
			| 1153 | 1120 |      sel=$?
 | 
	
		
			
			| 1154 | 1121 |      case $sel in
 | 
	
		
			
			| 1155 | 1122 |          1) return;;
 | 
	
	
		
			
			|  | @@ -1157,36 +1124,18 @@ function format_drive {
 | 
	
		
			
			| 1157 | 1124 |      esac
 | 
	
		
			
			| 1158 | 1125 |  
 | 
	
		
			
			| 1159 | 1126 |      clear
 | 
	
		
			
			| 1160 |  | -    ${PROJECT_NAME}-format $drive
 | 
	
		
			
			|  | 1127 | +    echo ''
 | 
	
		
			
			|  | 1128 | +    echo $"Formatting drive $USB_DRIVE. ALL CONTENTS WILL BE LOST."
 | 
	
		
			
			|  | 1129 | +    echo ''
 | 
	
		
			
			|  | 1130 | +    ${PROJECT_NAME}-format $USB_DRIVE
 | 
	
		
			
			| 1161 | 1131 |      any_key
 | 
	
		
			
			| 1162 | 1132 |  }
 | 
	
		
			
			| 1163 | 1133 |  
 | 
	
		
			
			| 1164 | 1134 |  function remove_backups {
 | 
	
		
			
			| 1165 |  | -    drive=
 | 
	
		
			
			|  | 1135 | +    detect_usb_drive
 | 
	
		
			
			| 1166 | 1136 |      data=$(tempfile 2>/dev/null)
 | 
	
		
			
			| 1167 | 1137 |      trap "rm -f $data" 0 1 2 5 15
 | 
	
		
			
			| 1168 |  | -    dialog --backtitle $"Freedombone Control Panel" \
 | 
	
		
			
			| 1169 |  | -           --title $"Remove backups from a USB drive" \
 | 
	
		
			
			| 1170 |  | -           --radiolist $"Choose a drive:" 12 70 5 \
 | 
	
		
			
			| 1171 |  | -           1 $"sda (Beaglebone Black)" off \
 | 
	
		
			
			| 1172 |  | -           2 $"sdb" off \
 | 
	
		
			
			| 1173 |  | -           3 $"sdc" off \
 | 
	
		
			
			| 1174 |  | -           4 $"sdd" off \
 | 
	
		
			
			| 1175 |  | -           5 $"Back to Backup and Restore menu" on 2> $data
 | 
	
		
			
			| 1176 |  | -    sel=$?
 | 
	
		
			
			| 1177 |  | -    case $sel in
 | 
	
		
			
			| 1178 |  | -        1) return;;
 | 
	
		
			
			| 1179 |  | -        255) return;;
 | 
	
		
			
			| 1180 |  | -    esac
 | 
	
		
			
			| 1181 |  | -    case $(cat $data) in
 | 
	
		
			
			| 1182 |  | -        1) drive='sda';;
 | 
	
		
			
			| 1183 |  | -        2) drive='sdb';;
 | 
	
		
			
			| 1184 |  | -        3) drive='sdc';;
 | 
	
		
			
			| 1185 |  | -        4) drive='sdd';;
 | 
	
		
			
			| 1186 |  | -        5) return;;
 | 
	
		
			
			| 1187 |  | -    esac
 | 
	
		
			
			| 1188 |  | -
 | 
	
		
			
			| 1189 |  | -    dialog --title $"Remove backups from a USB drive" \
 | 
	
		
			
			|  | 1138 | +    dialog --title $"Remove backups from a USB drive $USB_DRIVE" \
 | 
	
		
			
			| 1190 | 1139 |             --backtitle $"Freedombone Control Panel" \
 | 
	
		
			
			| 1191 | 1140 |             --defaultno \
 | 
	
		
			
			| 1192 | 1141 |             --yesno $"\nPlease confirm that you wish to remove backups from this drive\n\n    ${drive}\n\nYou will not be able to recover them afterwards." 12 60
 | 
	
	
		
			
			|  | @@ -1197,7 +1146,7 @@ function remove_backups {
 | 
	
		
			
			| 1197 | 1146 |      esac
 | 
	
		
			
			| 1198 | 1147 |  
 | 
	
		
			
			| 1199 | 1148 |      clear
 | 
	
		
			
			| 1200 |  | -    ${PROJECT_NAME}-backup-local $drive remove
 | 
	
		
			
			|  | 1149 | +    ${PROJECT_NAME}-backup-local $USB_DRIVE remove
 | 
	
		
			
			| 1201 | 1150 |      any_key
 | 
	
		
			
			| 1202 | 1151 |  }
 | 
	
		
			
			| 1203 | 1152 |  
 |