DEBUG varibel adn add true return to partprobe calls

This commit is contained in:
poslop
2025-07-31 11:32:17 -05:00
parent 14bfedd3bc
commit b000730adb

View File

@@ -1,7 +1,6 @@
#!/bin/bash #!/bin/bash
set -e set -e
cleanup() { cleanup() {
echo "Cleaning Mounts" echo "Cleaning Mounts"
@@ -48,21 +47,23 @@ mount $usb_name /mnt/ventoy
cd /mnt/ventoy/Images cd /mnt/ventoy/Images
# Decompress and write image # Decompress and write image
echo "Writing image to $disk_name..." if [[ $DEBUG==false ]]; then
lz4 -dc PBX-LVM.img.lz4 | dd of=$disk_name status=progress echo "Writing image to $disk_name..."
lz4 -dc PBX-LVM.img.lz4 | dd of=$disk_name status=progress
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
sgdisk -v $disk_name sgdisk -v $disk_name
partprobe
partprobe || true
echo "Expanding Partition 3 on $disk_name..." echo "Expanding Partition 3 on $disk_name..."
sgdisk --delete=3 $disk_name sgdisk --delete=3 $disk_name
sgdisk --new=3:0:0 --typecode=3:8e00 --change-name=3:"Linux LVM" $disk_name sgdisk --new=3:0:0 --typecode=3:8e00 --change-name=3:"Linux LVM" $disk_name
# Inform the OS of partition table changes partprobe || true
sleep 2 # Give the system a moment to recognize changes
# Resize physical volume # Resize physical volume
echo "Resizing physical volume..." echo "Resizing physical volume..."