summaryrefslogtreecommitdiff
path: root/packaging/RedHat/init.d/distcc
diff options
context:
space:
mode:
Diffstat (limited to 'packaging/RedHat/init.d/distcc')
-rw-r--r--packaging/RedHat/init.d/distcc94
1 files changed, 39 insertions, 55 deletions
diff --git a/packaging/RedHat/init.d/distcc b/packaging/RedHat/init.d/distcc
index 70d6d31..72f7847 100644
--- a/packaging/RedHat/init.d/distcc
+++ b/packaging/RedHat/init.d/distcc
@@ -43,13 +43,17 @@ PIDFILE=/var/run/$PROG.pid
EXEC="/usr/bin/distccd"
-if [[ -f /etc/sitename.install ]]; then
- # goobuntu
+if [ -f /etc/sitename.install ]; then
+ # Debian?
DOMAIN=`cat /etc/sitename.install`
- CONFIGDIR=/etc/site/current/distcc
+ if [ -d /etc/site/current/distcc ]; then
+ CONFIGDIR=/etc/site/current/distcc
+ else
+ CONFIGDIR=/etc/distcc
+ fi
NORESTART=$CONFIGDIR/no-restart
else
- # grhat
+ # RedHat?
DOMAIN=`/bin/dnsdomainname`
CONFIGDIR=/etc/distcc
NORESTART=$CONFIGDIR/no-restart
@@ -102,56 +106,52 @@ RETVAL=0
[ -x /usr/bin/distccd ] || exit 0
ALLOWFILE=""
-
-
-if test -f $CONFIGDIR/clients.allow; then
- ALLOWFILE=$CONFIGDIR/clients.allow
-elif test -f $CONFIGDIR/$DOMAIN/clients.allow; then
+if test -f $CONFIGDIR/$DOMAIN/clients.allow; then
ALLOWFILE=$CONFIGDIR/$DOMAIN/clients.allow
+elif test -f $CONFIGDIR/clients.allow; then
+ ALLOWFILE=$CONFIGDIR/clients.allow
else
echo "$0: no clients allowed"
exit 1
fi
-
if test "$ALLOWFILE"x != x; then
ALLOW_OPTIONS=$(sed -e 's/#.*$//' -e '/^[ ]*$/d' -e 's/^/--allow=/' < $ALLOWFILE)
OPTIONS="$OPTIONS $ALLOW_OPTIONS"
fi
+COMMANDFILE=""
+if test -f $CONFIGDIR/$DOMAIN/commands.allow.sh; then
+ COMMANDFILE=$CONFIGDIR/$DOMAIN/commands.allow.sh
+elif test -f $CONFIGDIR/commands.allow.sh; then
+ COMMANDFILE=$CONFIGDIR/commands.allow.sh
+fi
+
+mkdir -p /var/state/distcc
+CMDLIST=/var/state/distcc/commands.allow
rh_start() {
echo -n "Starting $PROG"
- if [[ -f $NORESTART ]]
+ if [ -f $NORESTART ]
then
echo "failed -- $NORESTART present"
return 1
fi
- #--- begin crosstool-specific configuration ---
- # List directories which might contain installations of crosstool on this node
- # This will let users compile on this node regardless of where crosstool
- # is installed on client or server
- # Neccessary because crosstool compilers are identified not just by
- # a command name, but also by the directory they're in (if you have
- # several toolchains built for a particular target).
- COMPILERS=
- # modern crosstool
- test -d /usr/crosstool && COMPILERS="$COMPILERS /usr/crosstool/*/*/bin/*-[cg][+c][+c] /usr/crosstool/v*/*/*/bin/*-[cg][+c][+c] /usr/crosstool/v4/*/*/*/bin/*-[cg][+c][+c]"
- # old crosstool (which stored everything in a directory named for the build system type)
- test -d /opt/crosstool && COMPILERS="$COMPILERS /opt/crosstool/*/*/*/bin/*-[cg][+c][+c]"
- test -d /home/build/buildtools/crosstool/v7 && COMPILERS="$COMPILERS /home/build/buildtools/crosstool/v7/*/*/bin/*-[cg][+c][+c]"
- if test ! -d $CONFIGDIR; then
- mkdir -p $CONFIGDIR
+ env="TMPDIR=$TMPDIR"
+ if [ -n "$COMMANDFILE" ]; then
+ : > $CMDLIST
+ . $COMMANDFILE
+ if [ "$DISTCC_CMDLIST" ]; then
+ env="$env DISTCC_CMDLIST=$DISTCC_CMDLIST"
+ fi
+ if [ "$DISTCC_CMDLIST_NUMWORDS" ]; then
+ env="$env DISTCC_CMDLIST_NUMWORDS=$DISTCC_CMDLIST_NUMWORDS"
+ fi
fi
- CMDLIST=$CONFIGDIR/commands.allow
- # Expand the wildcards in $COMPILERS, put one file per line, empty file if no match
- echo $COMPILERS | tr '\040' '\012' > $CMDLIST
- ENV="DISTCC_CMDLIST=$CMDLIST DISTCC_CMDLIST_NUMWORDS=5 TMPDIR=$TMPDIR"
- #--- done crosstool-specific configuration ---
- daemon --user $USER $ENV $PROG $OPTIONS
+ daemon --user $USER $env $PROG $OPTIONS
RETVAL=$?
echo
[ $RETVAL -eq 0 ] && touch /var/lock/subsys/$PROG
@@ -200,38 +200,22 @@ redhat() {
deb_start() {
log_begin_msg "Starting $PROG..."
- if [[ -f $NORESTART ]]
+ if [ -f $NORESTART ]
then
log_end_msg 1
echo "distcc start failed -- $NORESTART present"
return 1
fi
- #--- begin crosstool-specific configuration ---
- # List directories which might contain installations of crosstool on this node
- # This will let users compile on this node regardless of where crosstool
- # is installed on client or server
- # Neccessary because crosstool compilers are identified not just by
- # a command name, but also by the directory they're in (if you have
- # several toolchains built for a particular target).
- COMPILERS=
- # modern crosstool
- test -d /usr/crosstool && COMPILERS="$COMPILERS /usr/crosstool/*/*/bin/*-[cg][+c][+c] /usr/crosstool/v*/*/*/bin/*-[cg][+c][+c] /usr/crosstool/v4/*/*/*/bin/*-[cg][+c][+c]"
- # old crosstool (which stored everything in a directory named for the build system type)
- test -d /opt/crosstool && COMPILERS="$COMPILERS /opt/crosstool/*/*/*/bin/*-[cg][+c][+c]"
- test -d /home/build/buildtools/crosstool/v7 && COMPILERS="$COMPILERS /home/build/buildtools/crosstool/v7/*/*/bin/*-[cg][+c][+c]"
- if test ! -d $CONFIGDIR; then
- mkdir -p $CONFIGDIR
+ if [ -n "$COMMANDFILE" ]; then
+ : > $CMDLIST
+ CMDLIST=$COMMANDFILE
+ . $COMMANDFILE
+ export DISTCC_CMDLIST
+ export DISTCC_CMDLIST_NUMWORDS
fi
- CMDLIST=$CONFIGDIR/commands.allow
- # Expand the wildcards in $COMPILERS, put one file per line, empty file if no match
- echo $COMPILERS | tr '\040' '\012' > $CMDLIST
- export DISTCC_CMDLIST=$CMDLIST
- export DISTCC_CMDLIST_NUMWORDS=5
export TMPDIR=$TMPDIR
- #--- done crosstool-specific configuration ---
-
start-stop-daemon --start --name distccd --pidfile $PIDFILE -m --chuid $USER --exec $EXEC -- $OPTIONS || log_end_msg 1
RETVAL=$?
log_end_msg 0