pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/time/anacron Initial import of anacron, version 2.3:



details:   https://anonhg.NetBSD.org/pkgsrc/rev/4f04b6838813
branches:  trunk
changeset: 472554:4f04b6838813
user:      jmmv <jmmv%pkgsrc.org@localhost>
date:      Sun Apr 11 11:33:46 2004 +0000

description:
Initial import of anacron, version 2.3:

Anacron is a periodic command scheduler.  It executes commands at intervals
specified in days.  Unlike cron, it does not assume that the system is running
continuously.  It can therefore be used to control the execution of daily,
weekly and monthly jobs (or anything with a period of n days), on systems that
do not run 24 hours a day.  When installed and configured properly, Anacron
will make sure that the commands are run at the specified intervals as closely
as machine-uptime permits.

diffstat:

 time/anacron/DESCR                    |    7 +
 time/anacron/Makefile                 |   63 +++++++++++++
 time/anacron/PLIST                    |    8 +
 time/anacron/distinfo                 |    5 +
 time/anacron/files/anacron.sh         |   24 +++++
 time/anacron/files/anacrontab.FreeBSD |   15 +++
 time/anacron/files/anacrontab.NetBSD  |   15 +++
 time/anacron/patches/patch-aa         |  163 ++++++++++++++++++++++++++++++++++
 8 files changed, 300 insertions(+), 0 deletions(-)

diffs (truncated from 332 to 300 lines):

diff -r 56f19e6c112c -r 4f04b6838813 time/anacron/DESCR
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/time/anacron/DESCR        Sun Apr 11 11:33:46 2004 +0000
@@ -0,0 +1,7 @@
+Anacron is a periodic command scheduler.  It executes commands at intervals
+specified in days.  Unlike cron, it does not assume that the system is running
+continuously.  It can therefore be used to control the execution of daily,
+weekly and monthly jobs (or anything with a period of n days), on systems that
+do not run 24 hours a day.  When installed and configured properly, Anacron
+will make sure that the commands are run at the specified intervals as closely
+as machine-uptime permits.
diff -r 56f19e6c112c -r 4f04b6838813 time/anacron/Makefile
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/time/anacron/Makefile     Sun Apr 11 11:33:46 2004 +0000
@@ -0,0 +1,63 @@
+# $NetBSD: Makefile,v 1.1.1.1 2004/04/11 11:33:46 jmmv Exp $
+#
+
+DISTNAME=      anacron-2.3
+CATEGORIES=    time
+MASTER_SITES=  ${MASTER_SITE_SOURCEFORGE:=anacron/}
+
+MAINTAINER=    jmmv%NetBSD.org@localhost
+HOMEPAGE=      http://anacron.sourceforge.net/}
+COMMENT=       Periodic command scheduler
+
+USE_BUILDLINK3=                yes
+USE_GNU_TOOLS+=                make
+USE_PKGINSTALL=                yes
+
+.include "../../mk/bsd.prefs.mk"
+
+SUBST_CLASSES+=                hdr
+SUBST_MESSAGE.hdr=     "Setting up global.h."
+SUBST_STAGE.hdr=       pre-configure
+SUBST_FILES.hdr=       global.h
+.if ${OPSYS} == "NetBSD"
+SUBST_SED.hdr=         -e 's|SENDMAIL ".*"|SENDMAIL "/usr/sbin/sendmail"|'
+.else
+SUBST_SED.hdr=         -e 's|SENDMAIL ".*"|SENDMAIL "/usr/lib/sendmail"|'
+.endif
+
+SUBST_CLASSES+=                man
+SUBST_MESSAGE.man=     "Setting up manpages."
+SUBST_STAGE.man=       pre-configure
+SUBST_FILES.man=       anacrontab.5 anacron.8
+SUBST_SED.man=         -e 's|/etc/anacrontab|${PKG_SYSCONFDIR}/anacrontab|g'
+
+MAKE_FLAGS+=           ANACRONTAB='${PKG_SYSCONFDIR}/anacrontab'
+MAKE_FLAGS+=           BINDIR='${PREFIX}/sbin'
+MAKE_FLAGS+=           CFLAGS='${CFLAGS}'
+MAKE_FLAGS+=           INSTALL_DATA='${INSTALL_DATA}'
+MAKE_FLAGS+=           INSTALL_DIR='${TRUE}'
+MAKE_FLAGS+=           INSTALL_PROGRAM='${INSTALL_PROGRAM}'
+MAKE_FLAGS+=           MANDIR='${PREFIX}/man'
+MAKE_FLAGS+=           PREFIX='${PREFIX}'
+MAKE_FLAGS+=           SHELL='${SH}'
+MAKE_FLAGS+=           SPOOLDIR='/var/spool/anacron'
+
+EGDIR=                 ${PREFIX}/share/examples/anacron
+.if exists(${FILESDIR}/anacrontab.${OPSYS})
+CONF_FILES=            ${EGDIR}/anacrontab.${OPSYS} \
+                       ${PKG_SYSCONFDIR}/anacrontab
+CONF_FILES_MODE=       0600
+.endif
+
+OWN_DIRS=              /var/spool/anacron
+
+RCD_SCRIPTS=           anacron
+
+INSTALLATION_DIRS=     man/man5 man/man8 sbin
+
+post-install:
+       ${INSTALL_DATA_DIR} ${EGDIR}
+       ${INSTALL_DATA} ${FILESDIR}/anacrontab.FreeBSD ${EGDIR}
+       ${INSTALL_DATA} ${FILESDIR}/anacrontab.NetBSD ${EGDIR}
+
+.include "../../mk/bsd.pkg.mk"
diff -r 56f19e6c112c -r 4f04b6838813 time/anacron/PLIST
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/time/anacron/PLIST        Sun Apr 11 11:33:46 2004 +0000
@@ -0,0 +1,8 @@
+@comment $NetBSD: PLIST,v 1.1.1.1 2004/04/11 11:33:46 jmmv Exp $
+etc/rc.d/anacron
+man/man5/anacrontab.5
+man/man8/anacron.8
+sbin/anacron
+share/examples/anacron/anacrontab.FreeBSD
+share/examples/anacron/anacrontab.NetBSD
+@dirrm share/examples/anacron
diff -r 56f19e6c112c -r 4f04b6838813 time/anacron/distinfo
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/time/anacron/distinfo     Sun Apr 11 11:33:46 2004 +0000
@@ -0,0 +1,5 @@
+$NetBSD: distinfo,v 1.1.1.1 2004/04/11 11:33:46 jmmv Exp $
+
+SHA1 (anacron-2.3.tar.gz) = d0e154123585e9faf615d67230d82d7d1b4c099a
+Size (anacron-2.3.tar.gz) = 24140 bytes
+SHA1 (patch-aa) = d11218f289d48b6a12ce2a5a59f645a04695214d
diff -r 56f19e6c112c -r 4f04b6838813 time/anacron/files/anacron.sh
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/time/anacron/files/anacron.sh     Sun Apr 11 11:33:46 2004 +0000
@@ -0,0 +1,24 @@
+#! @RCD_SCRIPTS_SHELL@
+#
+# $NetBSD: anacron.sh,v 1.1.1.1 2004/04/11 11:33:46 jmmv Exp $
+#
+# PROVIDE: anacron
+# REQUIRE: LOGIN
+
+if [ -f /etc/rc.subr ]; then
+       . /etc/rc.subr
+fi
+
+name="anacron"
+rcvar=$name
+command="@PREFIX@/sbin/${name}"
+required_files="@PKG_SYSCONFDIR@/anacrontab"
+command_args="-t @PKG_SYSCONFDIR@/anacrontab"
+
+if [ -f /etc/rc.subr ]; then
+       load_rc_config $name
+       run_rc_command "$1"
+else
+       @ECHO@ -n ' ${name}'
+       ${command} ${anacron_flags} ${command_args}
+fi
diff -r 56f19e6c112c -r 4f04b6838813 time/anacron/files/anacrontab.FreeBSD
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/time/anacron/files/anacrontab.FreeBSD     Sun Apr 11 11:33:46 2004 +0000
@@ -0,0 +1,15 @@
+# $NetBSD
+#
+# anacrontab - Configuration file for FreeBSD.
+#
+# See anacrontab(5) and anacron(8) for more information.
+#
+
+SHELL=/bin/sh
+PATH=/bin:/sbin:/usr/bin:/usr/sbin
+HOME=/var/log
+
+#days  delay   id      command
+1      5       daily   /bin/sh /usr/sbin/periodic daily
+7      15      weekly  /bin/sh /usr/sbin/periodic weekly
+30     30      monthly /bin/sh /usr/sbin/periodic monthly
diff -r 56f19e6c112c -r 4f04b6838813 time/anacron/files/anacrontab.NetBSD
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/time/anacron/files/anacrontab.NetBSD      Sun Apr 11 11:33:46 2004 +0000
@@ -0,0 +1,15 @@
+# $NetBSD
+#
+# anacrontab - Configuration file for NetBSD.
+#
+# See anacrontab(5) and anacron(8) for more information.
+#
+
+SHELL=/bin/sh
+PATH=/bin:/sbin:/usr/bin:/usr/sbin
+HOME=/var/log
+
+#days  delay   id      command
+1      5       daily   /bin/sh /etc/daily 2>&1 | tee /var/log/daily.out | sendmail -t
+7      15      weekly  /bin/sh /etc/weekly 2>&1 | tee /var/log/weekly.out | sendmail -t
+30     30      monthly /bin/sh /etc/monthly 2>&1 | tee /var/log/monthly.out | sendmail -t
diff -r 56f19e6c112c -r 4f04b6838813 time/anacron/patches/patch-aa
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/time/anacron/patches/patch-aa     Sun Apr 11 11:33:46 2004 +0000
@@ -0,0 +1,163 @@
+$NetBSD: patch-aa,v 1.1.1.1 2004/04/11 11:33:46 jmmv Exp $
+
+--- readtab.c.orig     2000-06-23 00:13:12.000000000 +0200
++++ readtab.c
+@@ -19,6 +19,11 @@
+  
+     The GNU General Public License can also be found in the file
+     `COPYING' that comes with the Anacron source distribution.
++
++    Changes:
++
++    May 2003 (Derik van Zuetphen)
++      replaced obstack with malloc/realloc calls
+ */
+ 
+ 
+@@ -29,7 +34,6 @@
+ #include <errno.h>
+ #include <stdio.h>
+ #include <stdlib.h>
+-#include <obstack.h>
+ #include <limits.h>
+ #include <fnmatch.h>
+ #include <unistd.h>
+@@ -37,8 +41,6 @@
+ #include "global.h"
+ #include "matchrx.h"
+ 
+-static struct obstack input_o;   /* holds input line */
+-static struct obstack tab_o;    /* holds processed data read from anacrontab */
+ static FILE *tab;
+ job_rec **job_array;
+ int njobs;                       /* number of jobs to run */
+@@ -47,9 +49,7 @@
+ static job_rec *last_job_rec;    /* last job stored in memory, at the moment */
+ static env_rec *last_env_rec;    /* last environment assignment stored */
+ 
+-/* some definitions for the obstack macros */
+-#define obstack_chunk_alloc xmalloc
+-#define obstack_chunk_free free
++#define MAXTABLINE    1000
+ 
+ static void *
+ xmalloc (size_t size)
+@@ -63,6 +63,18 @@
+     return ptr;
+ }
+ 
++static void *
++xrealloc (void *mem, size_t size)
++/* Just like standard realloc(), only never returns NULL. */
++{
++    void * ptr;
++
++    ptr = realloc(mem,size);
++    if (ptr == NULL)
++      die("Memory exhausted");
++    return ptr;
++}
++
+ static int
+ conv2int(const char *s)
+ /* Return the int or -1 on over/under-flow
+@@ -78,19 +90,20 @@
+ }
+ 
+ static char *
+-read_tab_line ()
++read_tab_line (char *line)
+ /* Read one line and return a pointer to it.
+ Return NULL if no more lines.
+  */
+ {
+     int c;
++    int i = 0;
+ 
+     if (feof(tab)) return NULL;
+-    while ((c = getc(tab)) != EOF && c != '\n')
+-      obstack_1grow(&input_o, c);
++    while (i < MAXTABLINE-1 && (c = getc(tab)) != EOF && c != '\n')
++      line[i++] = c;
+     if (ferror(tab)) die_e("Error reading %s", anacrontab);
+-    obstack_1grow(&input_o, '\0');
+-    return obstack_finish(&input_o);
++    line[i] = 0;
++    return line;
+ }
+ 
+ static int
+@@ -119,8 +132,8 @@
+ 
+     var_len = strlen(env_var);
+     val_len = strlen(value);
+-    er = obstack_alloc(&tab_o, sizeof(env_rec));
+-    er->assign = obstack_alloc(&tab_o, var_len + 1 + val_len + 1);
++    er = (env_rec*)xmalloc(sizeof(env_rec));
++    er->assign = (char*)xmalloc(var_len + 1 + val_len + 1);
+     strcpy(er->assign, env_var);
+     er->assign[var_len] = '=';
+     strcpy(er->assign + var_len + 1, value);
+@@ -151,14 +164,14 @@
+                anacrontab, line_num);
+       return;
+     }
+-    jr = obstack_alloc(&tab_o, sizeof(job_rec));
++    jr = (job_rec*)xmalloc(sizeof(job_rec));
+     jr->period = period;
+     jr->delay = delay;
+     jr->tab_line = line_num;
+-    jr->ident = obstack_alloc(&tab_o, ident_len + 1);
++    jr->ident = (char*)xmalloc(ident_len + 1);
+     strcpy(jr->ident, ident);
+     jr->arg_num = job_arg_num(ident);
+-    jr->command = obstack_alloc(&tab_o, command_len + 1);
++    jr->command = (char*)xmalloc(command_len + 1);
+     strcpy(jr->command, command);
+     jr->job_pid = jr->mailer_pid = 0;
+     if (last_job_rec != NULL) last_job_rec->next = jr;
+@@ -222,7 +235,7 @@
+ read_tab()
+ /* Read the anacrontab file into memory */
+ {
+-    char *tab_line;
++    char tab_line[MAXTABLINE];
+ 
+     first_job_rec = last_job_rec = NULL;
+     first_env_rec = last_env_rec = NULL;
+@@ -231,14 +244,10 @@
+     /* Open the anacrontab file */
+     tab = fopen(anacrontab, "r");
+     if (tab == NULL) die_e("Error opening %s", anacrontab);



Home | Main Index | Thread Index | Old Index