diff options
Diffstat (limited to 'core')
-rw-r--r-- | core/systemd/0001-journald-DO-recalculate-the-ACL-mask-but-only-if-it-.patch | 87 | ||||
-rw-r--r-- | core/systemd/0001-polkit-Avoid-race-condition-in-scraping-proc.patch | 75 | ||||
-rw-r--r-- | core/systemd/0001-swap-fix-reverse-dependencies.patch | 30 | ||||
-rw-r--r-- | core/systemd/0001-utmp-turn-systemd-update-utmp-shutdown.service-into-.patch | 255 | ||||
-rw-r--r-- | core/systemd/0002-swap-create-.wants-symlink-to-auto-swap-devices.patch | 90 | ||||
-rw-r--r-- | core/systemd/PKGBUILD | 48 | ||||
-rw-r--r-- | core/systemd/initcpio-hook-udev | 2 | ||||
-rw-r--r-- | core/systemd/initcpio-install-systemd | 156 | ||||
-rw-r--r-- | core/systemd/initcpio-install-timestamp | 14 | ||||
-rw-r--r-- | core/systemd/initcpio-install-udev | 2 | ||||
-rw-r--r-- | core/systemd/systemd.install | 13 |
11 files changed, 392 insertions, 380 deletions
diff --git a/core/systemd/0001-journald-DO-recalculate-the-ACL-mask-but-only-if-it-.patch b/core/systemd/0001-journald-DO-recalculate-the-ACL-mask-but-only-if-it-.patch deleted file mode 100644 index 372ecebff..000000000 --- a/core/systemd/0001-journald-DO-recalculate-the-ACL-mask-but-only-if-it-.patch +++ /dev/null @@ -1,87 +0,0 @@ -From 23ad4dd8844c582929115a11ed2830a1371568d6 Mon Sep 17 00:00:00 2001 -From: "Jan Alexander Steffens (heftig)" <jan.steffens@gmail.com> -Date: Tue, 28 May 2013 20:45:34 +0200 -Subject: [PATCH] journald: DO recalculate the ACL mask, but only if it doesn't - exist - -Since 11ec7ce, journald isn't setting the ACLs properly anymore if -the files had no ACLs to begin with: acl_set_fd fails with EINVAL. - -An ACL with ACL_USER or ACL_GROUP entries but no ACL_MASK entry is -invalid, so make sure a mask exists before trying to set the ACL. ---- - src/journal/journald-server.c | 6 ++++-- - src/shared/acl-util.c | 28 ++++++++++++++++++++++++++++ - src/shared/acl-util.h | 1 + - 3 files changed, 33 insertions(+), 2 deletions(-) - -diff --git a/src/journal/journald-server.c b/src/journal/journald-server.c -index b717b92..da5b725 100644 ---- a/src/journal/journald-server.c -+++ b/src/journal/journald-server.c -@@ -227,9 +227,11 @@ void server_fix_perms(Server *s, JournalFile *f, uid_t uid) { - } - } - -- /* We do not recalculate the mask here, so that the fchmod() mask above stays intact. */ -+ /* We do not recalculate the mask unconditionally here, -+ * so that the fchmod() mask above stays intact. */ - if (acl_get_permset(entry, &permset) < 0 || -- acl_add_perm(permset, ACL_READ) < 0) { -+ acl_add_perm(permset, ACL_READ) < 0 || -+ calc_acl_mask_if_needed(&acl) < 0) { - log_warning("Failed to patch ACL on %s, ignoring: %m", f->path); - goto finish; - } -diff --git a/src/shared/acl-util.c b/src/shared/acl-util.c -index 48bb12f..fb04e49 100644 ---- a/src/shared/acl-util.c -+++ b/src/shared/acl-util.c -@@ -69,6 +69,34 @@ int acl_find_uid(acl_t acl, uid_t uid, acl_entry_t *entry) { - return 0; - } - -+int calc_acl_mask_if_needed(acl_t *acl_p) { -+ acl_entry_t i; -+ int found; -+ -+ assert(acl_p); -+ -+ for (found = acl_get_entry(*acl_p, ACL_FIRST_ENTRY, &i); -+ found > 0; -+ found = acl_get_entry(*acl_p, ACL_NEXT_ENTRY, &i)) { -+ -+ acl_tag_t tag; -+ -+ if (acl_get_tag_type(i, &tag) < 0) -+ return -errno; -+ -+ if (tag == ACL_MASK) -+ return 0; -+ } -+ -+ if (found < 0) -+ return -errno; -+ -+ if (acl_calc_mask(acl_p) < 0) -+ return -errno; -+ -+ return 0; -+} -+ - int search_acl_groups(char*** dst, const char* path, bool* belong) { - acl_t acl; - -diff --git a/src/shared/acl-util.h b/src/shared/acl-util.h -index 23090d9..36ef490 100644 ---- a/src/shared/acl-util.h -+++ b/src/shared/acl-util.h -@@ -24,4 +24,5 @@ - #include <stdbool.h> - - int acl_find_uid(acl_t acl, uid_t uid, acl_entry_t *entry); -+int calc_acl_mask_if_needed(acl_t *acl_p); - int search_acl_groups(char*** dst, const char* path, bool* belong); --- -1.8.3 - diff --git a/core/systemd/0001-polkit-Avoid-race-condition-in-scraping-proc.patch b/core/systemd/0001-polkit-Avoid-race-condition-in-scraping-proc.patch new file mode 100644 index 000000000..d3c09781c --- /dev/null +++ b/core/systemd/0001-polkit-Avoid-race-condition-in-scraping-proc.patch @@ -0,0 +1,75 @@ +From 72fd713962ca2c2450e23b01d9e22017a7e28fd4 Mon Sep 17 00:00:00 2001 +From: Colin Walters <walters@verbum.org> +Date: Thu, 22 Aug 2013 13:55:21 -0400 +Subject: [PATCH] polkit: Avoid race condition in scraping /proc + +If a calling process execve()s a setuid program, it can appear to be +uid 0. Since we're receiving requests over DBus, avoid this by simply +passing system-bus-name as a subject. +--- + src/shared/polkit.c | 31 +++++-------------------------- + 1 file changed, 5 insertions(+), 26 deletions(-) + +diff --git a/src/shared/polkit.c b/src/shared/polkit.c +index cea7074..1c5e9e3 100644 +--- a/src/shared/polkit.c ++++ b/src/shared/polkit.c +@@ -38,12 +38,8 @@ int verify_polkit( + + #ifdef ENABLE_POLKIT + DBusMessage *m = NULL, *reply = NULL; +- const char *unix_process = "unix-process", *pid = "pid", *starttime = "start-time", *cancel_id = ""; ++ const char *system_bus_name = "system-bus-name", *name = "name", *cancel_id = ""; + uint32_t flags = interactive ? 1 : 0; +- pid_t pid_raw; +- uint32_t pid_u32; +- unsigned long long starttime_raw; +- uint64_t starttime_u64; + DBusMessageIter iter_msg, iter_struct, iter_array, iter_dict, iter_variant; + int r; + dbus_bool_t authorized = FALSE, challenge = FALSE; +@@ -68,14 +64,6 @@ int verify_polkit( + + #ifdef ENABLE_POLKIT + +- pid_raw = bus_get_unix_process_id(c, sender, error); +- if (pid_raw == 0) +- return -EINVAL; +- +- r = get_starttime_of_pid(pid_raw, &starttime_raw); +- if (r < 0) +- return r; +- + m = dbus_message_new_method_call( + "org.freedesktop.PolicyKit1", + "/org/freedesktop/PolicyKit1/Authority", +@@ -86,22 +74,13 @@ int verify_polkit( + + dbus_message_iter_init_append(m, &iter_msg); + +- pid_u32 = (uint32_t) pid_raw; +- starttime_u64 = (uint64_t) starttime_raw; +- + if (!dbus_message_iter_open_container(&iter_msg, DBUS_TYPE_STRUCT, NULL, &iter_struct) || +- !dbus_message_iter_append_basic(&iter_struct, DBUS_TYPE_STRING, &unix_process) || ++ !dbus_message_iter_append_basic(&iter_struct, DBUS_TYPE_STRING, &system_bus_name) || + !dbus_message_iter_open_container(&iter_struct, DBUS_TYPE_ARRAY, "{sv}", &iter_array) || + !dbus_message_iter_open_container(&iter_array, DBUS_TYPE_DICT_ENTRY, NULL, &iter_dict) || +- !dbus_message_iter_append_basic(&iter_dict, DBUS_TYPE_STRING, &pid) || +- !dbus_message_iter_open_container(&iter_dict, DBUS_TYPE_VARIANT, "u", &iter_variant) || +- !dbus_message_iter_append_basic(&iter_variant, DBUS_TYPE_UINT32, &pid_u32) || +- !dbus_message_iter_close_container(&iter_dict, &iter_variant) || +- !dbus_message_iter_close_container(&iter_array, &iter_dict) || +- !dbus_message_iter_open_container(&iter_array, DBUS_TYPE_DICT_ENTRY, NULL, &iter_dict) || +- !dbus_message_iter_append_basic(&iter_dict, DBUS_TYPE_STRING, &starttime) || +- !dbus_message_iter_open_container(&iter_dict, DBUS_TYPE_VARIANT, "t", &iter_variant) || +- !dbus_message_iter_append_basic(&iter_variant, DBUS_TYPE_UINT64, &starttime_u64) || ++ !dbus_message_iter_append_basic(&iter_dict, DBUS_TYPE_STRING, &name) || ++ !dbus_message_iter_open_container(&iter_dict, DBUS_TYPE_VARIANT, "s", &iter_variant) || ++ !dbus_message_iter_append_basic(&iter_variant, DBUS_TYPE_STRING, &sender) || + !dbus_message_iter_close_container(&iter_dict, &iter_variant) || + !dbus_message_iter_close_container(&iter_array, &iter_dict) || + !dbus_message_iter_close_container(&iter_struct, &iter_array) || +-- +1.8.4 + diff --git a/core/systemd/0001-swap-fix-reverse-dependencies.patch b/core/systemd/0001-swap-fix-reverse-dependencies.patch new file mode 100644 index 000000000..7e51918ab --- /dev/null +++ b/core/systemd/0001-swap-fix-reverse-dependencies.patch @@ -0,0 +1,30 @@ +From 90060fa6605446bef7078867423b691e4effa575 Mon Sep 17 00:00:00 2001 +From: Tom Gundersen <teg@jklm.no> +Date: Fri, 13 Sep 2013 14:46:18 +0200 +Subject: [PATCH] swap: fix reverse dependencies + +Make sure swap.target correctly requires/wants the swap units. + +This fixes https://bugs.freedesktop.org/show_bug.cgi?id=69291. + +Reported-by: Hussam Al-Tayeb +--- + src/core/swap.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/core/swap.c b/src/core/swap.c +index 57d15eb..3950860 100644 +--- a/src/core/swap.c ++++ b/src/core/swap.c +@@ -220,7 +220,7 @@ static int swap_add_default_dependencies(Swap *s) { + } + + if (!noauto) { +- r = unit_add_two_dependencies_by_name(UNIT(s), UNIT_BEFORE, (nofail ? UNIT_WANTED_BY : UNIT_REQUIRED_BY), ++ r = unit_add_two_dependencies_by_name_inverse(UNIT(s), UNIT_AFTER, (nofail ? UNIT_WANTS : UNIT_REQUIRES), + SPECIAL_SWAP_TARGET, NULL, true); + if (r < 0) + return r; +-- +1.8.4 + diff --git a/core/systemd/0001-utmp-turn-systemd-update-utmp-shutdown.service-into-.patch b/core/systemd/0001-utmp-turn-systemd-update-utmp-shutdown.service-into-.patch deleted file mode 100644 index 84cce7121..000000000 --- a/core/systemd/0001-utmp-turn-systemd-update-utmp-shutdown.service-into-.patch +++ /dev/null @@ -1,255 +0,0 @@ -From 3f92e4b4b61042391bd44de4dceb18177df0dd57 Mon Sep 17 00:00:00 2001 -From: Lennart Poettering <lennart@poettering.net> -Date: Thu, 16 May 2013 00:19:03 +0200 -Subject: [PATCH] utmp: turn systemd-update-utmp-shutdown.service into a normal - runtime service - -With this change systemd-update-utmp-shutdown.service is replaced by -systemd-update-utmp.service which is started at boot and stays around -until shutdown. This allows us to properly order the unit against both -/var/log and auditd. - -https://bugzilla.redhat.com/show_bug.cgi?id=853104 -https://bugs.freedesktop.org/show_bug.cgi?id=64365 ---- - Makefile-man.am | 12 ++++++------ - Makefile.am | 8 ++++---- - ....service.xml => systemd-update-utmp.service.xml} | 16 ++++++++-------- - src/update-utmp/update-utmp.c | 2 +- - units/.gitignore | 2 +- - units/systemd-update-utmp-runlevel.service.in | 8 +++++--- - units/systemd-update-utmp-shutdown.service.in | 19 ------------------- - units/systemd-update-utmp.service.in | 21 +++++++++++++++++++++ - 8 files changed, 46 insertions(+), 42 deletions(-) - rename man/{systemd-update-utmp-runlevel.service.xml => systemd-update-utmp.service.xml} (82%) - delete mode 100644 units/systemd-update-utmp-shutdown.service.in - create mode 100644 units/systemd-update-utmp.service.in - -diff --git a/Makefile-man.am b/Makefile-man.am -index 7d62094..5888158 100644 ---- a/Makefile-man.am -+++ b/Makefile-man.am -@@ -72,7 +72,7 @@ MANPAGES += \ - man/systemd-tmpfiles.8 \ - man/systemd-tty-ask-password-agent.1 \ - man/systemd-udevd.service.8 \ -- man/systemd-update-utmp-runlevel.service.8 \ -+ man/systemd-update-utmp.service.8 \ - man/systemd.1 \ - man/systemd.automount.5 \ - man/systemd.device.5 \ -@@ -191,7 +191,7 @@ MANPAGES_ALIAS += \ - man/systemd-udevd-control.socket.8 \ - man/systemd-udevd-kernel.socket.8 \ - man/systemd-udevd.8 \ -- man/systemd-update-utmp-shutdown.service.8 \ -+ man/systemd-update-utmp-runlevel.service.8 \ - man/systemd-update-utmp.8 \ - man/systemd-user.conf.5 - man/SD_ALERT.3: man/sd-daemon.3 -@@ -289,8 +289,8 @@ man/systemd-tmpfiles-setup.service.8: man/systemd-tmpfiles.8 - man/systemd-udevd-control.socket.8: man/systemd-udevd.service.8 - man/systemd-udevd-kernel.socket.8: man/systemd-udevd.service.8 - man/systemd-udevd.8: man/systemd-udevd.service.8 --man/systemd-update-utmp-shutdown.service.8: man/systemd-update-utmp-runlevel.service.8 --man/systemd-update-utmp.8: man/systemd-update-utmp-runlevel.service.8 -+man/systemd-update-utmp-runlevel.service.8: man/systemd-update-utmp.service.8 -+man/systemd-update-utmp.8: man/systemd-update-utmp.service.8 - man/systemd-user.conf.5: man/systemd-system.conf.5 - man/SD_ALERT.html: man/sd-daemon.html - $(html-alias) -@@ -577,10 +577,10 @@ man/systemd-udevd-kernel.socket.html: man/systemd-udevd.service.html - man/systemd-udevd.html: man/systemd-udevd.service.html - $(html-alias) - --man/systemd-update-utmp-shutdown.service.html: man/systemd-update-utmp-runlevel.service.html -+man/systemd-update-utmp-runlevel.service.html: man/systemd-update-utmp.service.html - $(html-alias) - --man/systemd-update-utmp.html: man/systemd-update-utmp-runlevel.service.html -+man/systemd-update-utmp.html: man/systemd-update-utmp.service.html - $(html-alias) - - man/systemd-user.conf.html: man/systemd-system.conf.html -diff --git a/Makefile.am b/Makefile.am -index 8d8139c..4c5e6fc 100644 ---- a/Makefile.am -+++ b/Makefile.am -@@ -417,8 +417,8 @@ nodist_systemunit_DATA = \ - units/systemd-initctl.service \ - units/systemd-shutdownd.service \ - units/systemd-remount-fs.service \ -+ units/systemd-update-utmp.service \ - units/systemd-update-utmp-runlevel.service \ -- units/systemd-update-utmp-shutdown.service \ - units/systemd-tmpfiles-setup-dev.service \ - units/systemd-tmpfiles-setup.service \ - units/systemd-tmpfiles-clean.service \ -@@ -463,8 +463,8 @@ EXTRA_DIST += \ - units/systemd-initctl.service.in \ - units/systemd-shutdownd.service.in \ - units/systemd-remount-fs.service.in \ -+ units/systemd-update-utmp.service.in \ - units/systemd-update-utmp-runlevel.service.in \ -- units/systemd-update-utmp-shutdown.service.in \ - units/systemd-tmpfiles-setup-dev.service.in \ - units/systemd-tmpfiles-setup.service.in \ - units/systemd-tmpfiles-clean.service.in \ -@@ -4070,8 +4070,8 @@ RUNLEVEL4_TARGET_WANTS += \ - RUNLEVEL5_TARGET_WANTS += \ - systemd-update-utmp-runlevel.service - endif --SHUTDOWN_TARGET_WANTS += \ -- systemd-update-utmp-shutdown.service -+SYSINIT_TARGET_WANTS += \ -+ systemd-update-utmp.service - LOCAL_FS_TARGET_WANTS += \ - systemd-remount-fs.service \ - systemd-fsck-root.service \ -diff --git a/man/systemd-update-utmp-runlevel.service.xml b/man/systemd-update-utmp.service.xml -similarity index 82% -rename from man/systemd-update-utmp-runlevel.service.xml -rename to man/systemd-update-utmp.service.xml -index 867b958..846fc95 100644 ---- a/man/systemd-update-utmp-runlevel.service.xml -+++ b/man/systemd-update-utmp.service.xml -@@ -19,10 +19,10 @@ - You should have received a copy of the GNU Lesser General Public License - along with systemd; If not, see <http://www.gnu.org/licenses/>. - --> --<refentry id="systemd-update-utmp-runlevel.service"> -+<refentry id="systemd-update-utmp.service"> - - <refentryinfo> -- <title>systemd-update-utmp-runlevel.service</title> -+ <title>systemd-update-utmp.service</title> - <productname>systemd</productname> - - <authorgroup> -@@ -36,21 +36,21 @@ - </refentryinfo> - - <refmeta> -- <refentrytitle>systemd-update-utmp-runlevel.service</refentrytitle> -+ <refentrytitle>systemd-update-utmp.service</refentrytitle> - <manvolnum>8</manvolnum> - </refmeta> - - <refnamediv> -+ <refname>systemd-update-utmp.service</refname> - <refname>systemd-update-utmp-runlevel.service</refname> -- <refname>systemd-update-utmp-shutdown.service</refname> - <refname>systemd-update-utmp</refname> -- <refpurpose>Write audit and utmp updates at runlevel -+ <refpurpose>Write audit and utmp updates at bootup, runlevel - changes and shutdown</refpurpose> - </refnamediv> - - <refsynopsisdiv> -+ <para><filename>systemd-update-utmp.service</filename></para> - <para><filename>systemd-update-utmp-runlevel.service</filename></para> -- <para><filename>systemd-update-utmp-shutdown.service</filename></para> - <para><filename>/usr/lib/systemd/systemd-update-utmp</filename></para> - </refsynopsisdiv> - -@@ -60,8 +60,8 @@ - <para><filename>systemd-update-utmp-runlevel.service</filename> - is a service that writes SysV runlevel changes to utmp - and wtmp, as well as the audit logs, as they -- occur. <filename>systemd-update-utmp-shutdown.service</filename> -- does the same for shut-down requests.</para> -+ occur. <filename>systemd-update-utmp.service</filename> -+ does the same for system reboots and shut-down requests.</para> - </refsect1> - - <refsect1> -diff --git a/src/update-utmp/update-utmp.c b/src/update-utmp/update-utmp.c -index 9184025..202aa98 100644 ---- a/src/update-utmp/update-utmp.c -+++ b/src/update-utmp/update-utmp.c -@@ -104,7 +104,7 @@ static int get_current_runlevel(Context *c) { - { '3', SPECIAL_RUNLEVEL3_TARGET }, - { '4', SPECIAL_RUNLEVEL4_TARGET }, - { '2', SPECIAL_RUNLEVEL2_TARGET }, -- { 'S', SPECIAL_RESCUE_TARGET }, -+ { '1', SPECIAL_RESCUE_TARGET }, - }; - const char - *interface = "org.freedesktop.systemd1.Unit", -diff --git a/units/systemd-update-utmp-runlevel.service.in b/units/systemd-update-utmp-runlevel.service.in -index 27fae2c..99783e2 100644 ---- a/units/systemd-update-utmp-runlevel.service.in -+++ b/units/systemd-update-utmp-runlevel.service.in -@@ -7,12 +7,14 @@ - - [Unit] - Description=Update UTMP about System Runlevel Changes --Documentation=man:systemd-update-utmp-runlevel.service(8) man:utmp(5) -+Documentation=man:systemd-update-utmp.service(8) man:utmp(5) - DefaultDependencies=no - RequiresMountsFor=/var/log/wtmp --After=systemd-remount-fs.service systemd-tmpfiles-setup.service auditd.service -+Conflicts=shutdown.target -+Requisite=systemd-update-utmp.service -+After=systemd-update-utmp.service - After=runlevel1.target runlevel2.target runlevel3.target runlevel4.target runlevel5.target --Before=final.target -+Before=shutdown.target - - [Service] - Type=oneshot -diff --git a/units/systemd-update-utmp-shutdown.service.in b/units/systemd-update-utmp-shutdown.service.in -deleted file mode 100644 -index aa93562..0000000 ---- a/units/systemd-update-utmp-shutdown.service.in -+++ /dev/null -@@ -1,19 +0,0 @@ --# This file is part of systemd. --# --# systemd is free software; you can redistribute it and/or modify it --# under the terms of the GNU Lesser General Public License as published by --# the Free Software Foundation; either version 2.1 of the License, or --# (at your option) any later version. -- --[Unit] --Description=Update UTMP about System Shutdown --Documentation=man:systemd-update-utmp-runlevel.service(8) man:utmp(5) --DefaultDependencies=no --RequiresMountsFor=/var/log/wtmp --After=systemd-remount-fs.service systemd-tmpfiles-setup.service auditd.service --After=systemd-update-utmp-runlevel.service --Before=final.target -- --[Service] --Type=oneshot --ExecStart=@rootlibexecdir@/systemd-update-utmp shutdown -diff --git a/units/systemd-update-utmp.service.in b/units/systemd-update-utmp.service.in -new file mode 100644 -index 0000000..e7c20a5 ---- /dev/null -+++ b/units/systemd-update-utmp.service.in -@@ -0,0 +1,21 @@ -+# This file is part of systemd. -+# -+# systemd is free software; you can redistribute it and/or modify it -+# under the terms of the GNU Lesser General Public License as published by -+# the Free Software Foundation; either version 2.1 of the License, or -+# (at your option) any later version. -+ -+[Unit] -+Description=Update UTMP about System Reboot/Shutdown -+Documentation=man:systemd-update-utmp.service(8) man:utmp(5) -+DefaultDependencies=no -+RequiresMountsFor=/var/log/wtmp -+Conflicts=shutdown.target -+After=systemd-readahead-collect.service systemd-readahead-replay.service systemd-remount-fs.service systemd-tmpfiles-setup.service auditd.service -+Before=sysinit.target shutdown.target -+ -+[Service] -+Type=oneshot -+RemainAfterExit=yes -+ExecStart=@rootlibexecdir@/systemd-update-utmp reboot -+ExecStop=@rootlibexecdir@/systemd-update-utmp shutdown --- -1.8.2.3 - diff --git a/core/systemd/0002-swap-create-.wants-symlink-to-auto-swap-devices.patch b/core/systemd/0002-swap-create-.wants-symlink-to-auto-swap-devices.patch new file mode 100644 index 000000000..4b8743464 --- /dev/null +++ b/core/systemd/0002-swap-create-.wants-symlink-to-auto-swap-devices.patch @@ -0,0 +1,90 @@ +From 4e82fe5213bedcb70e25c0270e516d5f2706d8c8 Mon Sep 17 00:00:00 2001 +From: Tom Gundersen <teg@jklm.no> +Date: Mon, 16 Sep 2013 01:08:32 +0200 +Subject: [PATCH] swap: create .wants symlink to 'auto' swap devices + +As we load unit files lazily, we need to make sure something pulls in swap +units that should be started automatically, otherwise the default dependencies +will never be applied. + +This partially reinstates code removed in +commit 64347fc2b983f33e7efb0fd2bb44e133fb9f30f4. + +Also don't order swap devices after swap.target when they are 'nofail'. +--- + src/core/swap.c | 8 ++++++-- + src/fstab-generator/fstab-generator.c | 18 ++++++++++++++++-- + 2 files changed, 22 insertions(+), 4 deletions(-) + +diff --git a/src/core/swap.c b/src/core/swap.c +index 3950860..76c7d45 100644 +--- a/src/core/swap.c ++++ b/src/core/swap.c +@@ -220,8 +220,12 @@ static int swap_add_default_dependencies(Swap *s) { + } + + if (!noauto) { +- r = unit_add_two_dependencies_by_name_inverse(UNIT(s), UNIT_AFTER, (nofail ? UNIT_WANTS : UNIT_REQUIRES), +- SPECIAL_SWAP_TARGET, NULL, true); ++ if (nofail) ++ r = unit_add_dependency_by_name_inverse(UNIT(s), ++ UNIT_WANTS, SPECIAL_SWAP_TARGET, NULL, true); ++ else ++ r = unit_add_two_dependencies_by_name_inverse(UNIT(s), ++ UNIT_AFTER, UNIT_REQUIRES, SPECIAL_SWAP_TARGET, NULL, true); + if (r < 0) + return r; + } +diff --git a/src/fstab-generator/fstab-generator.c b/src/fstab-generator/fstab-generator.c +index 6ebe8aa..b73dfa4 100644 +--- a/src/fstab-generator/fstab-generator.c ++++ b/src/fstab-generator/fstab-generator.c +@@ -66,6 +66,7 @@ static int mount_find_pri(struct mntent *me, int *ret) { + static int add_swap(const char *what, struct mntent *me) { + _cleanup_free_ char *name = NULL, *unit = NULL, *lnk = NULL, *device = NULL; + _cleanup_fclose_ FILE *f = NULL; ++ bool noauto; + int r, pri = -1; + + assert(what); +@@ -77,6 +78,8 @@ static int add_swap(const char *what, struct mntent *me) { + return pri; + } + ++ noauto = !!hasmntopt(me, "noauto"); ++ + name = unit_name_from_path(what, ".swap"); + if (!name) + return log_oom(); +@@ -97,8 +100,7 @@ static int add_swap(const char *what, struct mntent *me) { + fprintf(f, + "# Automatically generated by systemd-fstab-generator\n\n" + "[Unit]\n" +- "SourcePath=/etc/fstab\n" +- "\n" ++ "SourcePath=/etc/fstab\n\n" + "[Swap]\n" + "What=%s\n", + what); +@@ -114,6 +116,18 @@ static int add_swap(const char *what, struct mntent *me) { + return -errno; + } + ++ if (!noauto) { ++ lnk = strjoin(arg_dest, "/" SPECIAL_SWAP_TARGET ".wants/", name, NULL); ++ if (!lnk) ++ return log_oom(); ++ ++ mkdir_parents_label(lnk, 0755); ++ if (symlink(unit, lnk) < 0) { ++ log_error("Failed to create symlink %s: %m", lnk); ++ return -errno; ++ } ++ } ++ + return 0; + } + +-- +1.8.4 + diff --git a/core/systemd/PKGBUILD b/core/systemd/PKGBUILD index 9b17e6d8f..6a84686ad 100644 --- a/core/systemd/PKGBUILD +++ b/core/systemd/PKGBUILD @@ -3,43 +3,41 @@ pkgbase=systemd pkgname=('systemd' 'systemd-sysvcompat') -pkgver=204 +pkgver=207 pkgrel=3 arch=('i686' 'x86_64') url="http://www.freedesktop.org/wiki/Software/systemd" -license=('GPL2' 'LGPL2.1' 'MIT') makedepends=('acl' 'cryptsetup' 'dbus-core' 'docbook-xsl' 'gobject-introspection' 'gperf' 'gtk-doc' 'intltool' 'kmod' 'libcap' 'libgcrypt' 'libmicrohttpd' 'libxslt' 'linux-api-headers' 'pam' 'python' 'quota-tools' 'xz') options=('!libtool') source=("http://www.freedesktop.org/software/$pkgname/$pkgname-$pkgver.tar.xz" - 0001-utmp-turn-systemd-update-utmp-shutdown.service-into-.patch - 0001-journald-DO-recalculate-the-ACL-mask-but-only-if-it-.patch 'initcpio-hook-udev' + 'initcpio-install-systemd' 'initcpio-install-udev' - 'initcpio-install-timestamp') -md5sums=('a07619bb19f48164fbf0761d12fd39a8' - '7f39f9fde1ff7b48293ed1e3d0a6c213' - '66e3162856ded8eb7dc7383405c6e0d6' - 'e99e9189aa2f6084ac28b8ddf605aeb8' - 'fb37e34ea006c79be1c54cbb0f803414' - 'df69615503ad293c9ddf9d8b7755282d') + 0001-polkit-Avoid-race-condition-in-scraping-proc.patch + 0001-swap-fix-reverse-dependencies.patch + 0002-swap-create-.wants-symlink-to-auto-swap-devices.patch) +md5sums=('7799f3cc9d289b8db1c1fa56ae7ecd88' + '2de72238ed5c0df62a7c3b6bdaf8cb7c' + '9027b31a875e74a45623954b3b23d09f' + 'd83d45e67cd75cdbafb81c96a7485319' + '9eb0a46aa2a3a6d74117f9a174dbe168' + '182be4c729aaecde249b7b05b48a481f' + 'b54fbe35e2689ac36cda9ac4a5a86f24') prepare() { cd "$pkgname-$pkgver" - patch -Np1 <"$srcdir/0001-utmp-turn-systemd-update-utmp-shutdown.service-into-.patch" - - patch -Np1 <"$srcdir/0001-journald-DO-recalculate-the-ACL-mask-but-only-if-it-.patch" - - autoreconf + patch -Np1 <"$srcdir"/0001-swap-fix-reverse-dependencies.patch + patch -Np1 <"$srcdir"/0002-swap-create-.wants-symlink-to-auto-swap-devices.patch + patch -Np1 <"$srcdir"/0001-polkit-Avoid-race-condition-in-scraping-proc.patch } build() { cd "$pkgname-$pkgver" ./configure \ - --enable-static \ --libexecdir=/usr/lib \ --localstatedir=/var \ --sysconfdir=/etc \ @@ -61,6 +59,7 @@ check() { package_systemd() { pkgdesc="system and service manager" + license=('GPL2' 'LGPL2.1' 'MIT') depends=('acl' 'bash' 'dbus-core' 'glib2' 'kbd' 'kmod' 'hwids' 'libcap' 'libgcrypt' 'pam' 'util-linux' 'xz') provides=("libsystemd=$pkgver" 'nss-myhostname' "systemd-tools=$pkgver" "udev=$pkgver" @@ -77,11 +76,13 @@ package_systemd() { etc/dbus-1/system.d/org.freedesktop.hostname1.conf etc/dbus-1/system.d/org.freedesktop.login1.conf etc/dbus-1/system.d/org.freedesktop.locale1.conf + etc/dbus-1/system.d/org.freedesktop.machine1.conf etc/dbus-1/system.d/org.freedesktop.timedate1.conf + etc/systemd/bootchart.conf + etc/systemd/journald.conf + etc/systemd/logind.conf etc/systemd/system.conf etc/systemd/user.conf - etc/systemd/logind.conf - etc/systemd/journald.conf etc/udev/udev.conf) install="systemd.install" @@ -99,7 +100,7 @@ package_systemd() { rmdir "$pkgdir/etc/systemd/system/getty.target.wants" # get rid of RPM macros - rm -r "$pkgdir/etc/rpm" + rm -r "$pkgdir/usr/lib/rpm/macros.d" # add back tmpfiles.d/legacy.conf install -m644 "systemd-$pkgver/tmpfiles.d/legacy.conf" "$pkgdir/usr/lib/tmpfiles.d" @@ -110,19 +111,24 @@ package_systemd() { s#GROUP="cdrom"#GROUP="optical"#g' "$pkgdir"/usr/lib/udev/rules.d/*.rules # add mkinitcpio hooks + install -Dm644 "$srcdir/initcpio-install-systemd" "$pkgdir/usr/lib/initcpio/install/systemd" install -Dm644 "$srcdir/initcpio-install-udev" "$pkgdir/usr/lib/initcpio/install/udev" install -Dm644 "$srcdir/initcpio-hook-udev" "$pkgdir/usr/lib/initcpio/hooks/udev" - install -Dm644 "$srcdir/initcpio-install-timestamp" "$pkgdir/usr/lib/initcpio/install/timestamp" ### split out manpages for sysvcompat rm -rf "$srcdir/_sysvcompat" install -dm755 "$srcdir"/_sysvcompat/usr/share/man/man8/ mv "$pkgdir"/usr/share/man/man8/{telinit,halt,reboot,poweroff,runlevel,shutdown}.8 \ "$srcdir"/_sysvcompat/usr/share/man/man8 + + # include MIT license, since it's technically custom + install -Dm755 "$srcdir/$pkgname-$pkgver/LICENSE.MIT" \ + "$pkgdir/usr/share/licenses/systemd/LICENSE.MIT" } package_systemd-sysvcompat() { pkgdesc="sysvinit compat for systemd" + license=('GPL2') groups=('base') conflicts=('sysvinit') depends=('sysvinit-tools' 'systemd') diff --git a/core/systemd/initcpio-hook-udev b/core/systemd/initcpio-hook-udev index 75da7e4a8..227a8d034 100644 --- a/core/systemd/initcpio-hook-udev +++ b/core/systemd/initcpio-hook-udev @@ -1,7 +1,7 @@ #!/usr/bin/ash run_earlyhook() { - udevd --daemon --resolve-names=never + /usr/lib/systemd/systemd-udevd --daemon --resolve-names=never udevd_running=1 } diff --git a/core/systemd/initcpio-install-systemd b/core/systemd/initcpio-install-systemd new file mode 100644 index 000000000..ac86d338d --- /dev/null +++ b/core/systemd/initcpio-install-systemd @@ -0,0 +1,156 @@ +#!/bin/bash + +strip_quotes() { + local len=${#1} quotes=$'[\'"]' str=${!1} + + if [[ ${str:0:1} = ${str: -1} && ${str:0:1} = $quotes ]]; then + declare -g "$1=${str:1:-1}" + fi +} + +add_udev_rule() { + # Add an udev rules file to the initcpio image. Dependencies on binaries + # will be discovered and added. + # $1: path to rules file (or name of rules file) + + local rules= rule= key= value= binary= + + rules=$(PATH=/usr/lib/udev/rules.d:/lib/udev/rules.d type -P "$1") + if [[ -z $rules ]]; then + # complain about not found rules + return 1 + fi + + add_file "$rules" + + while IFS=, read -ra rule; do + # skip empty lines, comments + [[ -z $rule || $rule = @(+([[:space:]])|#*) ]] && continue + + for pair in "${rule[@]}"; do + IFS=' =' read -r key value <<< "$pair" + case $key in + RUN@({program}|+)|IMPORT{program}|ENV{REMOVE_CMD}) + strip_quotes 'value' + # just take the first word as the binary name + binary=${value%% *} + if [[ ${binary:0:1} != '/' ]]; then + binary=$(PATH=/usr/lib/udev:/lib/udev type -P "$binary") + fi + add_binary "$binary" + ;; + esac + done + done <"$rules" +} + +add_systemd_unit() { + # Add a systemd unit file to the initcpio image. Hard dependencies on binaries + # and other unit files will be discovered and added. + # $1: path to rules file (or name of rules file) + + local unit= rule= entry= key= value= binary= dep= + + unit=$(PATH=/usr/lib/systemd/system:/lib/systemd/system type -P "$1") + if [[ -z $unit ]]; then + # complain about not found unit file + return 1 + fi + + add_file "$unit" + + while IFS='=' read -r key values; do + read -ra values <<< "$values" + + case $key in + Requires|OnFailure) + # only add hard dependencies (not Wants) + map add_systemd_unit "${values[@]}" + ;; + Exec*) + # don't add binaries unless they are required + if [[ ${values[0]:0:1} != '-' ]]; then + add_binary "${values[0]}" + fi + ;; + esac + + done <"$unit" + + # preserve reverse soft dependency + for dep in {/usr,}/lib/systemd/system/*.wants/${unit##*/}; do + if [[ -L $dep ]]; then + add_symlink "$dep" + fi + done + + # add hard dependencies + if [[ -d $unit.requires ]]; then + for dep in "$unit".requires/*; do + add_systemd_unit ${dep##*/} + done + fi +} + +build() { + local rules unit + + # from base + add_binary /bin/mount + add_binary /usr/bin/kmod /usr/bin/modprobe + + # systemd + add_binary /usr/lib/systemd/systemd /init + + # generate sysroot.mount and sysroot-usr.mount + add_file "/usr/lib/systemd/system-generators/systemd-fstab-generator" + + # udev rules and systemd units + map add_udev_rule "$rules" \ + 50-udev-default.rules \ + 60-persistent-storage.rules \ + 64-btrfs.rules \ + 80-drivers.rules \ + 99-systemd.rules \ + + map add_systemd_unit \ + systemd-udevd-control.socket \ + systemd-udevd-kernel.socket \ + sockets.target \ + systemd-journald.service \ + systemd-udevd.service \ + systemd-udev-trigger.service \ + initrd-cleanup.service \ + initrd-fs.target \ + initrd-parse-etc.service \ + initrd-root-fs.target \ + initrd-switch-root.service \ + initrd-switch-root.target \ + initrd-udevadm-cleanup-db.service \ + initrd.target \ + systemd-fsck@.service \ + ctrl-alt-del.target + + add_symlink "/usr/lib/systemd/system/default.target" "initrd.target" + + # libdbus needs the passwd info of the root user + # TODO: make sure this is no longer necessary when systemctl moves to sd-bus + add_file "/etc/nsswitch.conf" + add_file "/etc/passwd" + add_binary "$(readlink -f /usr/lib/libnss_files.so)" + + # udev wants /etc/group since it doesn't launch with --resolve-names=never + add_file "/etc/group" +} + +help() { + cat <<HELPEOF +This will install a basic systemd setup in your initramfs, and is meant to +replace the 'base', 'usr', 'udev' and 'timestamp' hooks. Other hooks with runtime +components will need to be ported, and will not work as intended. You also may +wish to still include the 'base' hook (before this hook) to ensure that a +rescue shell exists on your initramfs. +HELPEOF +} + +# vim: set ft=sh ts=4 sw=4 et: diff --git a/core/systemd/initcpio-install-timestamp b/core/systemd/initcpio-install-timestamp deleted file mode 100644 index 259cc705b..000000000 --- a/core/systemd/initcpio-install-timestamp +++ /dev/null @@ -1,14 +0,0 @@ -#!/bin/bash - -build() { - add_binary /usr/lib/systemd/systemd-timestamp /usr/bin/systemd-timestamp -} - -help() { - cat <<HELPEOF -Provides support for RD_TIMESTAMP in early userspace, which can be read by a -program such as systemd-analyze to determine boot time. -HELPEOF -} - -# vim: set ft=sh ts=4 sw=4 et: diff --git a/core/systemd/initcpio-install-udev b/core/systemd/initcpio-install-udev index 15124b8f7..2f6f15d0b 100644 --- a/core/systemd/initcpio-install-udev +++ b/core/systemd/initcpio-install-udev @@ -4,7 +4,7 @@ build() { local rules tool add_file "/etc/udev/udev.conf" - add_binary /usr/lib/systemd/systemd-udevd /usr/bin/udevd + add_binary /usr/lib/systemd/systemd-udevd add_binary /usr/bin/udevadm for rules in 50-udev-default.rules 60-persistent-storage.rules 64-btrfs.rules 80-drivers.rules; do diff --git a/core/systemd/systemd.install b/core/systemd/systemd.install index 508b384c3..3b36f0c5d 100644 --- a/core/systemd/systemd.install +++ b/core/systemd/systemd.install @@ -42,7 +42,7 @@ post_install() { post_common # enable getty@tty1 by default, but don't track the file - systemctl enable getty@.service + systemctl enable getty@tty1.service echo ":: Append 'init=/usr/lib/systemd/systemd' to your kernel command line in your" echo " bootloader to replace sysvinit with systemd, or install systemd-sysvcompat" @@ -87,6 +87,17 @@ post_upgrade() { printf '==> The /bin/systemd symlink has been removed. Any references in your\n' printf ' bootloader (or elsewhere) must be updated to /usr/lib/systemd/systemd.\n' fi + + if [ "$(vercmp 205-1 "$2")" -eq 1 ]; then + printf '==> systemd 205 restructures the cgroup hierarchy and changes internal\n' + printf ' protocols. You should reboot at your earliest convenience.\n' + fi + + if [ "$(vercmp 206-1 "$2")" -eq 1 ]; then + printf '==> The "timestamp" hook for mkinitcpio no longer exists. If you used\n' + printf ' this hook, you must remove it from /etc/mkinitcpio.conf. A "systemd"\n' + printf ' hook has been added which provides this functionality, and more.\n' + fi } # vim:set ts=2 sw=2 et: |