You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
oem-factory-reset: Move format confirmation before resetting anything
Move confirmation of formatting flash drive with LUKS percentage
selection before any reset actions have been taken, so aborting does
not result in a half-reset system. Combine with the more basic
"confirm" prompt that existed after selecting the device (but did not
include the LUKS size information).
Split up prepare_flash_drive into interactive_prepare_flash_drive (both
prompts and formats as before), confirm_thumb_drive_format (just
confirms the selections), and prepare_thumb_drive (now noninteractive).
Signed-off-by: Jonathon Hall <jonathon.hall@puri.sm>
#Console and whiptail $BG_COLOR_WARNING prompt (Y/n) validate one last time wiping and repartitioning of $device of total size $DISK_SIZE_MB with $PERCENTAGE_MB assigned to LUKS encrypted private partition
207
+
MSG="WARNING: Wiping and repartitioning $DEVICE ($DISK_SIZE_DISPLAY) with $LUKS_SIZE_MB MB\n assigned to private LUKS ext4 partition,\n rest assigned to exFAT public partition.\n\nAre you sure you want to continue?"
183
208
if [ -x /bin/whiptail ];then
184
-
whiptail $BG_COLOR_WARNING --title "WARNING: Wiping and repartitioning $DEVICE of $DISK_SIZE_MB MB" --yesno \
185
-
"WARNING: Wiping and repartitioning $DEVICE with $PERCENTAGE_MB MB\n assigned to private LUKS contained private ext4 partition,\n rest assigned to extfat public partition.\n\nAre you sure you want to continue?" 0 80 \
186
-
|| die "User cancelled wiping and repartitioning of $DEVICE"
echo -e -n "Warning: Wiping and repartitioning $DEVICE with $PERCENTAGE_MB MB assigned to private LUKS contained private ext4 partition, rest assigned to extfat public partition.\n\nAre you sure you want to continue?"
212
+
echo -e -n "$MSG"
189
213
read -r -p " [Y/n] " response
190
214
#transform response to uppercase with bash parameter expansion
191
215
response=${response^^}
192
-
#continue if response different then uppercase N
193
-
if [[ $response=~ ^(N)$ ]];then
194
-
die "User cancelled wiping and repartitioning of $DEVICE"
216
+
#continue if response is Y, y, or empty, abort for anything else
217
+
if [-n"$response" ] && [ "${response^^}"!= Y ];then
218
+
return 1
195
219
fi
196
220
fi
221
+
}
222
+
223
+
# Prepare a flash drive with a private LUKS-encrypted ext4 partition and a
224
+
# public exFAT partition. This is not interactive - during OEM reset, any
225
+
# selections/confirmations must occur before OEM reset starts resetting the
226
+
# system.
227
+
#
228
+
# $1 - block device of flash drive
229
+
# $2 - percentage of flash drive to allocate to LUKS [1-99]
0 commit comments