-# {{{ distcc
-config_distcc(){
-if checkbootparam 'distcc' ; then
- OPTIONS="$(getbootparam 'distcc' 2>>$DEBUG)"
- if [ -n "$OPTIONS" ]; then
- NET=""
- INTERFACE=""
- if [ -n "$OPTIONS" ]; then
- NET="${OPTIONS%%,*}"
- R="${OPTIONS#*,}"
- if [ -n "$R" -a "$R" != "$OPTIONS" ]; then
- OPTIONS="$R"
- INTERFACE="${OPTIONS%%,*}"
- R="${OPTIONS#*,}"
- fi
- fi
- fi
- CONFIG=/etc/default/distcc
- sed -i "s#^STARTDISTCC=.*#STARTDISTCC=YES#" $CONFIG
- sed -i "s#^ALLOWEDNETS=.*#ALLOWEDNETS=$NET#" $CONFIG
-
- if [ -n "$INTERFACE" ] ; then
- IP=$(LANG=C ifconfig $INTERFACE | gawk -F: /"inet addr"/'{print $2}' | gawk '{print $1}')
-
- counter=10
- while [ -z "$IP" ] && [[ "$counter" != 0 ]] ; do
- counter=$(( counter-1 ))
- ewarn "No ip address for $INTERFACE found. Sleeping for 3 seconds. $counter tries left."
- sleep 3
- IP=$(LANG=C ifconfig $INTERFACE | gawk -F: /"inet addr"/'{print $2}' | gawk '{print $1}')
- done
- fi
-
- if [ -n "$IP" ] ; then
- sed -i "s#^LISTENER=.*#LISTENER=$IP#" $CONFIG
-
- einfo "Bootoption distcc found. Preparing setup for distcc daemon."
- eindent
- id distccd >/dev/null 2>&1 || \
- (
- einfo "Creating distcc user" ; \
- adduser --quiet --system --ingroup nogroup --home / --no-create-home distccd ; eend $?
- )
-
- einfo "Starting distcc for network ${NET}, listening on ${IP}."
- /etc/init.d/distcc start >/dev/null ; eend $?
- eoutdent
- else
- eerror "No ip address for $INTERFACE found. distcc can not be used without it." ; eend 1
- fi
-fi
-
-if checkbootparam 'gcc'; then
- GCC="$(getbootparam 'gcc' 2>>$DEBUG)"
- eindent
- einfo "Pointing /usr/bin/gcc to /usr/bin/gcc-${GCC}."
- eoutdent
- rm -f /usr/bin/gcc
- ln -s /usr/bin/gcc-${GCC} /usr/bin/gcc ; eend $?
-fi
-
-if checkbootparam 'gpp'; then
- GPP="$(getbootparam 'gpp' 2>>$DEBUG)"
- eindent
- einfo "Pointing /usr/bin/g++ to /usr/bin/g++-${GPP}."
- if [ -x /usr/bin/g++-${GPP} ] ; then
- rm -f /usr/bin/g++
- ln -s /usr/bin/g++-${GPP} /usr/bin/g++ ; eend $?
- fi
- einfo "Pointing /usr/bin/cpp to /usr/bin/cpp-${GPP}."
- if [ -x /usr/bin/cpp-${GPP} ] ; then
- rm -f /usr/bin/cpp
- ln -s /usr/bin/cpp-${GPP} /usr/bin/cpp ; eend $?
- fi
- eoutdent
-fi
-
-}
-# }}}
-
-# {{{ load modules
-# Notice: use it only on live-cd system, if running from harddisk please
-# add modules to /etc/modules and activate /etc/init.d/module-init-tools
-# in /etc/runlevel.conf
-config_modules(){
-MODULES_FILE=/etc/grml/modules
-if checkbootparam 'nomodules' ; then
- ewarn "Skipping loading of modules defined in ${MODULES_FILE} as requested." ; eend 0
-elif [ -z "$INSTALLED" ]; then
- if [ -r $MODULES_FILE ] ; then
- einfo "Loading modules specified in ${MODULES_FILE}:"
- eindent
- grep '^[^#]' $MODULES_FILE | \
- while read module args; do
- [ "$module" ] || continue
- einfo "${module}"
- modprobe $module $args ; eend $?
- done
- eoutdent
- else
- ewarn "File $MODULES_FILE does not exist. Skipping loading of specific modules." ; eend 1
- fi
-fi
-}
-# }}}
-