]> granicus.if.org Git - cronie/commitdiff
Make the paths more configurable.
authorŠtěpán Kasal <kasal AT redhat DOT com>
Fri, 22 May 2009 07:05:10 +0000 (09:05 +0200)
committerMarcela Mašláňová <mmaslano@redhat.com>
Fri, 22 May 2009 07:05:10 +0000 (09:05 +0200)
.gitignore
configure.ac
src/Makefile.am
src/pathnames.h

index 135f2ddc028ef033dea1154eaa5e8198ca740739..09f00bdc4fb5f433cef0bdf8a8575e0dc03471e5 100644 (file)
@@ -17,5 +17,6 @@ stamp-h1
 *.o
 src/crond
 src/crontab
+src/cron-paths.h
 *~
 *.tar.*
index c41b9cf53ee43a91afdd70444787f16e92e0453a..54d5778db00f2f59dd792a332ea20bd2843771c3 100644 (file)
@@ -211,6 +211,19 @@ AC_ARG_WITH(audit,
         fi ]
 )
 
+dnl CRON_VAR_DEFAULT (VAR, DESCRIPTION, DEFAULT)
+dnl --------------------------------------------
+AC_DEFUN([CRONIE_CONF_VAR],
+[AC_ARG_VAR([$1], [$2 @<:@$3@:>@])
+if test "$$1" = ""; then
+       $1='$3'
+fi
+])
+CRONIE_CONF_VAR([SYSCRONTAB], [the current working directory of the running daemon], [${sysconfdir}/crontab])
+CRONIE_CONF_VAR([SYS_CROND_DIR], [the current working directory of the running daemon], [${sysconfdir}/cron.d])
+CRONIE_CONF_VAR([CRONDIR], [the current working directory of the running daemon], [${localstatedir}/spool])
+CRONIE_CONF_VAR([SPOOL_DIR], [the directory where all the user cron tabs reside], [${CRONDIR}/cron])
+
 AC_CONFIG_FILES([Makefile src/Makefile man/Makefile])
 AC_OUTPUT
 
index 8f1906519b48ce656f74194701a4ba50ae9e397e..59608f98027bb66743061b26a0ba649c8c6bf8e8 100644 (file)
@@ -10,6 +10,10 @@ crontab_SOURCES = crontab.c $(common_src)
 common_src = entry.c env.c misc.c pw_dup.c security.c cron.h \
        externs.h funcs.h globals.h macros.h pathnames.h structs.h \
        bitstring.h
+common_nodist = cron-paths.h
+nodist_crond_SOURCES = $(common_nodist)
+nodist_crontab_SOURCES = $(common_nodist)
+BUILT_SOURCES = $(common_nodist)
 
 
 LDADD = $(LIBSELINUX) $(LIBPAM) $(LIBAUDIT)
@@ -17,3 +21,48 @@ LDADD = $(LIBSELINUX) $(LIBPAM) $(LIBAUDIT)
 ## if DEBUG
 ## noinst_PROGRAMS = debug
 ## endif
+
+# This header contains all the paths.
+# If they are configurable, they are declared in configure script.
+# Depends on this Makefile, because it uses make variables.
+cron-paths.h: Makefile
+       @echo 'creating $@'
+       @sed >$@ 's/ *\\$$//' <<\END #\
+       /* This file has been automatically generated.  Do not edit. */ \
+       \
+       #ifndef _CRON_PATHS_H_ \
+       #define _CRON_PATHS_H_ \
+       \
+                       /* CRONDIR is where cron(8) and crontab(1) both chdir \
+                        * to; SPOOL_DIR, CRON_ALLOW, CRON_DENY, and LOG_FILE \
+                        * are all relative to this directory. \
+                        * FIXME: Hey, but do we need this at all? --kasal \
+                        */ \
+       #define CRONDIR         "$(CRONDIR)" \
+       \
+                       /* SPOOLDIR is where the crontabs live. \
+                        * This directory will have its modtime updated \
+                        * whenever crontab(1) changes a crontab; this is \
+                        * the signal for cron(8) to look at each individual \
+                        * crontab file and reload those whose modtimes are \
+                        * newer than they were last time around (or which \
+                        * didn't exist last time around...) \
+                        */ \
+       #define SPOOL_DIR       "$(SPOOL_DIR)" \
+       \
+                       /* cron allow/deny file.  At least cron.deny must \
+                        * exist for ordinary users to run crontab. \
+                        */ \
+       #define CRON_ALLOW      "$(sysconfdir)/cron.allow" \
+       #define CRON_DENY       "$(sysconfdir)/cron.deny" \
+       \
+                       /* 4.3BSD-style crontab */ \
+       #define SYSCRONTAB      "$(SYSCRONTAB)" \
+       \
+                       /* system crontab dir */  \
+       #define SYS_CROND_DIR   "$(SYS_CROND_DIR)" \
+       \
+       #define SYSCONFDIR      "$(sysconfdir)" \
+       \
+       #endif /* _CRON_PATHS_H_ */ \
+       END
index a7616e845c473fc7cfed46b6047abffab04a6f9f..b5d5c70c953817c29217cf194ffddcf94f174586 100644 (file)
 # include <paths.h>
 #endif /*BSD*/
 
-#define REBOOT_LOCK            "/var/run/cron.reboot"
-
-#ifndef CRONDIR
-                       /* CRONDIR is where cron(8) and crontab(1) both chdir
-                        * to; SPOOL_DIR, CRON_ALLOW, CRON_DENY, and LOG_FILE
-                        * are all relative to this directory.
-                        */
-#define CRONDIR                "/var/spool"
-#endif
-
-                       /* SPOOLDIR is where the crontabs live.
-                        * This directory will have its modtime updated
-                        * whenever crontab(1) changes a crontab; this is
-                        * the signal for cron(8) to look at each individual
-                        * crontab file and reload those whose modtimes are
-                        * newer than they were last time around (or which
-                        * didn't exist last time around...)
-                        */
-#define SPOOL_DIR      "cron"
-
-                       /* cron allow/deny file.  At least cron.deny must
-                        * exist for ordinary users to run crontab.
-                        */
-#define        CRON_ALLOW      "/etc/cron.allow"
-#define        CRON_DENY       "/etc/cron.deny"
+#include "cron-paths.h"
 
                        /* where should the daemon stick its PID?
                         * PIDDIR must end in '/'.
+                        * (Don't ask why the default is "/etc/".)
                         */
 #ifdef _PATH_VARRUN
 # define PIDDIR        _PATH_VARRUN
 #else
-# define PIDDIR "/etc/"
+# define PIDDIR SYSCONFDIR "/"
 #endif
 #define PIDFILE                "crond.pid"
 #define _PATH_CRON_PID PIDDIR PIDFILE
-
-                       /* 4.3BSD-style crontab */
-#define SYSCRONTAB     "/etc/crontab"
-
-                        /* system crontab dir */ 
-#define SYS_CROND_DIR    "/etc/cron.d"
+#define REBOOT_LOCK     PIDDIR "cron.reboot"
 
                        /* what editor to use if no EDITOR or VISUAL
                         * environment variable specified.