automate/020_distcc_slave.sh

98 lines
3.5 KiB
Bash
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/usr/bin/env bash
apt-get install -y distcc distcc-pump ccache dmucs distccmon-gnome
# For avahi/bonjour mdns support
apt-get install avahi-daemon avahi-utils libnss-mdns
#apt-get install avahi-ui-utils avahi-discover
# Update the symlinks found in
/usr/sbin/update-ccache-symlinks
## distcc will use Avahi Zeroconf DNS Service Discovery (DNS-SD) to locate any available distccd servers on the local network.
#
# The distccd server must be started with --zeroconf or /etc/default/distcc STARTDISTCC set to true.
#
# NB An important caveat is that in the current implementation, pump mode (",cpp") and compression (",lzo") will never be used for hosts located via zeroconf. Enabling compression makes the distcc client and server use more CPU time, but less network traffic. The added CPU time is insignificant for pump mode. Compression is usually economical on networks slower than 100Mbps
cat >/etc/distcc/hosts <<EOF
# As described in the distcc manpage, this file can be used for a global
# list of available distcc hosts.
#
# The list from this file will only be used, if neither the
# environment variable DISTCC_HOSTS, nor the file $HOME/.distcc/hosts
# contains a valid list of hosts.
#
# Add a list of hostnames in one line, seperated by spaces, here.
#+zeroconf
EOF
## /etc/default/distcc
# should distcc be started on boot?
STARTDISTCC="true"
# Which networks/hosts should be allowed to connect to the daemon?
# You can list multiple hosts/networks separated by spaces.
# Networks have to be in CIDR notation, e.g. 192.168.1.0/24
# Hosts are represented by a single IP address
#ALLOWEDNETS="127.0.0.1"
ALLOWEDNETS="127.0.0.1 192.168.1.0/24"
# Which interface should distccd listen on?
# You can specify a single interface, identified by it's IP address, here
LISTENER="127.0.0.1"
# You can specify a (positive) nice level for the distcc process here
NICE="10"
# You can specify a maximum number of jobs, the server will accept concurrently
JOBS=""
# Enable Zeroconf support?
# If enabled, distccd will register via mDNS/DNS-SD.
# It can then automatically be found by zeroconf enabled distcc clients
# without the need of a manually configured host list.
ZEROCONF="true"
sed -i "s,^\(STARTDISTCC=\).*,\1\"${STARTDISTCC}\"," /etc/default/distcc
sed -i "s,^\(ALLOWEDNETS=\).*,\1\"${ALLOWEDNETS}\"," /etc/default/distcc
sed -i "s,^\(LISTENER=\).*,\1\"${LISTENER}\"," /etc/default/distcc
sed -i "s,^\(NICE=\).*,\1\"${NICE}\"," /etc/default/distcc
sed -i "s,^\(JOBS=\).*,\1\"${JOBS}\"," /etc/default/distcc
sed -i "s,^\(ZEROCONF=\).*,\1\"${ZEROCONF}\"," /etc/default/distcc
## dmucs
# Change this to 'yes' if you want to run as a dmucs server.
# Normally only one host a given network need act as a server.
SERVER=no
# If you want this machine to act as a compilation server edit
# the line below and set USE_SERVER to the name of the dmucs
# server on your network.
USE_SERVER=
sed -i "s,^\(SERVER=\).*,\1\"${SERVER}\"," /etc/default/dmucs
sed -i "s,^\(USE_SERVER=\).*,\1\"${USE_SERVER}\"," /etc/default/dmucs
# Create a hosts-info file in the location '/usr/local/share/dmucs/hosts-info' (or, if you specified -prefix when 'configure'ing, in <prefix>/share/dmucs/hosts-info).
#Here is a sample hosts-info file:
# Format: machine number-of-cpus power-index
#
#linux-comp-1 4 10
#solaris-comp-1 2 5
#solaris-comp-2 2 5
#old-linux-comp-1 1 4
#old-solaris-comp-3 1 2
#169.144.80.25 1 2
cat >/etc/dmuc.conf <<EOF
# Configuration file for dmucs server.
#
# Format: machine number-of-cpus power-index
EOF