summaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/distcc/files/distcc
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-devtools/distcc/files/distcc')
-rwxr-xr-xmeta/recipes-devtools/distcc/files/distcc114
1 files changed, 114 insertions, 0 deletions
diff --git a/meta/recipes-devtools/distcc/files/distcc b/meta/recipes-devtools/distcc/files/distcc
new file mode 100755
index 0000000..c7c414d
--- /dev/null
+++ b/meta/recipes-devtools/distcc/files/distcc
@@ -0,0 +1,114 @@
1#!/bin/sh
2### BEGIN INIT INFO
3# Provides: distcc
4# Required-Start: $remote_fs $syslog
5# Required-Stop: $remote_fs $syslog
6# Default-Start: 2 3 4 5
7# Default-Stop: 1
8# Short-Description: simple distributed compiler client and server
9### END INIT INFO
10#
11# distccd Debian init.d script contributed by Jason Thomas. (Debian #161136)
12#
13# skeleton example file to build /etc/init.d/ scripts.
14# This file should be used to construct scripts for /etc/init.d.
15#
16# Written by Miquel van Smoorenburg <miquels@cistron.nl>.
17# Modified for Debian GNU/Linux
18# by Ian Murdock <imurdock@gnu.ai.mit.edu>.
19#
20# Version: @(#)skeleton 1.9.1 08-Apr-2002 miquels@cistron.nl
21#
22
23PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
24DAEMON=/usr/bin/distccd
25NAME=distcc
26DESC="Distributed Compiler Daemon"
27DAEMON_ARGS="--pid-file=/var/run/$NAME.pid --daemon"
28# please change those variables by overriding them in /etc/defaults/distcc
29ALLOWEDNETS="127.0.0.1"
30
31# Reads config file (will override defaults above)
32[ -r /etc/default/distcc ] && . /etc/default/distcc
33
34test -x $DAEMON || exit 0
35
36set -e
37
38# Source function library.
39. /etc/init.d/functions
40
41# construct access list
42ALLOW=""
43for net in $ALLOWEDNETS
44do
45 ALLOW="$ALLOW --allow $net"
46done
47
48should_start() {
49 if [ "$STARTDISTCC" != "true" ] && [ "$STARTDISTCC" != "YES" ]; then
50 echo "STARTDISTCC is set to false in /etc/default/distcc"
51 echo "$DAEMON not starting"
52 exit 0
53 fi
54}
55
56case "$1" in
57 start)
58 should_start
59 echo -n "Starting $DESC: $NAME"
60 start-stop-daemon --start --quiet --pidfile /var/run/$NAME.pid \
61 --exec $DAEMON -- $DAEMON_ARGS $ALLOW ||
62 {
63 code=$?
64 echo "$0: start failed with error code $code" >&2
65 exit $code
66 }
67 echo "."
68 ;;
69 stop)
70 echo -n "Stopping $DESC: $NAME"
71 start-stop-daemon --stop --quiet --pidfile /var/run/$NAME.pid \
72 --exec $DAEMON ||
73 {
74 code=$?
75 echo "$0: stop failed with error code $code" >&2
76 exit $code
77 }
78 echo "."
79 ;;
80 restart|force-reload)
81 #
82 # If the "reload" option is implemented, move the "force-reload"
83 # option to the "reload" entry above. If not, "force-reload" is
84 # just the same as "restart".
85 #
86 echo -n "Restarting $DESC: $NAME"
87 start-stop-daemon --stop --quiet --pidfile /var/run/$NAME.pid \
88 --exec $DAEMON
89 sleep 1
90 should_start
91 start-stop-daemon --start --quiet --pidfile /var/run/$NAME.pid \
92 --exec $DAEMON -- $DAEMON_ARGS $ALLOW ||
93 {
94 code=$?
95 echo "$0: restart failed with error code $code" >&2
96 exit $code
97 }
98 echo "."
99 ;;
100
101 status)
102 status $DAEMON
103 exit $?
104 ;;
105 *)
106 N=/etc/init.d/$NAME
107 echo "Usage: $N {start|stop|restart|force-reload|status}" >&2
108 exit 1
109 ;;
110esac
111
112exit 0
113
114