commit:     acca4e086d138cbad282fbfe3123c394e90e0346
Author:     S. Lockwood-Childs <sjl <AT> vctlabs <DOT> com>
AuthorDate: Wed May 23 09:25:56 2018 +0000
Commit:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
CommitDate: Fri Jun  8 11:08:58 2018 +0000
URL:        https://gitweb.gentoo.org/proj/musl.git/commit/?id=acca4e08

net-fs/autofs: add package

* satisfying net-libs/rpcsvc-proto dependency with version 0 is useless,
  (it is just a stub that does not provide rpcgen tool) so require
  greater than 0
* compiler patch based on musl-related patches from meta-openembedded

 net-fs/autofs/Manifest                             |   1 +
 net-fs/autofs/autofs-5.1.4.ebuild                  | 113 +++++++++++++++++++++
 .../files/autofs-5.1.2-libtirpc-as-need.patch      |  28 +++++
 net-fs/autofs/files/autofs-musl.patch              |  90 ++++++++++++++++
 net-fs/autofs/files/autofs5-auto.master            |  23 +++++
 net-fs/autofs/files/autofs5.initd                  |  69 +++++++++++++
 net-fs/autofs/metadata.xml                         |  20 ++++
 7 files changed, 344 insertions(+)

diff --git a/net-fs/autofs/Manifest b/net-fs/autofs/Manifest
new file mode 100644
index 0000000..b42b207
--- /dev/null
+++ b/net-fs/autofs/Manifest
@@ -0,0 +1 @@
+DIST autofs-5.1.4.tar.xz 304864 BLAKE2B 
7348aa1106554eb765919c765c0585b5d975d7a0ea036dec5b509711bf33cefd0f3e1e857a6865434adabbd1e323cfe8ffb09eb234495672e81101f79b8f4d0f
 SHA512 
1ef48800a1e44d6bf7048923109f3b8299ef266ff0fbaf5f979c32f42c6c5e28620c1876f64b9d913fddb69244ff83226c01c666401ff6271dd6b53d31860589

diff --git a/net-fs/autofs/autofs-5.1.4.ebuild 
b/net-fs/autofs/autofs-5.1.4.ebuild
new file mode 100644
index 0000000..81f6b76
--- /dev/null
+++ b/net-fs/autofs/autofs-5.1.4.ebuild
@@ -0,0 +1,113 @@
+# Copyright 1999-2018 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+inherit linux-info multilib systemd toolchain-funcs
+
+PATCH_VER=
+[[ -n ${PATCH_VER} ]] && \
+       
PATCHSET_URI="https://dev.gentoo.org/~jlec/distfiles/${P}-patches-${PATCH_VER}.tar.lzma";
+
+DESCRIPTION="Kernel based automounter"
+HOMEPAGE="http://www.linux-consulting.com/Amd_AutoFS/autofs.html";
+SRC_URI="
+       mirror://kernel/linux/daemons/${PN}/v5/${P}.tar.xz
+       ${PATCHSET_URI}"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~mips ~ppc ~ppc64 ~sparc ~x86"
+IUSE="-dmalloc ldap +libtirpc mount-locking sasl"
+
+# USE="sasl" adds SASL support to the LDAP module which will not be build. If
+# SASL support should be available, please add "ldap" to the USE flags.
+REQUIRED_USE="sasl? ( ldap )"
+
+# currently, sasl code assumes the presence of kerberosV
+RDEPEND=">=sys-apps/util-linux-2.20
+       dmalloc? ( dev-libs/dmalloc[threads] )
+       ldap? ( >=net-nds/openldap-2.0
+               sasl? (
+                       dev-libs/cyrus-sasl
+                       dev-libs/libxml2
+                       virtual/krb5
+               )
+       )
+       libtirpc? ( net-libs/libtirpc )
+       !libtirpc? ( elibc_glibc? ( sys-libs/glibc[rpc(-)] ) )
+"
+DEPEND="${RDEPEND}
+       sys-devel/flex
+       virtual/yacc
+       libtirpc? ( >net-libs/rpcsvc-proto-0 )
+"
+
+CONFIG_CHECK="~AUTOFS4_FS"
+
+PATCHES=(
+       "${FILESDIR}"/${PN}-musl.patch
+)
+
+src_prepare() {
+       # Upstream's patchset
+       if [[ -n ${PATCH_VER} ]]; then
+               EPATCH_SUFFIX="patch" \
+                       epatch "${WORKDIR}"/patches
+       fi
+
+       sed -i -e "s:/usr/bin/kill:/bin/kill:" samples/autofs.service.in || die 
#bug #479492
+       default
+}
+
+src_configure() {
+       # bug #483716
+       tc-export AR
+       # --with-confdir is for bug #361481
+       # --with-mapdir is for bug #385113
+       local myeconfargs=(
+               --with-confdir=/etc/conf.d
+               --with-mapdir=/etc/autofs
+               $(use_with dmalloc)
+               $(use_with ldap openldap)
+               $(use_with libtirpc)
+               $(use_with sasl)
+               $(use_enable mount-locking)
+               --without-hesiod
+               --disable-ext-env
+               --enable-sloppy-mount # bug #453778
+               --enable-force-shutdown
+               --enable-ignore-busy
+               --with-systemd="$(systemd_get_systemunitdir)" #bug #479492
+               RANLIB="$(type -P $(tc-getRANLIB))" # bug #483716
+       )
+       econf "${myeconfargs[@]}"
+}
+
+src_install() {
+       default
+
+       if kernel_is -lt 2 6 30; then
+               # kernel patches
+               docinto patches
+               dodoc patches/${PN}4-2.6.??{,.?{,?}}-v5-update-????????.patch
+       fi
+       newinitd "${FILESDIR}"/autofs5.initd autofs
+       insinto etc/autofs
+       newins "${FILESDIR}"/autofs5-auto.master auto.master
+}
+
+pkg_postinst() {
+       if kernel_is -lt 2 6 30; then
+               elog "This version of ${PN} requires a kernel with autofs4 
supporting"
+               elog "protocol version 5.00. Patches for kernels older than 
2.6.30 have"
+               elog "been installed into"
+               elog "${EROOT}usr/share/doc/${P}/patches."
+               elog "For further instructions how to patch the kernel, please 
refer to"
+               elog "${EROOT}usr/share/doc/${P}/INSTALL."
+               elog
+       fi
+       elog "If you plan on using autofs for automounting remote NFS mounts,"
+       elog "please check that both portmap (or rpcbind) and rpc.statd/lockd"
+       elog "are running."
+}

diff --git a/net-fs/autofs/files/autofs-5.1.2-libtirpc-as-need.patch 
b/net-fs/autofs/files/autofs-5.1.2-libtirpc-as-need.patch
new file mode 100644
index 0000000..f6e1769
--- /dev/null
+++ b/net-fs/autofs/files/autofs-5.1.2-libtirpc-as-need.patch
@@ -0,0 +1,28 @@
+Make configure compatible with -Wl,--as-needed following
+https://wiki.gentoo.org/wiki/Project:Quality_Assurance/As-needed#Failure_in_..2Fconfigure
+
+2016-07-05 Martin von Gagern
+
+--- autofs-5.1.2.orig/aclocal.m4
++++ autofs-5.1.2/aclocal.m4
+@@ -413,9 +413,9 @@ AC_DEFUN([AF_CHECK_LIBTIRPC],
+ [
+ # save current flags
+ af_check_libtirpc_save_cflags="$CFLAGS"
+-af_check_libtirpc_save_ldflags="$LDFLAGS"
++af_check_libtirpc_save_libs="$LIBS"
+ CFLAGS="$CFLAGS -I/usr/include/tirpc"
+-LDFLAGS="$LDFLAGS -ltirpc"
++LIBS="$LIBS -ltirpc"
+ 
+ AC_TRY_LINK(
+     [ #include <rpc/rpc.h> ],
+@@ -438,7 +438,7 @@ AC_CHECK_FUNCS([getrpcbyname getservbyna
+ 
+ # restore flags
+ CFLAGS="$af_check_libtirpc_save_cflags"
+-LDFLAGS="$af_check_libtirpc_save_ldflags"
++LIBS="$af_check_libtirpc_save_libs"
+ ])
+ 
+ AC_DEFUN([AF_WITH_LIBTIRPC],

diff --git a/net-fs/autofs/files/autofs-musl.patch 
b/net-fs/autofs/files/autofs-musl.patch
new file mode 100644
index 0000000..bda29ca
--- /dev/null
+++ b/net-fs/autofs/files/autofs-musl.patch
@@ -0,0 +1,90 @@
+musl-related compile fixes based on openembedded patchset for autofs
+
+https://github.com/openembedded/meta-openembedded/
+(see meta-networking/recipes-daemons/autofs/autofs/)
+
+diff -ur autofs-5.1.2/daemon/lookup.c.orig autofs-5.1.2/daemon/lookup.c
+--- autofs-5.1.2/daemon/lookup.c.orig  2016-06-15 02:40:44.000000000 +0000
++++ autofs-5.1.2/daemon/lookup.c       2018-05-22 19:37:53.698931707 +0000
+@@ -366,7 +366,7 @@
+       if (!S_ISREG(st.st_mode))
+               return NSS_STATUS_NOTFOUND;
+ 
+-      if (st.st_mode & __S_IEXEC)
++      if (st.st_mode & S_IEXEC)
+               type = src_prog;
+       else
+               type = src_file;
+@@ -856,7 +856,7 @@
+       if (!S_ISREG(st.st_mode))
+               return NSS_STATUS_NOTFOUND;
+ 
+-      if (st.st_mode & __S_IEXEC)
++      if (st.st_mode & S_IEXEC)
+               type = src_prog;
+       else
+               type = src_file;
+diff -ur autofs-5.1.2/include/automount.h.orig autofs-5.1.2/include/automount.h
+--- autofs-5.1.2/include/automount.h.orig      2016-06-15 02:40:44.000000000 
+0000
++++ autofs-5.1.2/include/automount.h   2018-05-22 19:38:01.242979571 +0000
+@@ -42,6 +42,14 @@
+ 
+ #define ENABLE_CORES  1
+ 
++#ifndef __SWORD_TYPE
++# if __WORDSIZE == 32  /* System word size */
++#  define __SWORD_TYPE int
++# else /* __WORDSIZE == 64 */
++#  define __SWORD_TYPE long int
++# endif
++#endif
++
+ /* We MUST have the paths to mount(8) and umount(8) */
+ #ifndef HAVE_MOUNT
+ #error Failed to locate mount(8)!
+diff -ur autofs-5.1.2/include/nsswitch.h.orig autofs-5.1.2/include/nsswitch.h
+--- autofs-5.1.2/include/nsswitch.h.orig       2016-06-15 02:40:44.000000000 
+0000
++++ autofs-5.1.2/include/nsswitch.h    2018-05-22 19:38:01.242979571 +0000
+@@ -24,6 +24,9 @@
+ #include <netdb.h>
+ #include "list.h"
+ 
++#ifndef _PATH_NSSWITCH_CONF
++#define _PATH_NSSWITCH_CONF     "/etc/nsswitch.conf"
++#endif
+ #define NSSWITCH_FILE _PATH_NSSWITCH_CONF
+ 
+ enum nsswitch_status {
+diff -ur autofs-5.1.2/include/rpc_subs.h.orig autofs-5.1.2/include/rpc_subs.h
+--- autofs-5.1.2/include/rpc_subs.h.orig       2016-06-15 02:40:44.000000000 
+0000
++++ autofs-5.1.2/include/rpc_subs.h    2018-05-22 19:38:10.547038606 +0000
+@@ -18,7 +18,7 @@
+ 
+ #include <rpc/rpc.h>
+ #include <rpc/pmap_prot.h>
+-#include <nfs/nfs.h>
++#include <linux/nfs.h>
+ #include <linux/nfs2.h>
+ #include <linux/nfs3.h>
+ 
+diff -ur autofs-5.1.2/modules/lookup_multi.c.orig 
autofs-5.1.2/modules/lookup_multi.c
+--- autofs-5.1.2/modules/lookup_multi.c.orig   2016-06-15 02:40:44.000000000 
+0000
++++ autofs-5.1.2/modules/lookup_multi.c        2018-05-22 19:38:45.231258767 
+0000
+@@ -247,7 +247,7 @@
+                               continue;
+                       }
+ 
+-                      if (st.st_mode & __S_IEXEC)
++                      if (st.st_mode & S_IEXEC)
+                               type = src_prog;
+                       else
+                               type = src_file;
+@@ -452,7 +452,7 @@
+                                       continue;
+                               }
+ 
+-                              if (st.st_mode & __S_IEXEC)
++                              if (st.st_mode & S_IEXEC)
+                                       type = src_prog;
+                               else
+                                       type = src_file;

diff --git a/net-fs/autofs/files/autofs5-auto.master 
b/net-fs/autofs/files/autofs5-auto.master
new file mode 100644
index 0000000..8ad0927
--- /dev/null
+++ b/net-fs/autofs/files/autofs5-auto.master
@@ -0,0 +1,23 @@
+# Sample auto.master file
+# This is an automounter map and it has the following format
+# key [ -mount-options-separated-by-comma ] location
+# For details of the format look at autofs(5).
+#
+#/misc /etc/autofs/auto.misc
+#/net  /etc/autofs/auto.net
+#
+# NOTE: mounts done from a hosts map will be mounted with the
+#      "nosuid" and "nodev" options unless the "suid" and "dev"
+#      options are explicitly given.
+#
+#/net  -hosts
+#
+# Include central master map if it can be found using
+# nsswitch sources.
+#
+# Note that if there are entries for /net or /misc (as
+# above) in the included master map any keys that are the
+# same will not be seen as the first read key seen takes
+# precedence.
+#
+#+auto.master

diff --git a/net-fs/autofs/files/autofs5.initd 
b/net-fs/autofs/files/autofs5.initd
new file mode 100644
index 0000000..119585c
--- /dev/null
+++ b/net-fs/autofs/files/autofs5.initd
@@ -0,0 +1,69 @@
+#!/sbin/openrc-run
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+DAEMON=/usr/sbin/automount
+PIDFILE=/var/run/autofs.pid
+DEVICE=autofs
+
+depend() {
+       need localmount 
+       use ypbind nfs slapd portmap net
+}
+
+extra_started_commands="reload"
+
+start() {
+       ebegin "Starting automounter"
+
+       # Ensure autofs support is loaded
+       grep -q autofs /proc/filesystems || modprobe -q autofs4
+       if [ $? -ne 0 ]; then
+               eend 1 "No autofs support available in kernel"
+               return 1
+       fi
+
+       # Check misc device
+       if [ -n "${USE_MISC_DEVICE}" -a "${USE_MISC_DEVICE}" = "yes" ]; then
+               sleep 1
+               if [ -e "/proc/misc" ]; then
+                       MINOR=$(awk "/${DEVICE}/ {print \$1}" /proc/misc)
+                       if [ -n "${MINOR}" -a ! -c "/dev/${DEVICE}" ]; then
+                               mknod -m 0600 "/dev/${DEVICE}" c 10 ${MINOR}
+                               if [ $? -ne 0 ]; then
+                                       eend 1 "Could not create 
'/dev/${DEVICE}'"
+                                       return 1
+                               fi
+                       fi
+               fi
+               if [ -x /sbin/restorecon -a -c "/dev/${DEVICE}" ]; then
+                       /sbin/restorecon "/dev/${DEVICE}"
+                       if [ $? -ne 0 ]; then
+                               eend 1 "Failed to execute '/sbin/restorecon 
\"/dev/${DEVICE}\"'"
+                               return 1
+                       fi
+               fi
+       else
+               [ -c "/dev/${DEVICE}" ] && rm -rf "/dev/${DEVICE}"
+       fi
+
+       start-stop-daemon --start --exec ${DAEMON} -- -p ${PIDFILE} ${OPTIONS}
+
+       eend $?
+}
+
+stop() {
+       ebegin "Stopping automounter"
+       start-stop-daemon --stop --quiet -R TERM/45 -p ${PIDFILE}
+       eend $?
+}
+
+reload() {
+       ebegin "Reloading automounter"
+       if [ ! -r "${PIDFILE}" ]; then
+               eend 1 "automount not running"
+       else
+               kill -s HUP $(cat "${PIDFILE}") 2> /dev/null
+               eend $?
+       fi
+}

diff --git a/net-fs/autofs/metadata.xml b/net-fs/autofs/metadata.xml
new file mode 100644
index 0000000..f368136
--- /dev/null
+++ b/net-fs/autofs/metadata.xml
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd";>
+<pkgmetadata>
+       <maintainer type="person">
+               <email>[email protected]</email>
+               <name>Yixun Lan</name>
+       </maintainer>
+       <use>
+               <flag name="dmalloc">Enable debugging with the dmalloc 
library</flag>
+               <flag name="ldap">Install LDAP module</flag>
+               <flag name="libtirpc">Use TiRPC library instead of SunRPC</flag>
+               <flag name="mount-locking">
+                       Enable locking to prevent corruption of /etc/mtab in 
the presence of
+                       concurrent auto-mounting. If enabled, recursive 
auto-mounting (eg. using
+                       autofs to bind or loop mount a filesystem which is 
itself auto-mounted)
+                       is not possible.
+               </flag>
+               <flag name="sasl">Enable SASL support in the LDAP module</flag>
+       </use>
+</pkgmetadata>

Reply via email to