Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 0664dde3cb | |||
| 91f41fbfba |
+33
-12
@@ -16,16 +16,14 @@ IMG_FILE="PBX-root.img.lz4"
|
|||||||
MOUNT_PATH="/mnt/debian"
|
MOUNT_PATH="/mnt/debian"
|
||||||
MOUNT_POINTS=("/dev" "/dev/pts" "/proc" "/sys" "/sys/firmware/efi/efivars" "/run")
|
MOUNT_POINTS=("/dev" "/dev/pts" "/proc" "/sys" "/sys/firmware/efi/efivars" "/run")
|
||||||
|
|
||||||
BOOT_PART="null"
|
BOOT_PART="NULL"
|
||||||
EFI_PART="null"
|
EFI_PART="NULL"
|
||||||
ROOT_PART="null"
|
ROOT_PART="NULL"
|
||||||
|
|
||||||
VGROUP="PBX-vg"
|
VGROUP="SangomaPBX-vg"
|
||||||
ROOT_LV="root"
|
ROOT_LV="root"
|
||||||
SWAP_LV="swap_1"
|
SWAP_LV="swap_1"
|
||||||
VG_PATH="/dev/mapper/PBX--vg-"
|
VG_PATH="/dev/mapper/SangomaPBX--vg-"
|
||||||
|
|
||||||
GRUB_CMD="export PATH=/usr/sbin:$PATH && update-initramfs -u -k all && grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=debian && update-grub"
|
|
||||||
|
|
||||||
for arg in "$@"; do
|
for arg in "$@"; do
|
||||||
case $arg in
|
case $arg in
|
||||||
@@ -62,16 +60,15 @@ main() {
|
|||||||
|
|
||||||
dialogue
|
dialogue
|
||||||
|
|
||||||
trap 'echo "Status Code: $?"; cleanup;' EXIT
|
assign_part_var
|
||||||
|
|
||||||
EFI_PART=$(get_partition $disk_name "1")
|
trap 'echo "Status Code: $?"; cleanup;' EXIT
|
||||||
BOOT_PART=$(get_partition $disk_name "2")
|
|
||||||
ROOT_PART=$(get_partition $disk_name "3")
|
|
||||||
|
|
||||||
if [[ $NO_RETABLE == true ]]; then
|
if [[ $NO_RETABLE == true ]]; then
|
||||||
echo -e "${YELLOW}Option --noretable is specified. Tables will not be erased and no partitions will be created${RESET}"
|
echo -e "${YELLOW}Option --noretable is specified. Tables will not be erased and no partitions will be created${RESET}"
|
||||||
else
|
else
|
||||||
rewrite_gpt_table
|
rewrite_gpt_table
|
||||||
|
assign_part_var
|
||||||
lvm_init
|
lvm_init
|
||||||
make_filesystem
|
make_filesystem
|
||||||
fi
|
fi
|
||||||
@@ -117,9 +114,18 @@ rewrite_gpt_table() {
|
|||||||
sgdisk -n 3:0:0 -t 3:8e00 -c 3:"Linux LVM" $disk_name
|
sgdisk -n 3:0:0 -t 3:8e00 -c 3:"Linux LVM" $disk_name
|
||||||
|
|
||||||
partprobe || true
|
partprobe || true
|
||||||
|
|
||||||
|
lsblk $disk_name
|
||||||
|
|
||||||
echo -e "${GREEN}GPT table created. ${RESET}"
|
echo -e "${GREEN}GPT table created. ${RESET}"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
assign_part_var() {
|
||||||
|
EFI_PART=$(get_partition $disk_name "1")
|
||||||
|
BOOT_PART=$(get_partition $disk_name "2")
|
||||||
|
ROOT_PART=$(get_partition $disk_name "3")
|
||||||
|
}
|
||||||
|
|
||||||
lvm_init() {
|
lvm_init() {
|
||||||
pvcreate $ROOT_PART -ff
|
pvcreate $ROOT_PART -ff
|
||||||
|
|
||||||
@@ -222,10 +228,25 @@ gen_fstab() {
|
|||||||
|
|
||||||
install_grub() {
|
install_grub() {
|
||||||
echo "Entering chroot to reinstall GRUB..."
|
echo "Entering chroot to reinstall GRUB..."
|
||||||
chroot $MOUNT_PATH /bin/bash -c "$GRUB_CMD"
|
|
||||||
|
CHROOT_LINUX_INSTALL="apt install --reinstall -y linux-image-amd64"
|
||||||
|
CHROOT_INITRAMFS="update-initramfs -c -k all"
|
||||||
|
CHROOT_GRUB_INSTALL="grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=debian"
|
||||||
|
CHROOT_GRUB_UPDATE="update-grub"
|
||||||
|
|
||||||
|
chroot_cmd "$CHROOT_LINUX_INSTALL"
|
||||||
|
chroot_cmd "$CHROOT_INITRAMFS"
|
||||||
|
chroot_cmd "$CHROOT_GRUB_INSTALL"
|
||||||
|
chroot_cmd "$CHROOT_GRUB_UPDATE"
|
||||||
|
|
||||||
echo -e "${GREEN}Grub installed!${RESET}"
|
echo -e "${GREEN}Grub installed!${RESET}"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
chroot_cmd() {
|
||||||
|
CHROOT_PATH="export PATH=/usr/sbin:/usr/bin:/sbin:/bin"
|
||||||
|
chroot $MOUNT_PATH /bin/bash -c "${CHROOT_PATH} && ${1}"
|
||||||
|
}
|
||||||
|
|
||||||
cleanup() {
|
cleanup() {
|
||||||
if [[ $NO_CLEANUP = true ]]; then
|
if [[ $NO_CLEANUP = true ]]; then
|
||||||
echo -e "${YELLOW}No cleanup specified. Make sure to manually clean mounts.${RESET}" 1>&2
|
echo -e "${YELLOW}No cleanup specified. Make sure to manually clean mounts.${RESET}" 1>&2
|
||||||
|
|||||||
+2
-2
@@ -8,7 +8,7 @@
|
|||||||
# Please run 'systemctl daemon-reload' after making changes here.
|
# Please run 'systemctl daemon-reload' after making changes here.
|
||||||
|
|
||||||
# <file system> <mount point> <type> <options> <dump> <pass>
|
# <file system> <mount point> <type> <options> <dump> <pass>
|
||||||
/dev/mapper/PBX--vg-root / ext4 errors=remount-ro 0 1
|
/dev/mapper/SangomaPBX--vg-root / ext4 errors=remount-ro 0 1
|
||||||
|
|
||||||
# /boot was on /dev/vda2 during installation
|
# /boot was on /dev/vda2 during installation
|
||||||
UUID=BOOT_UUID /boot ext2 defaults 0 2
|
UUID=BOOT_UUID /boot ext2 defaults 0 2
|
||||||
@@ -16,4 +16,4 @@ UUID=BOOT_UUID /boot ext2 defaults 0 2
|
|||||||
# /boot/efi was on /dev/vda1 during installation
|
# /boot/efi was on /dev/vda1 during installation
|
||||||
UUID=EFI_UUID /boot/efi vfat umask=0077 0 1
|
UUID=EFI_UUID /boot/efi vfat umask=0077 0 1
|
||||||
|
|
||||||
/dev/mapper/PBX--vg-swap_1 none swap sw 0 0
|
/dev/mapper/SangomaPBX--vg-swap_1 none swap sw 0 0
|
||||||
|
|||||||
Reference in New Issue
Block a user