1# I've only worked on this till it compiled and worked. So maybe there are some things which should be done but I've missed
2# restart using 'killall -TERM fcron; fcron -b
3# use convert-fcrontab to update fcrontab files
4
5{ stdenv, fetchurl, perl, busybox, vim }:
6
7stdenv.mkDerivation rec {
8 name = "fcron-3.1.2";
9
10 src = fetchurl {
11 url = "http://fcron.free.fr/archives/${name}.src.tar.gz";
12 sha256 = "0p8sn4m3frh2x2llafq2gbcm46rfrn6ck4qi0d0v3ql6mfx9k4hw";
13 };
14
15 buildInputs = [ perl ];
16
17 configureFlags =
18 [ "--with-sendmail=${busybox}/sbin/sendmail"
19 "--with-editor=${vim}/bin/vi" # TODO customizable
20 "--with-bootinstall=no"
21 "--sysconfdir=/etc"
22 # fcron would have been default user/grp
23 "--with-username=root"
24 "--with-groupname=root"
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 preConfigure =
33 ''
34 sed -i 's@/usr/bin/env perl@${perl}/bin/perl@g' configure script/*
35 # Don't let fcron create the group fcron, nix(os) should do this
36 sed -i '2s@.*@exit 0@' script/user-group
37
38 # --with-bootinstall=no shoud do this, didn't work. So just exit the script before doing anything
39 sed -i '2s@.*@exit 0@' script/boot-install
40
41 # also don't use chown or chgrp for documentation (or whatever) when installing
42 find -type f | xargs sed -i -e 's@^\(\s\)*chown@\1:@' -e 's@^\(\s\)*chgrp@\1:@'
43 '';
44
45 patchPhase =
46 ''
47 # don't try to create /etc/fcron.{allow,deny,conf}
48 sed -i -e 's@test -f $(DESTDIR)$(ETC)/fcron.conf @ # @' \
49 -e 's@if test ! -f $(DESTDIR)$(ETC)/fcron.allow@ # @' Makefile.in
50 '';
51
52 meta = {
53 description="A command scheduler with extended capabilities over cron and anacron";
54 homepage = http://fcron.free.fr;
55 license = stdenv.lib.licenses.gpl2;
56 platforms = stdenv.lib.platforms.all;
57 };
58}