aboutsummaryrefslogtreecommitdiff
path: root/utilities/dcron/dcron.build
blob: f60ebf28846f456e0fb4071204b2618be8ed40df (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
#!/bin/bash
#
# Maintainer: Deposite Pirate <ofni.sknuplatem@etaripd>

source /usr/src/ports/Build/build.sh

NAME=dcron
VERSION=4.5
BUILD=2

# Description

cat > ${PKG}/install/slack-desc <<EOF
# HOW TO EDIT THIS FILE:
# The "handy ruler" below makes it easier to edit a package description.  Line
# up the first '|' above the ':' following the base package name, and the '|'
# on the right side marks the last column you can put a character in. You must
# make exactly 11 lines for the formatting to be correct.  It's also
# customary to leave one space after the ':'.

$(padd)|-----handy-ruler------------------------------------------------------|
${NAME}: dcron (Dillon's Cron daemon)
${NAME}:
${NAME}: The cron daemon runs in the background and executes tasks on behalf
${NAME}: of users at the appropriate time. Many timed system tasks are
${NAME}: started with cron, such as the nightly indexing with updatedb.
${NAME}:
${NAME}: dcron was written entirely from scratch by Matthew Dillon.
${NAME}:
${NAME}: Homepage: http://www.jimpryor.net/linux/dcron.html
${NAME}:
${NAME}:
EOF

cat >> ${PKG}/install/doinst.sh <<EOF
#!/bin/sh

config() {
  NEW="\$1"
  OLD="\$(dirname \$NEW)/\$(basename \$NEW .new)"
  # If there's no config file by that name, mv it over:
  if [ ! -r \$OLD ]; then
    mv \$NEW \$OLD
  elif [ "\$(cat \$OLD | md5sum)" = "\$(cat \$NEW | md5sum)" ]; then
    # toss the redundant copy
    rm \$NEW
  fi
  # Otherwise, we leave the .new copy for the admin to consider...
}

config etc/conf.d/crond.conf.new

if [ ! -r var/spool/cron/crontabs/root ]; then
  mv var/spool/cron/crontabs/root.new var/spool/cron/crontabs/root
else
  rm -f var/spool/cron/crontabs/root.new
fi
EOF

# Sources

SRCNAME[0]=${NAME}
SRCVERS[0]=${VERSION}
SRCPACK[0]=http://www.jimpryor.net/linux/releases/${SRCNAME[0]}-${SRCVERS[0]}.tar.gz
SRCCOPY[0]="GPL2"

build0()
{
make ${JOBS} CFLAGS+="${FLAGS}" PREFIX="${SYS_DIR[usr]}"
make install DESTDIR="${PKG}" PREFIX="${SYS_DIR[usr]}" MANDIR="${SYS_DIR[man]}"
changelog CHANGELOG
install.dir ${PKG}${SYS_DIR[etc]}/conf.d
install.cfg extra/crond.conf ${PKG}${SYS_DIR[etc]}/conf.d/crond.conf.new
install.dir ${PKG}${SYS_DIR[share]}/vim/ftplugin
install.dat extra/crontab.vim ${PKG}${SYS_DIR[share]}/vim/ftplugin
install.dir ${PKG}${SYS_DIR[systemdsystemunitdir]}
install.dat dcron.service ${PKG}${SYS_DIR[systemdsystemunitdir]}
#FIXME: perhaps all this stuff should be renamed to dcron so that other versions
#of cron may be installed at the same time
chmod 0751 ${PKG}${SYS_DIR[var]}/spool/cron
chmod 0750 ${PKG}${SYS_DIR[var]}/spool/cron/cron{tabs,stamps}
chmod 4711 ${PKG}${SYS_DIR[usr]}/bin/crontab
chmod 0755 ${PKG}${SYS_DIR[usr]}/sbin/crond
#FIXME: this goes away when we switch to systemd
install.dir ${PKG}${SYS_DIR[etc]}/cron.{d,hourly,daily,weekly,monthly}
install -m 0600 crontab.root ${PKG}${SYS_DIR[var]}/spool/cron/crontabs/root.new
install.bin run-parts ${PKG}${SYS_DIR[usr]}/sbin
install.man run-parts.8 ${PKG}${SYS_DIR[man]}/man8
}