umorpha-boxes/modules/umorpha-disk.sh

41 lines
1.2 KiB
Bash
Raw Permalink Normal View History

2023-10-31 07:43:40 +00:00
#!/hint/bash -euE
# Copyright (C) 2023 Umorpha Systems
# SPDX-License-Identifier: AGPL-3.0-or-later
#packages+=(umorpha-disk)
2023-10-31 07:43:40 +00:00
2023-11-04 07:12:33 +00:00
pre_install+=(20:umorpha-disk:pre_install)
post_install+=(20:umorpha-disk:post_install)
2023-10-31 07:43:40 +00:00
umorpha-disk:pre_install() {
local arg_mountpoint=$1
mkdir -p "$arg_mountpoint/etc/pacman.d/hooks"
2023-12-13 03:03:48 +00:00
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"
2023-10-31 07:43:40 +00:00
ln -sT /dev/null "$arg_mountpoint/etc/pacman.d/hooks/90-mkinitcpio-install.hook"
}
umorpha-disk:post_install() {
local arg_mountpoint=$1
2023-12-13 03:03:48 +00:00
rm "$arg_mountpoint/etc/pacman.d/hooks/20-systemd-sysusers.hook"
rm "$arg_mountpoint/etc/pacman.d/hooks/30-systemd-tmpfiles.hook"
2023-10-31 07:43:40 +00:00
rm "$arg_mountpoint/etc/pacman.d/hooks/90-mkinitcpio-install.hook"
rmdir "$arg_mountpoint/etc/pacman.d/hooks" || true
2023-10-31 08:53:18 +00:00
2023-10-31 23:18:47 +00:00
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
2023-10-31 07:43:40 +00:00
}