summaryrefslogtreecommitdiffstats
path: root/meta-networking/recipes-daemons/tftp-hpa/files/init
diff options
context:
space:
mode:
Diffstat (limited to 'meta-networking/recipes-daemons/tftp-hpa/files/init')
-rw-r--r--meta-networking/recipes-daemons/tftp-hpa/files/init104
1 files changed, 104 insertions, 0 deletions
diff --git a/meta-networking/recipes-daemons/tftp-hpa/files/init b/meta-networking/recipes-daemons/tftp-hpa/files/init
new file mode 100644
index 0000000000..5ad8c52cb8
--- /dev/null
+++ b/meta-networking/recipes-daemons/tftp-hpa/files/init
@@ -0,0 +1,104 @@
1#! /bin/sh
2#
3# Author: Jaakko Niemi <liiwi@iki.fi>
4# Modified from skeleton file in sarge
5
6### BEGIN INIT INFO
7# Provides: tftp-hpa
8# Required-Start: $local_fs $remote_fs $syslog $network
9# Required-Stop: $local_fs $remote_fs $syslog $network
10# Default-Start: 2 3 4 5
11# Default-Stop: 1
12# Short-Description: HPA's tftp client
13# Description: tftp server to allow booting clients which support
14# the PXE protocol.
15### END INIT INFO
16
17set -e
18
19PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
20DESC="HPA's tftpd"
21NAME=in.tftpd
22DAEMON=/usr/sbin/$NAME
23PIDFILE=/var/run/$NAME.pid
24SCRIPTNAME=/etc/init.d/tftpd-hpa
25
26# Gracefully exit if the package has been removed.
27test -x $DAEMON || exit 0
28
29# Read config file if it is present.
30if [ -r /etc/default/tftpd-hpa ]
31then
32 . /etc/default/tftpd-hpa
33fi
34
35if [ "$RUN_DAEMON" != "yes" ] ; then
36 echo "tftpd-hpa disabled in /etc/default/tftpd-hpa"
37 exit 0
38fi
39
40#
41# Function that starts the daemon/service.
42#
43d_start() {
44 start-stop-daemon --start --quiet --exec $DAEMON -- $OPTIONS
45}
46
47#
48# Function that stops the daemon/service.
49#
50d_stop() {
51 start-stop-daemon --stop --quiet --name $NAME
52}
53
54#
55# Function that sends a SIGHUP to the daemon/service.
56#
57d_reload() {
58 start-stop-daemon --stop --quiet --name $NAME --signal 1
59}
60
61case "$1" in
62 start)
63 echo "Starting $DESC: $NAME"
64 d_start
65 echo "."
66 ;;
67 stop)
68 echo "Stopping $DESC: $NAME"
69 d_stop
70 echo "."
71 ;;
72 #reload)
73 #
74 # If the daemon can reload its configuration without
75 # restarting (for example, when it is sent a SIGHUP),
76 # then implement that here.
77 #
78 # If the daemon responds to changes in its config file
79 # directly anyway, make this an "exit 0".
80 #
81 # echo -n "Reloading $DESC configuration..."
82 # d_reload
83 # echo "done."
84 #;;
85 restart|force-reload)
86 #
87 # If the "reload" option is implemented, move the "force-reload"
88 # option to the "reload" entry above. If not, "force-reload" is
89 # just the same as "restart".
90 #
91 echo "Restarting $DESC: $NAME"
92 d_stop
93 sleep 1
94 d_start
95 echo "."
96 ;;
97 *)
98 # echo "Usage: $SCRIPTNAME {start|stop|restart|reload|force-reload}" >&2
99 echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload}" >&2
100 exit 1
101 ;;
102esac
103
104exit 0