#!/bin/bash ############################################################################### # # # IPFire.org - A linux based firewall # # Copyright (C) 2008 Michael Tremer & Christian Schmidt # # # # This program is free software: you can redistribute it and/or modify # # it under the terms of the GNU General Public License as published by # # the Free Software Foundation, either version 3 of the License, or # # (at your option) any later version. # # # # This program is distributed in the hope that it will be useful, # # but WITHOUT ANY WARRANTY; without even the implied warranty of # # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # # GNU General Public License for more details. # # # # You should have received a copy of the GNU General Public License # # along with this program. If not, see . # # # ############################################################################### BUILD_SPY_FILENAME=$BASEDIR/.build_spy BUILD_SPY_PID=$BUILD_SPY_FILENAME.pid build_spy() { local COMMAND COMMAND=$1 shift 1 if [ "$COMMAND" = "start" ]; then BASEDIR=$BASEDIR UUID=$UUID NAME=$NAME VERSION=$VERSION \ LOGFILE="$BASEDIR/log_${TARGET}/_build.00-buildspy.log" \ $BASEDIR/tools/make-buildspy & elif [ "$COMMAND" = "exit" ]; then echo -n "BUILDSPY_EXIT " >> $BUILD_SPY_FILENAME else echo -n "${COMMAND}=$* " >> $BUILD_SPY_FILENAME fi } build_spy_send_profile() { build_spy target ${TARGET} build_spy hostname ${HOSTNAME} build_spy distcc ${DISTCC_PORT-3632} build_spy jobs ${DISTCC_JOBS} build_spy cpu $(grep ^model\ name /proc/cpuinfo | head -n1 | \ awk -F: '{ print $2 }' | $BASEDIR/tools/base64) build_spy machine $(uname -m) build_spy toolchain "${NAME}-${TOOLCHAINVERSION}" } if [ "$(basename $0)" == "make-buildspy" ]; then if [ -f "$BUILD_SPY_PID" ]; then exit 0 fi echo $$ > $BUILD_SPY_PID while true; do DATA+=$(cat $BUILD_SPY_FILENAME 2>/dev/null || true) > $BUILD_SPY_FILENAME for command in $DATA; do if [ "$command" = "BUILDSPY_EXIT" ]; then BUILDSPY_EXIT=1 break fi done if [ -n "$DATA" ] && \ $BASEDIR/tools/buildspy \ action=set uuid=$UUID $DATA >> $LOGFILE 2>&1; then DATA="" fi if [ "$BUILDSPY_EXIT" = "1" ]; then break fi sleep 10 done rm -f $BUILD_SPY_FILENAME $BUILD_SPY_PID fi