Add possibility to skip grub installation

This commit is contained in:
gardouille 2020-12-10 19:55:33 +01:00
parent 1187cd8b21
commit e8900c1aec
Signed by: gardouille
GPG Key ID: E759BAA22501AF32
1 changed files with 17 additions and 10 deletions

27
debian/chroot.install vendored
View File

@ -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 {{{