From 4e3f5a158e7743a1cfb436f9c2b93274bc456bb0 Mon Sep 17 00:00:00 2001 From: poslop Date: Mon, 27 Apr 2026 15:26:47 -0500 Subject: [PATCH] Remove USB support --- CloneToDisk.sh | 40 ++++++++++++---------------------------- 1 file changed, 12 insertions(+), 28 deletions(-) diff --git a/CloneToDisk.sh b/CloneToDisk.sh index 1a99804..1a065bb 100755 --- a/CloneToDisk.sh +++ b/CloneToDisk.sh @@ -7,6 +7,7 @@ YELLOW='\e[33m' RESET='\e[0m' MOUNT_POINTS=("/dev" "/dev/pts" "/proc" "/sys" "/sys/firmware/efi/efivars" "/run") +IMG_FILE="PBX.img3.lz4" NO_WRITE=false NO_RETABLE=false NO_USB=false @@ -93,38 +94,21 @@ update-grub echo -e "${GREEN}Restore and resize complete!${RESET}" } -write_image() { - if [[ $NO_USB == true ]]; then - echo "Writing image to $(get_partition $disk_name "3")..." - lz4 -dc ./Image/PBX.img3.lz4 | dd of=$(get_partition $disk_name "3") status=progress - - partprobe || true +write_img() { + img_file_dir="null" + if [[ -f "./${IMG_FILE}" ]]; then + img_file_dir="./${IMG_FILE}" + elif [[ ! -f "./Image/${IMG_FILE}" ]]; then + img_file_dir="./Image/${IMG_FILE}" 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 "$(echo -e "${RED}You are about to WRITE and ERASE disk ${disk_name} | Are you sure? y/N: ${RESET}")" 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 - - echo "Writing image to $(get_partition $disk_name "3")..." - lz4 -dc PBX.img.lz4 | dd of=$(get_partition $disk_name "3") status=progress - - partprobe || true + img_file_dir="null" fi + echo "Writing image to $(get_partition $disk_name "3")..." + + lz4 -dc ${img_file_dir} | dd of=$(get_partition $disk_name "3") status=progress + partprobe || true } rewrite_gpt_table() {