* Mon Dec 5 2011 Ian Kent <ikent@redhat.com> - 1:5.0.6-5

- fix ipv6 name lookup check.
- fix ipv6 rpc calls.
- fix ipv6 configure check.
- add piddir to configure.
- add systemd unit support.
- fix MNT_DETACH define.
This commit is contained in:
Ian Kent 2011-12-05 15:09:33 +08:00
parent 3d4e057cef
commit 3d12a7aac3
7 changed files with 1408 additions and 7 deletions

View File

@ -0,0 +1,145 @@
autofs-5.0.5 - add piddir to configure
From: Ian Kent <ikent@redhat.com>
In order to accomodate possible changes or different pid file
locations add directory selection for pid file directory to
configure. Also update the fifo directory and flag file directory
configure checks.
---
CHANGELOG | 1 +
Makefile.conf.in | 3 +++
aclocal.m4 | 20 ++++++++++++++++++--
configure | 4 ++--
redhat/Makefile | 1 +
redhat/autofs.init.in | 4 ++--
samples/Makefile | 2 +-
7 files changed, 28 insertions(+), 7 deletions(-)
--- autofs-5.0.6.orig/CHANGELOG
+++ autofs-5.0.6/CHANGELOG
@@ -16,6 +16,7 @@
- fix ipv6 name lookup check.
- fix ipv6 rpc calls.
- fix ipv6 configure check.
+- add piddir to configure.
28/06/2011 autofs-5.0.6
-----------------------
--- autofs-5.0.6.orig/Makefile.conf.in
+++ autofs-5.0.6/Makefile.conf.in
@@ -79,6 +79,9 @@ autofsconfdir = @confdir@
# Location for autofs maps
autofsmapdir = @mapdir@
+# Localtion of pid files
+autofspiddir = @piddir@
+
# Location for autofs fifos
autofsfifodir = @fifodir@
--- autofs-5.0.6.orig/aclocal.m4
+++ autofs-5.0.6/aclocal.m4
@@ -121,13 +121,29 @@ AC_DEFUN(AF_MAP_D,
fi])
dnl --------------------------------------------------------------------------
+dnl AF_PID_D
+dnl
+dnl Check the location of the pid file directory.
+dnl --------------------------------------------------------------------------
+AC_DEFUN(AF_PID_D,
+[if test -z "$piddir"; then
+ for pid_d in /run /var/run /tmp; do
+ if test -z "$piddir"; then
+ if test -d "$pid_d"; then
+ piddir="$pid_d"
+ fi
+ fi
+ done
+fi])
+
+dnl --------------------------------------------------------------------------
dnl AF_FIFO_D
dnl
dnl Check the location of the autofs fifos directory
dnl --------------------------------------------------------------------------
AC_DEFUN(AF_FIFO_D,
[if test -z "$fifodir"; then
- for fifo_d in /var/run /tmp; do
+ for fifo_d in /run /var/run /tmp; do
if test -z "$fifodir"; then
if test -d "$fifo_d"; then
fifodir="$fifo_d"
@@ -143,7 +159,7 @@ dnl Check the location of the autofs fla
dnl --------------------------------------------------------------------------
AC_DEFUN(AF_FLAG_D,
[if test -z "$flagdir"; then
- for flag_d in /var/run /tmp; do
+ for flag_d in /run /var/run /tmp; do
if test -z "$flagdir"; then
if test -d "$flag_d"; then
flagdir="$flag_d"
--- autofs-5.0.6.orig/configure
+++ autofs-5.0.6/configure
@@ -2184,7 +2184,7 @@ $as_echo "$mapdir" >&6; }
# The user can specify --with-fifodir=PATH to specify where autofs fifos go
#
if test -z "$fifodir"; then
- for fifo_d in /var/run /tmp; do
+ for fifo_d in /run /var/run /tmp; do
if test -z "$fifodir"; then
if test -d "$fifo_d"; then
fifodir="$fifo_d"
@@ -2214,7 +2214,7 @@ $as_echo "$fifodir" >&6; }
# The user can specify --with-flagdir=PATH to specify where autofs flag file goes
#
if test -z "$flagdir"; then
- for flag_d in /var/run /tmp; do
+ for flag_d in /run /var/run /tmp; do
if test -z "$flagdir"; then
if test -d "$flag_d"; then
flagdir="$flag_d"
--- autofs-5.0.6.orig/redhat/Makefile
+++ autofs-5.0.6/redhat/Makefile
@@ -8,6 +8,7 @@ autofs.init: autofs.init.in
sed -e "s|@@sbindir@@|$(sbindir)|g" \
-e "s|@@autofslibdir@@|$(autofslibdir)|g" \
-e "s|@@autofsconfdir@@|$(autofsconfdir)|g" \
+ -e "s|@@autofspiddir@@|$(autofspiddir)|g" \
-e "s|@@initdir@@|$(initdir)|g" < autofs.init.in > autofs.init
autofs.sysconfig: autofs.sysconfig.in
--- autofs-5.0.6.orig/redhat/autofs.init.in
+++ autofs-5.0.6/redhat/autofs.init.in
@@ -86,7 +86,7 @@ function start() {
fi
echo -n $"Starting $prog: "
- $prog $OPTIONS --pid-file /var/run/autofs.pid
+ $prog $OPTIONS --pid-file @@autofspiddir@@/autofs.pid
RETVAL=$?
if [ $RETVAL -eq 0 ] ; then
success "$prog startup"
@@ -171,7 +171,7 @@ case "$1" in
stop
;;
status)
- status -p /var/run/autofs.pid -l autofs $prog
+ status -p @@autofspiddir@@/autofs.pid -l autofs $prog
;;
restart|force-reload)
restart
--- autofs-5.0.6.orig/samples/Makefile
+++ autofs-5.0.6/samples/Makefile
@@ -21,7 +21,7 @@ dirs:
install -d -m 755 $(INSTALLROOT)$(autofsmapdir)
install -d -m 755 $(INSTALLROOT)$(autofsconfdir)
install -d -m 755 $(INSTALLROOT)$(autofslibdir)
- install -d -m 755 $(INSTALLROOT)/var/run/autofs
+ install -d -m 755 $(INSTALLROOT)$(autofspiddir)
.PHONY: autofs.init
autofs.init:

View File

@ -0,0 +1,388 @@
autofs-5.0.5 - add systemd unit support
From: Ian Kent <ikent@redhat.com>
Add a systemd unit file and attempt to integrating it into our
install.
---
CHANGELOG | 1
Makefile.conf.in | 2 +
aclocal.m4 | 28 ++++++++++++++++++++++
autofs.spec | 58 +++++++++++++++++++++++++++++++++++++++++-----
configure | 47 +++++++++++++++++++++++++++++++++++++
configure.in | 9 +++++++
redhat/Makefile | 10 ++++++-
samples/Makefile | 23 +++++++++++++-----
samples/autofs.service.in | 12 +++++++++
9 files changed, 176 insertions(+), 14 deletions(-)
create mode 100644 samples/autofs.service.in
--- autofs-5.0.6.orig/CHANGELOG
+++ autofs-5.0.6/CHANGELOG
@@ -17,6 +17,7 @@
- fix ipv6 rpc calls.
- fix ipv6 configure check.
- add piddir to configure.
+- add systemd unit support.
28/06/2011 autofs-5.0.6
-----------------------
--- autofs-5.0.6.orig/Makefile.conf.in
+++ autofs-5.0.6/Makefile.conf.in
@@ -98,3 +98,5 @@ mandir = @mandir@
# Location for init.d files
initdir = @initdir@
+# Location of systemd unit files
+systemddir = @systemddir@
--- autofs-5.0.6.orig/aclocal.m4
+++ autofs-5.0.6/aclocal.m4
@@ -199,6 +199,34 @@ fi], [AC_MSG_RESULT(no)])
])
dnl --------------------------------------------------------------------------
+dnl AF_WITH_SYSTEMD
+dnl
+dnl Check the location of the systemd unit files directory
+dnl --------------------------------------------------------------------------
+AC_DEFUN([AF_WITH_SYSTEMD],
+[AC_ARG_WITH(systemd,
+[ --with-systemd install systemd unit file if systemd unit directory
+ is found on system],
+[if test "$withval" = yes; then
+ if test -z "$systemddir"; then
+ AC_MSG_CHECKING([location of the systemd unit files directory])
+ for systemd_d in /lib/systemd/system; do
+ if test -z "$systemddir"; then
+ if test -d "$systemd_d"; then
+ systemddir="$systemd_d"
+ fi
+ fi
+ done
+ fi
+ if test -n "$systemddir"; then
+ AC_MSG_RESULT($systemddir)
+ else
+ AC_MSG_RESULT(not found)
+ fi
+fi])
+])
+
+dnl --------------------------------------------------------------------------
dnl AF_CHECK_LIBXML
dnl
dnl Check for lib xml
--- autofs-5.0.6.orig/autofs.spec
+++ autofs-5.0.6/autofs.spec
@@ -8,6 +8,10 @@
%define _lib lib64
%endif
+# Use --without systemd in your rpmbuild command or force values to 0 to
+# disable them.
+%define with_systemd %{?_without_systemd: 0} %{?!_without_systemd: 1}
+
Summary: A tool from automatically mounting and umounting filesystems.
Name: autofs
%define version 5.0.6
@@ -18,9 +22,18 @@ License: GPL
Group: System Environment/Daemons
Source: ftp://ftp.kernel.org/pub/linux/daemons/autofs/v4/autofs-%{version}.tar.gz
Buildroot: %{_tmppath}/%{name}-tmp
+%if %{with_systemd}
+BuildRequires: systemd-units
+%endif
BuildPrereq: autoconf, hesiod-devel, openldap-devel, bison, flex, cyrus-sasl-devel
Prereq: chkconfig
Requires: /bin/bash mktemp sed textutils sh-utils grep /bin/ps
+%if %{with_systemd}
+Requires(post): systemd-sysv
+Requires(post): systemd-units
+Requires(preun): systemd-units
+Requires(postun): systemd-units
+%endif
Obsoletes: autofs-ldap
Summary(de): autofs daemon
Summary(fr): démon autofs
@@ -55,14 +68,22 @@ inkludera nätfilsystem, CD-ROM, floppydi
%prep
%setup -q
echo %{version}-%{release} > .version
+%if %{with_systemd}
+ %define _unitdir %{?_unitdir:/lib/systemd/system}
+ %define systemd_configure_arg --with-systemd
+%endif
%build
-CFLAGS="$RPM_OPT_FLAGS -Wall" ./configure --libdir=%{_libdir} --disable-mount-locking --enable-ignore-busy --with-libtirpc --disable-mount-move
+CFLAGS="$RPM_OPT_FLAGS -Wall" ./configure --libdir=%{_libdir} --disable-mount-locking --enable-ignore-busy --with-libtirpc --disable-mount-move %{?systemd_configure_arg:}
CFLAGS="$RPM_OPT_FLAGS -Wall" make initdir=/etc/rc.d/init.d DONTSTRIP=1
%install
rm -rf $RPM_BUILD_ROOT
+%if %{with_systemd}
+install -d -m 755 $RPM_BUILD_ROOT%{_unitdir}
+%else
mkdir -p -m755 $RPM_BUILD_ROOT/etc/rc.d/init.d
+%endif
mkdir -p -m755 $RPM_BUILD_ROOT%{_sbindir}
mkdir -p -m755 $RPM_BUILD_ROOT%{_libdir}/autofs
mkdir -p -m755 $RPM_BUILD_ROOT%{_mandir}/{man5,man8}
@@ -70,31 +91,56 @@ mkdir -p -m755 $RPM_BUILD_ROOT/etc/sysco
mkdir -p -m755 $RPM_BUILD_ROOT/etc/auto.master.d
make install mandir=%{_mandir} initdir=/etc/rc.d/init.d INSTALLROOT=$RPM_BUILD_ROOT
+echo make -C redhat
make -C redhat
+%if %{with_systemd}
+install -m 644 redhat/autofs.service $RPM_BUILD_ROOT%{_unitdir}/autofs.service
+%else
install -m 755 redhat/autofs.init $RPM_BUILD_ROOT/etc/rc.d/init.d/autofs
+%endif
install -m 644 redhat/autofs.sysconfig $RPM_BUILD_ROOT/etc/sysconfig/autofs
%clean
[ "$RPM_BUILD_ROOT" != "/" ] && rm -rf $RPM_BUILD_ROOT
%post
+%if %{with_systemd}
+/bin/systemctl daemon-reload >/dev/null 2>&1 || :
+%else
chkconfig --add autofs
-
-%postun
-if [ $1 -ge 1 ] ; then
- /sbin/service autofs condrestart > /dev/null 2>&1 || :
-fi
+%endif
%preun
if [ "$1" = 0 ] ; then
+%if %{with_systemd}
+ /bin/systemctl --no-reload disable autofs.service > /dev/null 2>&1 || :
+ /bin/systemctl stop autofs.service > /dev/null 2>&1 || :
+%else
/sbin/service autofs stop > /dev/null 2>&1 || :
/sbin/chkconfig --del autofs
+%endif
fi
+%postun
+%if %{with_systemd}
+/bin/systemctl daemon-reload >/dev/null 2>&1 || :
+if [ $1 -ge 1 ] ; then
+ /bin/systemctl try-restart autofs.service >/dev/null 2>&1 || :
+fi
+%else
+if [ $1 -ge 1 ] ; then
+ /sbin/service autofs condrestart > /dev/null 2>&1 || :
+fi
+%endif
+
%files
%defattr(-,root,root)
%doc CREDITS CHANGELOG INSTALL COPY* README* samples/ldap* samples/autofs.schema samples/autofs_ldap_auth.conf
+%if %{with_systemd}
+%{_unitdir}/autofs.service
+%else
%config /etc/rc.d/init.d/autofs
+%endif
%config(noreplace) /etc/auto.master
%config(noreplace,missingok) /etc/auto.misc
%config(noreplace,missingok) /etc/auto.net
--- autofs-5.0.6.orig/configure
+++ autofs-5.0.6/configure
@@ -650,6 +650,8 @@ flagdir
fifodir
mapdir
confdir
+systemddir
+piddir
initdir
target_alias
host_alias
@@ -693,6 +695,7 @@ ac_subst_files=''
ac_user_opts='
enable_option_checking
with_path
+with_systemd
with_confdir
with_mapdir
with_fifodir
@@ -1337,6 +1340,8 @@ Optional Packages:
--with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
--without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no)
--with-path=PATH look in PATH for binaries needed by the automounter
+ --with-systemd install systemd unit file if systemd unit directory
+ is found on system
--with-confdir=DIR use DIR for autofs configuration files
--with-mapdir=PATH look in PATH for mount maps used by the automounter
--with-fifodir=PATH use PATH as the directory for fifos used by the automounter
@@ -2119,6 +2124,48 @@ $as_echo "$initdir" >&6; }
done
fi
+if test -z "$piddir"; then
+ for pid_d in /run /var/run /tmp; do
+ if test -z "$piddir"; then
+ if test -d "$pid_d"; then
+ piddir="$pid_d"
+ fi
+ fi
+ done
+fi
+
+
+#
+# Check for systemd unit files direectory exists if unit file installation
+# is requested
+#
+
+# Check whether --with-systemd was given.
+if test "${with_systemd+set}" = set; then :
+ withval=$with_systemd; if test "$withval" = yes; then
+ if test -z "$systemddir"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking location of the systemd unit files directory" >&5
+$as_echo_n "checking location of the systemd unit files directory... " >&6; }
+ for systemd_d in /lib/systemd/system; do
+ if test -z "$systemddir"; then
+ if test -d "$systemd_d"; then
+ systemddir="$systemd_d"
+ fi
+ fi
+ done
+ fi
+ if test -n "$systemddir"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $systemddir" >&5
+$as_echo "$systemddir" >&6; }
+ else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found" >&5
+$as_echo "not found" >&6; }
+ fi
+fi
+fi
+
+
+
#
# Location of system config script directory?
--- autofs-5.0.6.orig/configure.in
+++ autofs-5.0.6/configure.in
@@ -43,6 +43,15 @@ AF_LINUX_PROCFS()
#
AF_INIT_D()
AC_SUBST(initdir)
+AF_PID_D()
+AC_SUBST(piddir)
+
+#
+# Check for systemd unit files direectory exists if unit file installation
+# is requested
+#
+AF_WITH_SYSTEMD()
+AC_SUBST(systemddir)
#
# Location of system config script directory?
--- autofs-5.0.6.orig/redhat/Makefile
+++ autofs-5.0.6/redhat/Makefile
@@ -2,7 +2,7 @@
-include ../Makefile.conf
include ../Makefile.rules
-all: autofs.init autofs.sysconfig
+all: autofs.init autofs.sysconfig autofs.service
autofs.init: autofs.init.in
sed -e "s|@@sbindir@@|$(sbindir)|g" \
@@ -15,6 +15,12 @@ autofs.sysconfig: autofs.sysconfig.in
sed -e "s|@@autofsmapdir@@|$(autofsmapdir)|g" \
< autofs.sysconfig.in > autofs.sysconfig
+autofs.service: ../samples/autofs.service.in
+ sed -e "s|@@sbindir@@|$(sbindir)|g" \
+ -e "s|@@autofsconfdir@@|$(autofsconfdir)|g" \
+ -e "s|@@autofspiddir@@|$(autofspiddir)|g" \
+ < ../samples/autofs.service.in > autofs.service
+
clean:
- rm -f autofs.init autofs.sysconfig
+ rm -f autofs.init autofs.sysconfig autofs.service
--- autofs-5.0.6.orig/samples/Makefile
+++ autofs-5.0.6/samples/Makefile
@@ -4,7 +4,7 @@ include ../Makefile.rules
SAMPLES = auto.master auto.misc auto.net auto.smb
-all: rc.autofs autofs.conf.default
+all: rc.autofs autofs.conf.default autofs.service
rc.autofs: rc.autofs.in
sed -e "s|@@sbindir@@|$(sbindir)|g" \
@@ -16,6 +16,12 @@ autofs.conf.default: autofs.conf.default
sed -e "s|@@autofsmapdir@@|$(autofsmapdir)|g" \
< autofs.conf.default.in > autofs.conf.default
+autofs.service: autofs.service.in
+ sed -e "s|@@sbindir@@|$(sbindir)|g" \
+ -e "s|@@autofsconfdir@@|$(autofsconfdir)|g" \
+ -e "s|@@autofspiddir@@|$(autofspiddir)|g" \
+ < autofs.service.in > autofs.service
+
.PHONY: dirs
dirs:
install -d -m 755 $(INSTALLROOT)$(autofsmapdir)
@@ -26,13 +32,18 @@ dirs:
.PHONY: autofs.init
autofs.init:
@echo
-ifneq ($(initdir),)
+ifneq ($(systemddir),)
+ install -d -m 755 $(INSTALLROOT)$(systemddir)
+ install autofs.service -m 644 $(INSTALLROOT)$(systemddir)/autofs.service
+else
+ ifneq ($(initdir),)
install -d -m 755 $(INSTALLROOT)$(initdir)
install rc.autofs -m 755 $(INSTALLROOT)$(initdir)/autofs
-else
+ else
if test -d $(INSTALLROOT)/etc/rc.d ; then \
install -c rc.autofs -m 755 $(INSTALLROOT)/etc/rc.d ; \
fi
+ endif
endif
CONFIG = $(shell test -e $(INSTALLROOT)$(autofsconfdir)/autofs.orig || echo "-b --suffix=.orig")
@@ -173,10 +184,10 @@ auto.smb:
fi ; \
fi
-install: rc.autofs autofs.conf.default dirs autofs.init autofs.conf \
- autofs_ldap_auth.conf $(SAMPLES)
+install: rc.autofs autofs.conf.default dirs autofs.init autofs.service \
+ autofs.conf autofs_ldap_auth.conf $(SAMPLES)
@echo
clean:
- rm -f *.o *.s rc.autofs autofs.conf.default
+ rm -f *.o *.s rc.autofs autofs.conf.default autofs.service
--- /dev/null
+++ autofs-5.0.6/samples/autofs.service.in
@@ -0,0 +1,12 @@
+[Unit]
+Description=Automounts filesystems on demand
+After=network.target ypbind.service
+
+[Service]
+Type=forking
+PIDFile=@@autofspiddir@@/autofs.pid
+EnvironmentFile=-@@autofsconfdir@@/autofs
+ExecStart=@@sbindir@@/automount ${OPTIONS} --pid-file @@autofspiddir@@/autofs.pid
+
+[Install]
+WantedBy=multi-user.target

View File

@ -0,0 +1,23 @@
autofs-5.0.6 - fix MNT_DETACH define
From: Ian Kent <raven@themaw.net>
MNT_DETACH has been included in herder file
---
include/automount.h | 2 ++
1 file changed, 2 insertions(+)
--- autofs-5.0.6.orig/include/automount.h
+++ autofs-5.0.6/include/automount.h
@@ -333,7 +333,9 @@ int ncat_path(char *buf, size_t len,
/* Core automount definitions */
+#ifndef MNT_DETACH
#define MNT_DETACH 0x00000002 /* Just detach from the tree */
+#endif
struct startup_cond {
pthread_mutex_t mutex;

View File

@ -0,0 +1,185 @@
autofs-5.0.6 - fix ipv6 configure check
From: Ian Kent <ikent@redhat.com>
Since the functions clntudp6_bufcreate() and clnttcp6_create() of
libtirpc were never actually included in the library our reference
to clntudp6_bufcreate() in configure needs to be removed.
Having redone the libtirpc interface (after realizing these functions
were defined but not actually included in the library) checking for
IPv6 support can't be done now and we need to rely on the transport
independent nature of libtirpc to take care of this. So the INET6
checks have been replaced with WITH_LIBTIRPC checks instead.
---
CHANGELOG | 1 +
aclocal.m4 | 36 ------------------------------------
configure | 46 ----------------------------------------------
include/config.h.in | 3 ---
modules/replicated.c | 10 +++++++---
5 files changed, 8 insertions(+), 88 deletions(-)
--- autofs-5.0.6.orig/CHANGELOG
+++ autofs-5.0.6/CHANGELOG
@@ -15,6 +15,7 @@
- add disable move mount configure option.
- fix ipv6 name lookup check.
- fix ipv6 rpc calls.
+- fix ipv6 configure check.
28/06/2011 autofs-5.0.6
-----------------------
--- autofs-5.0.6.orig/aclocal.m4
+++ autofs-5.0.6/aclocal.m4
@@ -324,41 +324,6 @@ LIBS="$af_check_ldap_parse_page_control_
])
dnl --------------------------------------------------------------------------
-dnl AF_CHECK_LIBTIRPC_IPV6
-dnl
-dnl Use libtirpc for rpc transport
-dnl --------------------------------------------------------------------------
-AC_DEFUN([AF_CHECK_LIBTIRPC_IPV6],
-[AC_MSG_CHECKING(if libtirpc has IPv6 support)
-
-# save current flags
-af_check_libtirpc_ipv6_save_cflags="$CFLAGS"
-af_check_libtirpc_ipv6_save_ldflags="$LDFLAGS"
-CFLAGS="$CFLAGS -I/usr/include/tirpc"
-LDFLAGS="$LDFLAGS -ltirpc"
-
-AC_TRY_LINK(
- [ #define INET6
- #include <rpc/rpc.h> ],
- [ CLIENT *cl;
- struct sockaddr_in6 addr;
- int fd;
- unsigned long ul; struct timeval t; unsigned int ui;
- cl = clntudp6_bufcreate(&addr,ul,ul,t,&fd,ui,ui); ],
- [ af_have_libtirpc_ipv6=yes
- AC_MSG_RESULT(yes) ],
- [ AC_MSG_RESULT(no) ])
-
-if test "$af_have_libtirpc_ipv6" = "yes"; then
- AC_DEFINE(INET6,1, [Use IPv6 with libtirpc])
-fi
-
-# restore flags
-CFLAGS="$af_check_libtirpc_ipv6_save_cflags"
-LDFLAGS="$af_check_libtirpc_ipv6_save_ldflags"
-])
-
-dnl --------------------------------------------------------------------------
dnl AF_CHECK_LIBTIRPC
dnl
dnl Use libtirpc for rpc transport
@@ -399,7 +364,6 @@ AC_ARG_WITH(libtirpc,
[ --with-libtirpc use libtirpc if available],
[if test "$withval" = yes; then
AF_CHECK_LIBTIRPC()
- AF_CHECK_LIBTIRPC_IPV6()
else
AC_MSG_RESULT(no)
fi], [AC_MSG_RESULT(no)])
--- autofs-5.0.6.orig/configure
+++ autofs-5.0.6/configure
@@ -3087,52 +3087,6 @@ fi
CFLAGS="$af_check_libtirpc_save_cflags"
LDFLAGS="$af_check_libtirpc_save_ldflags"
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking if libtirpc has IPv6 support" >&5
-$as_echo_n "checking if libtirpc has IPv6 support... " >&6; }
-
-# save current flags
-af_check_libtirpc_ipv6_save_cflags="$CFLAGS"
-af_check_libtirpc_ipv6_save_ldflags="$LDFLAGS"
-CFLAGS="$CFLAGS -I/usr/include/tirpc"
-LDFLAGS="$LDFLAGS -ltirpc"
-
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
- #define INET6
- #include <rpc/rpc.h>
-int
-main ()
-{
- CLIENT *cl;
- struct sockaddr_in6 addr;
- int fd;
- unsigned long ul; struct timeval t; unsigned int ui;
- cl = clntudp6_bufcreate(&addr,ul,ul,t,&fd,ui,ui);
- ;
- return 0;
-}
-_ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
- af_have_libtirpc_ipv6=yes
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; }
-else
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-rm -f core conftest.err conftest.$ac_objext \
- conftest$ac_exeext conftest.$ac_ext
-
-if test "$af_have_libtirpc_ipv6" = "yes"; then
-
-$as_echo "#define INET6 1" >>confdefs.h
-
-fi
-
-# restore flags
-CFLAGS="$af_check_libtirpc_ipv6_save_cflags"
-LDFLAGS="$af_check_libtirpc_ipv6_save_ldflags"
-
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
--- autofs-5.0.6.orig/include/config.h.in
+++ autofs-5.0.6/include/config.h.in
@@ -72,9 +72,6 @@
/* Define to 1 if you have the <unistd.h> header file. */
#undef HAVE_UNISTD_H
-/* Use IPv6 with libtirpc */
-#undef INET6
-
/* Use libxml2 tsd usage workaround */
#undef LIBXML2_WORKAROUND
--- autofs-5.0.6.orig/modules/replicated.c
+++ autofs-5.0.6/modules/replicated.c
@@ -180,7 +180,7 @@ static unsigned int get_proximity(struct
break;
case AF_INET6:
-#ifndef INET6
+#ifndef WITH_LIBTIRPC
return PROXIMITY_UNSUPPORTED;
#else
addr6 = (struct sockaddr_in6 *) host_addr;
@@ -229,7 +229,9 @@ static unsigned int get_proximity(struct
break;
case AF_INET6:
-#ifdef INET6
+#ifndef WITH_LIBTIRPC
+ return PROXIMITY_UNSUPPORTED;
+#else
if (host_addr->sa_family == AF_INET)
break;
@@ -309,7 +311,9 @@ static unsigned int get_proximity(struct
break;
case AF_INET6:
-#ifdef INET6
+#ifndef WITH_LIBTIRPC
+ return PROXIMITY_UNSUPPORTED;
+#else
if (host_addr->sa_family == AF_INET)
break;

View File

@ -0,0 +1,63 @@
autofs-5.0.6 - fix ipv6 name lookup check
From: Ian Kent <raven@themaw.net>
The host address must be used when the host name has multiple
addresses since we need to mount the specific host and so that
it is known what host log entries refer to.
But the check for multiple addresses can be wrong because there
is no distinction between ipv4 and ipv6 addresses. Change the
check to use the host name when mounting if neither the ipv4
or the ipv6 addresses have more than one record.
---
CHANGELOG | 1 +
modules/replicated.c | 17 +++++++++++++++--
2 files changed, 16 insertions(+), 2 deletions(-)
--- autofs-5.0.6.orig/CHANGELOG
+++ autofs-5.0.6/CHANGELOG
@@ -13,6 +13,7 @@
- fix submount shutdown race.
- fix fix map source check in file lookup.
- add disable move mount configure option.
+- fix ipv6 name lookup check.
28/06/2011 autofs-5.0.6
-----------------------
--- autofs-5.0.6.orig/modules/replicated.c
+++ autofs-5.0.6/modules/replicated.c
@@ -1117,7 +1117,7 @@ static int add_host_addrs(struct host **
char *name = n_ptr = strdup(host);
int len;
char buf[MAX_ERR_BUF];
- int rr = 0;
+ int rr = 0, rr4 = 0, rr6 = 0;
int ret;
if (!name) {
@@ -1167,8 +1167,21 @@ try_name:
}
this = ni;
- if (this->ai_next)
+ while (this->ai_next) {
+ if (this->ai_family == AF_INET) {
+ struct sockaddr_in *addr = (struct sockaddr_in *) this->ai_addr;
+ if (addr->sin_addr.s_addr != INADDR_LOOPBACK)
+ rr4++;
+ } else if (this->ai_family == AF_INET6) {
+ struct sockaddr_in6 *addr = (struct sockaddr_in6 *) this->ai_addr;
+ if (!IN6_IS_ADDR_LOOPBACK(addr->sin6_addr.__in6_u.__u6_addr32))
+ rr6++;
+ }
+ this = this->ai_next;
+ }
+ if (rr4 > 1 || rr6 > 1)
rr++;
+ this = ni;
while (this) {
ret = add_new_host(list, host, weight, this, rr, options);
if (!ret)

View File

@ -0,0 +1,531 @@
autofs-5.0.6 - fix ipv6 rpc calls
From: Ian Kent <ikent@redhat.com>
There is a mistake in the way autofs uses libtirpc. Two IPv6 compatibiliy
functions were thought to be included when in fact they were not and would
not actually work with IPv6 anyway.
To fix that the libtirpc interface code needed to be re-written. Portmap
(using libtirpc calls) is still used to get service port numbers, rather
than rpcbind.
---
CHANGELOG | 1
lib/rpc_subs.c | 370 ++++++++++++++++++++-------------------------------
modules/replicated.c | 8 -
3 files changed, 155 insertions(+), 224 deletions(-)
--- autofs-5.0.6.orig/CHANGELOG
+++ autofs-5.0.6/CHANGELOG
@@ -14,6 +14,7 @@
- fix fix map source check in file lookup.
- add disable move mount configure option.
- fix ipv6 name lookup check.
+- fix ipv6 rpc calls.
28/06/2011 autofs-5.0.6
-----------------------
--- autofs-5.0.6.orig/lib/rpc_subs.c
+++ autofs-5.0.6/lib/rpc_subs.c
@@ -62,89 +62,6 @@ static const rpcvers_t mount_vers[] = {
static int connect_nb(int, struct sockaddr *, socklen_t, struct timeval *);
inline void dump_core(void);
-static CLIENT *rpc_clntudp_create(struct sockaddr *addr, struct conn_info *info, int *fd)
-{
- struct sockaddr_in *in4_raddr;
- struct sockaddr_in6 *in6_raddr;
- CLIENT *client = NULL;
-
- switch (addr->sa_family) {
- case AF_INET:
- in4_raddr = (struct sockaddr_in *) addr;
- in4_raddr->sin_port = htons(info->port);
- client = clntudp_bufcreate(in4_raddr,
- info->program, info->version,
- info->timeout, fd,
- info->send_sz, info->recv_sz);
- break;
-
- case AF_INET6:
-#ifndef INET6
- /* Quiet compile warning */
- in6_raddr = NULL;
-#else
- in6_raddr = (struct sockaddr_in6 *) addr;
- in6_raddr->sin6_port = htons(info->port);
- client = clntudp6_bufcreate(in6_raddr,
- info->program, info->version,
- info->timeout, fd,
- info->send_sz, info->recv_sz);
-#endif
- break;
-
- default:
- break;
- }
-
- return client;
-}
-
-static CLIENT *rpc_clnttcp_create(struct sockaddr *addr, struct conn_info *info, int *fd)
-{
- struct sockaddr_in *in4_raddr;
- struct sockaddr_in6 *in6_raddr;
- CLIENT *client = NULL;
- socklen_t slen;
-
- switch (addr->sa_family) {
- case AF_INET:
- in4_raddr = (struct sockaddr_in *) addr;
- in4_raddr->sin_port = htons(info->port);
- slen = sizeof(struct sockaddr_in);
-
- if (connect_nb(*fd, addr, slen, &info->timeout) < 0)
- break;
-
- client = clnttcp_create(in4_raddr,
- info->program, info->version, fd,
- info->send_sz, info->recv_sz);
- break;
-
- case AF_INET6:
-#ifndef INET6
- /* Quiet compile warning */
- in6_raddr = NULL;
-#else
- in6_raddr = (struct sockaddr_in6 *) addr;
- in6_raddr->sin6_port = htons(info->port);
- slen = sizeof(struct sockaddr_in6);
-
- if (connect_nb(*fd, addr, slen, &info->timeout) < 0)
- break;
-
- client = clnttcp6_create(in6_raddr,
- info->program, info->version, fd,
- info->send_sz, info->recv_sz);
-#endif
- break;
-
- default:
- break;
- }
-
- return client;
-}
-
/*
* Perform a non-blocking connect on the socket fd.
*
@@ -232,12 +149,12 @@ done:
return ret;
}
+#ifndef WITH_LIBTIRPC
static CLIENT *rpc_do_create_client(struct sockaddr *addr, struct conn_info *info, int *fd)
{
CLIENT *client = NULL;
- struct sockaddr *laddr;
struct sockaddr_in in4_laddr;
- struct sockaddr_in6 in6_laddr;
+ struct sockaddr_in in4_raddr;
int type, proto;
socklen_t slen;
@@ -252,48 +169,41 @@ static CLIENT *rpc_do_create_client(stru
* layer, it would bind to a reserved port, which has been shown
* to exhaust the reserved port range in some situations.
*/
- switch (addr->sa_family) {
- case AF_INET:
- in4_laddr.sin_family = AF_INET;
- in4_laddr.sin_port = htons(0);
- in4_laddr.sin_addr.s_addr = htonl(INADDR_ANY);
- slen = sizeof(struct sockaddr_in);
- laddr = (struct sockaddr *) &in4_laddr;
- break;
-
- case AF_INET6:
-#ifndef INET6
- /* Quiet compiler */
- in6_laddr.sin6_family = AF_INET6;
- return NULL;
-#else
- in6_laddr.sin6_family = AF_INET6;
- in6_laddr.sin6_port = htons(0);
- in6_laddr.sin6_addr = in6addr_any;
- slen = sizeof(struct sockaddr_in6);
- laddr = (struct sockaddr *) &in6_laddr;
- break;
-#endif
- default:
- return NULL;
- }
+ in4_laddr.sin_family = AF_INET;
+ in4_laddr.sin_port = htons(0);
+ in4_laddr.sin_addr.s_addr = htonl(INADDR_ANY);
+ slen = sizeof(struct sockaddr_in);
if (!info->client) {
+ struct sockaddr *laddr;
+
*fd = open_sock(addr->sa_family, type, proto);
if (*fd < 0)
return NULL;
+ laddr = (struct sockaddr *) &in4_laddr;
if (bind(*fd, laddr, slen) < 0)
return NULL;
}
+ in4_raddr = (struct sockaddr_in *) addr;
+ in4_raddr->sin_port = htons(info->port);
+
switch (info->proto->p_proto) {
case IPPROTO_UDP:
- client = rpc_clntudp_create(addr, info, fd);
+ client = clntudp_bufcreate(in4_raddr,
+ info->program, info->version,
+ info->timeout, fd,
+ info->send_sz, info->recv_sz);
break;
case IPPROTO_TCP:
- client = rpc_clnttcp_create(addr, info, fd);
+ if (connect_nb(*fd, addr, slen, &info->timeout) < 0)
+ break;
+
+ client = clnttcp_create(in4_raddr,
+ info->program, info->version, fd,
+ info->send_sz, info->recv_sz);
break;
default:
@@ -302,20 +212,126 @@ static CLIENT *rpc_do_create_client(stru
return client;
}
+#else
+struct netconfig *find_netconf(void *handle, char *family, char *proto)
+{
+ struct netconfig *nconf;
+
+ while ((nconf = getnetconfig(handle))) {
+ if ((strcmp(nconf->nc_protofmly, family) == 0) &&
+ (strcmp(nconf->nc_proto, proto) == 0))
+ break;
+ }
+
+ return nconf;
+}
+
+static CLIENT *rpc_do_create_client(struct sockaddr *addr, struct conn_info *info, int *fd)
+{
+ CLIENT *client = NULL;
+ struct sockaddr_in in4_laddr;
+ struct sockaddr_in6 in6_laddr;
+ struct sockaddr *laddr = NULL;
+ struct netconfig *nconf;
+ struct netbuf nb_addr;
+ int type, proto;
+ char *nc_family, *nc_proto;
+ void *handle;
+ size_t slen;
+
+ proto = info->proto->p_proto;
+ if (proto == IPPROTO_UDP) {
+ type = SOCK_DGRAM;
+ nc_proto = NC_UDP;
+ } else {
+ type = SOCK_STREAM;
+ nc_proto = NC_TCP;
+ }
+
+ /*
+ * bind to any unused port. If we left this up to the rpc
+ * layer, it would bind to a reserved port, which has been shown
+ * to exhaust the reserved port range in some situations.
+ */
+ if (addr->sa_family == AF_INET) {
+ struct sockaddr_in *in4_raddr = (struct sockaddr_in *) addr;
+ in4_laddr.sin_family = AF_INET;
+ in4_laddr.sin_port = htons(0);
+ in4_laddr.sin_addr.s_addr = htonl(INADDR_ANY);
+ laddr = (struct sockaddr *) &in4_laddr;
+ in4_raddr->sin_port = htons(info->port);
+ slen = sizeof(struct sockaddr_in);
+ nc_family = NC_INET;
+ } else if (addr->sa_family == AF_INET6) {
+ struct sockaddr_in6 *in6_raddr = (struct sockaddr_in6 *) addr;
+ in6_laddr.sin6_family = AF_INET6;
+ in6_laddr.sin6_port = htons(0);
+ in6_laddr.sin6_addr = in6addr_any;
+ laddr = (struct sockaddr *) &in6_laddr;
+ in6_raddr->sin6_port = htons(info->port);
+ slen = sizeof(struct sockaddr_in6);
+ nc_family = NC_INET6;
+ } else
+ return NULL;
+
+ handle = setnetconfig();
+ if (!handle)
+ return NULL;
+
+ nconf = find_netconf(handle, nc_family, nc_proto);
+ if (!nconf) {
+ endnetconfig(handle);
+ return NULL;
+ }
+
+ /*
+ * bind to any unused port. If we left this up to the rpc layer,
+ * it would bind to a reserved port, which has been shown to
+ * exhaust the reserved port range in some situations.
+ */
+ if (!info->client) {
+ *fd = open_sock(addr->sa_family, type, proto);
+ if (*fd < 0) {
+ endnetconfig(handle);
+ return NULL;
+ }
+
+ if (bind(*fd, laddr, slen) < 0) {
+ endnetconfig(handle);
+ return NULL;
+ }
+ }
+
+ nb_addr.maxlen = nb_addr.len = slen;
+ nb_addr.buf = addr;
+
+ if (info->proto->p_proto == IPPROTO_TCP) {
+ if (connect_nb(*fd, addr, slen, &info->timeout) < 0) {
+ endnetconfig(handle);
+ return NULL;
+ }
+ }
+
+ client = clnt_tli_create(*fd, nconf, &nb_addr,
+ info->program, info->version,
+ info->send_sz, info->recv_sz);
+
+ endnetconfig(handle);
+
+ return client;
+}
+#endif
/*
- * Create a UDP RPC client
+ * Create an RPC client
*/
-static CLIENT *create_udp_client(struct conn_info *info)
+static CLIENT *create_client(struct conn_info *info)
{
CLIENT *client = NULL;
struct addrinfo *ai, *haddr;
struct addrinfo hints;
int fd, ret;
- if (info->proto->p_proto != IPPROTO_UDP)
- return NULL;
-
fd = RPC_ANYSOCK;
if (info->client) {
@@ -355,6 +371,11 @@ static CLIENT *create_udp_client(struct
haddr = ai;
while (haddr) {
+ if (haddr->ai_protocol != info->proto->p_proto) {
+ haddr = haddr->ai_next;
+ continue;
+ }
+
client = rpc_do_create_client(haddr->ai_addr, info, &fd);
if (client)
break;
@@ -408,7 +429,7 @@ int rpc_udp_getclient(struct conn_info *
info->program = program;
info->version = version;
- client = create_udp_client(info);
+ client = create_client(info);
if (!client)
return 0;
@@ -428,92 +449,6 @@ void rpc_destroy_udp_client(struct conn_
return;
}
-/*
- * Create a TCP RPC client using non-blocking connect
- */
-static CLIENT *create_tcp_client(struct conn_info *info)
-{
- CLIENT *client = NULL;
- struct addrinfo *ai, *haddr;
- struct addrinfo hints;
- int fd, ret;
-
- if (info->proto->p_proto != IPPROTO_TCP)
- return NULL;
-
- fd = RPC_ANYSOCK;
-
- if (info->client) {
- if (!clnt_control(info->client, CLGET_FD, (char *) &fd)) {
- fd = RPC_ANYSOCK;
- clnt_destroy(info->client);
- info->client = NULL;
- } else {
- clnt_control(info->client, CLSET_FD_NCLOSE, NULL);
- clnt_destroy(info->client);
- }
- }
-
- if (info->addr) {
- client = rpc_do_create_client(info->addr, info, &fd);
- if (client)
- goto done;
-
- if (!info->client) {
- close(fd);
- fd = RPC_ANYSOCK;
- }
- }
-
- memset(&hints, 0, sizeof(hints));
- hints.ai_flags = AI_ADDRCONFIG;
- hints.ai_family = AF_UNSPEC;
- hints.ai_socktype = SOCK_STREAM;
-
- ret = getaddrinfo(info->host, NULL, &hints, &ai);
- if (ret) {
- error(LOGOPT_ANY,
- "hostname lookup failed: %s", gai_strerror(ret));
- info->client = NULL;
- goto out_close;
- }
-
- haddr = ai;
- while (haddr) {
- client = rpc_do_create_client(haddr->ai_addr, info, &fd);
- if (client)
- break;
-
- if (!info->client && fd != RPC_ANYSOCK) {
- close(fd);
- fd = RPC_ANYSOCK;
- }
-
- haddr = haddr->ai_next;
- }
-
- freeaddrinfo(ai);
-
- if (!client) {
- info->client = NULL;
- goto out_close;
- }
-done:
- /* Close socket fd on destroy, as is default for rpcowned fds */
- if (!clnt_control(client, CLSET_FD_CLOSE, NULL)) {
- clnt_destroy(client);
- info->client = NULL;
- goto out_close;
- }
-
- return client;
-
-out_close:
- if (fd != -1)
- close(fd);
- return NULL;
-}
-
int rpc_tcp_getclient(struct conn_info *info,
unsigned int program, unsigned int version)
{
@@ -533,7 +468,7 @@ int rpc_tcp_getclient(struct conn_info *
info->program = program;
info->version = version;
- client = create_tcp_client(info);
+ client = create_client(info);
if (!client)
return 0;
@@ -593,12 +528,9 @@ int rpc_portmap_getclient(struct conn_in
info->close_option = option;
info->client = NULL;
- if (pe_proto->p_proto == IPPROTO_TCP) {
+ if (pe_proto->p_proto == IPPROTO_TCP)
info->timeout.tv_sec = PMAP_TOUT_TCP;
- client = create_tcp_client(info);
- } else
- client = create_udp_client(info);
-
+ client = create_client(info);
if (!client)
return 0;
@@ -635,11 +567,7 @@ unsigned short rpc_portmap_getport(struc
pmap_info.send_sz = RPCSMALLMSGSIZE;
pmap_info.recv_sz = RPCSMALLMSGSIZE;
- if (proto == IPPROTO_TCP)
- client = create_tcp_client(&pmap_info);
- else
- client = create_udp_client(&pmap_info);
-
+ client = create_client(&pmap_info);
if (!client)
return 0;
}
@@ -700,10 +628,8 @@ int rpc_ping_proto(struct conn_info *inf
if (info->proto->p_proto == IPPROTO_UDP) {
info->send_sz = UDPMSGSIZE;
info->recv_sz = UDPMSGSIZE;
- client = create_udp_client(info);
- } else
- client = create_tcp_client(info);
-
+ }
+ client = create_client(info);
if (!client)
return 0;
}
@@ -857,10 +783,8 @@ static int rpc_get_exports_proto(struct
if (info->proto->p_proto == IPPROTO_UDP) {
info->send_sz = UDPMSGSIZE;
info->recv_sz = UDPMSGSIZE;
- client = create_udp_client(info);
- } else
- client = create_tcp_client(info);
-
+ }
+ client = create_client(info);
if (!client)
return 0;
--- autofs-5.0.6.orig/modules/replicated.c
+++ autofs-5.0.6/modules/replicated.c
@@ -1095,7 +1095,13 @@ static int add_new_host(struct host **li
if (prx == PROXIMITY_ERROR)
return 0;
- addr_len = sizeof(struct sockaddr);
+ if (host_addr->ai_addr->sa_family == AF_INET)
+ addr_len = INET_ADDRSTRLEN;
+ else if (host_addr->ai_addr->sa_family == AF_INET6)
+ addr_len = INET6_ADDRSTRLEN;
+ else
+ return 0;
+
new = new_host(host, host_addr->ai_addr, addr_len, prx, weight, options);
if (!new)
return 0;

View File

@ -1,10 +1,14 @@
# #
# $Id: autofs.spec,v 1.11 2003/12/04 15:41:32 raven Exp $ # $Id: autofs.spec,v 1.11 2003/12/04 15:41:32 raven Exp $
# #
# Use --without systemd in your rpmbuild command or force values to 0 to
# disable them.
%define with_systemd %{?_without_systemd: 0} %{?!_without_systemd: 1}
Summary: A tool for automatically mounting and unmounting filesystems Summary: A tool for automatically mounting and unmounting filesystems
Name: autofs Name: autofs
Version: 5.0.6 Version: 5.0.6
Release: 4%{?dist} Release: 5%{?dist}
Epoch: 1 Epoch: 1
License: GPLv2+ License: GPLv2+
Group: System Environment/Daemons Group: System Environment/Daemons
@ -23,11 +27,26 @@ Patch11: autofs-5.0.6-fix-submount-shutdown-race.patch
Patch12: autofs-5.0.6-fix-fix-map-source-check-in-file-lookup.patch Patch12: autofs-5.0.6-fix-fix-map-source-check-in-file-lookup.patch
Patch13: autofs-5.0.6-add-disable-move-mount-configure-option.patch Patch13: autofs-5.0.6-add-disable-move-mount-configure-option.patch
Patch14: autofs-5.0.6-fix-lsb-service-name-in-init-script-2.patch Patch14: autofs-5.0.6-fix-lsb-service-name-in-init-script-2.patch
Patch15: autofs-5.0.6-fix-ipv6-name-lookup-check.patch
Patch16: autofs-5.0.6-fix-ipv6-rpc-calls.patch
Patch17: autofs-5.0.6-fix-ipv6-configure-check.patch
Patch18: autofs-5.0.6-add-piddir-to-configure.patch
Patch19: autofs-5.0.6-add-systemd-unit-support.patch
Patch20: autofs-5.0.6-fix-MNT_DETACH-define.patch
Buildroot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) Buildroot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
%if %{with_systemd}
BuildRequires: systemd-units
%endif
BuildRequires: autoconf, hesiod-devel, openldap-devel, bison, flex, libxml2-devel, cyrus-sasl-devel, openssl-devel module-init-tools util-linux nfs-utils e2fsprogs libtirpc-devel BuildRequires: autoconf, hesiod-devel, openldap-devel, bison, flex, libxml2-devel, cyrus-sasl-devel, openssl-devel module-init-tools util-linux nfs-utils e2fsprogs libtirpc-devel
Conflicts: cyrus-sasl-lib < 2.1.23-9 Conflicts: cyrus-sasl-lib < 2.1.23-9
Requires: kernel >= 2.6.17 Requires: kernel >= 2.6.17
Requires: bash mktemp sed gawk textutils sh-utils grep module-init-tools /bin/ps Requires: bash mktemp sed gawk textutils sh-utils grep module-init-tools /bin/ps
%if %{with_systemd}
Requires(post): systemd-sysv
Requires(post): systemd-units
Requires(preun): systemd-units
Requires(postun): systemd-units
%endif
Requires(post): /sbin/chkconfig Requires(post): /sbin/chkconfig
Requires(preun): /sbin/service Requires(preun): /sbin/service
Requires(postun): /sbin/service Requires(postun): /sbin/service
@ -65,6 +84,10 @@ inkludera nätfilsystem, CD-ROM, floppydiskar, och så vidare.
%prep %prep
%setup -q %setup -q
echo %{version}-%{release} > .version echo %{version}-%{release} > .version
%if %{with_systemd}
%define _unitdir %{?_unitdir:/lib/systemd/system}
%define systemd_configure_arg --with-systemd
%endif
%patch1 -p1 %patch1 -p1
%patch2 -p1 %patch2 -p1
%patch3 -p1 %patch3 -p1
@ -79,15 +102,25 @@ echo %{version}-%{release} > .version
%patch12 -p1 %patch12 -p1
%patch13 -p1 %patch13 -p1
%patch14 -p1 %patch14 -p1
%patch15 -p1
%patch16 -p1
%patch17 -p1
%patch18 -p1
%patch19 -p1
%patch20 -p1
%build %build
#CFLAGS="$RPM_OPT_FLAGS" ./configure --prefix=/usr --libdir=%{_libdir} #CFLAGS="$RPM_OPT_FLAGS" ./configure --prefix=/usr --libdir=%{_libdir}
%configure --disable-mount-locking --enable-ignore-busy --with-libtirpc --disable-mount-move %configure --disable-mount-locking --enable-ignore-busy --with-libtirpc --disable-mount-move %{?systemd_configure_arg:}
make initdir=%{_initrddir} DONTSTRIP=1 make initdir=%{_initrddir} DONTSTRIP=1
%install %install
rm -rf $RPM_BUILD_ROOT rm -rf $RPM_BUILD_ROOT
%if %{with_systemd}
install -d -m 755 $RPM_BUILD_ROOT%{_unitdir}
%else
mkdir -p -m755 $RPM_BUILD_ROOT%{_initrddir} mkdir -p -m755 $RPM_BUILD_ROOT%{_initrddir}
%endif
mkdir -p -m755 $RPM_BUILD_ROOT%{_sbindir} mkdir -p -m755 $RPM_BUILD_ROOT%{_sbindir}
mkdir -p -m755 $RPM_BUILD_ROOT%{_libdir}/autofs mkdir -p -m755 $RPM_BUILD_ROOT%{_libdir}/autofs
mkdir -p -m755 $RPM_BUILD_ROOT%{_mandir}/{man5,man8} mkdir -p -m755 $RPM_BUILD_ROOT%{_mandir}/{man5,man8}
@ -95,32 +128,57 @@ mkdir -p -m755 $RPM_BUILD_ROOT/etc/sysconfig
mkdir -p -m755 $RPM_BUILD_ROOT/etc/auto.master.d mkdir -p -m755 $RPM_BUILD_ROOT/etc/auto.master.d
make install mandir=%{_mandir} initdir=%{_initrddir} INSTALLROOT=$RPM_BUILD_ROOT make install mandir=%{_mandir} initdir=%{_initrddir} INSTALLROOT=$RPM_BUILD_ROOT
echo make -C redhat
make -C redhat make -C redhat
install -m 755 -d $RPM_BUILD_ROOT/misc install -m 755 -d $RPM_BUILD_ROOT/misc
%if %{with_systemd}
install -m 644 redhat/autofs.service $RPM_BUILD_ROOT%{_unitdir}/autofs.service
%else
install -m 755 redhat/autofs.init $RPM_BUILD_ROOT%{_initrddir}/autofs install -m 755 redhat/autofs.init $RPM_BUILD_ROOT%{_initrddir}/autofs
%endif
install -m 644 redhat/autofs.sysconfig $RPM_BUILD_ROOT/etc/sysconfig/autofs install -m 644 redhat/autofs.sysconfig $RPM_BUILD_ROOT/etc/sysconfig/autofs
%clean %clean
rm -rf $RPM_BUILD_ROOT rm -rf $RPM_BUILD_ROOT
%post %post
%if %{with_systemd}
/bin/systemctl daemon-reload >/dev/null 2>&1 || :
%else
/sbin/chkconfig --add autofs /sbin/chkconfig --add autofs
%endif
%postun
if [ $1 -ge 1 ] ; then
/sbin/service autofs condrestart > /dev/null 2>&1 || :
fi
%preun %preun
if [ "$1" = 0 ] ; then if [ "$1" = 0 ] ; then
%if %{with_systemd}
/bin/systemctl --no-reload disable autofs.service > /dev/null 2>&1 || :
/bin/systemctl stop autofs.service > /dev/null 2>&1 || :
%else
/sbin/service autofs stop > /dev/null 2>&1 || : /sbin/service autofs stop > /dev/null 2>&1 || :
/sbin/chkconfig --del autofs /sbin/chkconfig --del autofs
%endif
fi fi
%postun
%if %{with_systemd}
/bin/systemctl daemon-reload >/dev/null 2>&1 || :
if [ $1 -ge 1 ] ; then
/bin/systemctl try-restart autofs.service >/dev/null 2>&1 || :
fi
%else
if [ $1 -ge 1 ] ; then
/sbin/service autofs condrestart > /dev/null 2>&1 || :
fi
%endif
%files %files
%defattr(-,root,root,-) %defattr(-,root,root,-)
%doc CREDITS INSTALL COPY* README* patches/* samples/ldap* samples/autofs.schema %doc CREDITS INSTALL COPY* README* patches/* samples/ldap* samples/autofs.schema
%if %{with_systemd}
%{_unitdir}/autofs.service
%else
%{_initrddir}/autofs %{_initrddir}/autofs
%endif
%config(noreplace,missingok) /etc/auto.master %config(noreplace,missingok) /etc/auto.master
%config(noreplace,missingok) /etc/auto.misc %config(noreplace,missingok) /etc/auto.misc
%config(noreplace,missingok) /etc/auto.net %config(noreplace,missingok) /etc/auto.net
@ -133,6 +191,14 @@ fi
%dir /etc/auto.master.d %dir /etc/auto.master.d
%changelog %changelog
* Mon Dec 5 2011 Ian Kent <ikent@redhat.com> - 1:5.0.6-5
- fix ipv6 name lookup check.
- fix ipv6 rpc calls.
- fix ipv6 configure check.
- add piddir to configure.
- add systemd unit support.
- fix MNT_DETACH define.
* Mon Dec 5 2011 Ian Kent <ikent@redhat.com> - 1:5.0.6-4 * Mon Dec 5 2011 Ian Kent <ikent@redhat.com> - 1:5.0.6-4
- fix lsb service name in init script 2 (bz712504). - fix lsb service name in init script 2 (bz712504).