1#! /bin/bash 2# 3# Copyright (C) 2010 Igalia S.L. All rights reserved. 4# 5# This library is free software; you can redistribute it and/or 6# modify it under the terms of the GNU Library General Public 7# License as published by the Free Software Foundation; either 8# version 2 of the License, or (at your option) any later version. 9# 10# This library is distributed in the hope that it will be useful, 11# but WITHOUT ANY WARRANTY; without even the implied warranty of 12# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13# Library General Public License for more details. 14# 15# You should have received a copy of the GNU Library General Public License 16# along with this library; see the file COPYING.LIB. If not, write to 17# the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 18# Boston, MA 02110-1301, USA. 19 20exec 2>&1 21 22: ${BUILDBOT_CONFIG:=/etc/daemontools-buildbot.conf} 23 24# Read configuration file 25[ -r "${BUILDBOT_CONFIG}" ] && . "${BUILDBOT_CONFIG}" 26 27: ${buildbot_user:=${USER:-${LOGNAME}}} 28: ${crashmon_output:=''} 29 30# Expand all "env_*" environment variables 31for varname in ${!env_*} ; do 32 eval "export ${varname#env_}=\${${varname}}" 33done 34 35 36if [ ! -d "${crashmon_output}" ] 37then 38 if ! [ "${crashmon_output}" ] 39 then 40 echo "Dump directory '${crashmon_output}' does not exist (sleeping)" 41 fi 42 sleep $(( 60 * 60 * 4 )) 43 exit 111 44fi 45 46 47if ! [ "${buildbot_bits}" ] 48then 49 # Guess bits (32/64) from uname -m 50 machine=$(uname -m) 51 case ${machine} in 52 x86_64 | amd64 | ia64 | ppc64) 53 buildbot_bits="64" ;; 54 *) 55 buildbot_bits="32" ;; 56 esac 57fi 58 59: ${crashmon_bin_path:="${buildbot_path}/gtk-linux-${buildbot_bits}-debug/build/WebKitBuild/Debug/Programs"} 60 61 62cd "${crashmon_output}" 63exec /usr/bin/env - \ 64 PATH="${PATH}" \ 65 SHELL="/bin/bash" \ 66 USER="${buildbot_user}" \ 67 arch="${buildbot_bits}" \ 68 LOGNAME="${buildbot_user}" \ 69 coredir="${crashmon_output}" \ 70 HOME="/home/${buildbot_user}" \ 71 mailto="${crashmon_mailto:-''}" \ 72 programpath="${crashmon_bin_path}" \ 73 /usr/bin/setuidgid "${buildbot_user}" "$(pwd)/crashmon" 74 75