aboutsummaryrefslogtreecommitdiff
path: root/sysutils/anacron
diff options
context:
space:
mode:
authorJean-Yves Lefort <jylefort@FreeBSD.org>2005-06-16 15:51:38 +0000
committerJean-Yves Lefort <jylefort@FreeBSD.org>2005-06-16 15:51:38 +0000
commit610bc835b1230320760f51685d16856b344d5c7a (patch)
treec579ddc1260aa9376572b0dafef590f0a5a2cc80 /sysutils/anacron
parenta6555c8d3b759431cdf4acc1d1427c3a3e283536 (diff)
downloadports-610bc835b1230320760f51685d16856b344d5c7a.tar.gz
ports-610bc835b1230320760f51685d16856b344d5c7a.zip
Notes
Diffstat (limited to 'sysutils/anacron')
-rw-r--r--sysutils/anacron/Makefile27
-rw-r--r--sysutils/anacron/files/anacron.sh.in24
-rw-r--r--sysutils/anacron/files/anacrontab.default12
-rw-r--r--sysutils/anacron/files/patch-aa310
-rw-r--r--sysutils/anacron/files/patch-gregor.c11
-rw-r--r--sysutils/anacron/files/patch-matchrx.c10
-rw-r--r--sysutils/anacron/files/patch-readtab.c161
-rw-r--r--sysutils/anacron/files/patch-runjob.c34
-rw-r--r--sysutils/anacron/files/pkg-message.in7
-rw-r--r--sysutils/anacron/pkg-message8
-rw-r--r--sysutils/anacron/pkg-plist7
11 files changed, 284 insertions, 327 deletions
diff --git a/sysutils/anacron/Makefile b/sysutils/anacron/Makefile
index 0dfa6d52c06f..bcef69ba6728 100644
--- a/sysutils/anacron/Makefile
+++ b/sysutils/anacron/Makefile
@@ -7,7 +7,7 @@
PORTNAME= anacron
PORTVERSION= 2.3
-PORTREVISION= 3
+PORTREVISION= 4
CATEGORIES= sysutils
MASTER_SITES= ${MASTER_SITE_SOURCEFORGE}
MASTER_SITE_SUBDIR= anacron
@@ -17,14 +17,27 @@ COMMENT= Schedules periodic jobs on systems that are not permanently up
MAN8= anacron.8
MAN5= anacrontab.5
+USE_REINPLACE= yes
USE_GMAKE= yes
-PKGMESSAGE= ${WRKDIR}/pkg-message
-
-post-install:
- ${CAT} ${PKGMESSAGE}
- ${STRIP_CMD} ${PREFIX}/sbin/anacron
+USE_RC_SUBR= anacron.sh
+SUB_FILES= pkg-message
+MAKE_ENV= CC="${CC}"
post-patch:
- @${SED} -e 's|%%PREFIX%%|${PREFIX}|g' ${PKGDIR}/pkg-message >${PKGMESSAGE}
+.for f in Makefile anacron.8 anacrontab.5
+ @${REINPLACE_CMD} -e 's|\(/etc/anacrontab\)|${PREFIX}\1|' ${WRKSRC}/${f}
+.endfor
+ @${REINPLACE_CMD} -e 's|^CFLAGS = .*||' ${WRKSRC}/Makefile
+
+do-install:
+ ${INSTALL_PROGRAM} ${WRKSRC}/anacron ${PREFIX}/sbin
+ ${INSTALL_MAN} ${WRKSRC}/anacron.8 ${MAN8PREFIX}/man/man8
+ ${INSTALL_MAN} ${WRKSRC}/anacrontab.5 ${MAN5PREFIX}/man/man5
+ ${INSTALL_DATA} ${FILESDIR}/anacrontab.default ${PREFIX}/etc
+ [ -f ${PREFIX}/etc/anacrontab ] || ${INSTALL_DATA} ${FILESDIR}/anacrontab.default ${PREFIX}/etc/anacrontab
+ ${MKDIR} /var/spool/anacron
+
+post-install:
+ @${CAT} ${PKGMESSAGE}
.include <bsd.port.mk>
diff --git a/sysutils/anacron/files/anacron.sh.in b/sysutils/anacron/files/anacron.sh.in
new file mode 100644
index 000000000000..fd21894ad106
--- /dev/null
+++ b/sysutils/anacron/files/anacron.sh.in
@@ -0,0 +1,24 @@
+#!/bin/sh
+#
+# $FreeBSD$
+#
+
+# PROVIDE: anacron
+# REQUIRE: LOGIN
+
+#
+# Add the following line to /etc/rc.conf to enable anacron:
+#
+# anacron_enable="YES"
+#
+
+. %%RC_SUBR%%
+
+name="anacron"
+rcvar=`set_rcvar`
+command="%%PREFIX%%/sbin/anacron"
+
+load_rc_config $name
+: ${anacron_enable="NO"}
+
+run_rc_command "$1"
diff --git a/sysutils/anacron/files/anacrontab.default b/sysutils/anacron/files/anacrontab.default
new file mode 100644
index 000000000000..2797d7fc2cc1
--- /dev/null
+++ b/sysutils/anacron/files/anacrontab.default
@@ -0,0 +1,12 @@
+
+PATH=/bin:/sbin:/usr/bin:/usr/sbin
+
+# days make sure the command is executed at least every 'days' days
+# delay delay in minutes, before a command starts
+# id unique id of a command
+
+# days delay id command
+1 5 daily periodic daily
+7 15 weekly periodic weekly
+30 60 monthly periodic monthly
+
diff --git a/sysutils/anacron/files/patch-aa b/sysutils/anacron/files/patch-aa
deleted file mode 100644
index 66a6ff010b60..000000000000
--- a/sysutils/anacron/files/patch-aa
+++ /dev/null
@@ -1,310 +0,0 @@
-diff -uN ../anacron-2.3/Makefile ./Makefile
---- ../anacron-2.3/Makefile Fri Jun 23 00:26:11 2000
-+++ ./Makefile Sun Nov 21 14:29:24 2004
-@@ -19,16 +19,16 @@
- # `COPYING' that comes with the Anacron source distribution.
-
-
--PREFIX =
--BINDIR = $(PREFIX)/usr/sbin
--MANDIR = $(PREFIX)/usr/man
-+PREFIX ?= /usr/local
-+BINDIR = $(PREFIX)/sbin
-+MANDIR = $(PREFIX)/man
- CFLAGS = -Wall -pedantic -O2
- #CFLAGS = -Wall -O2 -g -DDEBUG
-
- # If you change these, please update the man-pages too
- # Only absolute paths here, please
- SPOOLDIR = /var/spool/anacron
--ANACRONTAB = /etc/anacrontab
-+ANACRONTAB = $(PREFIX)/etc/anacrontab
-
- RELEASE = 2.3
- package_name = anacron-$(RELEASE)
-@@ -64,7 +64,7 @@
-
- .PHONY: installdirs
- installdirs:
-- $(INSTALL_DIR) $(BINDIR) $(PREFIX)$(SPOOLDIR) \
-+ $(INSTALL_DIR) $(BINDIR) $(SPOOLDIR) \
- $(MANDIR)/man5 $(MANDIR)/man8
-
- .PHONY: install
-@@ -72,6 +72,8 @@
- $(INSTALL_PROGRAM) anacron $(BINDIR)/anacron
- $(INSTALL_DATA) anacrontab.5 $(MANDIR)/man5/anacrontab.5
- $(INSTALL_DATA) anacron.8 $(MANDIR)/man8/anacron.8
-+ $(INSTALL_DATA) anacrontab.sample $(PREFIX)/etc/anacrontab.sample
-+ $(INSTALL_DATA) anacron.sh $(PREFIX)/etc/rc.d/anacron.sh
-
- .PHONY: clean
- clean:
-diff -uN ../anacron-2.3/anacron.8 ./anacron.8
---- ../anacron-2.3/anacron.8 Fri Jun 23 00:42:05 2000
-+++ ./anacron.8 Thu Aug 26 11:52:13 2004
-@@ -18,7 +18,7 @@
- usually controlled by \fBcron\fR.
- .PP
- When executed, Anacron reads a list of jobs from a configuration file, normally
--.I /etc/anacrontab
-+.I /usr/local/etc/anacrontab
- (see \fBanacrontab(5)\fR). This file
- contains the list of jobs that Anacron controls. Each
- job entry specifies a period in days,
-@@ -84,7 +84,7 @@
- .TP
- .B -n
- Run jobs now. Ignore the delay specifications in the
--.I /etc/anacrontab
-+.I /usr/local/etc/anacrontab
- file. This options implies \fB-s\fR.
- .TP
- .B -d
-@@ -117,7 +117,7 @@
- for more information.
- .SH FILES
- .TP
--.I /etc/anacrontab
-+.I /usr/local/etc/anacrontab
- Contains specifications of jobs. See \fBanacrontab(5)\fR for a complete
- description.
- .TP
-diff -uN ../anacron-2.3/anacron.sh ./anacron.sh
---- ../anacron-2.3/anacron.sh Thu Jan 1 01:00:00 1970
-+++ ./anacron.sh Sun Nov 21 11:34:51 2004
-@@ -0,0 +1,18 @@
-+#!/bin/sh
-+#
-+# initialization/shutdown script for anacron
-+
-+# PROVIDE: anacron
-+# REQUIRE: LOGIN
-+# KEYWORD: FreeBSD
-+
-+. /etc/rc.subr
-+
-+prefix=/usr/local
-+
-+name="anacron"
-+rcvar=`set_rcvar`
-+command="$prefix/sbin/anacron"
-+
-+load_rc_config $name
-+run_rc_command "$1"
-diff -uN ../anacron-2.3/anacrontab.5 ./anacrontab.5
---- ../anacron-2.3/anacrontab.5 Wed Jun 21 01:12:18 2000
-+++ ./anacrontab.5 Thu Aug 26 11:52:13 2004
-@@ -1,9 +1,9 @@
- .TH ANACRONTAB 5 1998-02-02 "Itai Tzur" "Anacron Users' Manual"
- .SH NAME
--/etc/anacrontab \- configuration file for anacron
-+/usr/local/etc/anacrontab \- configuration file for anacron
- .SH DESCRIPTION
- The file
--.I /etc/anacrontab
-+.I /usr/local/etc/anacrontab
- describes the jobs controlled by \fBanacron(8)\fR. Its lines can be of
- three kinds: job-description lines, environment
- assignments, or empty lines.
-diff -uN ../anacron-2.3/anacrontab.sample ./anacrontab.sample
---- ../anacron-2.3/anacrontab.sample Thu Jan 1 01:00:00 1970
-+++ ./anacrontab.sample Thu Aug 26 11:52:13 2004
-@@ -0,0 +1,12 @@
-+
-+PATH=/bin:/sbin:/usr/bin:/usr/sbin
-+
-+# days make sure the command is executed at least every 'days' days
-+# delay delay in minutes, before a command starts
-+# id unique id of a command
-+
-+# days delay id command
-+1 5 daily periodic daily
-+7 15 weekly periodic weekly
-+30 60 monthly periodic monthly
-+
-diff -uN ../anacron-2.3/gregor.c ./gregor.c
---- ../anacron-2.3/gregor.c Fri Jun 23 00:50:40 2000
-+++ ./gregor.c Thu Aug 26 12:00:36 2004
-@@ -65,7 +65,7 @@
- {
- int dn;
- int i;
-- const int isleap; /* save three calls to leap() */
-+ int isleap; /* save three calls to leap() */
-
- /* Some validity checks */
-
-diff -uN ../anacron-2.3/matchrx.c ./matchrx.c
---- ../anacron-2.3/matchrx.c Wed Jun 21 01:12:18 2000
-+++ ./matchrx.c Thu Aug 26 11:52:13 2004
-@@ -23,6 +23,7 @@
-
-
- #include <stdio.h>
-+#include <unistd.h>
- #include <regex.h>
- #include <stdarg.h>
- #include <stdlib.h>
-diff -uN ../anacron-2.3/readtab.c ./readtab.c
---- ../anacron-2.3/readtab.c Fri Jun 23 00:13:12 2000
-+++ ./readtab.c Thu Aug 26 11:52:13 2004
-@@ -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);
-- /* Initialize the obstacks */
-- obstack_init(&input_o);
-- obstack_init(&tab_o);
-- while ((tab_line = read_tab_line()) != NULL)
-+ while ((read_tab_line(tab_line)) != NULL)
- {
- line_num++;
- parse_tab_line(tab_line);
-- obstack_free(&input_o, tab_line);
- }
- if (fclose(tab)) die_e("Error closing %s", anacrontab);
- }
-@@ -269,16 +278,17 @@
-
- j = first_job_rec;
- njobs = 0;
-+ job_array = NULL;
- while (j != NULL)
- {
- if (j->arg_num != -1 && (update_only || consider_job(j)))
- {
-+ job_array = (job_rec**)xrealloc(job_array, (njobs+1)*sizeof(j));
-+ job_array[njobs] = j;
- njobs++;
-- obstack_grow(&tab_o, &j, sizeof(j));
- }
- j = j->next;
- }
-- job_array = obstack_finish(&tab_o);
-
- /* sort the jobs */
- qsort(job_array, njobs, sizeof(*job_array),
diff --git a/sysutils/anacron/files/patch-gregor.c b/sysutils/anacron/files/patch-gregor.c
new file mode 100644
index 000000000000..f500d2216b9e
--- /dev/null
+++ b/sysutils/anacron/files/patch-gregor.c
@@ -0,0 +1,11 @@
+--- gregor.c.orig Fri Jun 23 00:50:40 2000
++++ gregor.c Thu Jun 16 17:38:02 2005
+@@ -65,7 +65,7 @@
+ {
+ int dn;
+ int i;
+- const int isleap; /* save three calls to leap() */
++ int isleap; /* save three calls to leap() */
+
+ /* Some validity checks */
+
diff --git a/sysutils/anacron/files/patch-matchrx.c b/sysutils/anacron/files/patch-matchrx.c
new file mode 100644
index 000000000000..b6c391c3b36e
--- /dev/null
+++ b/sysutils/anacron/files/patch-matchrx.c
@@ -0,0 +1,10 @@
+--- matchrx.c.orig Wed Jun 21 01:12:18 2000
++++ matchrx.c Thu Jun 16 17:31:09 2005
+@@ -23,6 +23,7 @@
+
+
+ #include <stdio.h>
++#include <sys/types.h>
+ #include <regex.h>
+ #include <stdarg.h>
+ #include <stdlib.h>
diff --git a/sysutils/anacron/files/patch-readtab.c b/sysutils/anacron/files/patch-readtab.c
new file mode 100644
index 000000000000..d48bcd4bf556
--- /dev/null
+++ b/sysutils/anacron/files/patch-readtab.c
@@ -0,0 +1,161 @@
+--- readtab.c.orig Fri Jun 23 00:13:12 2000
++++ readtab.c Thu Jun 16 17:35:07 2005
+@@ -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);
+- /* Initialize the obstacks */
+- obstack_init(&input_o);
+- obstack_init(&tab_o);
+- while ((tab_line = read_tab_line()) != NULL)
++ while ((read_tab_line(tab_line)) != NULL)
+ {
+ line_num++;
+ parse_tab_line(tab_line);
+- obstack_free(&input_o, tab_line);
+ }
+ if (fclose(tab)) die_e("Error closing %s", anacrontab);
+ }
+@@ -269,16 +278,17 @@
+
+ j = first_job_rec;
+ njobs = 0;
++ job_array = NULL;
+ while (j != NULL)
+ {
+ if (j->arg_num != -1 && (update_only || consider_job(j)))
+ {
++ job_array = (job_rec**)xrealloc(job_array, (njobs+1)*sizeof(j));
++ job_array[njobs] = j;
+ njobs++;
+- obstack_grow(&tab_o, &j, sizeof(j));
+ }
+ j = j->next;
+ }
+- job_array = obstack_finish(&tab_o);
+
+ /* sort the jobs */
+ qsort(job_array, njobs, sizeof(*job_array),
diff --git a/sysutils/anacron/files/patch-runjob.c b/sysutils/anacron/files/patch-runjob.c
new file mode 100644
index 000000000000..a6fd7f27fb2a
--- /dev/null
+++ b/sysutils/anacron/files/patch-runjob.c
@@ -0,0 +1,34 @@
+--- runjob.c.orig Thu Jun 16 17:04:19 2005
++++ runjob.c Thu Jun 16 17:10:48 2005
+@@ -39,26 +39,14 @@
+ temp_file()
+ /* Open a temporary file and return its file descriptor */
+ {
+- const int max_retries = 50;
+- char *name;
+- int fd, i;
++ int fd;
++ char name[] = "/tmp/anacron.XXXXXX";
++
++ fd = mkstemp(name);
+
+- i = 0;
+- name = NULL;
+- do
+- {
+- i++;
+- free(name);
+- name = tempnam(NULL, NULL);
+- if (name == NULL) die("Can't find a unique temporary filename");
+- fd = open(name, O_RDWR | O_CREAT | O_EXCL | O_APPEND,
+- S_IRUSR | S_IWUSR);
+- /* I'm not sure we actually need to be so persistent here */
+- } while (fd == -1 && errno == EEXIST && i < max_retries);
+-
+ if (fd == -1) die_e("Can't open temporary file");
+ if (unlink(name)) die_e("Can't unlink temporary file");
+- free(name);
++
+ fcntl(fd, F_SETFD, 1); /* set close-on-exec flag */
+ return fd;
+ }
diff --git a/sysutils/anacron/files/pkg-message.in b/sysutils/anacron/files/pkg-message.in
new file mode 100644
index 000000000000..16d6f823ed86
--- /dev/null
+++ b/sysutils/anacron/files/pkg-message.in
@@ -0,0 +1,7 @@
+
+Configuration hints:
+- Edit %%PREFIX%%/etc/anacrontab
+- Deactivate the 'periodic' commands in /etc/crontab
+- Add anacron_enable="YES" to /etc/rc.conf
+- Read anacron(8) and anacrontab(5)
+
diff --git a/sysutils/anacron/pkg-message b/sysutils/anacron/pkg-message
deleted file mode 100644
index 2933cced9ff4..000000000000
--- a/sysutils/anacron/pkg-message
+++ /dev/null
@@ -1,8 +0,0 @@
-
-Configuration hints:
-- Copy %%PREFIX%%/etc/anacrontab.sample to %%PREFIX%%/etc/anacrontab
-- Activate the 'periodic' commands in anacrontab
-- If you want, deactivate the 'periodic' commands in /etc/crontab
-- Add anacron_enable=YES to /etc/rc.conf
-- Read anacron(8) and anacrontab(5)
-
diff --git a/sysutils/anacron/pkg-plist b/sysutils/anacron/pkg-plist
index 69ae2c11330c..57fbd30146a9 100644
--- a/sysutils/anacron/pkg-plist
+++ b/sysutils/anacron/pkg-plist
@@ -1,3 +1,6 @@
sbin/anacron
-etc/anacrontab.sample
-etc/rc.d/anacron.sh
+@unexec if cmp -s %D/etc/anacrontab.default %D/etc/anacrontab; then rm -f %D/etc/anacrontab; fi
+etc/anacrontab.default
+@exec [ -f %B/anacrontab ] || cp %B/%f %B/anacrontab
+@exec mkdir -p /var/spool/anacron
+@unexec rmdir /var/spool/anacron 2>/dev/null || echo "If you are permanently removing this port, you should do a 'rm -rf /var/spool/anacron'."