summaryrefslogtreecommitdiff
path: root/source/a/dcron
diff options
context:
space:
mode:
Diffstat (limited to 'source/a/dcron')
-rw-r--r--source/a/dcron/crontab.c.O_EXCL.diff11
-rw-r--r--source/a/dcron/crontab.root22
-rw-r--r--source/a/dcron/dcron-2.3.3.crontab.diff419
-rw-r--r--source/a/dcron/dcron-2.3.3.diff40
-rw-r--r--source/a/dcron/dcron-2.3.3.diff2477
-rw-r--r--source/a/dcron/dcron-2.3.3.diff311
-rw-r--r--source/a/dcron/dcron-2.3.3.lsm17
-rw-r--r--source/a/dcron/dcron-2.3.3.version.diff11
-rwxr-xr-xsource/a/dcron/dcron.SlackBuild108
-rw-r--r--source/a/dcron/dcron.fork.diff11
-rw-r--r--source/a/dcron/dcron.manpage.paths.diff65
-rw-r--r--source/a/dcron/dcron.tmpdir.diff11
-rw-r--r--source/a/dcron/defs.h.TMPDIR.diff11
-rw-r--r--source/a/dcron/doinst.sh5
-rw-r--r--source/a/dcron/run-parts2
15 files changed, 190 insertions, 631 deletions
diff --git a/source/a/dcron/crontab.c.O_EXCL.diff b/source/a/dcron/crontab.c.O_EXCL.diff
new file mode 100644
index 00000000..7acd5ce2
--- /dev/null
+++ b/source/a/dcron/crontab.c.O_EXCL.diff
@@ -0,0 +1,11 @@
+--- ./crontab.c.orig 2010-01-18 09:27:31.000000000 -0600
++++ ./crontab.c 2010-02-11 16:38:03.000000000 -0600
+@@ -199,7 +199,7 @@
+ * Read from repFd, write to fd for "$CDir/$USER.new"
+ */
+ snprintf(path, sizeof(path), "%s.new", pas->pw_name);
+- if ((fd = open(path, O_CREAT|O_TRUNC|O_EXCL|O_APPEND|O_WRONLY, 0600)) >= 0) {
++ if ((fd = open(path, O_CREAT|O_TRUNC|O_APPEND|O_WRONLY, 0600)) >= 0) {
+ while ((n = read(repFd, buf, sizeof(buf))) > 0) {
+ write(fd, buf, n);
+ }
diff --git a/source/a/dcron/crontab.root b/source/a/dcron/crontab.root
new file mode 100644
index 00000000..b5b42562
--- /dev/null
+++ b/source/a/dcron/crontab.root
@@ -0,0 +1,22 @@
+# If you don't want the output of a cron job mailed to you, you have to direct
+# any output to /dev/null. We'll do this here since these jobs should run
+# properly on a newly installed system, but if they don't the average newbie
+# might get quite perplexed about getting strange mail every 5 minutes. :^)
+#
+# Run the hourly, daily, weekly, and monthly cron jobs.
+# Jobs that need different timing may be entered into the crontab as before,
+# but most really don't need greater granularity than this. If the exact
+# times of the hourly, daily, weekly, and monthly cron jobs do not suit your
+# needs, feel free to adjust them.
+#
+# Run hourly cron jobs at 47 minutes after the hour:
+47 * * * * /usr/bin/run-parts /etc/cron.hourly 1> /dev/null
+#
+# Run daily cron jobs at 4:40 every day:
+40 4 * * * /usr/bin/run-parts /etc/cron.daily 1> /dev/null
+#
+# Run weekly cron jobs at 4:30 on the first day of the week:
+30 4 * * 0 /usr/bin/run-parts /etc/cron.weekly 1> /dev/null
+#
+# Run monthly cron jobs at 4:20 on the first day of the month:
+20 4 1 * * /usr/bin/run-parts /etc/cron.monthly 1> /dev/null
diff --git a/source/a/dcron/dcron-2.3.3.crontab.diff4 b/source/a/dcron/dcron-2.3.3.crontab.diff4
deleted file mode 100644
index 30d0501a..00000000
--- a/source/a/dcron/dcron-2.3.3.crontab.diff4
+++ /dev/null
@@ -1,19 +0,0 @@
---- ./crontab.c.orig Wed Feb 20 14:31:32 2002
-+++ ./crontab.c Wed Feb 20 14:33:13 2002
-@@ -197,14 +197,14 @@
- int n;
-
- snprintf(path, sizeof(path), "%s.new", pas->pw_name);
-- if ((fd = open(path, O_CREAT|O_TRUNC|O_EXCL|O_APPEND|O_WRONLY, 0600)) >= 0) {
-+ if ((fd = open(path, O_CREAT|O_TRUNC|O_APPEND|O_WRONLY, 0600)) >= 0) {
- while ((n = read(repFd, buf, sizeof(buf))) > 0) {
- write(fd, buf, n);
- }
- close(fd);
- rename(path, pas->pw_name);
- } else {
-- fprintf(stderr, "unable to create %s/%s\n", CDir, buf);
-+ fprintf(stderr, "unable to create %s/%s\n", CDir, path);
- }
- close(repFd);
- }
diff --git a/source/a/dcron/dcron-2.3.3.diff b/source/a/dcron/dcron-2.3.3.diff
deleted file mode 100644
index 22806de3..00000000
--- a/source/a/dcron/dcron-2.3.3.diff
+++ /dev/null
@@ -1,40 +0,0 @@
---- ./defs.h.orig Fri Sep 5 14:44:32 1997
-+++ ./defs.h Thu Aug 26 16:56:10 1999
-@@ -29,7 +29,7 @@
- #define CRONTABS "/var/spool/cron/crontabs"
- #endif
- #ifndef TMPDIR
--#define TMPDIR "/tmp"
-+#define TMPDIR "/var/spool/cron"
- #endif
- #ifndef OPEN_MAX
- #define OPEN_MAX 256
---- ./subs.c.orig Mon Feb 16 13:35:10 1998
-+++ ./subs.c Thu Aug 26 16:57:21 1999
-@@ -15,7 +15,7 @@
- Prototype int ChangeUser(const char *user, short dochdir);
- Prototype void vlog(int level, int fd, const char *ctl, va_list va);
- Prototype int slog(char *buf, size_t sz, const char *ctl, va_list va, short useDate);
--Prototype char *strdup(const char *);
-+Prototype char *xx_strdup(const char *);
-
- void
- log9(const char *ctl, ...)
-@@ -80,7 +80,7 @@
-
- buf[0] = 0;
- if (useDate)
-- strftime(buf, 128, "%d-%b-%y %H:%M ", tp);
-+ strftime(buf, 128, "%d-%b-%Y %H:%M ", tp);
- vsnprintf(buf + strlen(buf), sz - strlen(buf), ctl, va);
- return(strlen(buf));
- }
-@@ -132,7 +132,7 @@
- }
-
- char *
--strdup(const char *str)
-+xx_strdup(const char *str)
- {
- char *ptr = malloc(strlen(str) + 1);
-
diff --git a/source/a/dcron/dcron-2.3.3.diff2 b/source/a/dcron/dcron-2.3.3.diff2
deleted file mode 100644
index 8eb8242c..00000000
--- a/source/a/dcron/dcron-2.3.3.diff2
+++ /dev/null
@@ -1,477 +0,0 @@
---- ./CHANGES:1.1 Fri Jan 7 18:15:59 2000
-+++ ./CHANGES Thu Apr 20 12:10:36 2000
-@@ -1,3 +1,15 @@
-+20/03/00 - TEMHOTA <temnota@kmv.ru>
-+ Adding SIGHUP signal handler. crond die when init send to it SIGHUP.
-+ Rewrtited all loging code. Added logging through syslog and normal
-+ logging to file.
-+
-+ Technical details:
-+ + logging through syslog used facility LOG_CRON
-+ + log_err - now *always* write message to logger (if selected logging
-+ through syslog - message send as LOG_ERR).
-+ + log9 - sends message hrough syslog loglevel LOG_WARNING
-+ + for all other log levels - default syslog loglevel LOG_NOTICE
-+
- 02/16/98 - Jordan Mendelson (jordy@wserv.com)
-
- Numerous people have reported a problem with logging. I'm sorry
---- ./Makefile:1.1 Fri Jan 7 18:15:59 2000
-+++ ./Makefile Thu Apr 20 12:24:40 2000
-@@ -27,7 +27,7 @@
- rm -f crond crontab
-
- cleano:
-- rm -f *.o dcron.tgz $(PROTOS)
-+ rm -f *.o dcron.tgz $(PROTOS) *~
-
- install: crond crontab
- install -o root -g root -m 0755 crond /usr/sbin
---- ./crontab.c:1.1 Fri Jan 7 18:15:59 2000
-+++ ./crontab.c Sun Mar 19 15:03:36 2000
-@@ -15,6 +15,9 @@
- char *CDir = CRONTABS;
- int UserId;
- short LogLevel = 9;
-+short DebugOpt = 0;
-+short LoggerOpt = 0;
-+char *LogFile = LOG_FILE;
-
- void EditFile(const char *user, const char *file);
- int GetReplaceStream(const char *user, const char *file);
-@@ -136,7 +139,7 @@
- */
-
- if (chdir(CDir) < 0) {
-- fprintf(stderr, "cannot change diir to %s: %s\n", CDir, strerror(errno));
-+ fprintf(stderr, "cannot change dir to %s: %s\n", CDir, strerror(errno));
- exit(1);
- }
-
---- ./defs.h:1.1 Fri Jan 7 18:15:59 2000
-+++ ./defs.h Sun Mar 19 15:03:36 2000
-@@ -17,6 +17,9 @@
- #include <pwd.h>
- #include <unistd.h>
- #include <grp.h>
-+#include <syslog.h>
-+#include <signal.h>
-+#include <getopt.h>
- #include <sys/ioctl.h>
- #include <sys/wait.h>
- #include <sys/stat.h>
-@@ -30,6 +33,9 @@
- #endif
- #ifndef TMPDIR
- #define TMPDIR "/var/spool/cron"
-+#endif
-+#ifndef LOG_FILE
-+#define LOG_FILE "/var/log/cron"
- #endif
- #ifndef OPEN_MAX
- #define OPEN_MAX 256
---- ./job.c:1.1 Fri Jan 7 18:15:59 2000
-+++ ./job.c Thu Apr 20 12:10:36 2000
-@@ -16,7 +16,7 @@
- {
- char mailFile[128];
- int mailFd;
--
-+
- line->cl_Pid = 0;
- line->cl_MailFlag = 0;
-
-@@ -57,14 +57,6 @@
- log(5, "Child Running %s\n", line->cl_Shell);
-
- /*
-- * Setup close-on-exec descriptor in case exec fails
-- */
--
-- dup2(2, 8);
-- fcntl(8, F_SETFD, 1);
-- fclose(stderr);
--
-- /*
- * stdin is already /dev/null, setup stdout and stderr
- */
-
-@@ -73,13 +65,13 @@
- dup2(mailFd, 2);
- close(mailFd);
- } else {
-- logfd(8, "unable to create mail file user %s file %s, output to /dev/null\n",
-+ log_err("unable to create mail file user %s file %s, output to /dev/null\n",
- file->cf_User,
- mailFile
- );
- }
- execl("/bin/sh", "/bin/sh", "-c", line->cl_Shell, NULL, NULL);
-- logfd(8, "unable to exec, user %s cmd /bin/sh -c %s\n",
-+ log_err("unable to exec, user %s cmd /bin/sh -c %s\n",
- file->cf_User,
- line->cl_Shell
- );
-@@ -89,7 +81,7 @@
- /*
- * PARENT, FORK FAILED
- */
-- log9("couldn't fork, user %s\n", file->cf_User);
-+ log_err("couldn't fork, user %s\n", file->cf_User);
- line->cl_Pid = 0;
- remove(mailFile);
- } else {
-@@ -158,6 +150,7 @@
- if (mailFd < 0) {
- return;
- }
-+
- if (fstat(mailFd, &sbuf) < 0 ||
- sbuf.st_uid != DaemonUid ||
- sbuf.st_nlink != 0 ||
-@@ -182,15 +175,6 @@
- exit(0);
-
- /*
-- * create close-on-exec log descriptor in case exec fails
-- */
--
-- dup2(2, 8);
-- fcntl(8, F_SETFD, 1);
--
-- fclose(stderr);
--
-- /*
- * run sendmail with mail file as standard input, only if
- * mail file exists!
- */
-@@ -200,7 +184,7 @@
- close(mailFd);
-
- execl(SENDMAIL, SENDMAIL, SENDMAIL_ARGS, NULL, NULL);
-- logfd(8, "unable to exec %s %s, user %s, output to sink null",
-+ log_err("unable to exec %s %s, user %s, output to sink null",
- SENDMAIL,
- SENDMAIL_ARGS,
- file->cf_User
-@@ -210,7 +194,7 @@
- /*
- * PARENT, FORK FAILED
- */
-- log9("unable to fork, user %s", file->cf_User);
-+ log_err("unable to fork, user %s", file->cf_User);
- line->cl_Pid = 0;
- } else {
- /*
---- ./main.c:1.1 Fri Jan 7 18:15:59 2000
-+++ ./main.c Sun Mar 19 15:03:36 2000
-@@ -15,14 +15,18 @@
- Prototype short DebugOpt;
- Prototype short LogLevel;
- Prototype short ForegroundOpt;
--Prototype char *CDir;
--Prototype int DaemonUid;
-+Prototype short LoggerOpt;
-+Prototype char *CDir;
-+Prototype char *LogFile;
-+Prototype uid_t DaemonUid;
-
- short DebugOpt;
- short LogLevel = 8;
--short ForegroundOpt;
-+short ForegroundOpt = 0;
-+short LoggerOpt;
- char *CDir = CRONTABS;
--int DaemonUid;
-+char *LogFile = LOG_FILE;
-+uid_t DaemonUid;
-
- int
- main(int ac, char **av)
-@@ -35,48 +39,49 @@
-
- DaemonUid = getuid();
-
-- for (i = 1; i < ac; ++i) {
-- char *ptr = av[i];
-+ opterr = 0; /* disable getopt 'errors' message.*/
-
-- if (*ptr == '-') {
-- ptr += 2;
--
-- switch(ptr[-1]) {
-+ while ((i = getopt(ac,av,"d:l:L:fbSc:")) != EOF){
-+
-+ switch (i){
- case 'l':
-- LogLevel = (*ptr) ? strtol(ptr, NULL, 0) : 1;
-- continue;
-+ LogLevel = atoi(optarg);
-+ break;
- case 'd':
-- DebugOpt = (*ptr) ? strtol(ptr, NULL, 0) : 1;
-+ DebugOpt = atoi(optarg);
- LogLevel = 0;
- /* fall through */
-+ break;
- case 'f':
- ForegroundOpt = 1;
-- continue;
-+ break;
- case 'b':
- ForegroundOpt = 0;
-- continue;
-+ break;
-+ case 'S': /* select logging to syslog */
-+ LoggerOpt = 0;
-+ break;
-+ case 'L': /* select internal file logger */
-+ LoggerOpt = 1;
-+ if (*optarg != 0) LogFile = optarg;
-+ break;
- case 'c':
-- CDir = (*ptr) ? ptr : av[++i];
-- continue;
-+ if (*optarg != 0) CDir = optarg;
-+ break;
- default:
-+ /*
-+ * parse error
-+ */
-+ printf("dcron " VERSION "\n");
-+ printf("dcron -d [#] -l [#] -S -L logfile -f -b -c dir\n");
-+ printf("-d num\tdebug level\n-l num\tlog level (8 - default)\n-S\tlog to syslod (defualt)\n");
-+ printf("-L file\tlog to file\n-f\trun in fordeground\n");
-+ printf("-b\trun in background (default)\n-c dir\tworking dir\n");
-+ exit(1);
- break;
-- }
-- }
-- break; /* error */
-- }
--
-- /*
-- * check for parse error
-- */
--
-- if (i != ac) {
-- if (i > ac)
-- puts("expected argument for option");
-- printf("dcron " VERSION "\n");
-- printf("dcron -d[#] -l[#] -f -b -c dir\n");
-- exit(1);
-+ }
- }
--
-+
- /*
- * change directory
- */
-@@ -87,14 +92,15 @@
- }
-
- /*
-- * close stdin and stdout (stderr normally redirected by caller).
-- * close unused descriptors
-+ * close stdin and stdout, stderr.
-+ * close unused descriptors - don't need.
- * optional detach from controlling terminal
- */
-
- fclose(stdin);
- fclose(stdout);
--
-+ fclose(stderr);
-+
- i = open("/dev/null", O_RDWR);
- if (i < 0) {
- perror("open: /dev/null:");
-@@ -102,15 +108,14 @@
- }
- dup2(i, 0);
- dup2(i, 1);
-+ dup2(i, 2);
-
-- for (i = 3; i < OPEN_MAX; ++i) {
-- close(i);
-- }
--
- if (ForegroundOpt == 0) {
- int fd;
- int pid;
--
-+ if (setsid() < 0)
-+ perror("setsid");
-+
- if ((fd = open("/dev/tty", O_RDWR)) >= 0) {
- ioctl(fd, TIOCNOTTY, 0);
- close(fd);
-@@ -125,13 +130,17 @@
- if (pid > 0)
- exit(0);
- }
--
-+
-+ (void)startlogger(); /* need if syslog mode selected */
-+ (void)initsignals(); /* set some signal handlers */
-+
- /*
- * main loop - synchronize to 1 second after the minute, minimum sleep
- * of 1 second.
- */
-+
-+ log(9,"%s " VERSION " dillon, started, log level %d\n", av[0], LogLevel);
-
-- log9("%s " VERSION " dillon, started\n", av[0]);
- SynchronizeDir(".");
-
- {
---- ./subs.c:1.1 Fri Jan 7 18:15:59 2000
-+++ ./subs.c Sun Mar 19 15:03:36 2000
-@@ -10,43 +10,62 @@
-
- Prototype void log(int level, const char *ctl, ...);
- Prototype void log9(const char *ctl, ...);
--Prototype void logfd(int fd, const char *ctl, ...);
-+Prototype void log_err(const char *ctl, ...);
- Prototype void fdprintf(int fd, const char *ctl, ...);
--Prototype int ChangeUser(const char *user, short dochdir);
--Prototype void vlog(int level, int fd, const char *ctl, va_list va);
--Prototype int slog(char *buf, size_t sz, const char *ctl, va_list va, short useDate);
-+Prototype void vlog(int level, int MLOG_LEVEL, const char *ctl, va_list va);
-+Prototype int ChangeUser(const char *user, short dochdir);
- Prototype char *xx_strdup(const char *);
-+Prototype void startlogger(void);
-+Prototype void initsignals(void);
-
-+/*
-+ set log_level=9 and log messages
-+*/
-+
- void
- log9(const char *ctl, ...)
- {
- va_list va;
-
- va_start(va, ctl);
-- vlog(9, 2, ctl, va);
-+ vlog(9, LOG_WARNING, ctl, va);
- va_end(va);
- }
-
-+/*
-+ normal logger call point.
-+*/
-+
- void
- log(int level, const char *ctl, ...)
- {
- va_list va;
-
- va_start(va, ctl);
-- vlog(level, 2, ctl, va);
-+ vlog(level, LOG_NOTICE, ctl, va);
- va_end(va);
- }
-
-+/*
-+ Original: void
-+ logfd(int fd, const char *ctl, ...)
-+ Updated to: log_error (used by jobs.c)
-+*/
-+
- void
--logfd(int fd, const char *ctl, ...)
-+log_err(const char *ctl, ...)
- {
- va_list va;
-
- va_start(va, ctl);
-- vlog(9, fd, ctl, va);
-+ vlog(20, LOG_ERR, ctl, va);
- va_end(va);
- }
-
-+/*
-+ used by jobs.c (write to temp file..)
-+*/
-+
- void
- fdprintf(int fd, const char *ctl, ...)
- {
-@@ -60,32 +79,28 @@
- }
-
- void
--vlog(int level, int fd, const char *ctl, va_list va)
-+vlog(int level, int MLOG_LEVEL, const char *ctl, va_list va)
- {
- char buf[1024];
-- short n;
-- static short useDate = 1;
-+ int logfd;
-
- if (level >= LogLevel) {
-- write(fd, buf, n = slog(buf, sizeof(buf), ctl, va, useDate));
-- useDate = (n && buf[n-1] == '\n');
-+
-+ vsnprintf(buf,sizeof(buf), ctl, va);
-+ if (DebugOpt) fprintf(stderr,"%s",buf);
-+ else
-+ if (LoggerOpt == 0) syslog(MLOG_LEVEL, "%s",buf );
-+ else {
-+ if ((logfd = open(LogFile,O_WRONLY|O_CREAT|O_APPEND,600)) >= 0){
-+ write(logfd, buf, strlen(buf));
-+ close(logfd);
-+ } else
-+ fprintf(stderr,"Can't open log file. Err: %s",strerror(errno));
-+ }
- }
- }
-
- int
--slog(char *buf, size_t sz, const char *ctl, va_list va, short useDate)
--{
-- time_t t = time(NULL);
-- struct tm *tp = localtime(&t);
--
-- buf[0] = 0;
-- if (useDate)
-- strftime(buf, 128, "%d-%b-%Y %H:%M ", tp);
-- vsnprintf(buf + strlen(buf), sz - strlen(buf), ctl, va);
-- return(strlen(buf));
--}
--
--int
- ChangeUser(const char *user, short dochdir)
- {
- struct passwd *pas;
-@@ -141,3 +156,28 @@
- return(ptr);
- }
-
-+
-+void
-+startlogger(void){
-+int logfd;
-+
-+ if (LoggerOpt == 0)
-+ openlog("crond",LOG_CONS|LOG_PID,LOG_CRON);
-+
-+ else { /* test logfile */
-+ if ((logfd = open(LogFile,O_WRONLY|O_CREAT|O_APPEND,600)) >= 0)
-+ close(logfd);
-+ else
-+ printf("Failed to open log file '%s' reason: %s",LogFile,strerror(errno));
-+ }
-+}
-+
-+
-+void
-+initsignals(void){
-+
-+ signal(SIGHUP,SIG_IGN); /* hmm.. but, if kill -HUP original
-+ * version - his died. ;(
-+ */
-+
-+}
diff --git a/source/a/dcron/dcron-2.3.3.diff3 b/source/a/dcron/dcron-2.3.3.diff3
deleted file mode 100644
index 25c72fc9..00000000
--- a/source/a/dcron/dcron-2.3.3.diff3
+++ /dev/null
@@ -1,11 +0,0 @@
---- ./defs.h.orig Wed May 30 14:13:05 2001
-+++ ./defs.h Wed May 30 14:13:13 2001
-@@ -41,7 +41,7 @@
- #define OPEN_MAX 256
- #endif
- #ifndef SENDMAIL
--#define SENDMAIL "/usr/lib/sendmail"
-+#define SENDMAIL "/usr/sbin/sendmail"
- #endif
- #ifndef SENDMAIL_ARGS
- #define SENDMAIL_ARGS "-t", "-oem", "-i"
diff --git a/source/a/dcron/dcron-2.3.3.lsm b/source/a/dcron/dcron-2.3.3.lsm
deleted file mode 100644
index 5c161b50..00000000
--- a/source/a/dcron/dcron-2.3.3.lsm
+++ /dev/null
@@ -1,17 +0,0 @@
-Begin3
-Title: DCron - yet another cron
-Version: 2.3.3
-Entered-date: 17Feb98
-Description: A multi-user cron written from scratch by the author,
- similar to vixie-cron but with significant differences.
- Attention paid less to feature creep and more to usability
- and reliability
-Keywords: cron crontab dcron
-Author: dillon@apollo.west.oic.com (Matthew Dillon)
-Maintained-by: dillon@apollo.west.oic.com (Matthew Dillon)
-Primary-site: sunsite.unc.edu /pub/Linux/system/daemons/cron
-Alternate-site:
-Original-site:
-Platforms:
-Copying-policy: GPL
-End
diff --git a/source/a/dcron/dcron-2.3.3.version.diff b/source/a/dcron/dcron-2.3.3.version.diff
deleted file mode 100644
index 1b65a0c9..00000000
--- a/source/a/dcron/dcron-2.3.3.version.diff
+++ /dev/null
@@ -1,11 +0,0 @@
---- ./defs.h.orig Tue Apr 9 01:07:07 2002
-+++ ./defs.h Tue Apr 9 01:07:15 2002
-@@ -51,7 +51,7 @@
- #endif
-
-
--#define VERSION "2.3.2"
-+#define VERSION "2.3.3"
-
- typedef struct CronFile {
- struct CronFile *cf_Next;
diff --git a/source/a/dcron/dcron.SlackBuild b/source/a/dcron/dcron.SlackBuild
index c9bb62ff..f67f869f 100755
--- a/source/a/dcron/dcron.SlackBuild
+++ b/source/a/dcron/dcron.SlackBuild
@@ -1,6 +1,6 @@
#!/bin/sh
-# Copyright 2008, 2009 Patrick J. Volkerding, Sebeka, Minnesota, USA
+# Copyright 2009, 2010 Patrick J. Volkerding, Sebeka, MN, USA
# All rights reserved.
#
# Redistribution and use of this script, with or without modification, is
@@ -9,7 +9,7 @@
# 1. Redistributions of this script must retain the above copyright
# notice, this list of conditions and the following disclaimer.
#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ''AS IS'' AND ANY EXPRESS OR IMPLIED
# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
# EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
@@ -20,57 +20,99 @@
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-VERSION=2.3.3
-ARCH=${ARCH:-x86_64}
-BUILD=${BUILD:-6}
+VERSION=${VERSION:-$(echo dcron-*.tar.?z* | rev | cut -f 3- -d . | cut -f 1 -d - | rev)}
+BUILD=${BUILD:-1}
+
+# Automatically determine the architecture we're building on:
+if [ -z "$ARCH" ]; then
+ case "$( uname -m )" in
+ i?86) export ARCH=i486 ;;
+ arm*) export ARCH=arm ;;
+ # Unless $ARCH is already set, use uname -m for all other archs:
+ *) export ARCH=$( uname -m ) ;;
+ esac
+fi
CWD=$(pwd)
TMP=${TMP:-/tmp}
PKG=$TMP/package-dcron
+if [ "$ARCH" = "i486" ]; then
+ SLKCFLAGS="-O2 -march=i486 -mtune=i686"
+ LIBDIRSUFFIX=""
+elif [ "$ARCH" = "s390" ]; then
+ SLKCFLAGS="-O2"
+ LIBDIRSUFFIX=""
+elif [ "$ARCH" = "x86_64" ]; then
+ SLKCFLAGS="-O2 -fPIC"
+ LIBDIRSUFFIX="64"
+else
+ SLKCFLAGS="-O2"
+ LIBDIRSUFFIX=""
+fi
+
rm -rf $PKG
mkdir -p $TMP $PKG
-
-# Explode the package framework:
-cd $PKG
-explodepkg $CWD/_dcron.tar.gz
-
cd $TMP
-rm -rf dcron-$VERSION
-tar xzvf $CWD/dcron-$VERSION.tar.gz
+rm -rf dcron
+tar xvf $CWD/dcron-$VERSION.tar.?z* || exit 1
cd dcron-$VERSION
-mkdir -p $PKG/usr/doc/dcron-$VERSION
-cp -a CHANGES README dcron-$VERSION.lsm $PKG/usr/doc/dcron-2.3.3
-chown root:root $PKG/usr/doc/dcron-$VERSION/*
-chmod 644 $PKG/usr/doc/dcron-$VERSION/*
-zcat $CWD/dcron-$VERSION.diff.gz | patch -p1 -E --verbose --backup || exit
-# Added signal handling/logging patch from TEMHOTA <temnota@kmv.ru>:
-zcat $CWD/dcron-$VERSION.diff2.gz | patch -p1 -E --verbose --backup || exit
-# Use /usr/sbin/sendmail, not /usr/lib/sendmail. Fixes cron working
-# with Postfix. Suggested by Big Brother.
-zcat $CWD/dcron-$VERSION.diff3.gz | patch -p1 -E --verbose --backup || exit
+find . \
+ \( -perm 777 -o -perm 775 -o -perm 711 -o -perm 555 -o -perm 511 \) \
+ -exec chmod 755 {} \; -o \
+ \( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \
+ -exec chmod 644 {} \;
+
+# Define TMPDIR as /var/spool/cron instead of /tmp
+zcat $CWD/defs.h.TMPDIR.diff.gz | patch -p1 || exit 1
+
# Fix problem where user creates /var/spool/cron/crontabs/<user>.new
# using 'crontab -', exits with control-c, and then crontab refuses to
-# overwrite the junk file:
-zcat $CWD/dcron-$VERSION.crontab.diff4.gz | patch -p1 -E --verbose --backup || exit
-# Dcron reports wrong version:
-zcat $CWD/dcron-2.3.3.version.diff.gz | patch -p1 || exit
-# Keep dcron from improperly forking in some circumstances.
-# Thanks to Henrik Carlqvist for the patch.
-zcat $CWD/dcron.fork.diff.gz | patch -p1
-make
-strip crond crontab
+# overwrite the junk file. It would be better if dcron would wipe
+# the junk file in the event it were not closed correctly, but oh well.
+zcat $CWD/patches/crontab.c.O_EXCL.diff.gz | patch -p1 || exit 1
+
+# Get the directory names under /var/spool/ right in the manpages:
+zcat $CWD/dcron.manpage.paths.diff.gz | patch -p1 --verbose || exit 1
+
+CFLAGS+="$SLKCFLAGS" make || exit 1
+strip --strip-unneeded crond crontab
+
+mkdir -p $PKG/usr/{bin,sbin}
cat crond > $PKG/usr/sbin/crond
cat crontab > $PKG/usr/bin/crontab
zcat $CWD/run-parts.gz > $PKG/usr/bin/run-parts
+chmod 0755 $PKG/usr/sbin/crond
+chmod 4711 $PKG/usr/bin/crontab
+chmod 0755 $PKG/usr/bin/run-parts
+
+mkdir -p $PKG/usr/man/man{1,8}
cat crontab.1 | gzip -9c > $PKG/usr/man/man1/crontab.1.gz
cat crond.8 | gzip -9c > $PKG/usr/man/man8/crond.8.gz
cat $CWD/run-parts.8.gz > $PKG/usr/man/man8/run-parts.8.gz
+# Create some other stuff we need
+mkdir -p $PKG/etc/cron.{hourly,daily,weekly,monthly}
+mkdir -p $PKG/var/spool/cron/crontabs
+mkdir -p $PKG/var/spool/cron/cronstamps
+chmod 0751 $PKG/var/spool/cron
+chmod 0750 $PKG/var/spool/cron/crontabs $PKG/var/spool/cron/cronstamps
+zcat $CWD/crontab.root > $PKG/var/spool/cron/crontabs/root.new
+chmod 0600 $PKG/var/spool/cron/crontabs/root.new
+# dcron will whine about "unable to scan" this directory, so we'll create it
+mkdir -p $PKG/etc/cron.d
+
+mkdir -p $PKG/usr/doc/dcron-$VERSION
+cp -a \
+ CHANGELOG README \
+ extra \
+ $PKG/usr/doc/dcron-$VERSION
+chown -R root:root $PKG/usr/doc/dcron-$VERSION/*
+
mkdir -p $PKG/install
cat $CWD/slack-desc > $PKG/install/slack-desc
+zcat $CWD/doinst.sh.gz > $PKG/install/doinst.sh
-# Build the package:
cd $PKG
-makepkg -l y -c n $TMP/dcron-$VERSION-$ARCH-$BUILD.txz
+/sbin/makepkg -l y -c n $TMP/dcron-$VERSION-$ARCH-$BUILD.txz
diff --git a/source/a/dcron/dcron.fork.diff b/source/a/dcron/dcron.fork.diff
deleted file mode 100644
index b3aefc05..00000000
--- a/source/a/dcron/dcron.fork.diff
+++ /dev/null
@@ -1,11 +0,0 @@
---- ./job.c.orig 2005-09-11 16:36:43.000000000 -0700
-+++ ./job.c 2005-09-11 16:37:51.000000000 -0700
-@@ -51,7 +51,7 @@
- */
-
- if (ChangeUser(file->cf_User, 1) < 0)
-- return;
-+ exit(0);
-
- if (DebugOpt)
- log(5, "Child Running %s\n", line->cl_Shell);
diff --git a/source/a/dcron/dcron.manpage.paths.diff b/source/a/dcron/dcron.manpage.paths.diff
new file mode 100644
index 00000000..afd9c3d1
--- /dev/null
+++ b/source/a/dcron/dcron.manpage.paths.diff
@@ -0,0 +1,65 @@
+--- ./crond.8.orig 2010-01-18 09:29:25.000000000 -0600
++++ ./crond.8 2010-02-11 17:22:36.000000000 -0600
+@@ -17,13 +17,13 @@
+ .RE
+ .TP
+ .B -c dir
+-directory of per-user crontabs (defaults to /var/spool/cron)
++directory of per-user crontabs (defaults to /var/spool/cron/crontabs)
+ .RS
+ .RE
+ .TP
+ .B -t dir
+ directory of timestamps for \@freq and FREQ=\&... jobs (defaults to
+-/var/spool/cronstamps)
++/var/spool/cron/cronstamps)
+ .RS
+ .RE
+ .TP
+@@ -172,7 +172,7 @@
+ \f[B]crontab\f[] notifies \f[B]crond\f[] that a user's crontab file
+ has been modified (or created or deleted) through the
+ \[lq]cron.update\[rq] file, which resides in the per-user crontabs
+-directory (usually /var/spool/cron).
++directory (usually /var/spool/cron/crontabs).
+ \f[B]crontab\f[] appends the filename of the modified crontab file
+ to \[lq]cron.update\[rq]; and \f[B]crond\f[] inspects this file to
+ determine when to reparse or otherwise update its internal list of
+@@ -180,7 +180,7 @@
+ .PP
+ Whenever a \[lq]cron.update\[rq] file is seen, \f[B]crond\f[] also
+ re-reads timestamp files from its timestamp directory (usually
+-/var/spool/cronstamps).
++/var/spool/cron/cronstamps).
+ Normally these will just mirror \f[B]crond\f[]'s own internal
+ representations, but this mechanism could be used to manually
+ notify \f[B]crond\f[] that you've externally updated the
+@@ -210,7 +210,7 @@
+ crontab to /etc/cron.d/foo.
+ .PP
+ The superuser has a per-user crontab along with other users.
+-It usually resides at /var/spool/cron/root.
++It usually resides at /var/spool/cron/crontabs/root.
+ .PP
+ Users can only have a crontab if they have an entry in /etc/passwd;
+ however they do not need to have login shell privileges.
+--- ./crontab.1.orig 2010-01-18 09:29:25.000000000 -0600
++++ ./crontab.1 2010-02-11 17:23:13.000000000 -0600
+@@ -45,7 +45,7 @@
+ different user and/or crontab directory.
+ .PP
+ The superuser also has his or her own per-user crontab, saved as
+-/var/spool/cron/root.
++/var/spool/cron/crontabs/root.
+ .PP
+ Unlike other cron daemons, this crond/crontab package doesn't try
+ to do everything under the sun.
+@@ -117,7 +117,7 @@
+ The formats \@hourly, \@daily, \@weekly, \@monthly, and \@yearly
+ need to update timestamp files when their jobs have been run.
+ The timestamp files are saved as
+-/var/spool/cronstamps/user.jobname.
++/var/spool/cron/cronstamps/user.jobname.
+ So for all of these formats, the cron command needs a jobname,
+ given by prefixing the command with \f[B]ID=jobname\f[].
+ (This syntax was chosen to maximize the chance that our crontab
diff --git a/source/a/dcron/dcron.tmpdir.diff b/source/a/dcron/dcron.tmpdir.diff
deleted file mode 100644
index 3946fede..00000000
--- a/source/a/dcron/dcron.tmpdir.diff
+++ /dev/null
@@ -1,11 +0,0 @@
---- defs.h.orig Mon May 2 10:27:40 1994
-+++ defs.h Sun Apr 4 22:09:00 1999
-@@ -29,7 +29,7 @@
- #define CRONTABS "/var/spool/cron/crontabs"
- #endif
- #ifndef TMPDIR
--#define TMPDIR "/tmp"
-+#define TMPDIR "/var/spool/cron"
- #endif
- #ifndef OPEN_MAX
- #define OPEN_MAX 256
diff --git a/source/a/dcron/defs.h.TMPDIR.diff b/source/a/dcron/defs.h.TMPDIR.diff
new file mode 100644
index 00000000..6263843b
--- /dev/null
+++ b/source/a/dcron/defs.h.TMPDIR.diff
@@ -0,0 +1,11 @@
+--- ./defs.h.orig 2010-01-15 20:17:04.000000000 -0600
++++ ./defs.h 2010-02-11 16:39:33.000000000 -0600
+@@ -73,7 +73,7 @@
+ #define CRONUPDATE "cron.update"
+ #endif
+ #ifndef TMPDIR
+-#define TMPDIR "/tmp"
++#define TMPDIR "/var/spool/cron"
+ #endif
+
+ #ifndef SENDMAIL
diff --git a/source/a/dcron/doinst.sh b/source/a/dcron/doinst.sh
new file mode 100644
index 00000000..ce8dc7f3
--- /dev/null
+++ b/source/a/dcron/doinst.sh
@@ -0,0 +1,5 @@
+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
diff --git a/source/a/dcron/run-parts b/source/a/dcron/run-parts
index dd6b59b3..247d8c6e 100644
--- a/source/a/dcron/run-parts
+++ b/source/a/dcron/run-parts
@@ -29,7 +29,7 @@ for SCRIPT in $1/* ; do
# Determine if this file should be skipped by suffix:
SKIP=false
for SUFFIX in $IGNORE_SUFFIXES ; do
- if [ ! "`basename $SCRIPT $SUFFIX`" = "`basename $SCRIPT`" ]; then
+ if [ ! "$(basename $SCRIPT $SUFFIX)" = "$(basename $SCRIPT)" ]; then
SKIP=true
break
fi