2021-02-05 17:12:51 +00:00
|
|
|
{ lib, stdenv, fetchurl, withoutInitTools ? false }:
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-08-08 23:34:03 +00:00
|
|
|
let version = "2.99"; in
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
stdenv.mkDerivation {
|
|
|
|
name = (if withoutInitTools then "sysvtools" else "sysvinit") + "-" + version;
|
|
|
|
|
|
|
|
src = fetchurl {
|
|
|
|
url = "mirror://savannah/sysvinit/sysvinit-${version}.tar.xz";
|
2021-08-08 23:34:03 +00:00
|
|
|
sha256 = "sha256-sFw2d7tpiv5kyZeWiwDEmyqb0yDOljUjIw7n6kEZd1c=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
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
|
|
|
|
'';
|
|
|
|
|
|
|
|
makeFlags = [ "SULOGINLIBS=-lcrypt" "ROOT=$(out)" "MANDIR=/share/man" ];
|
|
|
|
|
|
|
|
preInstall =
|
|
|
|
''
|
|
|
|
substituteInPlace src/Makefile --replace /usr /
|
|
|
|
'';
|
|
|
|
|
|
|
|
postInstall = ''
|
|
|
|
mv $out/sbin/killall5 $out/bin
|
|
|
|
ln -sf killall5 $out/bin/pidof
|
|
|
|
''
|
2021-02-05 17:12:51 +00:00
|
|
|
+ lib.optionalString withoutInitTools
|
2020-04-24 23:36:52 +00:00
|
|
|
''
|
|
|
|
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/wall $out/share/man/man1/wall.1
|
|
|
|
'';
|
|
|
|
|
|
|
|
meta = {
|
|
|
|
homepage = "https://www.nongnu.org/sysvinit/";
|
|
|
|
description = "Utilities related to booting and shutdown";
|
2021-02-05 17:12:51 +00:00
|
|
|
platforms = lib.platforms.linux;
|
|
|
|
license = lib.licenses.gpl2Plus;
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
}
|