systemd: Use our systemd repo directly

Since upstream no longer provides an autoconfed tarball, we may as
well use our own repo and drop the patch.
This commit is contained in:
Eelco Dolstra 2015-09-08 13:07:23 +02:00
parent 3cc04956f3
commit 3609007b7c
2 changed files with 6 additions and 329 deletions

View File

@ -1,4 +1,4 @@
{ stdenv, fetchurl, pkgconfig, intltool, gperf, libcap, dbus, kmod
{ stdenv, fetchFromGitHub, pkgconfig, intltool, gperf, libcap, dbus, kmod
, xz, pam, acl, cryptsetup, libuuid, m4, utillinux
, glib, kbd, libxslt, coreutils, libgcrypt
, kexectools, libmicrohttpd, linuxHeaders, libseccomp
@ -14,17 +14,13 @@ stdenv.mkDerivation rec {
version = "225";
name = "systemd-${version}";
src = fetchurl {
url = "https://github.com/systemd/systemd/archive/v${version}.tar.gz";
sha256 = "00cpdw52lcypiyyqxsbhfdb69yf638a8xfa95xgk3sc86sxpdxdj";
src = fetchFromGitHub {
owner = "NixOS";
repo = "systemd";
rev = "72184f47631ede4cb0df44e7c96d5183ac0ea5b4";
sha256 = "1j8rkf7x27gvaqw2jqizf62lb1850kwpb763qm11799jbf5m9l95";
};
patches =
[ # These are all changes between upstream and
# https://github.com/NixOS/systemd/tree/nixos-${version}.
./fixes.patch
];
buildInputs =
[ linuxHeaders pkgconfig intltool gperf libcap kmod xz pam acl
/* cryptsetup */ libuuid m4 glib libxslt libgcrypt

View File

@ -1,319 +0,0 @@
diff --git a/rules/99-systemd.rules.in b/rules/99-systemd.rules.in
index 10b90b8..db63c11 100644
--- a/rules/99-systemd.rules.in
+++ b/rules/99-systemd.rules.in
@@ -13,10 +13,6 @@ KERNEL=="vport*", TAG+="systemd"
SUBSYSTEM=="block", TAG+="systemd"
SUBSYSTEM=="block", ENV{DM_UDEV_DISABLE_OTHER_RULES_FLAG}=="1", ENV{SYSTEMD_READY}="0"
-# Ignore encrypted devices with no identified superblock on it, since
-# we are probably still calling mke2fs or mkswap on it.
-SUBSYSTEM=="block", ENV{DM_UUID}=="CRYPT-*", ENV{ID_PART_TABLE_TYPE}=="", ENV{ID_FS_USAGE}=="", ENV{SYSTEMD_READY}="0"
-
# Ignore raid devices that are not yet assembled and started
SUBSYSTEM=="block", ENV{DEVTYPE}=="disk", KERNEL=="md*", TEST!="md/array_state", ENV{SYSTEMD_READY}="0"
SUBSYSTEM=="block", ENV{DEVTYPE}=="disk", KERNEL=="md*", ATTR{md/array_state}=="|clear|inactive", ENV{SYSTEMD_READY}="0"
diff --git a/src/basic/path-util.h b/src/basic/path-util.h
index 1eac89c..38a134c 100644
--- a/src/basic/path-util.h
+++ b/src/basic/path-util.h
@@ -26,7 +26,7 @@
#include "macro.h"
#include "time-util.h"
-#define DEFAULT_PATH_NORMAL "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin"
+#define DEFAULT_PATH_NORMAL "/no-such-path"
#define DEFAULT_PATH_SPLIT_USR DEFAULT_PATH_NORMAL ":/sbin:/bin"
#ifdef HAVE_SPLIT_USR
diff --git a/src/core/mount.c b/src/core/mount.c
index c0d1cdf..0711748 100644
--- a/src/core/mount.c
+++ b/src/core/mount.c
@@ -367,7 +367,9 @@ static bool should_umount(Mount *m) {
MountParameters *p;
if (path_equal(m->where, "/") ||
- path_equal(m->where, "/usr"))
+ path_equal(m->where, "/usr") ||
+ path_equal(m->where, "/nix") ||
+ path_equal(m->where, "/nix/store"))
return false;
p = get_mount_parameters(m);
@@ -395,6 +397,8 @@ static int mount_add_default_dependencies(Mount *m) {
* virtual, and hence not worth the effort. */
if (path_equal(m->where, "/") ||
path_equal(m->where, "/usr") ||
+ path_equal(m->where, "/nix") ||
+ path_equal(m->where, "/nix/store") ||
path_startswith(m->where, "/proc") ||
path_startswith(m->where, "/sys") ||
path_startswith(m->where, "/dev"))
diff --git a/src/core/systemd.pc.in b/src/core/systemd.pc.in
index ac52b30..d2e28f4 100644
--- a/src/core/systemd.pc.in
+++ b/src/core/systemd.pc.in
@@ -13,8 +13,8 @@ systemduserunitdir=@userunitdir@
systemduserpresetdir=@userpresetdir@
systemdsystemconfdir=@pkgsysconfdir@/system
systemduserconfdir=@pkgsysconfdir@/user
-systemdsystemunitpath=${systemdsystemconfdir}:/etc/systemd/system:/run/systemd/system:/usr/local/lib/systemd/system:${systemdsystemunitdir}:/usr/lib/systemd/system:/lib/systemd/system
-systemduserunitpath=${systemduserconfdir}:/etc/systemd/user:/run/systemd/user:/usr/local/lib/systemd/user:/usr/local/share/systemd/user:${systemduserunitdir}:/usr/lib/systemd/user:/usr/share/systemd/user
+systemdsystemunitpath=${systemdsystemconfdir}:/etc/systemd/system:/etc/systemd-mutable/system:/nix/var/nix/profiles/default/lib/systemd/user:/run/systemd/system:${systemdsystemunitdir}
+systemduserunitpath=${systemduserconfdir}:/etc/systemd/user:/etc/systemd-mutable/user:/nix/var/nix/profiles/default/lib/systemd/system:/run/systemd/user:${systemduserunitdir}
systemdsystemgeneratordir=@systemgeneratordir@
systemdusergeneratordir=@usergeneratordir@
systemdsleepdir=@systemsleepdir@
diff --git a/src/core/umount.c b/src/core/umount.c
index d59b5d0..30b66e3 100644
--- a/src/core/umount.c
+++ b/src/core/umount.c
@@ -392,6 +392,8 @@ static int mount_points_list_umount(MountPoint **head, bool *changed, bool log_e
* anyway, since we are running from it. They have
* already been remounted ro. */
if (path_equal(m->path, "/")
+ || path_equal(m->path, "/nix")
+ || path_equal(m->path, "/nix/store")
#ifndef HAVE_SPLIT_USR
|| path_equal(m->path, "/usr")
#endif
diff --git a/src/core/unit.c b/src/core/unit.c
index 43a5ca1..5d5ac2a 100644
--- a/src/core/unit.c
+++ b/src/core/unit.c
@@ -49,6 +49,7 @@
#include "formats-util.h"
#include "process-util.h"
#include "bus-util.h"
+#include "virt.h"
const UnitVTable * const unit_vtable[_UNIT_TYPE_MAX] = {
[UNIT_SERVICE] = &service_vtable,
@@ -1646,7 +1647,8 @@ static void unit_check_binds_to(Unit *u) {
}
assert(other);
- log_unit_info(u, "Unit is bound to inactive unit %s. Stopping, too.", other->id);
+ if (u->type != UNIT_MOUNT || detect_container(NULL) <= 0)
+ log_unit_info(u, "Unit is bound to inactive unit %s. Stopping, too.", other->id);
/* A unit we need to run is gone. Sniff. Let's stop this. */
r = manager_add_job(u->manager, JOB_STOP, u, JOB_FAIL, true, NULL, NULL);
diff --git a/src/fsck/fsck.c b/src/fsck/fsck.c
index bd3051f..3ae8099 100644
--- a/src/fsck/fsck.c
+++ b/src/fsck/fsck.c
@@ -413,7 +413,7 @@ int main(int argc, char *argv[]) {
} else
dash_c[0] = 0;
- cmdline[i++] = "/sbin/fsck";
+ cmdline[i++] = "/run/current-system/sw/sbin/fsck";
cmdline[i++] = arg_repair;
cmdline[i++] = "-T";
diff --git a/src/nspawn/nspawn.c b/src/nspawn/nspawn.c
index 837947e..2884c6e 100644
--- a/src/nspawn/nspawn.c
+++ b/src/nspawn/nspawn.c
@@ -4655,6 +4655,7 @@ int main(int argc, char *argv[]) {
goto finish;
}
} else {
+#if 0
const char *p;
p = strjoina(arg_directory,
@@ -4664,6 +4665,7 @@ int main(int argc, char *argv[]) {
r = -EINVAL;
goto finish;
}
+#endif
}
} else {
diff --git a/src/shared/path-lookup.c b/src/shared/path-lookup.c
index f6a1271..9bec8e9 100644
--- a/src/shared/path-lookup.c
+++ b/src/shared/path-lookup.c
@@ -111,17 +111,14 @@ static char** user_dirs(
const char * const config_unit_paths[] = {
USER_CONFIG_UNIT_PATH,
"/etc/systemd/user",
+ "/etc/systemd-mutable/user",
NULL
};
const char * const runtime_unit_path = "/run/systemd/user";
const char * const data_unit_paths[] = {
- "/usr/local/lib/systemd/user",
- "/usr/local/share/systemd/user",
USER_DATA_UNIT_PATH,
- "/usr/lib/systemd/user",
- "/usr/share/systemd/user",
NULL
};
@@ -288,13 +285,11 @@ int lookup_paths_init(
STRV_IFNOTNULL(generator_early),
USER_CONFIG_UNIT_PATH,
"/etc/systemd/user",
+ "/etc/systemd-mutable/user",
+ "/nix/var/nix/profiles/default/lib/systemd/user",
"/run/systemd/user",
STRV_IFNOTNULL(generator),
- "/usr/local/lib/systemd/user",
- "/usr/local/share/systemd/user",
USER_DATA_UNIT_PATH,
- "/usr/lib/systemd/user",
- "/usr/share/systemd/user",
STRV_IFNOTNULL(generator_late),
NULL);
} else
@@ -304,14 +299,11 @@ int lookup_paths_init(
STRV_IFNOTNULL(generator_early),
SYSTEM_CONFIG_UNIT_PATH,
"/etc/systemd/system",
+ "/etc/systemd-mutable/system",
+ "/nix/var/nix/profiles/default/lib/systemd/system",
"/run/systemd/system",
STRV_IFNOTNULL(generator),
- "/usr/local/lib/systemd/system",
SYSTEM_DATA_UNIT_PATH,
- "/usr/lib/systemd/system",
-#ifdef HAVE_SPLIT_USR
- "/lib/systemd/system",
-#endif
STRV_IFNOTNULL(generator_late),
NULL);
diff --git a/units/console-getty.service.m4.in b/units/console-getty.service.m4.in
index 413d940..972b86a 100644
--- a/units/console-getty.service.m4.in
+++ b/units/console-getty.service.m4.in
@@ -16,7 +16,6 @@ After=rc-local.service
Before=getty.target
[Service]
-ExecStart=-/sbin/agetty --noclear --keep-baud console 115200,38400,9600 $TERM
Type=idle
Restart=always
RestartSec=0
diff --git a/units/container-getty@.service.m4.in b/units/container-getty@.service.m4.in
index e126f3a..925af72 100644
--- a/units/container-getty@.service.m4.in
+++ b/units/container-getty@.service.m4.in
@@ -17,7 +17,6 @@ IgnoreOnIsolate=yes
ConditionPathExists=/dev/pts/%I
[Service]
-ExecStart=-/sbin/agetty --noclear --keep-baud pts/%I 115200,38400,9600 $TERM
Type=idle
Restart=always
RestartSec=0
diff --git a/units/emergency.service.in b/units/emergency.service.in
index 8dc3cbd..a3efec2 100644
--- a/units/emergency.service.in
+++ b/units/emergency.service.in
@@ -16,7 +16,6 @@ Before=shutdown.target
[Service]
Environment=HOME=/root
WorkingDirectory=/root
-ExecStartPre=-/bin/plymouth --wait quit
ExecStartPre=-/bin/echo -e 'Welcome to emergency mode! After logging in, type "journalctl -xb" to view\\nsystem logs, "systemctl reboot" to reboot, "systemctl default" or ^D to\\ntry again to boot into default mode.'
ExecStart=-/bin/sh -c "@SULOGIN@; @SYSTEMCTL@ --job-mode=fail --no-block default"
Type=idle
diff --git a/units/getty@.service.m4 b/units/getty@.service.m4
index 46164ab..f194a31 100644
--- a/units/getty@.service.m4
+++ b/units/getty@.service.m4
@@ -23,11 +23,12 @@ IgnoreOnIsolate=yes
# On systems without virtual consoles, don't start any getty. Note
# that serial gettys are covered by serial-getty@.service, not this
# unit.
-ConditionPathExists=/dev/tty0
+ConditionPathExists=|/dev/tty0
+ConditionVirtualization=|lxc
+ConditionVirtualization=|lxc-libvirt
[Service]
# the VT is cleared by TTYVTDisallocate
-ExecStart=-/sbin/agetty --noclear %I $TERM
Type=idle
Restart=always
RestartSec=0
diff --git a/units/kmod-static-nodes.service.in b/units/kmod-static-nodes.service.in
index 0934a87..7e30c9e 100644
--- a/units/kmod-static-nodes.service.in
+++ b/units/kmod-static-nodes.service.in
@@ -10,7 +10,6 @@ Description=Create list of required static device nodes for the current kernel
DefaultDependencies=no
Before=sysinit.target systemd-tmpfiles-setup-dev.service
ConditionCapability=CAP_SYS_MODULE
-ConditionPathExists=/lib/modules/%v/modules.devname
[Service]
Type=oneshot
diff --git a/units/rescue.service.in b/units/rescue.service.in
index 432e4f3..66bdf87 100644
--- a/units/rescue.service.in
+++ b/units/rescue.service.in
@@ -16,7 +16,6 @@ Before=shutdown.target
[Service]
Environment=HOME=/root
WorkingDirectory=/root
-ExecStartPre=-/bin/plymouth quit
ExecStartPre=-/bin/echo -e 'Welcome to emergency mode! After logging in, type "journalctl -xb" to view\\nsystem logs, "systemctl reboot" to reboot, "systemctl default" or ^D to\\nboot into default mode.'
ExecStart=-/bin/sh -c "@SULOGIN@; @SYSTEMCTL@ --job-mode=fail --no-block default"
Type=idle
diff --git a/units/serial-getty@.service.m4 b/units/serial-getty@.service.m4
index 4522d0d..96daa5c 100644
--- a/units/serial-getty@.service.m4
+++ b/units/serial-getty@.service.m4
@@ -22,7 +22,6 @@ Before=getty.target
IgnoreOnIsolate=yes
[Service]
-ExecStart=-/sbin/agetty --keep-baud 115200,38400,9600 %I $TERM
Type=idle
Restart=always
UtmpIdentifier=%I
diff --git a/units/sysinit.target b/units/sysinit.target
index ec33503..4ac47b9 100644
--- a/units/sysinit.target
+++ b/units/sysinit.target
@@ -9,5 +9,4 @@
Description=System Initialization
Documentation=man:systemd.special(7)
Conflicts=emergency.service emergency.target
-Wants=local-fs.target swap.target
-After=local-fs.target swap.target emergency.service emergency.target
+After=emergency.service emergency.target
diff --git a/units/systemd-tmpfiles-setup.service.in b/units/systemd-tmpfiles-setup.service.in
index e895cda..194146f 100644
--- a/units/systemd-tmpfiles-setup.service.in
+++ b/units/systemd-tmpfiles-setup.service.in
@@ -11,7 +11,7 @@ Documentation=man:tmpfiles.d(5) man:systemd-tmpfiles(8)
DefaultDependencies=no
Conflicts=shutdown.target
After=local-fs.target systemd-sysusers.service
-Before=sysinit.target shutdown.target
+Before=shutdown.target
RefuseManualStop=yes
[Service]
diff --git a/units/systemd-update-utmp.service.in b/units/systemd-update-utmp.service.in
index 163eccd..31476c3 100644
--- a/units/systemd-update-utmp.service.in
+++ b/units/systemd-update-utmp.service.in
@@ -11,7 +11,7 @@ Documentation=man:systemd-update-utmp.service(8) man:utmp(5)
DefaultDependencies=no
RequiresMountsFor=/var/log/wtmp
Conflicts=shutdown.target
-After=systemd-remount-fs.service systemd-tmpfiles-setup.service auditd.service
+After=systemd-remount-fs.service auditd.service
Before=sysinit.target shutdown.target
[Service]