summaryrefslogtreecommitdiff
path: root/packaging
diff options
context:
space:
mode:
authorfergus.henderson <fergushenderson@users.noreply.github.com>2008-04-18 18:32:35 +0000
committerfergus.henderson <fergushenderson@users.noreply.github.com>2008-04-18 18:32:35 +0000
commit0265943b80e6ee3932fc03ce11d5393758ec62c8 (patch)
tree791faae8d44145090d7fe047366f28b0a007445d /packaging
parent946857c057da7a392d6e41ce81db5f66d0899f0c (diff)
downloaddistcc-git-0265943b80e6ee3932fc03ce11d5393758ec62c8.tar.gz
A bunch of changes to the configuration files and installation:
(1) Remove the Google crosstool-specific stuff from packaging/RedHat/init.d/distcc; instead, make it source a new configuration file "commands.allow.sh". (2) Install default versions of all the configuration files in $(sysconfdir), i.e. /etc: distcc/hosts, distcc/clients.allow, commands.allow.sh, and defaults/distcc. (3) Fix a bug in Makefile.in: "make install" didn't work when you configured with srcdir != builddir. Added "$(srcdir)/" in various places to make it work. (There's similar problems with "make dist", but I gave up on those for now.) (4) Add "install-deb" rule, to install the ".deb" files. (5) Don't run install-for-include-server-tests as part of "make install". That target is part of "make check", not "make install". (6) Add missing dependency on "include-server" to "pump-check" rule. (7) Remove some bash-isms from the "init.d/distcc" script. Tested by running "make install-deb" followed by "distcc /usr/bin/gcc -c foo.c" - this now works "out-of-the-box"! :-> Also ran "make maintainer-check" and "make pump-check".
Diffstat (limited to 'packaging')
-rw-r--r--packaging/RedHat/conf/clients.allow16
-rw-r--r--packaging/RedHat/conf/commands.allow.sh47
-rw-r--r--packaging/RedHat/conf/hosts6
-rw-r--r--packaging/RedHat/default/distcc1
-rw-r--r--packaging/RedHat/init.d/distcc94
-rw-r--r--packaging/RedHat/rpm.spec10
6 files changed, 118 insertions, 56 deletions
diff --git a/packaging/RedHat/conf/clients.allow b/packaging/RedHat/conf/clients.allow
new file mode 100644
index 0000000..1f6f9eb
--- /dev/null
+++ b/packaging/RedHat/conf/clients.allow
@@ -0,0 +1,16 @@
+# Comments start with "#" and go to end of line. Non-comment lines should
+# contain entries suitable for passing to the --allow option of distccd, e.g.
+# 192.168.1.100
+# 192.168.2.0/8
+#
+# From the distccd man page:
+# -a, --allow IPADDR[/MASK]
+# Instructs distccd to accept connections from the IP address
+# IPADDR. A CIDR mask length can be supplied optionally after a
+# trailing slash, e.g. 192.168.0.0/24, in which case addresses
+# that match in the most significant MASK bits will be allowed.
+# If no --allow options are specified, no clients are allowed!
+# Unauthorized connections are rejected by closing the TCP connec-
+# tion immediately. A warning is logged on the server but nothing
+# is sent to the client.
+127.0.0.1
diff --git a/packaging/RedHat/conf/commands.allow.sh b/packaging/RedHat/conf/commands.allow.sh
new file mode 100644
index 0000000..af75467
--- /dev/null
+++ b/packaging/RedHat/conf/commands.allow.sh
@@ -0,0 +1,47 @@
+#!/bin/sh
+# --- /etc/site/current/distcc/commands.allow.sh ----------------------
+#
+# This file is a shell script that gets sourced by /etc/init.d/distcc.
+# It's purpose is to optionally set the following environment
+# variables, which affect the behaviour of distccd:
+#
+# DISTCC_CMDLIST
+# If the environment variable DISTCC_CMDLIST is set, distccd will
+# load a list of supported commands from the file named by
+# DISTCC_CMDLIST, and will refuse to serve any command whose last
+# DISTCC_CMDLIST_MATCHWORDS last words do not match those of a
+# command in that list. See the comments in src/serve.c.
+#
+# DISTCC_CMDLIST_NUMWORDS
+# The number of words, from the end of the command, to match. The
+# default is 1.
+#
+# The interface to this script is as follows.
+# Input variables:
+# CMDLIST: this variable will hold the full path of the commands.allow file.
+# Side effects:
+# This script should write into the commands.allow file specified by
+# $CMDLIST. It should write the list of allowable commands, one per line.
+# Output variables:
+# DISTCC_CMDLIST and DISTCC_CMDLIST_NUMWORDS. See above.
+#-----------------------------------------------------------------------------#
+
+# Here are the parts that you may want to modify.
+
+numwords=1
+allowed_compilers="
+ /usr/bin/gcc
+ /usr/bin/*gcc-*
+"
+
+# You shouldn't need to alter anything below here.
+
+[ "$CMDLIST" ] || {
+ echo "$0: don't run this script directly!" >&2
+ echo "Run /etc/init.d/distcc (or equivalent) instead." >&2
+ exit 1
+}
+
+echo $allowed_compilers | tr ' ' '\n' > $CMDLIST
+DISTCC_CMDLIST=$CMDLIST
+DISTCC_CMDLIST_NUMWORDS=$numwords
diff --git a/packaging/RedHat/conf/hosts b/packaging/RedHat/conf/hosts
new file mode 100644
index 0000000..f2c033e
--- /dev/null
+++ b/packaging/RedHat/conf/hosts
@@ -0,0 +1,6 @@
+# --- /etc/distcc/hosts -----------------------
+# See the "Hosts Specification" section of
+# "man distcc" for the format of this file.
+#
+# By default, just test that it works in loopback mode.
+127.0.0.1
diff --git a/packaging/RedHat/default/distcc b/packaging/RedHat/default/distcc
new file mode 100644
index 0000000..5128353
--- /dev/null
+++ b/packaging/RedHat/default/distcc
@@ -0,0 +1 @@
+STARTDISTCC=true
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
diff --git a/packaging/RedHat/rpm.spec b/packaging/RedHat/rpm.spec
index ed46416..3c97f97 100644
--- a/packaging/RedHat/rpm.spec
+++ b/packaging/RedHat/rpm.spec
@@ -22,7 +22,7 @@ Distribution: Redhat 7 and above.
BuildRoot: %{_tmppath}/%{name}-buildroot
Prefix: %_prefix
Provides: distcc
-Obsoletes: crosstool-distcc
+Obsoletes: crosstool-distcc distcc-include-server
%description
distcc is a program to distribute compilation of C or C++ code across several
@@ -51,6 +51,7 @@ make RPM_OPT_FLAGS="$RPM_OPT_FLAGS" \
%install
rm -rf $RPM_BUILD_ROOT
make DESTDIR=${RPM_BUILD_ROOT} PYTHON_INSTALL_RECORD=python_install_record install
+# TODO(fergus): move these to "make install"?
mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d
install -m 644 packaging/RedHat/logrotate.d/distcc $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d/distcc
mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/xinetd.d
@@ -73,6 +74,8 @@ rm -rf $RPM_BUILD_ROOT
%{_bindir}/lsdistcc
%{_libdir}/distcc
%{_bindir}/pump
+%dir %{_sysconfdir}/distcc
+%config %{_sysconfdir}/distcc/hosts
%doc %{_mandir}/man1/distcc.1.gz
%doc %{_mandir}/man1/distccmon-text.1.gz
%doc %{_docdir}
@@ -101,6 +104,11 @@ faster than a local compile.
%config %{_sysconfdir}/init.d/distcc
%dir %{_sysconfdir}/xinetd.d/
%config %{_sysconfdir}/xinetd.d/distcc
+%dir %{_sysconfdir}/distcc
+%config %{_sysconfdir}/distcc/clients.allow
+%config %{_sysconfdir}/distcc/commands.allow.sh
+%dir %{_sysconfdir}/default
+%config %{_sysconfdir}/default/distcc
%doc %{_mandir}/man1/distccd.1.gz
%pre server