change umount operation
This commit is contained in:
@@ -3,8 +3,14 @@ set -e
|
||||
|
||||
|
||||
cleanup() {
|
||||
echo "Cleaning up mounts..."
|
||||
umount -lfR /mnt 2>/dev/null || true
|
||||
echo "Cleaning Mounts"
|
||||
|
||||
for i in /run /sys/firmware/efi/efivars /sys /proc /dev/pts /dev; do
|
||||
umount -lf /mnt$i 2>/dev/null || true
|
||||
done
|
||||
umount -lf /mnt/boot/efi 2>/dev/null || true
|
||||
umount -lf /mnt/boot 2>/dev/null || true
|
||||
umount -lf /mnt 2>/dev/null || true
|
||||
}
|
||||
trap cleanup EXIT
|
||||
|
||||
@@ -27,7 +33,7 @@ echo
|
||||
read -rp "Enter the name of the usb partition in /dev/mapper (e.g., sda1): " disk_suffix
|
||||
usb_name="/dev/mapper/${disk_suffix}"
|
||||
|
||||
read -rp "You are about to WRITE and ERASE disk ${disk_name} \nAre you sure? y/n: " user_response
|
||||
read -rp "You are about to WRITE and ERASE disk ${disk_name} | Are you sure? y/n: " user_response
|
||||
|
||||
if [[ $user_response != y ]]; then
|
||||
echo "Exiting script"
|
||||
|
||||
Reference in New Issue
Block a user