summaryrefslogtreecommitdiffstats
path: root/meta-networking/recipes-support/nis/files/ypbind-yocto.init
diff options
context:
space:
mode:
Diffstat (limited to 'meta-networking/recipes-support/nis/files/ypbind-yocto.init')
-rw-r--r--meta-networking/recipes-support/nis/files/ypbind-yocto.init99
1 files changed, 99 insertions, 0 deletions
diff --git a/meta-networking/recipes-support/nis/files/ypbind-yocto.init b/meta-networking/recipes-support/nis/files/ypbind-yocto.init
new file mode 100644
index 000000000..5f50a530e
--- /dev/null
+++ b/meta-networking/recipes-support/nis/files/ypbind-yocto.init
@@ -0,0 +1,99 @@
1#! /bin/sh
2# Copyright (c) 2004 Author: Thorsten Kukuk <kukuk@suse.de>
3#
4# /etc/init.d/ypbind
5#
6# and symbolic its link
7#
8# /usr/sbin/rcypbind
9#
10# System startup script for the ypbind daemon
11#
12### BEGIN INIT INFO
13# Provides: ypbind
14# Required-Start: $remote_fs $portmap
15# Should-Start: ypserv slpd
16# Required-Stop: portmap
17# Default-Start: 3 5
18# Default-Stop: 0 1 2 6
19# Short-Description: Start ypbind (necessary for a NIS client)
20# Description: ypbind finds the server for NIS domains and maintains
21# the NIS binding information.
22### END INIT INFO
23
24YPBIND_BIN=/usr/sbin/ypbind
25pidfile=/var/run/ypbind.pid
26
27[ -f /etc/default/ypbind ] && . /etc/default/ypbind
28
29case "$1" in
30 start)
31 echo -n "Starting ypbind"
32 ## If the domainname is not set, skip starting of ypbind
33 ## and return with "program not configured"
34 /bin/ypdomainname &> /dev/null
35 if [ $? -ne 0 -o -z "`/bin/ypdomainname 2>/dev/null`" ]; then
36 if [ -f /etc/defaultdomain ]; then
37 XDOMAINNAME=`cat /etc/defaultdomain`
38 /bin/ypdomainname "$XDOMAINNAME"
39 fi
40 /bin/ypdomainname &> /dev/null
41 if [ $? -ne 0 -o -z "`/bin/ypdomainname 2>/dev/null`" ]; then
42 # Tell the user this has skipped
43 echo -n " . . . . . . . . . . No domainname set"
44 # service is not configured
45 exit 1
46 fi
47 fi
48
49 ## If we don't have a /etc/yp.conf file, skip starting of
50 ## ypbind and return with "program not configured"
51 ## if you add the -broadcast Option later, comment this out.
52 if [ ! -f /etc/yp.conf -a "$YPBIND_BROADCAST" != "yes" ] ; then
53 # Tell the user this has skipped
54 echo -n " . . . . . . . . . . ${attn}/etc/yp.conf not found${norm}"
55 # service is not configured
56 exit 1
57 fi
58
59 # evaluate the OPTIONS for ypbind-mt
60 OPTIONS=""
61 test "$YPBIND_LOCAL_ONLY" = "yes" && OPTIONS="-local-only $OPTIONS"
62 test "$YPBIND_BROADCAST" = "yes" && OPTIONS="-broadcast $OPTIONS"
63 test "$YPBIND_BROKEN_SERVER" = "yes" && OPTIONS="-broken-server $OPTIONS"
64
65 start-stop-daemon --start --quiet --pidfile $pidfile --exec $YPBIND_BIN -- $YPBIND_OPTIONS $OPTIONS
66 if [ $? -eq 0 ]; then
67 notfound=1
68 for i in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15; do
69 ypwhich &>/dev/null && { notfound=0 ; break; };
70 echo -n " ."
71 sleep 1;
72 done
73 if [ $notfound -eq 1 ]; then
74 echo -n " ${warn}No NIS server found${norm}";
75 fi
76 else
77 exit 1
78 fi
79 ;;
80 stop)
81 echo -n "Shutting down ypbind"
82 start-stop-daemon --stop --quiet --pidfile $pidfile
83 # Remove static data, else glibc will continue to use NIS
84 rm -f /var/yp/binding/* /var/run/ypbind.pid
85 ;;
86 restart)
87 $0 stop
88 sleep 1
89 $0 start
90 ;;
91 reload | force-reload)
92 echo -n "Reload service ypbind"
93 start-stop-daemon --stop --quiet --signal 1 --pidfile $pidfile
94 ;;
95 *)
96 echo "Usage: $0 {start|stop|status|try-restart|restart|force-reload|reload|probe}"
97 exit 1
98 ;;
99esac