From cdb2f64a3553ac20824c4fd5b40c1115cbaf06e3 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Tue, 8 Jan 2013 18:11:56 +0100 Subject: [PATCH 1/2] systemd: Get rescue.service and emergency.service to work --- pkgs/os-specific/linux/systemd/default.nix | 9 ++++++--- pkgs/os-specific/linux/sysvinit/default.nix | 11 ++++++----- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/pkgs/os-specific/linux/systemd/default.nix b/pkgs/os-specific/linux/systemd/default.nix index 975a37fffce0..e605b998c4a6 100644 --- a/pkgs/os-specific/linux/systemd/default.nix +++ b/pkgs/os-specific/linux/systemd/default.nix @@ -1,6 +1,6 @@ { stdenv, fetchurl, pkgconfig, intltool, gperf, libcap, dbus, kmod , xz, pam, acl, cryptsetup, libuuid, m4, utillinux -, glib, kbd, libxslt, coreutils, libgcrypt +, glib, kbd, libxslt, coreutils, libgcrypt, sysvtools }: assert stdenv.gcc.libc or null != null; @@ -42,14 +42,17 @@ stdenv.mkDerivation rec { preConfigure = '' # FIXME: patch this in systemd properly (and send upstream). - for i in src/remount-fs/remount-fs.c src/core/mount.c src/core/swap.c src/fsck/fsck.c; do + # FIXME: use sulogin from util-linux once updated. + for i in src/remount-fs/remount-fs.c src/core/mount.c src/core/swap.c src/fsck/fsck.c units/emergency.service.in units/rescue.service.m4.in; do test -e $i substituteInPlace $i \ --replace /bin/mount ${utillinux}/bin/mount \ --replace /bin/umount ${utillinux}/bin/umount \ --replace /sbin/swapon ${utillinux}/sbin/swapon \ --replace /sbin/swapoff ${utillinux}/sbin/swapoff \ - --replace /sbin/fsck ${utillinux}/sbin/fsck + --replace /sbin/fsck ${utillinux}/sbin/fsck \ + --replace /bin/echo ${coreutils}/bin/echo \ + --replace /sbin/sulogin ${sysvtools}/sbin/sulogin done substituteInPlace src/journal/catalog.c \ diff --git a/pkgs/os-specific/linux/sysvinit/default.nix b/pkgs/os-specific/linux/sysvinit/default.nix index 7b3ea62ea2df..99aebd11667c 100644 --- a/pkgs/os-specific/linux/sysvinit/default.nix +++ b/pkgs/os-specific/linux/sysvinit/default.nix @@ -4,12 +4,12 @@ let version = "2.88dsf"; in stdenv.mkDerivation { name = (if withoutInitTools then "sysvtools" else "sysvinit") + "-" + version; - + src = fetchurl { url = "mirror://savannah/sysvinit/sysvinit-${version}.tar.bz2"; sha256 = "068mvzaz808a673zigyaqb63xc8bndh2klk16zi5c83rw70wifv0"; }; - + prePatch = '' # Patch some minimal hard references, so halt/shutdown work sed -i -e "s,/sbin/,$out/sbin/," src/halt.c src/init.c src/paths.h @@ -27,16 +27,17 @@ stdenv.mkDerivation { ''; postInstall = stdenv.lib.optionalString withoutInitTools - '' + '' mv $out/sbin/killall5 $out/bin ln -sf killall5 $out/bin/pidof - rm -rf $out/sbin + shopt -s extglob + rm -rf $out/sbin/!(sulogin) rm -rf $out/include rm -rf $out/share/man/man5 rm $(for i in $out/share/man/man8/*; do echo $i; done | grep -v 'pidof\|killall5') rm $out/bin/{mountpoint,wall} $out/share/man/man1/{mountpoint.1,wall.1} ''; - + meta = { homepage = http://www.nongnu.org/sysvinit/; description = "Utilities related to booting and shutdown"; From 5a79974c8197b04948cb57789a3ffbdd8b5dba8e Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Tue, 8 Jan 2013 18:41:21 +0100 Subject: [PATCH 2/2] systemd: Remove some plymouth calls --- ...aemon-reexec-do-the-right-thing-on-N.patch | 2 +- ...e-duplicate-paths-in-systemctl-start.patch | 2 +- ...ts-for-uninitialised-encrypted-devic.patch | 2 +- ...o-configuration-hints-for-some-units.patch | 2 +- ...rop-the-dependency-on-local-fs.targe.patch | 2 +- .../0006-Don-t-call-plymouth-quit.patch | 38 +++++++++++++++++++ pkgs/os-specific/linux/systemd/default.nix | 1 + 7 files changed, 44 insertions(+), 5 deletions(-) create mode 100644 pkgs/os-specific/linux/systemd/0006-Don-t-call-plymouth-quit.patch diff --git a/pkgs/os-specific/linux/systemd/0001-Make-systemctl-daemon-reexec-do-the-right-thing-on-N.patch b/pkgs/os-specific/linux/systemd/0001-Make-systemctl-daemon-reexec-do-the-right-thing-on-N.patch index dda9bea7674c..9afa7543e571 100644 --- a/pkgs/os-specific/linux/systemd/0001-Make-systemctl-daemon-reexec-do-the-right-thing-on-N.patch +++ b/pkgs/os-specific/linux/systemd/0001-Make-systemctl-daemon-reexec-do-the-right-thing-on-N.patch @@ -1,7 +1,7 @@ From 0085f49cd0ba889e3db9102f328f6044ae3a2c18 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Tue, 8 Jan 2013 15:44:33 +0100 -Subject: [PATCH 1/5] Make "systemctl daemon-reexec" do the right thing on +Subject: [PATCH 1/6] Make "systemctl daemon-reexec" do the right thing on NixOS --- diff --git a/pkgs/os-specific/linux/systemd/0002-Ignore-duplicate-paths-in-systemctl-start.patch b/pkgs/os-specific/linux/systemd/0002-Ignore-duplicate-paths-in-systemctl-start.patch index 14795e521112..76160a1f7cc1 100644 --- a/pkgs/os-specific/linux/systemd/0002-Ignore-duplicate-paths-in-systemctl-start.patch +++ b/pkgs/os-specific/linux/systemd/0002-Ignore-duplicate-paths-in-systemctl-start.patch @@ -1,7 +1,7 @@ From 2b0a9106d3aabb365af0cc34b595a1e697120f37 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Tue, 8 Jan 2013 15:45:01 +0100 -Subject: [PATCH 2/5] Ignore duplicate paths in "systemctl start" +Subject: [PATCH 2/6] Ignore duplicate paths in "systemctl start" --- src/systemctl/systemctl.c | 7 +++++-- diff --git a/pkgs/os-specific/linux/systemd/0003-Start-device-units-for-uninitialised-encrypted-devic.patch b/pkgs/os-specific/linux/systemd/0003-Start-device-units-for-uninitialised-encrypted-devic.patch index 63de58f97d5a..a16a2672feb5 100644 --- a/pkgs/os-specific/linux/systemd/0003-Start-device-units-for-uninitialised-encrypted-devic.patch +++ b/pkgs/os-specific/linux/systemd/0003-Start-device-units-for-uninitialised-encrypted-devic.patch @@ -1,7 +1,7 @@ From a013beb84f135cebf1c8c9363d5676c1c0a6be7a Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Tue, 8 Jan 2013 15:46:30 +0100 -Subject: [PATCH 3/5] Start device units for uninitialised encrypted devices +Subject: [PATCH 3/6] Start device units for uninitialised encrypted devices This is necessary because the NixOS service that initialises the filesystem depends on the appearance of the device unit. Also, this diff --git a/pkgs/os-specific/linux/systemd/0004-Set-switch-to-configuration-hints-for-some-units.patch b/pkgs/os-specific/linux/systemd/0004-Set-switch-to-configuration-hints-for-some-units.patch index f819d1640e83..beab35d63a06 100644 --- a/pkgs/os-specific/linux/systemd/0004-Set-switch-to-configuration-hints-for-some-units.patch +++ b/pkgs/os-specific/linux/systemd/0004-Set-switch-to-configuration-hints-for-some-units.patch @@ -1,7 +1,7 @@ From b40d8783f94666035baae567882c0d4be82cda01 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Tue, 8 Jan 2013 15:48:19 +0100 -Subject: [PATCH 4/5] Set switch-to-configuration hints for some units +Subject: [PATCH 4/6] Set switch-to-configuration hints for some units MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit diff --git a/pkgs/os-specific/linux/systemd/0005-sysinit.target-Drop-the-dependency-on-local-fs.targe.patch b/pkgs/os-specific/linux/systemd/0005-sysinit.target-Drop-the-dependency-on-local-fs.targe.patch index 54009f2e7fc7..4403e6f56aaf 100644 --- a/pkgs/os-specific/linux/systemd/0005-sysinit.target-Drop-the-dependency-on-local-fs.targe.patch +++ b/pkgs/os-specific/linux/systemd/0005-sysinit.target-Drop-the-dependency-on-local-fs.targe.patch @@ -1,7 +1,7 @@ From c5c8ac3a0420fb42ba2f629368fd5bd6ea1e753b Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Tue, 8 Jan 2013 15:56:03 +0100 -Subject: [PATCH 5/5] sysinit.target: Drop the dependency on local-fs.target +Subject: [PATCH 5/6] sysinit.target: Drop the dependency on local-fs.target and swap.target Having all services with DefaultDependencies=yes depend on diff --git a/pkgs/os-specific/linux/systemd/0006-Don-t-call-plymouth-quit.patch b/pkgs/os-specific/linux/systemd/0006-Don-t-call-plymouth-quit.patch new file mode 100644 index 000000000000..250a751fe0c0 --- /dev/null +++ b/pkgs/os-specific/linux/systemd/0006-Don-t-call-plymouth-quit.patch @@ -0,0 +1,38 @@ +From d3caa154098e215145679f38fa92a8bd482107be Mon Sep 17 00:00:00 2001 +From: Eelco Dolstra +Date: Tue, 8 Jan 2013 18:36:28 +0100 +Subject: [PATCH 6/6] Don't call "plymouth quit" + +NixOS doesn't use Plymouth (yet). +--- + units/emergency.service.in | 1 - + units/rescue.service.m4.in | 1 - + 2 files changed, 2 deletions(-) + +diff --git a/units/emergency.service.in b/units/emergency.service.in +index 442f0e0..6b7eafd 100644 +--- a/units/emergency.service.in ++++ b/units/emergency.service.in +@@ -15,7 +15,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" to try again\\nto boot into default mode.' + ExecStart=-/sbin/sulogin + ExecStopPost=@SYSTEMCTL@ --fail --no-block default +diff --git a/units/rescue.service.m4.in b/units/rescue.service.m4.in +index 269797a..2c640f4 100644 +--- a/units/rescue.service.m4.in ++++ b/units/rescue.service.m4.in +@@ -16,7 +16,6 @@ Before=shutdown.target + [Service] + Environment=HOME=/root + WorkingDirectory=/root +-ExecStartPre=-/bin/plymouth quit + ExecStartPre=-/bin/echo -e 'Welcome to rescue mode! Type "systemctl default" or ^D to enter default mode.\\nType "journalctl -xb" to view system logs. Type "systemctl reboot" to reboot.' + ExecStart=-/sbin/sulogin + ExecStopPost=-@SYSTEMCTL@ --fail --no-block default +-- +1.8.0.1 + diff --git a/pkgs/os-specific/linux/systemd/default.nix b/pkgs/os-specific/linux/systemd/default.nix index e605b998c4a6..93471d497c6e 100644 --- a/pkgs/os-specific/linux/systemd/default.nix +++ b/pkgs/os-specific/linux/systemd/default.nix @@ -19,6 +19,7 @@ stdenv.mkDerivation rec { ./0003-Start-device-units-for-uninitialised-encrypted-devic.patch ./0004-Set-switch-to-configuration-hints-for-some-units.patch ./0005-sysinit.target-Drop-the-dependency-on-local-fs.targe.patch + ./0006-Don-t-call-plymouth-quit.patch ]; buildInputs =