at/at-3.1.14-parse-suse-sysconfig.patch

93 lines
2.7 KiB
Diff
Raw Normal View History

From: Cristian Rodríguez <crrodriguez@opensuse.org>
Last updated by: Jan Engelhardt <jengelh@inai.de>
http://bugzilla.novell.com/780259
---
Makefile.in | 4 ++--
atd.c | 21 +++++++++++++++++++++
configure.ac | 2 ++
3 files changed, 25 insertions(+), 2 deletions(-)
Index: at-3.2.0/Makefile.in
===================================================================
--- at-3.2.0.orig/Makefile.in
+++ at-3.2.0/Makefile.in
@@ -29,7 +29,7 @@ LEX = @LEX@
LEXLIB = @LEXLIB@
CC = @CC@
-CFLAGS = -I$(srcdir) @CFLAGS@
+CFLAGS = -I$(srcdir) @CFLAGS@ @HX_CFLAGS@
LDFLAGS = @LDFLAGS@
LFILE = $(ATJOB_DIR)/.SEQ
DEFS = @DEFS@ -DVERSION=\"$(VERSION)\" \
@@ -37,7 +37,7 @@ DEFS = @DEFS@ -DVERSION=\"$(VERSION)\"
-DDAEMON_USERNAME=\"$(DAEMON_USERNAME)\" \
-DDAEMON_GROUPNAME=\"$(DAEMON_GROUPNAME)\" \
-DLFILE=\"$(LFILE)\" -Wall
-LIBS = @LIBS@
+LIBS = @LIBS@ @HX_LIBS@
LIBOBJS = @LIBOBJS@
INSTALL = @INSTALL@
PAMLIB = @PAMLIB@
Index: at-3.2.0/atd.c
===================================================================
--- at-3.2.0.orig/atd.c
+++ at-3.2.0/atd.c
@@ -74,6 +74,10 @@
#include <syslog.h>
#endif
+#include <libHX/defs.h>
+#include <libHX/map.h>
+#include <libHX/option.h>
+
/* Local headers */
#include "privs.h"
@@ -798,6 +802,7 @@ main(int argc, char *argv[])
* for execution and yet another one, optionally, for sending mail.
* Files which already have run are removed during the next invocation.
*/
+ struct HXmap *sc_map;
int c;
time_t next_invocation;
struct sigaction act;
@@ -875,6 +880,22 @@ main(int argc, char *argv[])
}
}
+ sc_map = HX_shconfig_map("/etc/sysconfig/atd");
+ if (sc_map != NULL) {
+ char *v;
+
+ v = HXmap_get(sc_map, "ATD_BATCH_INTERVAL");
+ if (v != NULL && strlen(v) > 0) {
+ batch_interval = strtol(v, NULL, 0);
+ syslog(LOG_INFO, "sysconfig requested batch_interval to be set to %d\n", batch_interval);
+ }
+ v = HXmap_get(sc_map, "ATD_LOADAVG");
+ if (v != NULL && strlen(v) > 0) {
+ load_avg = strtod(v, NULL);
+ syslog(LOG_INFO, "sysconfig requested load_avg to be set to %f\n", load_avg);
+ }
+ }
+
namep = argv[0];
if (chdir(ATJOB_DIR) != 0)
perr("Cannot change to " ATJOB_DIR);
Index: at-3.2.0/configure.ac
===================================================================
--- at-3.2.0.orig/configure.ac
+++ at-3.2.0/configure.ac
@@ -54,6 +54,8 @@ AC_CHECK_LIB(fl,yywrap,
[Define to 1 if we need to provide our own yywrap()])
)
+PKG_CHECK_MODULES([HX], [libHX])
+
AC_CHECK_FUNCS([__secure_getenv secure_getenv])
dnl Checks for header files.
AC_HEADER_DIRENT