rewrite chroot
This commit is contained in:
+16
-3
@@ -25,8 +25,6 @@ ROOT_LV="root"
|
|||||||
SWAP_LV="swap_1"
|
SWAP_LV="swap_1"
|
||||||
VG_PATH="/dev/mapper/SangomaPBX--vg-"
|
VG_PATH="/dev/mapper/SangomaPBX--vg-"
|
||||||
|
|
||||||
GRUB_CMD="export PATH=/usr/sbin:$PATH && update-initramfs -c -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
|
||||||
--nowrite)
|
--nowrite)
|
||||||
@@ -230,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
|
||||||
|
|||||||
Reference in New Issue
Block a user