Blame SOURCES/autofs-5.1.4-use-systemd-sd_notify-at-startup.patch

304803
autofs-5.1.4 - use systemd sd_notify() at startup
304803
304803
From: Ian Kent <raven@themaw.net>
304803
304803
autofs needs to ensure statd is started before any NFS mounts
304803
are attempted.
304803
304803
When starting the statd service with the autofs service the statd
304803
service will trigger a restart of the autofs service during its
304803
start up. Sometimes this can happen during the automount start up
304803
itself.
304803
304803
When this happens it causes systemd to become confused and remove
304803
the pid file created by automount leaving systemd thinking the
304803
autofs service had failed start up when it was actually running.
304803
304803
It was recommened that autofs be changed to a "Type=notify" service
304803
to avoid this. Using this a pid file is no longer needed and is now
304803
not used.
304803
304803
Signed-off-by: Ian Kent <raven@themaw.net>
304803
---
304803
 CHANGELOG                 |    1 
304803
 Makefile.conf.in          |    3 
304803
 aclocal.m4                |    2 
304803
 autofs.spec               |    1 
304803
 configure                 |  577 +++++++++++++++++++++++++++++++++++-----------
304803
 configure.in              |   10 
304803
 daemon/Makefile           |    5 
304803
 daemon/automount.c        |   83 ++++--
304803
 samples/autofs.service.in |    5 
304803
 9 files changed, 529 insertions(+), 158 deletions(-)
304803
304803
--- autofs-5.0.7.orig/CHANGELOG
304803
+++ autofs-5.0.7/CHANGELOG
304803
@@ -300,6 +300,7 @@
304803
 - fix fd leak in rpc_do_create_client().
304803
 - add man page note about extra slashes in paths.
304803
 - add units After line to include statd service.
304803
+- use systemd sd_notify() at startup.
304803
 
304803
 25/07/2012 autofs-5.0.7
304803
 =======================
304803
--- autofs-5.0.7.orig/Makefile.conf.in
304803
+++ autofs-5.0.7/Makefile.conf.in
304803
@@ -15,6 +15,9 @@ DAEMON_LDFLAGS = @DAEMON_LDFLAGS@
304803
 LIBNSL    = @LIBNSL@
304803
 LIBRESOLV = @LIBRESOLV@
304803
 
304803
+SYSTEMD = @WITH_SYSTEMD@
304803
+LIBSYSTEMD = @systemd_LIBS@
304803
+
304803
 # Hesiod support: yes (1) no (0)
304803
 HESIOD = @HAVE_HESIOD@
304803
 LIBHESIOD = @LIBHESIOD@
304803
--- autofs-5.0.7.orig/autofs.spec
304803
+++ autofs-5.0.7/autofs.spec
304803
@@ -28,6 +28,7 @@ Source: ftp://ftp.kernel.org/pub/linux/d
304803
 Buildroot: %{_tmppath}/%{name}-tmp
304803
 %if %{with_systemd}
304803
 BuildRequires: systemd-units
304803
+BuildRequires: systemd-devel
304803
 %endif
304803
 %if %{with_libtirpc}
304803
 BuildRequires: libtirpc-devel
304803
--- autofs-5.0.7.orig/configure.in
304803
+++ autofs-5.0.7/configure.in
304803
@@ -11,6 +11,9 @@ define([AC_CACHE_LOAD], )dnl
304803
 define([AC_CACHE_SAVE], )dnl
304803
 AC_INIT(.autofs-5.0.7)
304803
 
304803
+# for pkg-config macros
304803
+m4_include([/usr/share/aclocal/pkg.m4])
304803
+
304803
 #
304803
 # autofs installs by default in /usr
304803
 #
304803
@@ -45,6 +48,7 @@ AF_INIT_D()
304803
 AC_SUBST(initdir)
304803
 AF_PID_D()
304803
 AC_SUBST(piddir)
304803
+PKG_PROG_PKG_CONFIG()
304803
 
304803
 #
304803
 # Check for systemd unit files direectory exists if unit file installation
304803
@@ -52,6 +56,12 @@ AC_SUBST(piddir)
304803
 #
304803
 AF_WITH_SYSTEMD()
304803
 AC_SUBST(systemddir)
304803
+AC_SUBST(WITH_SYSTEMD)
304803
+PKG_CHECK_MODULES([systemd],[libsystemd],,
304803
+[
304803
+  AC_CHECK_LIB(systemd, sm_notify, systemd_LIBS="-lsystemd")
304803
+  AC_SUBST(systemd_LIBS)
304803
+])
304803
 
304803
 #
304803
 # Location of system config script directory?
304803
--- autofs-5.0.7.orig/daemon/Makefile
304803
+++ autofs-5.0.7/daemon/Makefile
304803
@@ -22,6 +22,11 @@ CFLAGS += -DVERSION_STRING=\"$(version)\
304803
 LDFLAGS += -rdynamic
304803
 LIBS = -ldl
304803
 
304803
+ifeq ($(SYSTEMD), 1)
304803
+    CFLAGS += -DWITH_SYSTEMD
304803
+    LIBS += $(LIBSYSTEMD)
304803
+endif
304803
+
304803
 ifeq ($(LDAP), 1)
304803
     CFLAGS += $(XML_FLAGS)
304803
     LIBS += $(XML_LIBS)
304803
--- autofs-5.0.7.orig/daemon/automount.c
304803
+++ autofs-5.0.7/daemon/automount.c
304803
@@ -36,6 +36,9 @@
304803
 #include <dirent.h>
304803
 #include <sys/vfs.h>
304803
 #include <sys/utsname.h>
304803
+#ifdef WITH_SYSTEMD
304803
+#include <systemd/sd-daemon.h>
304803
+#endif
304803
 
304803
 #include "automount.h"
304803
 #if defined(LIBXML2_WORKAROUND) || defined(TIRPC_WORKAROUND)
304803
@@ -65,7 +68,7 @@ unsigned int global_selection_options;
304803
 long global_negative_timeout = -1;
304803
 int do_force_unlink = 0;		/* Forceably unlink mount tree at startup */
304803
 
304803
-static int start_pipefd[2];
304803
+static int start_pipefd[2] = {-1, -1};
304803
 static int st_stat = 1;
304803
 static int *pst_stat = &st_stat;
304803
 static pthread_t state_mach_thid;
304803
@@ -1208,12 +1211,6 @@ static void become_daemon(unsigned foreg
304803
 		exit(0);
304803
 	}
304803
 
304803
-	if (open_pipe(start_pipefd) < 0) {
304803
-		fprintf(stderr, "%s: failed to create start_pipefd.\n",
304803
-			program);
304803
-		exit(0);
304803
-	}
304803
-
304803
 	/* Detach from foreground process */
304803
 	if (foreground) {
304803
 		if (daemon_check && !aquire_flag_file()) {
304803
@@ -1223,6 +1220,12 @@ static void become_daemon(unsigned foreg
304803
 		}
304803
 		log_to_stderr();
304803
 	} else {
304803
+		if (open_pipe(start_pipefd) < 0) {
304803
+			fprintf(stderr, "%s: failed to create start_pipefd.\n",
304803
+				program);
304803
+			exit(0);
304803
+		}
304803
+
304803
 		pid = fork();
304803
 		if (pid > 0) {
304803
 			close(start_pipefd[1]);
304803
@@ -2455,8 +2458,10 @@ int main(int argc, char *argv[])
304803
 	if (pthread_attr_init(&th_attr)) {
304803
 		logerr("%s: failed to init thread attribute struct!",
304803
 		     program);
304803
-		res = write(start_pipefd[1], pst_stat, sizeof(*pst_stat));
304803
-		close(start_pipefd[1]);
304803
+		if (start_pipefd[1] != -1) {
304803
+			res = write(start_pipefd[1], pst_stat, sizeof(*pst_stat));
304803
+			close(start_pipefd[1]);
304803
+		}
304803
 		release_flag_file();
304803
 		macro_free_global_table();
304803
 		exit(1);
304803
@@ -2465,8 +2470,10 @@ int main(int argc, char *argv[])
304803
 	if (pthread_attr_init(&th_attr_detached)) {
304803
 		logerr("%s: failed to init thread attribute struct!",
304803
 		     program);
304803
-		res = write(start_pipefd[1], pst_stat, sizeof(*pst_stat));
304803
-		close(start_pipefd[1]);
304803
+		if (start_pipefd[1] != -1) {
304803
+			res = write(start_pipefd[1], pst_stat, sizeof(*pst_stat));
304803
+			close(start_pipefd[1]);
304803
+		}
304803
 		release_flag_file();
304803
 		macro_free_global_table();
304803
 		exit(1);
304803
@@ -2476,8 +2483,10 @@ int main(int argc, char *argv[])
304803
 			&th_attr_detached, PTHREAD_CREATE_DETACHED)) {
304803
 		logerr("%s: failed to set detached thread attribute!",
304803
 		     program);
304803
-		res = write(start_pipefd[1], pst_stat, sizeof(*pst_stat));
304803
-		close(start_pipefd[1]);
304803
+		if (start_pipefd[1] != -1) {
304803
+			res = write(start_pipefd[1], pst_stat, sizeof(*pst_stat));
304803
+			close(start_pipefd[1]);
304803
+		}
304803
 		release_flag_file();
304803
 		macro_free_global_table();
304803
 		exit(1);
304803
@@ -2488,8 +2497,10 @@ int main(int argc, char *argv[])
304803
 			&th_attr_detached, detached_thread_stack_size)) {
304803
 		logerr("%s: failed to set stack size thread attribute!",
304803
 		       program);
304803
-		res = write(start_pipefd[1], pst_stat, sizeof(*pst_stat));
304803
-		close(start_pipefd[1]);
304803
+		if (start_pipefd[1] != -1) {
304803
+			res = write(start_pipefd[1], pst_stat, sizeof(*pst_stat));
304803
+			close(start_pipefd[1]);
304803
+		}
304803
 		release_flag_file();
304803
 		macro_free_global_table();
304803
 		exit(1);
304803
@@ -2500,8 +2511,10 @@ int main(int argc, char *argv[])
304803
 			&th_attr_detached, &detached_thread_stack_size)) {
304803
 		logerr("%s: failed to get detached thread stack size!",
304803
 		       program);
304803
-		res = write(start_pipefd[1], pst_stat, sizeof(*pst_stat));
304803
-		close(start_pipefd[1]);
304803
+		if (start_pipefd[1] != -1) {
304803
+			res = write(start_pipefd[1], pst_stat, sizeof(*pst_stat));
304803
+			close(start_pipefd[1]);
304803
+		}
304803
 		release_flag_file();
304803
 		macro_free_global_table();
304803
 		exit(1);
304803
@@ -2518,8 +2531,10 @@ int main(int argc, char *argv[])
304803
 		logerr("%s: failed to create thread data key for std env vars!",
304803
 		       program);
304803
 		master_kill(master_list);
304803
-		res = write(start_pipefd[1], pst_stat, sizeof(*pst_stat));
304803
-		close(start_pipefd[1]);
304803
+		if (start_pipefd[1] != -1) {
304803
+			res = write(start_pipefd[1], pst_stat, sizeof(*pst_stat));
304803
+			close(start_pipefd[1]);
304803
+		}
304803
 		release_flag_file();
304803
 		macro_free_global_table();
304803
 		exit(1);
304803
@@ -2530,8 +2545,10 @@ int main(int argc, char *argv[])
304803
 		logerr("%s: failed to create thread data key for attempt ID!",
304803
 		       program);
304803
 		master_kill(master_list);
304803
-		res = write(start_pipefd[1], pst_stat, sizeof(*pst_stat));
304803
-		close(start_pipefd[1]);
304803
+		if (start_pipefd[1] != -1) {
304803
+			res = write(start_pipefd[1], pst_stat, sizeof(*pst_stat));
304803
+			close(start_pipefd[1]);
304803
+		}
304803
 		release_flag_file();
304803
 		macro_free_global_table();
304803
 		exit(1);
304803
@@ -2542,8 +2559,10 @@ int main(int argc, char *argv[])
304803
 	if (!alarm_start_handler()) {
304803
 		logerr("%s: failed to create alarm handler thread!", program);
304803
 		master_kill(master_list);
304803
-		res = write(start_pipefd[1], pst_stat, sizeof(*pst_stat));
304803
-		close(start_pipefd[1]);
304803
+		if (start_pipefd[1] != -1) {
304803
+			res = write(start_pipefd[1], pst_stat, sizeof(*pst_stat));
304803
+			close(start_pipefd[1]);
304803
+		}
304803
 		release_flag_file();
304803
 		macro_free_global_table();
304803
 		exit(1);
304803
@@ -2552,8 +2571,10 @@ int main(int argc, char *argv[])
304803
 	if (!st_start_handler()) {
304803
 		logerr("%s: failed to create FSM handler thread!", program);
304803
 		master_kill(master_list);
304803
-		res = write(start_pipefd[1], pst_stat, sizeof(*pst_stat));
304803
-		close(start_pipefd[1]);
304803
+		if (start_pipefd[1] != -1) {
304803
+			res = write(start_pipefd[1], pst_stat, sizeof(*pst_stat));
304803
+			close(start_pipefd[1]);
304803
+		}
304803
 		release_flag_file();
304803
 		macro_free_global_table();
304803
 		exit(1);
304803
@@ -2599,9 +2620,15 @@ int main(int argc, char *argv[])
304803
 	 */
304803
 	do_force_unlink = 0;
304803
 
304803
-	st_stat = 0;
304803
-	res = write(start_pipefd[1], pst_stat, sizeof(*pst_stat));
304803
-	close(start_pipefd[1]);
304803
+	if (start_pipefd[1] != -1) {
304803
+		st_stat = 0;
304803
+		res = write(start_pipefd[1], pst_stat, sizeof(*pst_stat));
304803
+		close(start_pipefd[1]);
304803
+	}
304803
+
304803
+#ifdef WITH_SYSTEMD
304803
+	sd_notify(1, "READY=1");
304803
+#endif
304803
 
304803
 	state_mach_thid = pthread_self();
304803
 	statemachine(NULL);
304803
--- autofs-5.0.7.orig/samples/autofs.service.in
304803
+++ autofs-5.0.7/samples/autofs.service.in
304803
@@ -4,10 +4,9 @@ After=network.target ypbind.service sssd
304803
 Wants=network-online.target rpc-statd.service rpcbind.service
304803
 
304803
 [Service]
304803
-Type=forking
304803
-PIDFile=@@autofspiddir@@/autofs.pid
304803
+Type=notify
304803
 EnvironmentFile=-@@autofsconfdir@@/autofs
304803
-ExecStart=@@sbindir@@/automount $OPTIONS --pid-file @@autofspiddir@@/autofs.pid
304803
+ExecStart=@@sbindir@@/automount $OPTIONS --foreground --dont-check-daemon
304803
 ExecReload=/usr/bin/kill -HUP $MAINPID
304803
 KillMode=process
304803
 TimeoutSec=180
304803
--- autofs-5.0.7.orig/configure
304803
+++ autofs-5.0.7/configure
304803
@@ -672,6 +672,10 @@ HAVE_MOUNT
304803
 MOUNT
304803
 DMALLOCLIB
304803
 TIRPCLIB
304803
+flagdir
304803
+fifodir
304803
+mapdir
304803
+confdir
304803
 OBJEXT
304803
 EXEEXT
304803
 ac_ct_CC
304803
@@ -679,11 +683,13 @@ CPPFLAGS
304803
 LDFLAGS
304803
 CFLAGS
304803
 CC
304803
-flagdir
304803
-fifodir
304803
-mapdir
304803
-confdir
304803
+systemd_LIBS
304803
+systemd_CFLAGS
304803
+WITH_SYSTEMD
304803
 systemddir
304803
+PKG_CONFIG_LIBDIR
304803
+PKG_CONFIG_PATH
304803
+PKG_CONFIG
304803
 piddir
304803
 initdir
304803
 target_alias
304803
@@ -748,6 +754,11 @@ enable_limit_getgrgid_size
304803
       ac_precious_vars='build_alias
304803
 host_alias
304803
 target_alias
304803
+PKG_CONFIG
304803
+PKG_CONFIG_PATH
304803
+PKG_CONFIG_LIBDIR
304803
+systemd_CFLAGS
304803
+systemd_LIBS
304803
 CC
304803
 CFLAGS
304803
 LDFLAGS
304803
@@ -1388,6 +1399,15 @@ Optional Packages:
304803
   --with-sasl=DIR	  enable SASL support for LDAP maps (libs and includes in DIR)
304803
 
304803
 Some influential environment variables:
304803
+  PKG_CONFIG  path to pkg-config utility
304803
+  PKG_CONFIG_PATH
304803
+              directories to add to pkg-config's search path
304803
+  PKG_CONFIG_LIBDIR
304803
+              path overriding pkg-config's built-in search path
304803
+  systemd_CFLAGS
304803
+              C compiler flags for systemd, overriding pkg-config
304803
+  systemd_LIBS
304803
+              linker flags for systemd, overriding pkg-config
304803
   CC          C compiler command
304803
   CFLAGS      C compiler flags
304803
   LDFLAGS     linker flags, e.g. -L<lib dir> if you have libraries in a
304803
@@ -2161,6 +2181,31 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
304803
 
304803
 
304803
 
304803
+# for pkg-config macros
304803
+# pkg.m4 - Macros to locate and utilise pkg-config.   -*- Autoconf -*-
304803
+# serial 11 (pkg-config-0.29.1)
304803
+
304803
+
304803
+
304803
+
304803
+
304803
+
304803
+
304803
+
304803
+
304803
+
304803
+
304803
+
304803
+
304803
+
304803
+
304803
+
304803
+
304803
+
304803
+
304803
+
304803
+
304803
+
304803
 #
304803
 # autofs installs by default in /usr
304803
 #
304803
@@ -2236,6 +2281,126 @@ if test -z "$piddir"; then
304803
 fi
304803
 
304803
 
304803
+
304803
+
304803
+
304803
+
304803
+
304803
+
304803
+if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
304803
+	if test -n "$ac_tool_prefix"; then
304803
+  # Extract the first word of "${ac_tool_prefix}pkg-config", so it can be a program name with args.
304803
+set dummy ${ac_tool_prefix}pkg-config; ac_word=$2
304803
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
304803
+$as_echo_n "checking for $ac_word... " >&6; }
304803
+if ${ac_cv_path_PKG_CONFIG+:} false; then :
304803
+  $as_echo_n "(cached) " >&6
304803
+else
304803
+  case $PKG_CONFIG in
304803
+  [\\/]* | ?:[\\/]*)
304803
+  ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path.
304803
+  ;;
304803
+  *)
304803
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
304803
+for as_dir in $PATH
304803
+do
304803
+  IFS=$as_save_IFS
304803
+  test -z "$as_dir" && as_dir=.
304803
+    for ac_exec_ext in '' $ac_executable_extensions; do
304803
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
304803
+    ac_cv_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext"
304803
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
304803
+    break 2
304803
+  fi
304803
+done
304803
+  done
304803
+IFS=$as_save_IFS
304803
+
304803
+  ;;
304803
+esac
304803
+fi
304803
+PKG_CONFIG=$ac_cv_path_PKG_CONFIG
304803
+if test -n "$PKG_CONFIG"; then
304803
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PKG_CONFIG" >&5
304803
+$as_echo "$PKG_CONFIG" >&6; }
304803
+else
304803
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
304803
+$as_echo "no" >&6; }
304803
+fi
304803
+
304803
+
304803
+fi
304803
+if test -z "$ac_cv_path_PKG_CONFIG"; then
304803
+  ac_pt_PKG_CONFIG=$PKG_CONFIG
304803
+  # Extract the first word of "pkg-config", so it can be a program name with args.
304803
+set dummy pkg-config; ac_word=$2
304803
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
304803
+$as_echo_n "checking for $ac_word... " >&6; }
304803
+if ${ac_cv_path_ac_pt_PKG_CONFIG+:} false; then :
304803
+  $as_echo_n "(cached) " >&6
304803
+else
304803
+  case $ac_pt_PKG_CONFIG in
304803
+  [\\/]* | ?:[\\/]*)
304803
+  ac_cv_path_ac_pt_PKG_CONFIG="$ac_pt_PKG_CONFIG" # Let the user override the test with a path.
304803
+  ;;
304803
+  *)
304803
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
304803
+for as_dir in $PATH
304803
+do
304803
+  IFS=$as_save_IFS
304803
+  test -z "$as_dir" && as_dir=.
304803
+    for ac_exec_ext in '' $ac_executable_extensions; do
304803
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
304803
+    ac_cv_path_ac_pt_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext"
304803
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
304803
+    break 2
304803
+  fi
304803
+done
304803
+  done
304803
+IFS=$as_save_IFS
304803
+
304803
+  ;;
304803
+esac
304803
+fi
304803
+ac_pt_PKG_CONFIG=$ac_cv_path_ac_pt_PKG_CONFIG
304803
+if test -n "$ac_pt_PKG_CONFIG"; then
304803
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_PKG_CONFIG" >&5
304803
+$as_echo "$ac_pt_PKG_CONFIG" >&6; }
304803
+else
304803
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
304803
+$as_echo "no" >&6; }
304803
+fi
304803
+
304803
+  if test "x$ac_pt_PKG_CONFIG" = x; then
304803
+    PKG_CONFIG=""
304803
+  else
304803
+    case $cross_compiling:$ac_tool_warned in
304803
+yes:)
304803
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
304803
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
304803
+ac_tool_warned=yes ;;
304803
+esac
304803
+    PKG_CONFIG=$ac_pt_PKG_CONFIG
304803
+  fi
304803
+else
304803
+  PKG_CONFIG="$ac_cv_path_PKG_CONFIG"
304803
+fi
304803
+
304803
+fi
304803
+if test -n "$PKG_CONFIG"; then
304803
+	_pkg_min_version=0.9.0
304803
+	{ $as_echo "$as_me:${as_lineno-$LINENO}: checking pkg-config is at least version $_pkg_min_version" >&5
304803
+$as_echo_n "checking pkg-config is at least version $_pkg_min_version... " >&6; }
304803
+	if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
304803
+		{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
304803
+$as_echo "yes" >&6; }
304803
+	else
304803
+		{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
304803
+$as_echo "no" >&6; }
304803
+		PKG_CONFIG=""
304803
+	fi
304803
+fi
304803
+
304803
 #
304803
 # Check for systemd unit files direectory exists if unit file installation
304803
 # is requested
304803
@@ -2255,9 +2420,11 @@ $as_echo_n "checking location of the sys
304803
       fi
304803
     done
304803
   fi
304803
+  WITH_SYSTEMD=0
304803
   if test -n "$systemddir"; then
304803
     { $as_echo "$as_me:${as_lineno-$LINENO}: result: $systemddir" >&5
304803
 $as_echo "$systemddir" >&6; }
304803
+    WITH_SYSTEMD=1
304803
   else
304803
     { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found" >&5
304803
 $as_echo "not found" >&6; }
304803
@@ -2268,129 +2435,6 @@ fi
304803
 
304803
 
304803
 
304803
-#
304803
-# Location of system config script directory?
304803
-#
304803
-if test -z "$confdir"; then
304803
-  for conf_d in /etc/sysconfig /etc/defaults /etc/conf.d /etc/default; do
304803
-    if test -z "$confdir"; then
304803
-      if test -d "$conf_d"; then
304803
-	confdir="$conf_d"
304803
-      fi
304803
-    fi
304803
-  done
304803
-fi
304803
-
304803
-# Check whether --with-confdir was given.
304803
-if test "${with_confdir+set}" = set; then :
304803
-  withval=$with_confdir; if test -z "$withval" -o "$withval" = "yes" -o "$withval" = "no"
304803
-	then
304803
-		:
304803
-	else
304803
-		confdir="${withval}"
304803
-	fi
304803
-
304803
-fi
304803
-
304803
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for autofs configuration file directory" >&5
304803
-$as_echo_n "checking for autofs configuration file directory... " >&6; }
304803
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $confdir" >&5
304803
-$as_echo "$confdir" >&6; }
304803
-
304803
-
304803
-#
304803
-# The user can specify --with-mapsdir=PATH to specify autofs maps go
304803
-#
304803
-if test -z "$mapdir"; then
304803
-  for map_d in /etc/autofs /etc; do
304803
-    if test -z "$mapdir"; then
304803
-      if test -d "$map_d"; then
304803
-	mapdir="$map_d"
304803
-      fi
304803
-    fi
304803
-  done
304803
-fi
304803
-
304803
-# Check whether --with-mapdir was given.
304803
-if test "${with_mapdir+set}" = set; then :
304803
-  withval=$with_mapdir; if test -z "$withval" -o "$withval" = "yes" -o "$withval" = "no"
304803
-	then
304803
-		:
304803
-	else
304803
-		mapdir="${withval}"
304803
-	fi
304803
-
304803
-fi
304803
-
304803
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for autofs maps directory" >&5
304803
-$as_echo_n "checking for autofs maps directory... " >&6; }
304803
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $mapdir" >&5
304803
-$as_echo "$mapdir" >&6; }
304803
-
304803
-
304803
-#
304803
-# The user can specify --with-fifodir=PATH to specify where autofs fifos go
304803
-#
304803
-if test -z "$fifodir"; then
304803
-  for fifo_d in /run /var/run /tmp; do
304803
-    if test -z "$fifodir"; then
304803
-      if test -d "$fifo_d"; then
304803
-        fifodir="$fifo_d"
304803
-      fi
304803
-    fi
304803
-  done
304803
-fi
304803
-
304803
-# Check whether --with-fifodir was given.
304803
-if test "${with_fifodir+set}" = set; then :
304803
-  withval=$with_fifodir; if test -z "$withval" -o "$withval" = "yes" -o "$withval" = "no"
304803
-	then
304803
-		:
304803
-	else
304803
-		fifodir="${withval}"
304803
-	fi
304803
-
304803
-fi
304803
-
304803
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for autofs fifos directory" >&5
304803
-$as_echo_n "checking for autofs fifos directory... " >&6; }
304803
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $fifodir" >&5
304803
-$as_echo "$fifodir" >&6; }
304803
-
304803
-
304803
-#
304803
-# The user can specify --with-flagdir=PATH to specify where autofs flag file goes
304803
-#
304803
-if test -z "$flagdir"; then
304803
-  for flag_d in /run /var/run /tmp; do
304803
-    if test -z "$flagdir"; then
304803
-      if test -d "$flag_d"; then
304803
-        flagdir="$flag_d"
304803
-      fi
304803
-    fi
304803
-  done
304803
-fi
304803
-
304803
-# Check whether --with-flagdir was given.
304803
-if test "${with_flagdir+set}" = set; then :
304803
-  withval=$with_flagdir; if test -z "$withval" -o "$withval" = "yes" -o "$withval" = "no"
304803
-	then
304803
-		:
304803
-	else
304803
-		filagdir="${withval}"
304803
-	fi
304803
-
304803
-fi
304803
-
304803
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for autofs flag file directory" >&5
304803
-$as_echo_n "checking for autofs flag file directory... " >&6; }
304803
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $flagdir" >&5
304803
-$as_echo "$flagdir" >&6; }
304803
-
304803
-
304803
-#
304803
-# Use libtirpc
304803
-#
304803
 ac_ext=c
304803
 ac_cpp='$CPP $CPPFLAGS'
304803
 ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
304803
@@ -3181,6 +3225,285 @@ ac_link='$CC -o conftest$ac_exeext $CFLA
304803
 ac_compiler_gnu=$ac_cv_c_compiler_gnu
304803
 
304803
 
304803
+
304803
+pkg_failed=no
304803
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for systemd" >&5
304803
+$as_echo_n "checking for systemd... " >&6; }
304803
+
304803
+if test -n "$systemd_CFLAGS"; then
304803
+    pkg_cv_systemd_CFLAGS="$systemd_CFLAGS"
304803
+ elif test -n "$PKG_CONFIG"; then
304803
+    if test -n "$PKG_CONFIG" && \
304803
+    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libsystemd\""; } >&5
304803
+  ($PKG_CONFIG --exists --print-errors "libsystemd") 2>&5
304803
+  ac_status=$?
304803
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
304803
+  test $ac_status = 0; }; then
304803
+  pkg_cv_systemd_CFLAGS=`$PKG_CONFIG --cflags "libsystemd" 2>/dev/null`
304803
+		      test "x$?" != "x0" && pkg_failed=yes
304803
+else
304803
+  pkg_failed=yes
304803
+fi
304803
+ else
304803
+    pkg_failed=untried
304803
+fi
304803
+if test -n "$systemd_LIBS"; then
304803
+    pkg_cv_systemd_LIBS="$systemd_LIBS"
304803
+ elif test -n "$PKG_CONFIG"; then
304803
+    if test -n "$PKG_CONFIG" && \
304803
+    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libsystemd\""; } >&5
304803
+  ($PKG_CONFIG --exists --print-errors "libsystemd") 2>&5
304803
+  ac_status=$?
304803
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
304803
+  test $ac_status = 0; }; then
304803
+  pkg_cv_systemd_LIBS=`$PKG_CONFIG --libs "libsystemd" 2>/dev/null`
304803
+		      test "x$?" != "x0" && pkg_failed=yes
304803
+else
304803
+  pkg_failed=yes
304803
+fi
304803
+ else
304803
+    pkg_failed=untried
304803
+fi
304803
+
304803
+
304803
+
304803
+if test $pkg_failed = yes; then
304803
+   	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
304803
+$as_echo "no" >&6; }
304803
+
304803
+if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
304803
+        _pkg_short_errors_supported=yes
304803
+else
304803
+        _pkg_short_errors_supported=no
304803
+fi
304803
+        if test $_pkg_short_errors_supported = yes; then
304803
+	        systemd_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "libsystemd" 2>&1`
304803
+        else
304803
+	        systemd_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "libsystemd" 2>&1`
304803
+        fi
304803
+	# Put the nasty error message in config.log where it belongs
304803
+	echo "$systemd_PKG_ERRORS" >&5
304803
+
304803
+
304803
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for sm_notify in -lsystemd" >&5
304803
+$as_echo_n "checking for sm_notify in -lsystemd... " >&6; }
304803
+if ${ac_cv_lib_systemd_sm_notify+:} false; then :
304803
+  $as_echo_n "(cached) " >&6
304803
+else
304803
+  ac_check_lib_save_LIBS=$LIBS
304803
+LIBS="-lsystemd  $LIBS"
304803
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
304803
+/* end confdefs.h.  */
304803
+
304803
+/* Override any GCC internal prototype to avoid an error.
304803
+   Use char because int might match the return type of a GCC
304803
+   builtin and then its argument prototype would still apply.  */
304803
+#ifdef __cplusplus
304803
+extern "C"
304803
+#endif
304803
+char sm_notify ();
304803
+int
304803
+main ()
304803
+{
304803
+return sm_notify ();
304803
+  ;
304803
+  return 0;
304803
+}
304803
+_ACEOF
304803
+if ac_fn_c_try_link "$LINENO"; then :
304803
+  ac_cv_lib_systemd_sm_notify=yes
304803
+else
304803
+  ac_cv_lib_systemd_sm_notify=no
304803
+fi
304803
+rm -f core conftest.err conftest.$ac_objext \
304803
+    conftest$ac_exeext conftest.$ac_ext
304803
+LIBS=$ac_check_lib_save_LIBS
304803
+fi
304803
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_systemd_sm_notify" >&5
304803
+$as_echo "$ac_cv_lib_systemd_sm_notify" >&6; }
304803
+if test "x$ac_cv_lib_systemd_sm_notify" = xyes; then :
304803
+  systemd_LIBS="-lsystemd"
304803
+fi
304803
+
304803
+
304803
+
304803
+elif test $pkg_failed = untried; then
304803
+     	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
304803
+$as_echo "no" >&6; }
304803
+
304803
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for sm_notify in -lsystemd" >&5
304803
+$as_echo_n "checking for sm_notify in -lsystemd... " >&6; }
304803
+if ${ac_cv_lib_systemd_sm_notify+:} false; then :
304803
+  $as_echo_n "(cached) " >&6
304803
+else
304803
+  ac_check_lib_save_LIBS=$LIBS
304803
+LIBS="-lsystemd  $LIBS"
304803
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
304803
+/* end confdefs.h.  */
304803
+
304803
+/* Override any GCC internal prototype to avoid an error.
304803
+   Use char because int might match the return type of a GCC
304803
+   builtin and then its argument prototype would still apply.  */
304803
+#ifdef __cplusplus
304803
+extern "C"
304803
+#endif
304803
+char sm_notify ();
304803
+int
304803
+main ()
304803
+{
304803
+return sm_notify ();
304803
+  ;
304803
+  return 0;
304803
+}
304803
+_ACEOF
304803
+if ac_fn_c_try_link "$LINENO"; then :
304803
+  ac_cv_lib_systemd_sm_notify=yes
304803
+else
304803
+  ac_cv_lib_systemd_sm_notify=no
304803
+fi
304803
+rm -f core conftest.err conftest.$ac_objext \
304803
+    conftest$ac_exeext conftest.$ac_ext
304803
+LIBS=$ac_check_lib_save_LIBS
304803
+fi
304803
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_systemd_sm_notify" >&5
304803
+$as_echo "$ac_cv_lib_systemd_sm_notify" >&6; }
304803
+if test "x$ac_cv_lib_systemd_sm_notify" = xyes; then :
304803
+  systemd_LIBS="-lsystemd"
304803
+fi
304803
+
304803
+
304803
+
304803
+else
304803
+	systemd_CFLAGS=$pkg_cv_systemd_CFLAGS
304803
+	systemd_LIBS=$pkg_cv_systemd_LIBS
304803
+        { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
304803
+$as_echo "yes" >&6; }
304803
+
304803
+fi
304803
+
304803
+#
304803
+# Location of system config script directory?
304803
+#
304803
+if test -z "$confdir"; then
304803
+  for conf_d in /etc/sysconfig /etc/defaults /etc/conf.d /etc/default; do
304803
+    if test -z "$confdir"; then
304803
+      if test -d "$conf_d"; then
304803
+	confdir="$conf_d"
304803
+      fi
304803
+    fi
304803
+  done
304803
+fi
304803
+
304803
+# Check whether --with-confdir was given.
304803
+if test "${with_confdir+set}" = set; then :
304803
+  withval=$with_confdir; if test -z "$withval" -o "$withval" = "yes" -o "$withval" = "no"
304803
+	then
304803
+		:
304803
+	else
304803
+		confdir="${withval}"
304803
+	fi
304803
+
304803
+fi
304803
+
304803
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for autofs configuration file directory" >&5
304803
+$as_echo_n "checking for autofs configuration file directory... " >&6; }
304803
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $confdir" >&5
304803
+$as_echo "$confdir" >&6; }
304803
+
304803
+
304803
+#
304803
+# The user can specify --with-mapsdir=PATH to specify autofs maps go
304803
+#
304803
+if test -z "$mapdir"; then
304803
+  for map_d in /etc/autofs /etc; do
304803
+    if test -z "$mapdir"; then
304803
+      if test -d "$map_d"; then
304803
+	mapdir="$map_d"
304803
+      fi
304803
+    fi
304803
+  done
304803
+fi
304803
+
304803
+# Check whether --with-mapdir was given.
304803
+if test "${with_mapdir+set}" = set; then :
304803
+  withval=$with_mapdir; if test -z "$withval" -o "$withval" = "yes" -o "$withval" = "no"
304803
+	then
304803
+		:
304803
+	else
304803
+		mapdir="${withval}"
304803
+	fi
304803
+
304803
+fi
304803
+
304803
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for autofs maps directory" >&5
304803
+$as_echo_n "checking for autofs maps directory... " >&6; }
304803
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $mapdir" >&5
304803
+$as_echo "$mapdir" >&6; }
304803
+
304803
+
304803
+#
304803
+# The user can specify --with-fifodir=PATH to specify where autofs fifos go
304803
+#
304803
+if test -z "$fifodir"; then
304803
+  for fifo_d in /run /var/run /tmp; do
304803
+    if test -z "$fifodir"; then
304803
+      if test -d "$fifo_d"; then
304803
+        fifodir="$fifo_d"
304803
+      fi
304803
+    fi
304803
+  done
304803
+fi
304803
+
304803
+# Check whether --with-fifodir was given.
304803
+if test "${with_fifodir+set}" = set; then :
304803
+  withval=$with_fifodir; if test -z "$withval" -o "$withval" = "yes" -o "$withval" = "no"
304803
+	then
304803
+		:
304803
+	else
304803
+		fifodir="${withval}"
304803
+	fi
304803
+
304803
+fi
304803
+
304803
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for autofs fifos directory" >&5
304803
+$as_echo_n "checking for autofs fifos directory... " >&6; }
304803
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $fifodir" >&5
304803
+$as_echo "$fifodir" >&6; }
304803
+
304803
+
304803
+#
304803
+# The user can specify --with-flagdir=PATH to specify where autofs flag file goes
304803
+#
304803
+if test -z "$flagdir"; then
304803
+  for flag_d in /run /var/run /tmp; do
304803
+    if test -z "$flagdir"; then
304803
+      if test -d "$flag_d"; then
304803
+        flagdir="$flag_d"
304803
+      fi
304803
+    fi
304803
+  done
304803
+fi
304803
+
304803
+# Check whether --with-flagdir was given.
304803
+if test "${with_flagdir+set}" = set; then :
304803
+  withval=$with_flagdir; if test -z "$withval" -o "$withval" = "yes" -o "$withval" = "no"
304803
+	then
304803
+		:
304803
+	else
304803
+		filagdir="${withval}"
304803
+	fi
304803
+
304803
+fi
304803
+
304803
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for autofs flag file directory" >&5
304803
+$as_echo_n "checking for autofs flag file directory... " >&6; }
304803
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $flagdir" >&5
304803
+$as_echo "$flagdir" >&6; }
304803
+
304803
+
304803
+#
304803
+# Use libtirpc
304803
+#
304803
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking if libtirpc is requested and available" >&5
304803
 $as_echo_n "checking if libtirpc is requested and available... " >&6; }
304803
 
304803
--- autofs-5.0.7.orig/aclocal.m4
304803
+++ autofs-5.0.7/aclocal.m4
304803
@@ -242,8 +242,10 @@ AC_DEFUN([AF_WITH_SYSTEMD],
304803
       fi
304803
     done
304803
   fi
304803
+  WITH_SYSTEMD=0
304803
   if test -n "$systemddir"; then
304803
     AC_MSG_RESULT($systemddir)
304803
+    WITH_SYSTEMD=1
304803
   else
304803
     AC_MSG_RESULT(not found)
304803
   fi