[meta-lsi] [PATCH 45/86] nis: fix ypdomainname configuration in ypbind init script
Daniel Dragomir
daniel.dragomir at windriver.com
Wed Oct 29 08:35:53 PDT 2014
From: "Hong H. Pham" <hong.pham at windriver.com>
The Open Embedded (meta-oe) nis package still has the ypbind init bug.
Reapply the scripting fix in commit 2027af7c30a2c86f7e27f4c5d34bdfa5c1e0fc91
but rework to co-exist with the meta-oe nis recipe.
Signed-off-by: Hong H. Pham <hong.pham at windriver.com>
---
recipes-support/nis/files/ypbind-yocto.init | 115 ++++++++++++++++++++++++++++
recipes-support/nis/ypbind-mt_1.36.bbappend | 1 +
2 files changed, 116 insertions(+)
create mode 100644 recipes-support/nis/files/ypbind-yocto.init
create mode 100644 recipes-support/nis/ypbind-mt_1.36.bbappend
diff --git a/recipes-support/nis/files/ypbind-yocto.init b/recipes-support/nis/files/ypbind-yocto.init
new file mode 100644
index 0000000..e417b25
--- /dev/null
+++ b/recipes-support/nis/files/ypbind-yocto.init
@@ -0,0 +1,115 @@
+#! /bin/sh
+# Copyright (c) 2004 Author: Thorsten Kukuk <kukuk at suse.de>
+#
+# /etc/init.d/ypbind
+#
+# and symbolic its link
+#
+# /usr/sbin/rcypbind
+#
+# System startup script for the ypbind daemon
+#
+### BEGIN INIT INFO
+# Provides: ypbind
+# Required-Start: $remote_fs $portmap
+# Should-Start: ypserv slpd
+# Required-Stop: portmap
+# Default-Start: 3 5
+# Default-Stop: 0 1 2 6
+# Short-Description: Start ypbind (necessary for a NIS client)
+# Description: ypbind finds the server for NIS domains and maintains
+# the NIS binding information.
+### END INIT INFO
+
+YPBIND_BIN=/usr/sbin/ypbind
+pidfile=/var/run/ypbind.pid
+
+[ -f /etc/default/ypbind ] && . /etc/default/ypbind
+
+
+function _ypdomainname_is_set() {
+ _ypdomainname="`/bin/ypdomainname 2>/dev/null`"
+
+ if test $? -ne 0 ; then
+ return 0
+ fi
+
+ if test "x${_ypdomainname}" = "x" -o "x${_ypdomainname}" = "x(none)"; then
+ return 0
+ fi
+
+ return 1
+}
+
+
+case "$1" in
+ start)
+ echo -n "Starting ypbind"
+ ## If the domainname is not set, skip starting of ypbind
+ ## and return with "program not configured"
+ _ypdomainname_is_set
+ if [ $? -eq 0 ]; then
+ if [ -f /etc/defaultdomain ]; then
+ XDOMAINNAME=`cat /etc/defaultdomain`
+ /bin/ypdomainname "$XDOMAINNAME"
+ fi
+ _ypdomainname_is_set
+ if [ $? -eq 0 ]; then
+ # Tell the user this has skipped
+ echo -n " . . . . . . . . . . No domainname set"
+ # service is not configured
+ exit 1
+ fi
+ fi
+
+ ## If we don't have a /etc/yp.conf file, skip starting of
+ ## ypbind and return with "program not configured"
+ ## if you add the -broadcast Option later, comment this out.
+ if [ ! -f /etc/yp.conf -a "$YPBIND_BROADCAST" != "yes" ] ; then
+ # Tell the user this has skipped
+ echo -n " . . . . . . . . . . ${attn}/etc/yp.conf not found${norm}"
+ # service is not configured
+ exit 1
+ fi
+
+ # evaluate the OPTIONS for ypbind-mt
+ OPTIONS=""
+ test "$YPBIND_LOCAL_ONLY" = "yes" && OPTIONS="-local-only $OPTIONS"
+ test "$YPBIND_BROADCAST" = "yes" && OPTIONS="-broadcast $OPTIONS"
+ test "$YPBIND_BROKEN_SERVER" = "yes" && OPTIONS="-broken-server $OPTIONS"
+
+ start-stop-daemon --start --quiet --pidfile $pidfile --exec $YPBIND_BIN -- $YPBIND_OPTIONS $OPTIONS
+ if [ $? -eq 0 ]; then
+ notfound=1
+ for i in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15; do
+ ypwhich &>/dev/null && { notfound=0 ; break; };
+ echo -n " ."
+ sleep 1;
+ done
+ if [ $notfound -eq 1 ]; then
+ echo -n " ${warn}No NIS server found${norm}";
+ fi
+ else
+ exit 1
+ fi
+ ;;
+ stop)
+ echo -n "Shutting down ypbind"
+ start-stop-daemon --stop --quiet --pidfile $pidfile
+ # Remove static data, else glibc will continue to use NIS
+ rm -f /var/yp/binding/* /var/run/ypbind.pid
+ ;;
+ restart)
+ $0 stop
+ sleep 1
+ $0 start
+ ;;
+ reload | force-reload)
+ echo -n "Reload service ypbind"
+ start-stop-daemon --stop --quiet --signal 1 --pidfile $pidfile
+ ;;
+ *)
+ echo "Usage: $0 {start|stop|status|try-restart|restart|force-reload|reload|probe}"
+ exit 1
+ ;;
+esac
diff --git a/recipes-support/nis/ypbind-mt_1.36.bbappend b/recipes-support/nis/ypbind-mt_1.36.bbappend
new file mode 100644
index 0000000..81fe7b7
--- /dev/null
+++ b/recipes-support/nis/ypbind-mt_1.36.bbappend
@@ -0,0 +1 @@
+FILESEXTRAPATHS_prepend := "${THISDIR}/files:"
--
1.8.1.4
More information about the meta-lsi
mailing list