41 lines
1.2 KiB
Bash
41 lines
1.2 KiB
Bash
#!/hint/bash -euE
|
|
# Copyright (C) 2023 Umorpha Systems
|
|
# SPDX-License-Identifier: AGPL-3.0-or-later
|
|
|
|
#packages+=(umorpha-disk)
|
|
|
|
pre_install+=(20:umorpha-disk:pre_install)
|
|
post_install+=(20:umorpha-disk:post_install)
|
|
|
|
umorpha-disk:pre_install() {
|
|
local arg_mountpoint=$1
|
|
|
|
mkdir -p "$arg_mountpoint/etc/pacman.d/hooks"
|
|
ln -sT /dev/null "$arg_mountpoint/etc/pacman.d/hooks/20-systemd-sysusers.hook"
|
|
ln -sT /dev/null "$arg_mountpoint/etc/pacman.d/hooks/30-systemd-tmpfiles.hook"
|
|
ln -sT /dev/null "$arg_mountpoint/etc/pacman.d/hooks/90-mkinitcpio-install.hook"
|
|
}
|
|
|
|
umorpha-disk:post_install() {
|
|
local arg_mountpoint=$1
|
|
|
|
rm "$arg_mountpoint/etc/pacman.d/hooks/20-systemd-sysusers.hook"
|
|
rm "$arg_mountpoint/etc/pacman.d/hooks/30-systemd-tmpfiles.hook"
|
|
rm "$arg_mountpoint/etc/pacman.d/hooks/90-mkinitcpio-install.hook"
|
|
rmdir "$arg_mountpoint/etc/pacman.d/hooks" || true
|
|
|
|
cat >"$arg_mountpoint/etc/mkinitcpio.conf.d/umorpha.conf" <<'EOF'
|
|
#!/hint/bash
|
|
# Copyright (C) 2023 Umorpha Systems
|
|
# SPDX-License-Identifier: AGPL-3.0-or-later
|
|
|
|
# Insert 'umorpha-overlayfs' and 'lvm2' into HOOKS.
|
|
for ((i=0; i<${#HOOKS[@]}; i++)); do
|
|
if [[ ${HOOKS[i]} == filesystems ]]; then
|
|
HOOKS=("${HOOKS[@]:0:i}" umorpha-overlayfs lvm2 "${HOOKS[@]:i}" )
|
|
break
|
|
fi
|
|
done
|
|
EOF
|
|
}
|