echo debugs

This commit is contained in:
2026-04-28 13:21:48 -05:00
parent 8577cd1176
commit f06573af1c
+15 -7
View File
@@ -11,7 +11,7 @@ NO_RETABLE=false
NO_USB=false
NO_CLEANUP=false
IMG_FILE="PBX.img3.lz4"
IMG_FILE="PBX-root.img.lz4"
MOUNT_PATH="/mnt/debian"
MOUNT_POINTS=("/dev" "/dev/pts" "/proc" "/sys" "/sys/firmware/efi/efivars" "/run")
@@ -111,6 +111,7 @@ rewrite_gpt_table() {
sgdisk -n 3:0:0 -t 3:8e00 -c 3:"Linux LVM" $disk_name
partprobe || true
echo -e "${GREEN}GPT table created. ${RESET}"
}
lvm_init() {
@@ -122,12 +123,15 @@ lvm_init() {
lvcreate -L 4G $VGROUP -n swap_1
lvcreate -l 100%FREE $VGROUP -n root
echo -e "${GREEN}LVM initialized ${RESET}"
}
make_filesystem() {
mkfs.vfat -F 32 $(get_partition $disk_name "1")
mkfs.ext4 $(get_partition $disk_name "2")
mkswap "${VG_PATH}${SWAP_LV}"
echo -e "${GREEN}Make filesystems finished.${RESET}"
}
write_img() {
@@ -142,8 +146,8 @@ write_img() {
img_file_dir="./${IMG_FILE}"
elif [[ -f "./Image/${IMG_FILE}" ]]; then
img_file_dir="./Image/${IMG_FILE}"
elif [[ ! -f $img_file_dir ]]
echo "${RED}NO IMG FILE FOUND${RESET}"
elif [[ ! -f $img_file_dir ]]; then
echo -e "${RED}NO IMG FILE FOUND${RESET}"
exit 100
fi
@@ -152,11 +156,13 @@ write_img() {
lz4 -dc ${img_file_dir} | partclone.ext4 -r -o $(get_partition $disk_name "3")
partprobe || true
echo -e "${GREEN}Finished writing image to disk${RESET}"
}
cleanup() {
if [[ $NO_CLEANUP = true ]]; then
echo -e "${YELLOW}No cleanup specified. Make sure to manually clean mounts." 1>&2
echo -e "${YELLOW}No cleanup specified. Make sure to manually clean mounts.${RESET}" 1>&2
exit 100
fi
@@ -164,13 +170,14 @@ cleanup() {
umount -lf /mnt/ventoy 2>/dev/null || true
for i in "${MOUNT_POINTS[@]}"; do umount -lf "/mnt/debian$i" 2>/dev/null || true; done
for i in "${MOUNT_POINTS[@]}"; do umount -lf "${MOUNT_PATH}${i}" 2>/dev/null || true; done
umount -lf /mnt/debian/boot/efi 2>/dev/null || true
umount -lf /mnt/debian/boot 2>/dev/null || true
umount -lf /mnt/debian 2>/dev/null || true
vgchange -an $VGROUP
echo -e "${GREEN}Clean.${RESET}"
}
get_partition() {
@@ -210,6 +217,7 @@ mount_chroot() {
mount $(get_partition $disk_name "1") ${MOUNT_PATH}/boot/efi
for i in "${MOUNT_POINTS[@]}"; do mount -B $i ${MOUNT_PATH}${i}; done
echo -e "${GREEN}Mounts prepared for chroot.${RESET}"
}
gen_fstab() {
@@ -221,13 +229,13 @@ gen_fstab() {
sed --in-place "s/boot_uuid/$(get_partuuid $disk_name "2")/g" ${MOUNT_PATH}/etc/fstab
sed --in-place "s/efi_uuid/$(get_partuuid $disk_name "1")/g" ${MOUNT_PATH}/etc/fstab
echo "${GREEN}fstab write complete!${RESET}"
echo -e "${GREEN}fstab write complete!${RESET}"
}
install_grub() {
echo "Entering chroot to reinstall GRUB..."
chroot $MOUNT_PATH /bin/bash -c $GRUB_CMD
echo "${GREEN}Grub installed!${RESET}"
echo -e "${GREEN}Grub installed!${RESET}"
}
main