Skip to content
Snippets Groups Projects
Commit c9db056a authored by Jérôme Charaoui's avatar Jérôme Charaoui :telescope:
Browse files

use envvars in remount procedure

Document the chroot remount procedure with environment variables instead
of hardcoding all the paths, making it easier to use this in different
hardware environments.

Also, assume that the "rebuild grub" set of commands occur within the
chroot as this is the expected result of the previous set of commands.
parent 580d1a84
No related branches found
No related tags found
No related merge requests found
......@@ -146,27 +146,33 @@ point it becomes a bit too complicated.
### remount procedure
If you need to do something post-install, this should bring you a
working shell in the `chroot`:
working shell in the `chroot`.
cryptsetup luksOpen /dev/sda3 crypt_dev_sda3 &&
First, set some variables according to the current environment:
export BOOTDEV=/dev/sda2 CRYPTDEV=/dev/sda3 ROOTFS=/dev/mapper/vg_ganeti-root
Then setup and enter the `chroot`:
cryptsetup luksOpen "$CRYPTDEV" "crypt_dev_${CRYPTDEV##*/}" &&
vgchange -a y ; \
mount /dev/mapper/vg_ganeti-root /mnt &&
for fs in /run /sys /dev /proc; do mount -o bind $fs /mnt$fs; done &&
mount /dev/sda2 /mnt/boot &&
mount "$ROOTFS" /mnt &&
for fs in /run /sys /dev /proc; do mount -o bind $fs "/mnt${fs}"; done &&
mount "$BOOTDEV" /mnt/boot &&
chroot /mnt /bin/bash
This will rebuild grub:
This will rebuild grub from within the `chroot`:
chroot /mnt update-grub &&
chroot /mnt grub-install /dev/sda
update-grub &&
grub-install /dev/sda
And this will cleanup the rest:
And this will cleanup after exiting `chroot`:
umount /mnt/boot &&
for fs in /dev /sys /run /proc; do umount /mnt$fs; done &&
for fs in /dev /sys /run /proc; do umount "/mnt${fs}"; done &&
umount /mnt &&
vgchange -a n &&
cryptsetup luksClose crypt_dev_sda3
cryptsetup luksClose "crypt_dev_${CRYPTDEV##*/}"
### Extra firmware
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment