Update the grub payload script and disable the grub commandline script.
This commit is contained in:
parent
85206b2535
commit
a0ab011100
|
|
@ -0,0 +1,29 @@
|
|||
#!/usr/bin/env bash
|
||||
: <<!
|
||||
"We hardcode the GRUB_CMDLINE_LINUX_DEFAULT options for zbm in 020_grub_zbm_payload.sh"
|
||||
!
|
||||
exit 1
|
||||
|
||||
# | Parameter | Purpose | Notes |
|
||||
# | --------------------------- | -------------------------------------------------- | ----------------------------------------------------------------- |
|
||||
# | zbm.prefer=<pool> | Tells ZBM which ZFS pool to import first | Highly recommended if you have multiple zpools or bootable clones |
|
||||
# | zbm.import_delay=<seconds> | Adds a startup delay before auto-importing pools | Useful for slow disks or sparse device init |
|
||||
# | zbm.readonly=1 | Forces all imports read‑only | For emergency/recovery boot entries |
|
||||
# | zbm.timeout=<sec> | Default menu timeout | Optional override of ZBM’s own internal timeout |
|
||||
# | zbm.skip=<boolean> | Skip pool discovery, assume you’ll import manually | Optional, advanced |
|
||||
# | loglevel=<n> | Controls kernel verbosity | 4 is a balanced choice; 7 for deep debugging |
|
||||
# | rd.vconsole.keymap=<keymap> | Keyboard layout for early TTY | Optional, good for non‑US systems |
|
||||
# | rd.vconsole.font=<font> | Sets framebuffer console font (e.g. ter-124n) | Helps when small fonts are hard to read on hi‑res screens |
|
||||
|
||||
# Define arguments to add
|
||||
# Font sizes : ter-v32n ter-v28n ter-v24n ter-v20n ter-v14n
|
||||
# Font sizes bold: ter-v32b ter-v28b ter-v24b ter-v20b ter-v14b
|
||||
NEWARG=("rd.vconsole.font=ter-124n" "zbm.prefer=rpool" "loglevel=4" "zbm.import_delay=5")
|
||||
|
||||
# Loop through each argument and append to GRUB_CMDLINE_LINUX_DEFAULT
|
||||
for arg in "${NEWARG[@]}"; do
|
||||
sudo sed -i -E "s|^(GRUB_CMDLINE_LINUX_DEFAULT=\"[^\"]*)\"|\1 ${arg}\"|" /etc/default/grub
|
||||
done
|
||||
|
||||
# Update GRUB
|
||||
sudo update-grub
|
||||
|
|
@ -14,6 +14,17 @@ set -euo pipefail
|
|||
# 4. ZBM Environment: ZBM initializes, finds your ZFS datasets, and provides the UI.
|
||||
# 5. kexec: Once you select a kernel in ZBM, it uses kexec to replace itself with your actual Devuan kernel.
|
||||
|
||||
# --- CLI Argument Parsing ---
|
||||
FORCE=0
|
||||
for arg in "$@"; do
|
||||
case "$arg" in
|
||||
--force | --force=1 | --force=true)
|
||||
FORCE=1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
#
|
||||
# --- Configuration ---
|
||||
REPO="zbm-dev/zfsbootmenu"
|
||||
ZBM_DIR="/boot/zfsbootmenu"
|
||||
|
|
@ -60,8 +71,7 @@ REMOTE_HASH_DATA=$(curl -sfSL --connect-timeout 10 "$HASH_URL")
|
|||
# REMOTE_HASH=$(echo "$REMOTE_HASH_DATA" | grep "$EFI_NAME" | sed -n "s/.*= \([0-9a-f]*\).*/\1/p")
|
||||
REMOTE_HASH=$(echo "$REMOTE_HASH_DATA" | grep "$EFI_NAME" | sed -n "s/.*= *\([0-9a-f]\{64\}\).*/\1/p")
|
||||
|
||||
mkdir -p "$ZBM_DIR"
|
||||
if [[ -f "$ZBM_DIR/.hash" && "$(cat "$ZBM_DIR/.hash")" == "$REMOTE_HASH" ]]; then
|
||||
if [[ -f "$ZBM_DIR/.hash" && "$(cat "$ZBM_DIR/.hash")" == "$REMOTE_HASH" && "$FORCE" -ne 1 ]]; then
|
||||
echo "✔ ZFSBootMenu $LATEST_TAG already installed and verified. Exiting."
|
||||
exit 0
|
||||
fi
|
||||
|
|
@ -121,18 +131,43 @@ sudo bash -c "
|
|||
mv vmlinuz-zbm.tmp "$ZBM_DIR/vmlinuz-zbm"
|
||||
mv initramfs-zbm.img.tmp "$ZBM_DIR/initramfs-zbm.img"
|
||||
chmod 600 "$ZBM_DIR/vmlinuz-zbm" "$ZBM_DIR/initramfs-zbm.img"
|
||||
echo "$REMOTE_HASH" >"$ZBM_DIR/.hash"
|
||||
echo $REMOTE_HASH >$ZBM_DIR/.hash
|
||||
"
|
||||
|
||||
# --- 7. GRUB Integration ---
|
||||
ZBM_POOL=$(findmnt -n -o SOURCE -T "$ZBM_DIR" | cut -d'/' -f1)
|
||||
ZBM_DATASET_MNT=$(findmnt -n -o TARGET -T "$ZBM_DIR")
|
||||
REL_PATH="${ZBM_DIR#$ZBM_DATASET_MNT}"
|
||||
[[ -z "$REL_PATH" ]] && REL_PATH="/"
|
||||
REL_PATH="${REL_PATH//|/}"
|
||||
ZBM_SOURCE=$(findmnt -n -o SOURCE -T "$ZBM_DIR") # e.g. rpool/ROOT/devuan-1@
|
||||
ZBM_DATASET="${ZBM_SOURCE#*/}" # -> ROOT/devuan-1@
|
||||
ZBM_DATASET_PATH="/${ZBM_DATASET}"
|
||||
|
||||
# Combine dataset location with the ZBM storage path
|
||||
REL_PATH="${ZBM_DATASET_PATH}${ZBM_DIR}"
|
||||
|
||||
# Normalize: collapse any duplicate slashes and tidy snapshot notation
|
||||
REL_PATH="${REL_PATH//|\/|@|/}" # ensure `/` before `@` isn’t broken
|
||||
REL_PATH="${REL_PATH//|//|/|}" # reduce any '//' to '/'
|
||||
|
||||
echo "[*] Generating GRUB configuration for pool: $ZBM_POOL..."
|
||||
|
||||
# | Parameter | Purpose | Notes |
|
||||
# | --------------------------- | -------------------------------------------------- | ----------------------------------------------------------------- |
|
||||
# | zbm.prefer=<pool> | Tells ZBM which ZFS pool to import first | Highly recommended if you have multiple zpools or bootable clones |
|
||||
# | zbm.import_delay=<seconds> | Adds a startup delay before auto-importing pools | Useful for slow disks or sparse device init |
|
||||
# | zbm.readonly=1 | Forces all imports read‑only | For emergency/recovery boot entries |
|
||||
# | zbm.timeout=<sec> | Default menu timeout | Optional override of ZBM’s own internal timeout |
|
||||
# | zbm.skip=<boolean> | Skip pool discovery, assume you’ll import manually | Optional, advanced |
|
||||
# | loglevel=<n> | Controls kernel verbosity | 4 is a balanced choice; 7 for deep debugging |
|
||||
# | rd.vconsole.keymap=<keymap> | Keyboard layout for early TTY | Optional, good for non‑US systems |
|
||||
# | rd.vconsole.font=<font> | Sets framebuffer console font (e.g. ter-124n) | Helps when small fonts are hard to read on hi‑res screens |
|
||||
|
||||
# Define arguments to add
|
||||
# Font sizes : ter-v32n ter-v28n ter-v24n ter-v20n ter-v14n
|
||||
# Font sizes bold: ter-v32b ter-v28b ter-v24b ter-v20b ter-v14b
|
||||
|
||||
# FIXME: If this where placed in /etc/default/zfsbootmenu/ it could be sourced here rather than hardcoded here. Much like /etc/default/grub
|
||||
# The scripts is separated from the settings. Maybe something I would do if I were packaging zbm.
|
||||
GRUB_DEFAULTS='loglevel=4 zbm.import_delay=5 video=vesafb:1920x1200-32@60 rd.vconsole.keymap=uk'
|
||||
|
||||
conf_print_grub_menu_zbm() {
|
||||
cat <<EOF
|
||||
#!/bin/sh
|
||||
|
|
@ -144,7 +179,7 @@ submenu 'ZFSBootMenu>Recovery Options' {
|
|||
insmod part_gpt
|
||||
insmod zfs
|
||||
search --no-floppy --set=root --label $ZBM_POOL
|
||||
linux $REL_PATH/vmlinuz-zbm loglevel=4 zbm.import_delay=5
|
||||
linux $REL_PATH/vmlinuz-zbm ${GRUB_DEFAULTS} zbm.prefer=$ZBM_POOL
|
||||
initrd $REL_PATH/initramfs-zbm.img
|
||||
}
|
||||
|
||||
|
|
@ -152,7 +187,7 @@ submenu 'ZFSBootMenu>Recovery Options' {
|
|||
insmod part_gpt
|
||||
insmod zfs
|
||||
search --no-floppy --set=root --label $ZBM_POOL
|
||||
linux $REL_PATH/vmlinuz-zbm.old loglevel=4 zbm.import_delay=5
|
||||
linux $REL_PATH/vmlinuz-zbm.old ${GRUB_DEFAULTS} zbm.prefer=$ZBM_POOL
|
||||
initrd $REL_PATH/initramfs-zbm.img.old
|
||||
}
|
||||
|
||||
|
|
@ -160,7 +195,7 @@ submenu 'ZFSBootMenu>Recovery Options' {
|
|||
insmod part_gpt
|
||||
insmod zfs
|
||||
search --no-floppy --set=root --label $ZBM_POOL
|
||||
linux $REL_PATH/vmlinuz-zbm loglevel=4 zbm.import_delay=5 zbm.readonly=1
|
||||
linux $REL_PATH/vmlinuz-zbm ${GRUB_DEFAULTS} zbm.readonly=1 zbm.prefer=$ZBM_POOL
|
||||
initrd $REL_PATH/initramfs-zbm.img
|
||||
}
|
||||
|
||||
|
|
@ -168,7 +203,7 @@ submenu 'ZFSBootMenu>Recovery Options' {
|
|||
insmod part_gpt
|
||||
insmod zfs
|
||||
search --no-floppy --set=root --label $ZBM_POOL
|
||||
linux $REL_PATH/vmlinuz-zbm loglevel=4 zbm.import_delay=5 zbm.readonly=1 zbm.prefer=$ZBM_POOL!
|
||||
linux $REL_PATH/vmlinuz-zbm ${GRUB_DEFAULTS} zbm.readonly=1 zbm.prefer=$ZBM_POOL!
|
||||
initrd $REL_PATH/initramfs-zbm.img
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue