1 # Build recipe for scron.
3 # Copyright (c) 2017 Matias Fonzo, <selk@dragora.org>.
5 # Licensed under the Apache License, Version 2.0 (the "License");
6 # you may not use this file except in compliance with the License.
7 # You may obtain a copy of the License at
9 # http://www.apache.org/licenses/LICENSE-2.0
11 # Unless required by applicable law or agreed to in writing, software
12 # distributed under the License is distributed on an "AS IS" BASIS,
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 # See the License for the specific language governing permissions and
15 # limitations under the License.
21 # Define a category for the output of the package name
24 tarname=${program}-${version}.tar.gz
27 fetch=http://dl.2f30.org/releases/$tarname
32 Scron schedules commands to be run at specified dates and times.
35 homepage=http://git.2f30.org/scron
38 # Source documentation
39 docs="LICENSE README TODO"
40 docsdir="${docdir}/${program}-${version}"
46 unpack "${tardir}/$tarname"
50 # Set sane permissions
51 chmod -R u+w,go-w,a+rX-s .
54 CFLAGS="$QICFLAGS -std=c99 -Wall -Wextra -pedantic -D_POSIX_C_SOURCE=200809L -D_BSD_SOURCE" \
55 LDFLAGS="$QILDFLAGS -static" \
58 DESTDIR="$destdir" install
60 # Compress man page and copy the documentation
62 lzip -9 "${destdir}/${mandir}/man1/scron.1"
63 ln -s scron.1.lz "${destdir}/${mandir}/man1/cron.1.lz" # Symlink-compatibility.
65 mkdir -p "${destdir}${docsdir}"
66 cp -p $docs "${destdir}${docsdir}"
68 # Create directories adding the crontab file
70 mkdir -p "${destdir}/etc/cron.hourly" \
71 "${destdir}/etc/cron.daily" \
72 "${destdir}/etc/cron.weekly" \
73 "${destdir}/etc/cron.monthly"
75 # Incorporate our "run-parts" version for running cron jobs
76 cp -p "${worktree}/archive/scron/run-parts" "${destdir}/usr/bin/"
77 chmod 755 "${destdir}/usr/bin/run-parts"
79 # Add the crontab file
80 mkdir -p "${destdir}/etc"
81 cp -p "${worktree}/archive/scron/crontab" "${destdir}/etc/"
82 chmod 644 "${destdir}/etc/crontab"
84 # Install scron perp service
86 mkdir -p "${destdir}/etc/perp/crond"
88 cp -p "${worktree}/archive/scron/rc.log" \
89 "${worktree}/archive/scron/rc.main" \
90 "${destdir}/etc/perp/crond/"
92 chmod 755 "${destdir}"/etc/perp/crond/rc.*
94 # Be an active service by default
95 chmod +t "${destdir}/etc/perp/crond"
97 # To handle config file(s)
98 touch "${destdir}/etc/.graft-config" \
99 "${destdir}/etc/perp/crond/.graft-config"