installer: create holoscript with disk uuid instead if directly modifying /etc/default/grub

This commit is contained in:
Daniel Langbein 2021-06-18 17:51:45 +02:00
parent fed9294e2d
commit eeb3061eb1
4 changed files with 21 additions and 7 deletions

1
.gitignore vendored
View File

@ -6,7 +6,6 @@
/pkg/*/*-any.pkg.tar.zst /pkg/*/*-any.pkg.tar.zst
/pkg/*/*-package.log /pkg/*/*-package.log
/pkg/*/*-x86_64-build.log /pkg/*/*-x86_64-build.log
/pkg/de-p1st-gnupg/duraconf/
/build-iso/out/ /build-iso/out/
/build-pkg/out/ /build-pkg/out/

View File

@ -2,7 +2,7 @@
_pkgname=grub _pkgname=grub
_reponame=arch _reponame=arch
pkgname="de-p1st-$_pkgname" pkgname="de-p1st-$_pkgname"
pkgver=0.0.4 pkgver=0.0.5
pkgrel=1 pkgrel=1
pkgdesc="grub with configuration" pkgdesc="grub with configuration"
arch=('any') arch=('any')
@ -20,5 +20,5 @@ package() {
install -Dm0755 -o0 40_efi_setup "$pkgdir"/etc/grub.d/40_efi_setup install -Dm0755 -o0 40_efi_setup "$pkgdir"/etc/grub.d/40_efi_setup
install -Dm0544 grub.holoscript "$pkgdir"/usr/share/holo/files/"$pkgname"/etc/default/grub.holoscript install -Dm0544 grub.holoscript "$pkgdir"/usr/share/holo/files/10-"$pkgname"/etc/default/grub.holoscript
} }

View File

@ -2,7 +2,7 @@
_pkgname=installer _pkgname=installer
_reponame=arch _reponame=arch
pkgname="de-p1st-$_pkgname" pkgname="de-p1st-$_pkgname"
pkgver=0.1.12 pkgver=0.1.13
pkgrel=1 pkgrel=1
pkgdesc="Bash script to install Arch Linux" pkgdesc="Bash script to install Arch Linux"
arch=('any') arch=('any')

View File

@ -312,9 +312,24 @@ function bootloader() {
esac esac
echo "Generating /boot/grub/grub.cfg ..." echo "Generating /boot/grub/grub.cfg ..."
sudo sed -i "s|^GRUB_CMDLINE_LINUX=.*\$|GRUB_CMDLINE_LINUX=\"cryptdevice=/dev/disk/by-uuid/${LUKS_PART_UUID}:crypt\"|" \ {
/mnt/etc/default/grub || return $? # /etc/default/grub is managed by Holo. Therefore we should not manually modify it.
sudo arch-chroot /mnt grub-mkconfig -o /boot/grub/grub.cfg || return $? # Instead, we create a holosript which writes $LUKS_PART_UUID into GRUB_CMDLINE_LINUX of /etc/default/grub
{
# Use filename .../20- for the holoscript so that it gets executed after the one from de-p1st-grub
local holoScriptDir=/mnt/usr/share/holo/files/20-de-p1st-installer/etc/default/
# The holoscript shall contain one 'sed "..."' command
sudo mkdir -p "${holoScriptDir}" || return $?
sudo echo '#!/bin/sh
sed "s|^GRUB_CMDLINE_LINUX=.*\$|GRUB_CMDLINE_LINUX=\"cryptdevice=/dev/disk/by-uuid/'"${LUKS_PART_UUID}"':crypt\"|"' \
| sudo tee "${holoScriptDir}"/grub.holoscript || return $?
sudo chmod 0544 "${holoScriptDir}"/grub.holoscript || return $?
}
# Then we apply the holoscript
sudo arch-chroot /mnt holo apply -f file:/etc/default/grub || return $?
# And finally run grub-mkconfig
sudo arch-chroot /mnt grub-mkconfig -o /boot/grub/grub.cfg || return $?
}
} }
function main() { function main() {