Makefile | 6 +- hooks/udev | 6 +- init_functions | 11 ---- install/lvm2 | 8 +-- install/mdadm_udev | 3 - install/sd-encrypt | 67 -------------------- install/sd-shutdown | 19 ------ install/sd-vconsole | 119 ----------------------------------- install/systemd | 174 ---------------------------------------------------- install/udev | 4 +- 10 files changed, 8 insertions(+), 409 deletions(-) diff --git a/Makefile b/Makefile index 824387b..f73df17 100644 --- a/Makefile +++ b/Makefile @@ -22,7 +22,6 @@ DIRS = \ /usr/share/man/man5 \ /usr/share/man/man1 \ /usr/share/mkinitcpio \ - /usr/lib/systemd/system/shutdown.target.wants \ /usr/lib/tmpfiles.d \ /usr/share/libalpm/hooks \ /usr/share/libalpm/scripts @@ -63,10 +62,7 @@ install-generator: all prepare cp -at $(DESTDIR)/usr/lib/initcpio hooks install install -m644 -t $(DESTDIR)/usr/share/mkinitcpio mkinitcpio.d/* - install -m644 systemd/mkinitcpio-generate-shutdown-ramfs.service \ - $(DESTDIR)/usr/lib/systemd/system/mkinitcpio-generate-shutdown-ramfs.service - ln -s ../mkinitcpio-generate-shutdown-ramfs.service \ - $(DESTDIR)/usr/lib/systemd/system/shutdown.target.wants/mkinitcpio-generate-shutdown-ramfs.service + install -m644 tmpfiles/mkinitcpio.conf $(DESTDIR)/usr/lib/tmpfiles.d/mkinitcpio.conf install -m755 kernel-install/50-mkinitcpio.install $(DESTDIR)/usr/lib/kernel/install.d/50-mkinitcpio.install diff --git a/hooks/udev b/hooks/udev index 951c95e..4b67922 100644 --- a/hooks/udev +++ b/hooks/udev @@ -2,13 +2,13 @@ run_earlyhook() { kmod static-nodes --format=tmpfiles --output=/run/tmpfiles.d/kmod.conf - systemd-tmpfiles --prefix=/dev --create --boot + etmpfiles --prefix=/dev --create --boot # assigned by parse_cmdline # shellcheck disable=SC2154 if [ "${quiet}" = "y" ]; then - /usr/lib/systemd/systemd-udevd --daemon --resolve-names=never >/dev/null 2>&1 + /usr/bin/udevd --daemon --resolve-names=never >/dev/null 2>&1 else - /usr/lib/systemd/systemd-udevd --daemon --resolve-names=never + /usr/bin/udevd --daemon --resolve-names=never fi # used externally by poll_device() # shellcheck disable=SC2034 diff --git a/init_functions b/init_functions index 0abfde7..e33b2a5 100644 --- a/init_functions +++ b/init_functions @@ -338,17 +338,6 @@ fsck_root() { elif bitfield_has_bit "$fsckret" 128; then err "fatal error invoking fsck" fi - - # ensure that root is going to be mounted rw. Otherwise, systemd - # might fsck the device again. Annoy the user so that they fix this. - if [ "${rwopt:-ro}" != 'rw' ]; then - echo "********************** WARNING **********************" - echo "* *" - echo "* The root device is not configured to be mounted *" - echo "* read-write! It may be fsck'd again later. *" - echo "* *" - echo "*****************************************************" - fi fi } diff --git a/install/lvm2 b/install/lvm2 index c2dc8a6..42884dc 100644 --- a/install/lvm2 +++ b/install/lvm2 @@ -33,12 +33,8 @@ build() { '95-dm-notify.rules' \ '/usr/lib/initcpio/udev/11-dm-initramfs.rules' - # this udev rule is specific for systemd and non-systemd systems - if declare -F add_systemd_unit &>/dev/null; then - add_udev_rule '69-dm-lvm.rules' - else - add_udev_rule '/usr/lib/initcpio/udev/69-dm-lvm.rules' - fi + # this udev rule is specific for non-systemd systems + add_udev_rule '/usr/lib/initcpio/udev/69-dm-lvm.rules' # config file add_file '/etc/lvm/lvm.conf' diff --git a/install/mdadm_udev b/install/mdadm_udev index f8ad731..af6adf6 100644 --- a/install/mdadm_udev +++ b/install/mdadm_udev @@ -15,9 +15,6 @@ build() { # For external metadata arrays (e.g. IMSM) add_binary mdmon - if declare -F add_systemd_unit &>/dev/null; then - add_systemd_unit 'mdmon@.service' - fi } help() { diff --git a/install/sd-encrypt b/install/sd-encrypt deleted file mode 100644 index e60d883..0000000 --- a/install/sd-encrypt +++ /dev/null @@ -1,67 +0,0 @@ -#!/bin/bash - -build() { - local mod - - add_module 'dm-crypt' - add_module 'dm-integrity' - if [[ -n "$CRYPTO_MODULES" ]]; then - for mod in $CRYPTO_MODULES; do - add_module "$mod" - done - else - add_all_modules '/crypto/' - fi - add_checked_modules '/drivers/char/tpm/' - - map add_udev_rule \ - '10-dm.rules' \ - '13-dm-disk.rules' \ - '60-fido-id.rules' \ - '95-dm-notify.rules' \ - '/usr/lib/initcpio/udev/11-dm-initramfs.rules' - - map add_systemd_unit 'cryptsetup.target' \ - 'systemd-ask-password-console.path' \ - 'systemd-ask-password-console.service' - map add_binary \ - '/usr/lib/systemd/system-generators/systemd-cryptsetup-generator' \ - '/usr/lib/systemd/systemd-cryptsetup' \ - '/usr/lib/systemd/systemd-makefs' \ - '/usr/lib/cryptsetup/libcryptsetup-token-systemd-fido2.so' \ - '/usr/lib/cryptsetup/libcryptsetup-token-systemd-pkcs11.so' \ - '/usr/lib/cryptsetup/libcryptsetup-token-systemd-tpm2.so' - - # cryptsetup calls pthread_create(), which dlopen()s libgcc_s.so.1 - add_binary '/usr/lib/libgcc_s.so.1' - - # cryptsetup loads the legacy provider which is required for whirlpool - add_binary '/usr/lib/ossl-modules/legacy.so' - - # add libraries dlopen()ed by systemd-cryptsetup - LC_ALL=C.UTF-8 find /usr/lib/ -maxdepth 1 -name "libfido2.so*" | while read -r -d '' FILE; do - if [[ -L "${FILE}" ]]; then - add_symlink "${FILE}" - else - add_binary "${FILE}" - fi - done - - # add mkswap for creating swap space on the fly (see 'swap' in crypttab(5)) - add_binary 'mkswap' - - [[ -f /etc/crypttab.initramfs ]] && add_file '/etc/crypttab.initramfs' '/etc/crypttab' -} - -help() { - cat </dev/null; then - add_binary kexec - fi -} - -help() { - cat <"$BUILDROOT/$of" - done < <(LC_ALL=C.UTF-8 find /usr/share/kbd/keymaps/ -type f -regex ".*/$1\(\.inc\)?\(\.gz\|\.bz2|\.zst\)?") - } - - add_font_file() { - local cat file filename fontfile="$1" - get_decompressor "$fontfile" - add_dir "${of%/*}" - "$cat" "$fontfile" >"$BUILDROOT/$of" - if [[ "$(head -c 23 "$BUILDROOT/$of" | tr -d '\0')" == '# combine partial fonts' ]]; then - while read -r filename; do - for file in "/usr/share/kbd/consolefonts/partialfonts/$filename"?('.gz'|'.bz2'|'.zst'); do - add_font_file "$file" - done - done < <(sed '/^#/d' "$BUILDROOT/$of") - fi - } - - # shellcheck disable=SC1091 - [[ -s /etc/vconsole.conf ]] && . /etc/vconsole.conf - - [[ "$KEYMAP" != '@kernel' ]] && add_keymap_file "${KEYMAP:-us}.map" - [[ -n "$KEYMAP_TOGGLE" ]] && add_keymap_file "${KEYMAP_TOGGLE}.map" - - if [[ -n "$FONT_MAP" ]]; then - FONT_MAP="${FONT_MAP%.trans}" - if [[ -f "/usr/share/kbd/consoletrans/$FONT_MAP" ]]; then - add_file "/usr/share/kbd/consoletrans/$FONT_MAP" - elif [[ -f "/usr/share/kbd/consoletrans/$FONT_MAP.trans" ]]; then - add_file "/usr/share/kbd/consoletrans/$FONT_MAP.trans" - elif [[ -f "/usr/share/kbd/consoletrans/${FONT_MAP}_to_uni.trans" ]]; then - add_file "/usr/share/kbd/consoletrans/${FONT_MAP}_to_uni.trans" - else - error "sd-vconsole: requested font map not found: '%s'" "$FONT_MAP" - return 1 - fi - fi - - if [[ -n "$FONT_UNIMAP" ]]; then - FONT_UNIMAP="${FONT_UNIMAP%.uni}" - if [[ -f "/usr/share/kbd/unimaps/$FONT_UNIMAP.uni" ]]; then - add_file "/usr/share/kbd/unimaps/$FONT_UNIMAP.uni" - else - error "sd-vconsole: requested font unimap not found: '%s'" "$FONT_UNIMAP" - return 1 - fi - fi - - if [[ -n "$FONT" ]]; then - for file in "/usr/share/kbd/consolefonts/$FONT"?('.psfu'|'.psf'|'.cp'|'.fnt')?('.gz'|'.bz2'|'.zst'); do - add_font_file "$file" - return - done - error "sd-vconsole: requested font not found: '%s'" "$FONT" - return 1 - fi - ) -} - -help() { - cat <"$BUILDROOT/etc/systemd/system/$unit.d/$2.conf" -} - -build() { - local rules unit - - add_binary /usr/bin/kmod /usr/bin/modprobe - add_binary /usr/bin/mount - add_binary /usr/bin/sulogin - add_binary /usr/bin/umount - add_binary /usr/lib/systemd/systemd /init - - map add_binary \ - /usr/bin/journalctl \ - /usr/bin/systemd-tmpfiles \ - /usr/lib/systemd/systemd-executor \ - /usr/lib/systemd/systemd-hibernate-resume \ - /usr/lib/systemd/systemd-shutdown \ - /usr/lib/systemd/systemd-sulogin-shell \ - /usr/lib/systemd/system-generators/systemd-fstab-generator \ - /usr/lib/systemd/system-generators/systemd-gpt-auto-generator \ - /usr/lib/systemd/system-generators/systemd-hibernate-resume-generator - - # udev rules - map add_udev_rule "$rules" \ - 50-udev-default.rules \ - 60-persistent-storage.rules \ - 64-btrfs.rules \ - 80-drivers.rules \ - 99-systemd.rules - - # systemd units - map add_systemd_unit \ - initrd-cleanup.service \ - initrd-fs.target \ - initrd-parse-etc.service \ - initrd-root-fs.target \ - initrd-root-device.target \ - initrd-switch-root.service \ - initrd-switch-root.target \ - initrd-udevadm-cleanup-db.service \ - initrd.target \ - kmod-static-nodes.service \ - local-fs.target \ - local-fs-pre.target \ - paths.target \ - reboot.target \ - slices.target \ - sockets.target \ - swap.target \ - systemd-battery-check.service \ - systemd-bsod.service \ - systemd-fsck@.service \ - systemd-hibernate-resume.service \ - systemd-journald-audit.socket \ - systemd-journald-dev-log.socket \ - systemd-journald.service \ - systemd-modules-load.service \ - systemd-pcrphase-initrd.service \ - systemd-tmpfiles-setup-dev.service \ - systemd-udevd-control.socket \ - systemd-udevd-kernel.socket \ - systemd-udevd.service \ - systemd-udev-trigger.service \ - timers.target \ - rescue.target \ - emergency.target - - # add libraries dlopen()ed (hard and optional dependencies): - # tss2-* -> tpm2-util - # kmod -> systemd-shared - # qrencode -> bsod - for LIB in kmod tss2-{esys,rc,mu,tcti-'*'} qrencode; do - LC_ALL=C.UTF-8 find /usr/lib/ -maxdepth 1 -name "lib${LIB}.so*" | while read -r -d '' FILE; do - if [[ -L "${FILE}" ]]; then - add_symlink "${FILE}" - else - add_binary "${FILE}" - fi - done - done - - add_symlink "/usr/lib/systemd/system/default.target" "initrd.target" - add_symlink "/usr/lib/systemd/system/ctrl-alt-del.target" "reboot.target" - - printf '%s\n' >"$BUILDROOT/etc/nsswitch.conf" \ - 'passwd: files' \ - 'group: files' \ - 'shadow: files' - - echo "root:x:0:0:root:/root:/bin/sh" >"$BUILDROOT/etc/passwd" - echo 'root:*:::::::' >"$BUILDROOT/etc/shadow" - getent group root audio disk input kmem kvm lp optical render sgx storage tty uucp video | awk -F: ' { print $1 ":x:" $3 ":" }' >"$BUILDROOT/etc/group" - - add_dir "/etc/modules-load.d" - ( - # FIXME: this should be a function in mkinitcpio - # shellcheck disable=SC1091,SC2154 source=mkinitcpio.conf - . "$_f_config" - set -f - printf '%s\n' "${MODULES[@]}" >"$BUILDROOT/etc/modules-load.d/MODULES.conf" - ) - - [[ -f /etc/fstab.initramfs ]] && add_file "/etc/fstab.initramfs" "/etc/fstab" -} - -help() { - cat <