From e8900c1aec3c79f0ef7ecad60c9c6f3b4ca61202 Mon Sep 17 00:00:00 2001 From: Gardouille Date: Thu, 10 Dec 2020 19:55:33 +0100 Subject: [PATCH] Add possibility to skip grub installation --- debian/chroot.install | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/debian/chroot.install b/debian/chroot.install index 3a1f13f..684eb18 100755 --- a/debian/chroot.install +++ b/debian/chroot.install @@ -27,6 +27,8 @@ manage_luks=1 luks_passphrase="generic key" luks_key_file="/tmp/luks.keyfile.temp" luks_pv_name=$(basename "${hdd}"2_crypt) +## If the script should manage everything (partition, package,…) related to grub +manage_grub=0 ## Colors definition {{{ BLACK='\033[49;30m' BLACKB='\033[49;90m' @@ -126,12 +128,14 @@ mkswap -L sw01 -- /dev/mapper/"${vgname}"-swap || exit 4 mkdir -p -- /target mountpoint -q /target || mount -- /dev/mapper/"${vgname}"-root /target -### boot - grub -mkdir -p -- /target/boot -mountpoint -q /target/boot || mount -- ${hdd}1 /target/boot -boot_uuid=$(blkid | grep "${hdd}1" | sed 's/.*1.*UUID="\(.*\)" TYPE.*/\1/') -### Prepare an fstab file -printf '%b\n' "UUID=${boot_uuid} /boot ext3 defaults 0 0" > /tmp/target.fstab +if [ "${manage_grub}" -eq 0 ]; then + ### boot - grub + mkdir -p -- /target/boot + mountpoint -q /target/boot || mount -- ${hdd}1 /target/boot + boot_uuid=$(blkid | grep "${hdd}1" | sed 's/.*1.*UUID="\(.*\)" TYPE.*/\1/') + ### Prepare an fstab file + printf '%b\n' "UUID=${boot_uuid} /boot ext3 defaults 0 0" > /tmp/target.fstab +fi ### Prepare the base system tree according to the expected file system if [ "${manage_btrfs}" -eq 0 ]; then @@ -272,10 +276,13 @@ chroot /target dpkg-reconfigure --frontend noninteractive tzdata ## }}} ## Kernel and Grub {{{ ### Install -chroot /target aptitude install --assume-yes --without-recommends -- linux-image-amd64 grub-pc -chroot /target grub-install "${hdd}" -chroot /target update-grub - +if [ "${manage_grub}" -eq 0 ]; then + chroot /target aptitude install --assume-yes --without-recommends -- linux-image-amd64 grub-pc + chroot /target grub-install "${hdd}" + chroot /target update-grub +else + chroot /target aptitude install --assume-yes --without-recommends -- linux-image-amd64 +fi ## }}} ## Hostname {{{