From d3eaede791c121147f1b99db01facd2080019993 Mon Sep 17 00:00:00 2001 From: Zhu Yanjun Date: Thu, 13 Aug 2015 08:38:32 +0800 Subject: ypbind-mt: add status command for initscript Add the "status" command in initscript to check the status of ypbind. remove ypbind-yocto.init as ypbind.init, which is the initscript, make its name similar to other recipes Signed-off-by: Zhu Yanjun Signed-off-by: Roy Li Signed-off-by: Joe MacDonald --- .../recipes-support/nis/files/ypbind-yocto.init | 99 ------------------- .../recipes-support/nis/files/ypbind.init | 106 +++++++++++++++++++++ .../recipes-support/nis/ypbind-mt_1.38.bb | 4 +- .../recipes-support/nis/ypbind-mt_2.2.bb | 4 +- 4 files changed, 110 insertions(+), 103 deletions(-) delete mode 100644 meta-networking/recipes-support/nis/files/ypbind-yocto.init create mode 100644 meta-networking/recipes-support/nis/files/ypbind.init (limited to 'meta-networking/recipes-support') diff --git a/meta-networking/recipes-support/nis/files/ypbind-yocto.init b/meta-networking/recipes-support/nis/files/ypbind-yocto.init deleted file mode 100644 index 2c50d12e63..0000000000 --- a/meta-networking/recipes-support/nis/files/ypbind-yocto.init +++ /dev/null @@ -1,99 +0,0 @@ -#! /bin/sh -# Copyright (c) 2004 Author: Thorsten Kukuk -# -# /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 - -case "$1" in - start) - echo -n "Starting ypbind" - ## If the domainname is not set, skip starting of ypbind - ## and return with "program not configured" - /bin/ypdomainname >/dev/null 2>&1 - if [ $? -ne 0 -o -z "`/bin/ypdomainname 2>/dev/null`" ]; then - if [ -f /etc/defaultdomain ]; then - XDOMAINNAME=`cat /etc/defaultdomain` - /bin/ypdomainname "$XDOMAINNAME" - fi - /bin/ypdomainname >/dev/null 2>&1 - if [ $? -ne 0 -o -z "`/bin/ypdomainname 2>/dev/null`" ]; 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 2>&1 && { 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/meta-networking/recipes-support/nis/files/ypbind.init b/meta-networking/recipes-support/nis/files/ypbind.init new file mode 100644 index 0000000000..244dc78bca --- /dev/null +++ b/meta-networking/recipes-support/nis/files/ypbind.init @@ -0,0 +1,106 @@ +#! /bin/sh +# Copyright (c) 2004 Author: Thorsten Kukuk +# +# /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 + +# Need to use status function +. /etc/init.d/functions + +YPBIND_BIN=/usr/sbin/ypbind +pidfile=/var/run/ypbind.pid + +[ -f /etc/default/ypbind ] && . /etc/default/ypbind + +case "$1" in + start) + echo -n "Starting ypbind" + ## If the domainname is not set, skip starting of ypbind + ## and return with "program not configured" + /bin/ypdomainname >/dev/null 2>&1 + if [ $? -ne 0 -o -z "`/bin/ypdomainname 2>/dev/null`" ]; then + if [ -f /etc/defaultdomain ]; then + XDOMAINNAME=`cat /etc/defaultdomain` + /bin/ypdomainname "$XDOMAINNAME" + fi + /bin/ypdomainname >/dev/null 2>&1 + if [ $? -ne 0 -o -z "`/bin/ypdomainname 2>/dev/null`" ]; 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 2>&1 && { 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 + ;; + status) + echo -n "Checking for ypbind: " + status $YPBIND_BIN + ;; + *) + echo "Usage: $0 {start|stop|status|try-restart|restart|force-reload|reload|probe}" + exit 1 + ;; +esac diff --git a/meta-networking/recipes-support/nis/ypbind-mt_1.38.bb b/meta-networking/recipes-support/nis/ypbind-mt_1.38.bb index d25ef5c754..5702cd6a5f 100644 --- a/meta-networking/recipes-support/nis/ypbind-mt_1.38.bb +++ b/meta-networking/recipes-support/nis/ypbind-mt_1.38.bb @@ -26,7 +26,7 @@ DEPENDS = " \ PROVIDES += "ypbind" SRC_URI = "http://www.linux-nis.org/download/ypbind-mt/${BP}.tar.bz2 \ - file://ypbind-yocto.init \ + file://ypbind.init \ file://ypbind.service \ " SRC_URI[md5sum] = "094088c0e282fa7f3b3dd6cc51d0a4e1" @@ -44,7 +44,7 @@ do_install_append () { install -d ${D}${sysconfdir}/init.d install -d ${D}${sysconfdir}/rcS.d - install -m 0755 ${WORKDIR}/ypbind-yocto.init ${D}${sysconfdir}/init.d/ypbind + install -m 0755 ${WORKDIR}/ypbind.init ${D}${sysconfdir}/init.d/ypbind install -d ${D}${systemd_unitdir}/system install -m 0644 ${WORKDIR}/ypbind.service ${D}${systemd_unitdir}/system diff --git a/meta-networking/recipes-support/nis/ypbind-mt_2.2.bb b/meta-networking/recipes-support/nis/ypbind-mt_2.2.bb index 6a9262acab..cee5880f7a 100644 --- a/meta-networking/recipes-support/nis/ypbind-mt_2.2.bb +++ b/meta-networking/recipes-support/nis/ypbind-mt_2.2.bb @@ -21,7 +21,7 @@ PROVIDES += "ypbind" PNBLACKLIST[ypbind-mt] ?= "BROKEN: Depends on broken yp-tools" SRC_URI = "http://www.linux-nis.org/download/ypbind-mt/${BP}.tar.bz2 \ - file://ypbind-yocto.init \ + file://ypbind.init \ file://ypbind.service \ " SRC_URI[md5sum] = "54e2040d8266ae7d302d081ca310c8a8" @@ -41,7 +41,7 @@ do_install_append () { install -d ${D}${sysconfdir}/init.d install -d ${D}${sysconfdir}/rcS.d - install -m 0755 ${WORKDIR}/ypbind-yocto.init ${D}${sysconfdir}/init.d/ypbind + install -m 0755 ${WORKDIR}/ypbind.init ${D}${sysconfdir}/init.d/ypbind install -d ${D}${systemd_unitdir}/system install -m 0644 ${WORKDIR}/ypbind.service ${D}${systemd_unitdir}/system -- cgit 1.2.3-korg