[arch-projects] [mkinitcpio] [PATCH] [WIP] systemd: add systemd hook
Note: generate initramfs with HOOKS=('systemd' 'autodetect' 'block' 'filesystems' 'fsck') This relies on patches patches soon to be posted on the systemd mailinglist. This hook would live in the systemd package, but posting it as a mkinitcpio patch because SVN. Ideally, we would eventaully introduce "add_unit" and "add_rules" functions that would allow us to add a few udev rules and systemd units, and have everything else in this hook (e.g., binaries from RUN= or ExecStart= and other units based on Wants/Requires dependencise) pulled in automatically. --- install/systemd | 64 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 install/systemd diff --git a/install/systemd b/install/systemd new file mode 100644 index 0000000..bfa1ec1 --- /dev/null +++ b/install/systemd @@ -0,0 +1,64 @@ +#!/bin/bash + +build() { + local rules tool socket service + + # from base + add_binary /bin/mount + + # systemd + add_binary /usr/lib/systemd/systemd /init + add_binary /usr/bin/systemctl + add_binary /usr/bin/udevadm + add_binary /usr/lib/systemd/systemd-udevd + add_binary /usr/lib/systemd/systemd-journald + + # generate sysroot.mount and sysroot-usr.mount + add_file "/usr/lib/systemd/system-generators/systemd-fstab-generator" + + # libdbus needs the passwd info of the root user + # TODO: patch dbus to avoid this hack + add_file "/etc/nsswitch.conf" + add_file "/etc/passwd" + add_file "/lib/libnss_files-2.17.so" + add_symlink "/lib/libnss_files.so.2" "libnss_files-2.17.so" + add_symlink "/lib/libnss_files.so" "libnss_files.so.2" + + # udev rules and systemd units + for rules in 50-udev-default.rules 60-persistent-storage.rules 64-btrfs.rules 80-drivers.rules 99-systemd.rules; do + add_file "/usr/lib/udev/rules.d/$rules" + done + for tool in ata_id scsi_id; do + add_file "/usr/lib/udev/$tool" + done + for socket in systemd-udevd-control systemd-udevd-kernel systemd-journald; do + add_file "/usr/lib/systemd/system/$socket.socket" + add_symlink "/usr/lib/systemd/system/sockets.target.wants/$socket.socket" "../$socket.socket" + done + for service in systemd-udevd systemd-udev-trigger systemd-journald; do + add_file "/usr/lib/systemd/system/$service.service" + add_symlink "/usr/lib/systemd/system/sysinit.target.wants/$service.service" "../$service.service" + done + for target in sysinit sockets basic emergency local-fs-pre local-fs swap remote-fs-pre initrd-switch-root; do + add_file "/usr/lib/systemd/system/$target.target" + done + + add_file "/usr/lib/systemd/system/systemd-fsck@.service" + add_file "/usr/lib/systemd/system/systemd-reboot.service" "/usr/lib/systemd/system/ctrl-alt-del.service" + + add_file "/usr/lib/systemd/system/initrd-parse-etc.service" + add_symlink "/usr/lib/systemd/system/basic.target.wants/initrd-parse-etc.service" "../initrd-parse-etc.service" + add_file "/usr/lib/systemd/system/initrd-cleanup.service" + add_file "/usr/lib/systemd/system/initrd-switch-root.service" + add_file "/usr/lib/systemd/system/initrd-udevadm-cleanup-db.service" + + add_symlink "/usr/lib/systemd/system/default.target" "basic.target" +} + +help() { + cat <<HELPEOF +This will install a basic systemd setup on your initrd, you might want to add more hooks to get more advanced functionality. +HELPEOF +} + +# vim: set ft=sh ts=4 sw=4 et: -- 1.8.1.4
On Mon, Feb 25, 2013 at 3:37 PM, Tom Gundersen <teg@jklm.no> wrote:
This relies on patches patches soon to be posted on the systemd mailinglist.
systemd patches: <http://lists.freedesktop.org/archives/systemd-devel/2013-February/009205.html>
On Mon, Feb 25, 2013 at 3:37 PM, Tom Gundersen <teg@jklm.no> wrote:
+ # libdbus needs the passwd info of the root user + # TODO: patch dbus to avoid this hack
dbus patch: <http://lists.freedesktop.org/archives/dbus/2013-February/015489.html>
participants (1)
-
Tom Gundersen