aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNatanael Copa <ncopa@alpinelinux.org>2017-06-16 14:57:20 +0200
committerNatanael Copa <ncopa@alpinelinux.org>2017-06-16 15:26:39 +0200
commit0c3615be5e898b397f6d6cf7e89eb28a895fdd12 (patch)
treeb6655b04b54ff74da08dc2ad241b6248e84d0bc6
parent60745ad8694ef21a29b35a28cdd1a3d802c07868 (diff)
downloadalpine-conf-0c3615be5e898b397f6d6cf7e89eb28a895fdd12.tar.bz2
alpine-conf-0c3615be5e898b397f6d6cf7e89eb28a895fdd12.tar.xz
setup-disk: clean up setup_grub/syslinux
- move extlinux_raidopt to setup_syslinux and pass bootdev instead - pass kernel_opts to grub config too - make sure to quote the args to setup_grub/syslinux
-rw-r--r--setup-disk.in28
1 files changed, 14 insertions, 14 deletions
diff --git a/setup-disk.in b/setup-disk.in
index 82bccb5..f5f19c6 100644
--- a/setup-disk.in
+++ b/setup-disk.in
@@ -199,8 +199,8 @@ has_bootopt() {
# setup grub bootloader
setup_grub() {
- local mnt="$1" root="$2" modules="$3"
- shift 3
+ local mnt="$1" root="$2" modules="$3" kernel_opts="$4"
+ shift 4
local disks="${@}"
for disk in $disks; do
@@ -213,7 +213,7 @@ setup_grub() {
cat > "$mnt"/boot/grub/grub.cfg <<- EOF
set timeout=2
menuentry "Alpine Linux" {
- linux /boot/vmlinuz $modules root=$root
+ linux /boot/vmlinuz $modules root=$root $kernel_opts
initrd /boot/initramfs-$KERNEL_FLAVOR
}
EOF
@@ -221,9 +221,8 @@ setup_grub() {
# setup syslinux bootloader
setup_syslinux() {
- local mnt="$1" root="$2" modules="$3" extlinux_raidopt="$4"
- shift 4
- local kernel_opts="$@"
+ local mnt="$1" root="$2" modules="$3" kernel_opts="$4" bootdev="$5"
+ local exlinux_raidopt=
sed -e "s:^root=.*:root=$root:" \
-e "s:^default_kernel_opts=.*:default_kernel_opts=\"$kernel_opts\":" \
@@ -233,6 +232,13 @@ setup_syslinux() {
sed -i -e "s:^default=.*:default=xen-grsec:" \
"$mnt"/etc/update-extlinux.conf
fi
+
+ # Check if we boot from raid so we can pass proper option to
+ # extlinux later.
+ if [ -e "/sys/block/${bootdev#/dev/}/md" ]; then
+ extlinux_raidopt="--raid"
+ fi
+
extlinux $extlinux_raidopt --install "$mnt"/boot
}
@@ -269,12 +275,6 @@ install_mounted_root() {
boot_fs=$(find_mount_fs "$mnt_boot")
supported_boot_fs "$boot_fs" || return 1
- # Check if we boot from raid so we can pass proper option to
- # extlinux later.
- if [ -e "/sys/block/${bootdev#/dev/}/md" ]; then
- extlinux_raidopt="--raid"
- fi
-
# check if our root is on raid so we can feed mkinitfs and
# bootloader conf with the proper kernel module params
for dev in $rootdev $pvs; do
@@ -357,8 +357,8 @@ install_mounted_root() {
rm -f "$mnt"/var/lib/apk/installed "$mnt"/lib/apk/db/installed
echo "Installing system on $rootdev:"
case "$ARCH" in
- ppc64le) setup_grub $mnt $root $modules $disks;;
- *) setup_syslinux $mnt $root $modules $extlinux_raidopt $kernel_opts;;
+ ppc64le) setup_grub "$mnt" "$root" "$modules" "$kernel_opts" $disks;;
+ *) setup_syslinux "$mnt" "$root" "$modules" "$kernel_opts" "$bootdev";;
esac
# apk reads config from target root so we need to copy the config