1 { lib, stdenv, fetchurl, libxcrypt, withoutInitTools ? false }:
3 stdenv.mkDerivation rec {
4 pname = if withoutInitTools then "sysvtools" else "sysvinit";
8 url = "mirror://savannah/sysvinit/sysvinit-${version}.tar.xz";
9 sha256 = "sha256-KmIf5uRSi8kTCLdIZ92q6733dT8COVwMW66Be9K346U=";
13 # Patch some minimal hard references, so halt/shutdown work
14 sed -i -e "s,/sbin/,$out/sbin/," src/halt.c src/init.c src/paths.h
17 buildInputs = [ libxcrypt ];
19 makeFlags = [ "SULOGINLIBS=-lcrypt" "ROOT=$(out)" "MANDIR=/share/man" ];
23 substituteInPlace src/Makefile --replace /usr /
27 mv $out/sbin/killall5 $out/bin
28 ln -sf killall5 $out/bin/pidof
30 + lib.optionalString withoutInitTools
33 rm -rf $out/sbin/!(sulogin)
35 rm -rf $out/share/man/man5
36 rm $(for i in $out/share/man/man8/*; do echo $i; done | grep -v 'pidof\|killall5')
37 rm $out/bin/wall $out/share/man/man1/wall.1
41 homepage = "https://www.nongnu.org/sysvinit/";
42 description = "Utilities related to booting and shutdown";
43 platforms = lib.platforms.linux;
44 license = lib.licenses.gpl2Plus;