Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1# restart using 'killall -TERM fcron; fcron -b
2# use convert-fcrontab to update fcrontab files
3
4{ lib, stdenv, fetchurl, perl, busybox, vim }:
5
6stdenv.mkDerivation rec {
7 pname = "fcron";
8 version = "3.3.1";
9
10 src = fetchurl {
11 url = "http://fcron.free.fr/archives/${pname}-${version}.src.tar.gz";
12 sha256 = "sha256-81naoIpj3ft/4vlkuz9cUiRMJao2+SJaPMVNNvRoEQY=";
13 };
14
15 buildInputs = [ perl ];
16
17 patches = [ ./relative-fcronsighup.patch ];
18
19 configureFlags =
20 [ "--with-sendmail=${busybox}/sbin/sendmail"
21 "--with-editor=${vim}/bin/vi" # TODO customizable
22 "--with-bootinstall=no"
23 "--localstatedir=/var"
24 "--sysconfdir=/etc"
25 "--with-rootname=root"
26 "--with-rootgroup=root"
27 "--disable-checks"
28 ];
29
30 installTargets = [ "install-staged" ]; # install does also try to change permissions of /etc/* files
31
32 # fcron tries to install pid into system directory on install
33 installFlags = [
34 "ETC=."
35 "PIDDIR=."
36 "PIDFILE=fcron.pid"
37 "REBOOT_LOCK=fcron.reboot"
38 "FIFODIR=."
39 "FIFOFILE=fcron.fifo"
40 "FCRONTABS=."
41 ];
42
43 preConfigure = ''
44 sed -i 's@/usr/bin/env perl@${perl}/bin/perl@g' configure script/*
45 # Don't let fcron create the group fcron, nix(os) should do this
46 sed -i '2s@.*@exit 0@' script/user-group
47
48 # --with-bootinstall=no shoud do this, didn't work. So just exit the script before doing anything
49 sed -i '2s@.*@exit 0@' script/boot-install
50
51 # also don't use chown or chgrp for documentation (or whatever) when installing
52 find -type f | xargs sed -i -e 's@^\(\s\)*chown@\1:@' -e 's@^\(\s\)*chgrp@\1:@'
53 '';
54
55 meta = with lib; {
56 description="A command scheduler with extended capabilities over cron and anacron";
57 homepage = "http://fcron.free.fr";
58 license = licenses.gpl2;
59 platforms = lib.platforms.all;
60 };
61}