umorpha-boxes/modules/umorpha-disk.sh

37 lines
969 B
Bash
Raw 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"
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/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
}