omarchy-settings: pass #13362's platform-aware hooks through on aarch64

omacom/omarchy#13362 sets HOOKS per platform inside 00-omarchy-hooks.conf,
with no column-0 HOOKS= line, so the aarch64 build failed on it; settings-dev
tracks quattro automatically and would break as soon as it lands. Wrap only a
single-line HOOKS=(...), refuse any other column-0 HOOKS=, then source the
shipped files onto a Mac line and a stock line: the Mac line must come through
unchanged and the stock one must not. Back up 00-omarchy-hooks.conf when it
ships, and refuse it without the omarchy-hw-platform copy it asks.

The test now uses the real v4.0.4 hooks file, #13362's two files and
omarchy-mac-boot's 90-94 fragments, and covers upgrades over a hand-restored
file.
This commit is contained in:
Marcelo Alcantara committed 2026-09-28 07:53:14 +10:00
1 parent 919b084b93
commit caac8448be
11 files changed
+564 -62

No files matched your search

@@ -0,0 +1,18 @@
# Generated by the Omarchy Apple Silicon image builder.
_omarchy_asahi_hooks=()
_omarchy_asahi_added=false
for _omarchy_asahi_hook in "${HOOKS[@]}"; do
if [[ $_omarchy_asahi_hook == asahi ]]; then
_omarchy_asahi_added=true
fi
if [[ $_omarchy_asahi_hook == filesystems && $_omarchy_asahi_added == false ]]; then
_omarchy_asahi_hooks+=(asahi omarchy-vendorfw)
_omarchy_asahi_added=true
fi
_omarchy_asahi_hooks+=("$_omarchy_asahi_hook")
done
if [[ $_omarchy_asahi_added == false ]]; then
_omarchy_asahi_hooks+=(asahi omarchy-vendorfw)
fi
HOOKS=("${_omarchy_asahi_hooks[@]}")
unset _omarchy_asahi_hooks _omarchy_asahi_hook _omarchy_asahi_added
@@ -0,0 +1,90 @@
# Insert omarchy-mac-encrypt after vendorfw/block and sd-encrypt immediately
# before filesystems, each only if that hook is absent. 90-omarchy-mac.conf
# already put asahi and omarchy-vendorfw before filesystems; this drop-in is
# sourced after it.
#
# Both are systemd initrd units: the systemd hook replaces udev (mkinitcpio's
# stock HOOKS line) and keymap/consolefont become sd-vconsole. A HOOKS line
# carrying the busybox encrypt hook belongs to a Mac unlocked by cryptdevice=,
# which sd-encrypt cannot parse: that line is left exactly as it is.
_omarchy_mac_encrypt_hooks=()
_omarchy_mac_encrypt_have_systemd=false
_omarchy_mac_encrypt_have_vconsole=false
_omarchy_mac_encrypt_have_encrypt=false
for _omarchy_mac_encrypt_hook in "${HOOKS[@]}"; do
case $_omarchy_mac_encrypt_hook in
systemd) _omarchy_mac_encrypt_have_systemd=true ;;
sd-vconsole) _omarchy_mac_encrypt_have_vconsole=true ;;
encrypt) _omarchy_mac_encrypt_have_encrypt=true ;;
esac
done
if [[ $_omarchy_mac_encrypt_have_encrypt == false ]]; then
for _omarchy_mac_encrypt_hook in "${HOOKS[@]}"; do
case $_omarchy_mac_encrypt_hook in
udev)
if [[ $_omarchy_mac_encrypt_have_systemd == false ]]; then
_omarchy_mac_encrypt_hooks+=(systemd)
_omarchy_mac_encrypt_have_systemd=true
fi
;;
keymap|consolefont)
if [[ $_omarchy_mac_encrypt_have_vconsole == false ]]; then
_omarchy_mac_encrypt_hooks+=(sd-vconsole)
_omarchy_mac_encrypt_have_vconsole=true
fi
;;
*) _omarchy_mac_encrypt_hooks+=("$_omarchy_mac_encrypt_hook") ;;
esac
done
if [[ $_omarchy_mac_encrypt_have_systemd == false ]]; then
if [[ ${_omarchy_mac_encrypt_hooks[0]:-} == base ]]; then
_omarchy_mac_encrypt_hooks=(base systemd "${_omarchy_mac_encrypt_hooks[@]:1}")
else
_omarchy_mac_encrypt_hooks=(systemd "${_omarchy_mac_encrypt_hooks[@]}")
fi
fi
HOOKS=("${_omarchy_mac_encrypt_hooks[@]}")
_omarchy_mac_encrypt_hooks=()
_omarchy_mac_encrypt_have_ours=false
_omarchy_mac_encrypt_have_sd=false
_omarchy_mac_encrypt_added_ours=false
_omarchy_mac_encrypt_added_sd=false
for _omarchy_mac_encrypt_hook in "${HOOKS[@]}"; do
if [[ $_omarchy_mac_encrypt_hook == omarchy-mac-encrypt ]]; then
_omarchy_mac_encrypt_have_ours=true
fi
if [[ $_omarchy_mac_encrypt_hook == sd-encrypt ]]; then
_omarchy_mac_encrypt_have_sd=true
fi
done
for _omarchy_mac_encrypt_hook in "${HOOKS[@]}"; do
if [[ $_omarchy_mac_encrypt_hook == sd-encrypt && $_omarchy_mac_encrypt_have_ours == false &&
$_omarchy_mac_encrypt_added_ours == false ]]; then
_omarchy_mac_encrypt_hooks+=(omarchy-mac-encrypt)
_omarchy_mac_encrypt_added_ours=true
fi
if [[ $_omarchy_mac_encrypt_hook == filesystems ]]; then
if [[ $_omarchy_mac_encrypt_have_ours == false && $_omarchy_mac_encrypt_added_ours == false ]]; then
_omarchy_mac_encrypt_hooks+=(omarchy-mac-encrypt)
_omarchy_mac_encrypt_added_ours=true
fi
if [[ $_omarchy_mac_encrypt_have_sd == false && $_omarchy_mac_encrypt_added_sd == false ]]; then
_omarchy_mac_encrypt_hooks+=(sd-encrypt)
_omarchy_mac_encrypt_added_sd=true
fi
fi
_omarchy_mac_encrypt_hooks+=("$_omarchy_mac_encrypt_hook")
done
if [[ $_omarchy_mac_encrypt_have_ours == false && $_omarchy_mac_encrypt_added_ours == false ]]; then
_omarchy_mac_encrypt_hooks+=(omarchy-mac-encrypt)
fi
if [[ $_omarchy_mac_encrypt_have_sd == false && $_omarchy_mac_encrypt_added_sd == false ]]; then
_omarchy_mac_encrypt_hooks+=(sd-encrypt)
fi
HOOKS=("${_omarchy_mac_encrypt_hooks[@]}")
fi
unset _omarchy_mac_encrypt_hooks _omarchy_mac_encrypt_hook \
_omarchy_mac_encrypt_have_ours _omarchy_mac_encrypt_have_sd \
_omarchy_mac_encrypt_added_ours _omarchy_mac_encrypt_added_sd \
_omarchy_mac_encrypt_have_systemd _omarchy_mac_encrypt_have_vconsole \
_omarchy_mac_encrypt_have_encrypt
@@ -0,0 +1,31 @@
# Origin: omarchy-mx-mac install/hardware/apple/fix-asahi-hid-race.sh
# Apple Silicon internal keyboard and trackpad at the sd-encrypt passphrase
# prompt. dockchannel-hid creates the HID devices; hid_apple binds the
# keyboard and hid_magicmouse the SPI trackpad. MTP machines (M2 Air, M2 Max
# j416c) use dockchannel-hid — linux-aurora has no apple-mtp module. SPI HID
# (M1 Air, M1 Pro j314s) is spi-hid-apple-of, built-in on aurora. usbhid is
# an external USB keyboard at the prompt. thunderbolt (CONFIG_USB4=m) and
# thunderbolt_apple, the Apple Silicon USB4 host router (CONFIG_USB4_APPLE_SOC=m
# on linux-aurora), bring up the USB4/Thunderbolt tunnels, so a keyboard behind
# a USB-C or Thunderbolt dock types at the prompt too (omarchy-mx-mac#86).
#
# mkinitcpio fails the whole image over a MODULES entry it cannot find, or a
# built-in it reports as "(builtin)". Each name is added only when modinfo
# returns a real path. Ending on unset keeps the exit status zero.
for _omarchy_mac_hid_module in \
hid_apple hid_magicmouse dockchannel-hid usbhid \
spi-apple spi-hid-apple spi-hid-apple-of \
apple-dockchannel apple-rtkit-helper thunderbolt thunderbolt_apple; do
_omarchy_mac_hid_path=$(modinfo -k "${KERNELVERSION:-$(uname -r)}" -F filename \
"$_omarchy_mac_hid_module" 2>/dev/null) || continue
[[ $_omarchy_mac_hid_path == /* ]] || continue
MODULES+=("$_omarchy_mac_hid_module")
done
unset _omarchy_mac_hid_module _omarchy_mac_hid_path
# MTP trackpad firmware (apple/tpmtfw-<board>.bin) is not a MODULES entry.
# omarchy-vendorfw-initrd.service unpacks ESP vendorfw/firmware.cpio onto
# /lib/firmware/vendor (symlink to /vendorfw) before cryptsetup-pre.target.
# Do not FILES+= under /lib/firmware/vendor, and do not pre-create
# /vendorfw/apple in the image: that skipped ESP extraction.
@@ -0,0 +1,18 @@
# Plymouth draws the disk password prompt and the boot splash, as on x86
# Omarchy. It goes right after systemd so its initrd units order correctly,
# only when the hook is installed, and never twice.
if [[ -f /usr/lib/initcpio/install/plymouth && " ${HOOKS[*]} " != *" plymouth "* ]]; then
_omarchy_mac_plymouth_hooks=()
_omarchy_mac_plymouth_added=false
for _omarchy_mac_plymouth_hook in "${HOOKS[@]}"; do
_omarchy_mac_plymouth_hooks+=("$_omarchy_mac_plymouth_hook")
if [[ $_omarchy_mac_plymouth_hook == systemd && $_omarchy_mac_plymouth_added == false ]]; then
_omarchy_mac_plymouth_hooks+=(plymouth)
_omarchy_mac_plymouth_added=true
fi
done
if [[ $_omarchy_mac_plymouth_added == true ]]; then
HOOKS=("${_omarchy_mac_plymouth_hooks[@]}")
fi
unset _omarchy_mac_plymouth_hooks _omarchy_mac_plymouth_added _omarchy_mac_plymouth_hook
fi
@@ -0,0 +1,46 @@
# The disk passphrase prompt types with the owner's keyboard layout, as on
# x86 Omarchy: sd-vconsole loads KEYMAP on the console (systemd-ask-password)
# and /etc/vconsole.conf gives Plymouth its XKBLAYOUT. The aarch64
# omarchy-settings drops upstream's omarchy_hooks.conf, so this drop-in
# carries its guard: a layout that does not type Latin letters stays out of
# the initramfs, because a Latin passphrase would be untypeable in it
# (upstream #6229). The prompt then uses the kernel's US map, which is what
# such a passphrase was typed with.
#
# A systemd HOOKS line gets sd-vconsole exactly once, after keyboard (or
# after systemd without one); keymap and consolefont are its busybox
# counterparts and never belong on such a line. A busybox line (a Mac
# unlocked by cryptdevice=, which 91 leaves alone) keeps its hooks; it only
# gets the file for Plymouth, as upstream does.
# No vconsole.conf is the kernel's US map: sd-vconsole stays, nothing to bundle.
_omarchy_mac_vconsole_latin=true
if [[ -f /etc/vconsole.conf ]]; then
_omarchy_mac_vconsole_layout=$(unset XKBLAYOUT; . /etc/vconsole.conf 2>/dev/null; printf '%s' "${XKBLAYOUT:-}")
case ${_omarchy_mac_vconsole_layout%%,*} in
af | am | ara | bd | bg | by | et | ge | gr | il | in | iq | ir | kg | kh | kz | la | lk | mk | mm | mn | mv | np | rs | ru | sy | th | tj | ua)
_omarchy_mac_vconsole_latin=false ;;
esac
fi
if [[ " ${HOOKS[*]} " == *" systemd "* ]]; then
_omarchy_mac_vconsole_hooks=()
_omarchy_mac_vconsole_anchor=systemd
[[ " ${HOOKS[*]} " != *" keyboard "* ]] || _omarchy_mac_vconsole_anchor=keyboard
for _omarchy_mac_vconsole_hook in "${HOOKS[@]}"; do
case $_omarchy_mac_vconsole_hook in
sd-vconsole | keymap | consolefont) continue ;;
esac
_omarchy_mac_vconsole_hooks+=("$_omarchy_mac_vconsole_hook")
if [[ $_omarchy_mac_vconsole_hook == "$_omarchy_mac_vconsole_anchor" && $_omarchy_mac_vconsole_latin == true ]]; then
_omarchy_mac_vconsole_hooks+=(sd-vconsole)
_omarchy_mac_vconsole_anchor=
fi
done
HOOKS=("${_omarchy_mac_vconsole_hooks[@]}")
fi
if [[ $_omarchy_mac_vconsole_latin == true && -f /etc/vconsole.conf ]]; then
FILES+=(/etc/vconsole.conf)
fi
unset _omarchy_mac_vconsole_latin _omarchy_mac_vconsole_layout _omarchy_mac_vconsole_hooks \
_omarchy_mac_vconsole_anchor _omarchy_mac_vconsole_hook