aboutsummaryrefslogtreecommitdiff
path: root/sys/process/anacron
diff options
context:
space:
mode:
Diffstat (limited to 'sys/process/anacron')
-rw-r--r--sys/process/anacron/anacron.SlackBuild46
-rw-r--r--sys/process/anacron/anacrontab.new7
2 files changed, 51 insertions, 2 deletions
diff --git a/sys/process/anacron/anacron.SlackBuild b/sys/process/anacron/anacron.SlackBuild
index 0c5ffbfa..62b8a36c 100644
--- a/sys/process/anacron/anacron.SlackBuild
+++ b/sys/process/anacron/anacron.SlackBuild
@@ -134,12 +134,12 @@ fi
make $NUMJOBS || exit $ERROR_MAKE
# Install
-mkdir -p $PKG
-mkdir -p $PKG/usr/sbin $PKG/var/spool/anacron $PKG/usr/man/man5 $PKG/usr/man/man8
+mkdir -p $PKG/usr/sbin $PKG/var/spool/anacron $PKG/usr/man/man5 $PKG/usr/man/man8 $PKG/etc
cp anacron $PKG/usr/sbin
cp anacrontab.5 $PKG/usr/man/man5
cp anacron.8 $PKG/usr/man/man8
+cp $CWD/anacrontab.new $PKG/etc
gzip $PKG/usr/man/man5/anacrontab.5
gzip $PKG/usr/man/man8/anacron.8
@@ -185,6 +185,48 @@ anacron: machine-uptime permits.
anacron:
EODESC
+# Add a post-installation script (doinst.sh)
+cat << EOSCRIPT > "$PKG/install/doinst.sh"
+config() {
+ NEW="\$1"
+ OLD="\$(dirname \$NEW)/\$(basename \$NEW .new)"
+ OLD="\$(dirname \$NEW)/\$(basename \$OLD .sample)"
+ OLD="\$(dirname \$NEW)/\$(basename \$OLD .dist)"
+
+ # 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...
+}
+
+mkgroup() {
+ GROUP="\$1"
+ if ! grep -qe "^\$GROUP:" etc/group; then
+ echo Creating group \$GROUP...
+ chroot . /usr/sbin/groupadd \$GROUP
+ fi
+}
+
+mkuser() {
+ USER="\$1"
+ if [ ! -z "\$2" ]; then
+ GROUP="\$2"
+ else
+ GROUP="\$USER"
+ fi
+ if ! grep -qe "^\$USER:" etc/passwd; then
+ echo Creating user \$USER...
+ chroot . /usr/sbin/useradd \$USER -g \$GROUP
+ fi
+}
+
+config etc/anacrontab.new
+EOSCRIPT
+
# Build the package
cd "$PKG"
makepkg -l y -c n "$REPOS/$PKG_NAME-$PKG_VERSION-$ARCH-$BUILD.tgz" || exit $ERROR_MKPKG
diff --git a/sys/process/anacron/anacrontab.new b/sys/process/anacron/anacrontab.new
new file mode 100644
index 00000000..793cf3e0
--- /dev/null
+++ b/sys/process/anacron/anacrontab.new
@@ -0,0 +1,7 @@
+# /etc/anacrontab
+SHELL=/bin/sh
+PATH=/sbin:/bin:/usr/sbin:/usr/bin
+# format: period delay job-identifier command
+1 5 cron.daily run-parts /etc/cron.daily
+7 10 cron.weekly run-parts /etc/cron.weekly
+@monthly 15 cron.monthly run-parts /etc/cron.monthly