#!/bin/sh # # distccd Debian init.d script contributed by Jason Thomas. (Debian #161136) # modified for chroot by Thomas Sjogren PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin DAEMON=/usr/bin/distccd NAME=distccd DESC="Distributed Compiler Daemon" CHROOTDIR=/var/chroot/distccd PIDFILE=/var/run/distccd/$NAME.pid DAEMON_ARGS="--verbose --pid-file=$PIDFILE --log-file=/var/log/$NAME.log --daemon" # please change those variables by overriding them in /etc/defaults/distcc ALLOWEDNETS="127.0.0.1" # Reads config file (will override defaults above) [ -r /etc/default/distcc ] && . /etc/default/distcc test -x $DAEMON || exit 0 set -e # construct access list ALLOW="" for net in $ALLOWEDNETS do ALLOW="$ALLOW --allow $net" done should_start() { if [ "$STARTDISTCC" != "true" ] && [ "$STARTDISTCC" != "YES" ]; then echo "STARTDISTCC is set to false in /etc/default/distcc" echo "$DAEMON not starting" exit 0 fi # we need permission to write to the pid file touch $CHROOTDIR$PIDFILE chown distccd $CHROOTDIR$PIDFILE } case "$1" in start) should_start echo -n "Starting $DESC: $NAME" start-stop-daemon --start --quiet --pidfile $PIDFILE \ --chuid distccd \ --chroot $CHROOTDIR \ --exec $DAEMON -- $DAEMON_ARGS $ALLOW echo "." ;; stop) echo -n "Stopping $DESC: " start-stop-daemon --stop --pidfile $CHROOTDIR$PIDFILE --oknodo echo "done" ;; restart|force-reload) $0 stop sleep 1 $0 start ;; *) N=/etc/init.d/$NAME echo "Usage: $N {start|stop|restart|force-reload}" >&2 exit 1 ;; esac exit 0