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
|
fi
|
||||||
|
|
||||||
|
|
||||||
if [[ $DEBUG == "true" ]]; then
|
|
||||||
echo "DEBUG is true"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Set your target disk here
|
# Set your target disk here
|
||||||
udevadm trigger
|
udevadm trigger
|
||||||
|
|
||||||
lsblk
|
lsblk
|
||||||
|
|
||||||
echo
|
echo
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
read -rp "Enter the target disk (e.g., sda): " disk_suffix
|
read -rp "Enter the target disk (e.g., sda): " disk_suffix
|
||||||
disk_name="/dev/${disk_suffix}"
|
disk_name="/dev/${disk_suffix}"
|
||||||
|
|
||||||
|
echo "Chose disk $disk_name"
|
||||||
echo
|
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
|
read -rp "Enter the name of the usb partition in /dev/mapper (e.g., sda1): " disk_suffix
|
||||||
|
|
||||||
usb_name="/dev/mapper/${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
|
read -rp "You are about to WRITE and ERASE disk ${disk_name} | Are you sure? y/n: " user_response
|
||||||
|
|
||||||
if [[ $user_response != y ]]; then
|
if [[ $user_response != y ]]; then
|
||||||
@@ -47,18 +54,16 @@ if [[ $user_response != y ]]; then
|
|||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Mount Ventoy
|
|
||||||
echo "Mounting Ventoy..."
|
echo "Mounting Ventoy..."
|
||||||
mkdir -p /mnt/ventoy
|
mkdir -p /mnt/ventoy
|
||||||
mount $usb_name /mnt/ventoy
|
mount $usb_name /mnt/ventoy
|
||||||
cd /mnt/ventoy/Images
|
cd /mnt/ventoy/Images
|
||||||
|
|
||||||
# Decompress and write image
|
|
||||||
if [[ $DEBUG != "true" ]]; then
|
|
||||||
echo "Writing image to $disk_name..."
|
echo "Writing image to $disk_name..."
|
||||||
lz4 -dc PBX-LVM.img.lz4 | dd of=$disk_name status=progress
|
lz4 -dc PBX-LVM.img.lz4 | dd of=$disk_name status=progress
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
# Repartition disk using sgdisk
|
# Repartition disk using sgdisk
|
||||||
echo "Repairing partition tables"
|
echo "Repairing partition tables"
|
||||||
sgdisk -e $disk_name
|
sgdisk -e $disk_name
|
||||||
|
|||||||
Reference in New Issue
Block a user