Changed usb mount lcoationa dn write code to be insite if
This commit is contained in:
@@ -23,23 +23,30 @@ 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
|
||||
|
||||
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
|
||||
|
||||
usb_name="/dev/mapper/${disk_suffix}"
|
||||
|
||||
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
|
||||
@@ -47,18 +54,16 @@ if [[ $user_response != y ]]; then
|
||||
exit
|
||||
fi
|
||||
|
||||
# Mount Ventoy
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user