Changed usb mount lcoationa dn write code to be insite if

This commit is contained in:
poslop
2025-07-31 15:00:57 -05:00
parent 7d322f391d
commit 7aea11370c

View File

@@ -23,42 +23,47 @@ if [[ $EUID -ne 0 ]]; then
fi
if [[ $DEBUG == "true" ]]; then
echo "DEBUG is true"
fi
# Set your target disk here
udevadm trigger
lsblk
echo
read -rp "Enter the target disk (e.g., sda): " disk_suffix
disk_name="/dev/${disk_suffix}"
echo "Chose disk $disk_name"
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} | Are you sure? y/n: " user_response
if [[ $NO_WRITE == "true" ]]; then
echo "NO_WRITE is true no need for Img no disks will be written to"
else
read -rp "Enter the name of the usb partition in /dev/mapper (e.g., sda1): " disk_suffix
if [[ $user_response != y ]]; then
echo "Exiting script"
exit
fi
usb_name="/dev/mapper/${disk_suffix}"
# Mount Ventoy
echo "Mounting Ventoy..."
mkdir -p /mnt/ventoy
mount $usb_name /mnt/ventoy
cd /mnt/ventoy/Images
user_response = "n"
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"
exit
fi
echo "Mounting Ventoy..."
mkdir -p /mnt/ventoy
mount $usb_name /mnt/ventoy
cd /mnt/ventoy/Images
# Decompress and write image
if [[ $DEBUG != "true" ]]; then
echo "Writing image to $disk_name..."
lz4 -dc PBX-LVM.img.lz4 | dd of=$disk_name status=progress
fi
# Repartition disk using sgdisk
echo "Repairing partition tables"
sgdisk -e $disk_name