Add a big warning and additional check when wiping target destination
This commit is contained in:
parent
26867787e5
commit
a2f9e1f1e5
@ -659,17 +659,21 @@ check_partitions()
|
||||
CMD="lsblk -io KNAME,FSTYPE,SIZE,TYPE,MOUNTPOINT | grep -v -w $root_partition_name $INCLUDE $EXCLUDE | grep -E '^sd|^nvme|^md|^mmc' | awk -F\" \" '/ part | raid..? / {print \$1}'"
|
||||
AvailablePartitions=$(eval $CMD)
|
||||
|
||||
dialog --yes-label "Proceed" --no-label 'Skip' --title "$title" --backtitle "$backtitle" --yesno "\nIt is highly recommended to wipe all partitions on the destination disk /dev/$diskcheck and leave installer to make them!" 8 75
|
||||
dialog --yes-label "Proceed" --no-label 'Skip' --title "$title" --backtitle "$backtitle" --yesno "\nIt is highly recommended to wipe all partitions on the destination disk\n \n/dev/$diskcheck\n\nand leave installer to make them!" 10 75
|
||||
|
||||
# wiping destination to make sure we don't run into issues
|
||||
if [[ $? -eq 0 ]]; then
|
||||
dd if=/dev/zero of=/dev/${diskcheck} bs=1M count=10 >> $logfile 2>&1
|
||||
partprobe -s "/dev/${diskcheck}" >> $logfile 2>&1
|
||||
echo -e 'mktable gpt\nmkpart primary ext4 0% 100%\nquit' | sudo parted "/dev/${diskcheck}" >> $logfile 2>&1
|
||||
sudo partprobe -s "/dev/${diskcheck}" >> $logfile 2>&1
|
||||
sudo mkfs.ext4 -E "/dev/${diskcheck}"p1 >> $logfile 2>&1
|
||||
sudo partprobe -s "/dev/${diskcheck}" >> $logfile 2>&1
|
||||
sleep 2
|
||||
exec 3>&1
|
||||
ACKNOWLEDGEMENT=$(dialog --colors --nocancel --backtitle "$BACKTITLE" --no-collapse --title " Warning " \
|
||||
--clear \--radiolist "\nTHIS OPERATION WILL WIPE ALL DATA ON DRIVE:\n\n/dev/$diskcheck\n " 0 56 4 "Yes, I understand" "" off 2>&1 1>&3)
|
||||
exec 3>&-
|
||||
if [[ "${ACKNOWLEDGEMENT}" == "Yes, I understand" ]]; then
|
||||
dd if=/dev/zero of=/dev/${diskcheck} bs=1M count=10 >> $logfile 2>&1
|
||||
partprobe -s "/dev/${diskcheck}" >> $logfile 2>&1
|
||||
echo -e 'mktable gpt\nmkpart primary ext4 0% 100%\nquit' | sudo parted "/dev/${diskcheck}" >> $logfile 2>&1
|
||||
sudo partprobe -s "/dev/${diskcheck}" >> $logfile 2>&1
|
||||
sleep 2
|
||||
fi
|
||||
fi
|
||||
|
||||
if [[ -z $AvailablePartitions ]]; then
|
||||
|
||||
Loading…
Reference in New Issue
Block a user