#!/bin/bash BUILDSERVER_CACHE_DIR="/var/cache/mage-buildserver" SMAGEFILE="$1" CLEANPACKAGES=0 if [ -f /etc/rc.d/init.d/functions ] then source /etc/rc.d/init.d/functions else die "/etc/rc.d/init.d/functions not found" fi if [ -f /etc/mage.rc.global ] then source /etc/mage.rc.global else die "/etc/mage.rc.global not found" fi if [ -f /etc/mage.rc ] then source /etc/mage.rc else die "/etc/mage.rc not found" fi if [ -f ${MLIBDIR}/mage4.functions.sh ] then source ${MLIBDIR}/mage4.functions.sh else die "${MLIBDIR}/mage4.functions.sh not found" fi if [ -f ${MLIBDIR}/smage2.functions.sh ] then source ${MLIBDIR}/smage2.functions.sh else die "${MLIBDIR}/smage2.functions.sh not found" fi # do this at least of all includes to prevent path overwrites env-rebuild source /etc/profile # export default path export PATH="${PATH}:${MLIBDIR}" die() { echo "ERROR: $@" exit 1 } is_split_target_magefile() { local mage="$1" for target_mage in ${MY_SPLIT_TARGET_MAGEFILES} do if [[ ${mage} = ${target_mage} ]] then return 0 fi done return 1 } load_mage_features mage_setup if [[ -z ${SMAGEFILE} ]] then die "no smage file given. call '$(basename $0) with/relative/path/from/buildroot/svn/smage/to/smagefile'" fi if [ -f ${SMAGESCRIPTSDIR}/${SMAGEFILE} ] then # be silent FVERBOSE=off \ SILENT=1 \ smagesource ${SMAGESCRIPTSDIR}/${SMAGEFILE} else die "smagefile '${SMAGESCRIPTSDIR}/${SMAGEFILE}' not found." fi # create build info dir install -d ${BUILDSERVER_CACHE_DIR}/build if [ ! -f ${BUILDSERVER_CACHE_DIR}/build/${PNAME}-${PVER}-${PBUILD}/INSTALL_DEPS ] then die "${BUILDSERVER_CACHE_DIR}/build/${PNAME}-${PVER}-${PBUILD}/INSTALL_DEPS missing. run 'buildserver-build-depends first" fi if [ ! -f ${BUILDSERVER_CACHE_DIR}/build/${PNAME}-${PVER}-${PBUILD}/SRC_INSTALL_DEPS ] then die "${BUILDSERVER_CACHE_DIR}/build/${PNAME}-${PVER}-${PBUILD}/SRC_INSTALL_DEPS missing. run 'buildserver-build-depends first" fi INSTALL_DEPS="$(< ${BUILDSERVER_CACHE_DIR}/build/${PNAME}-${PVER}-${PBUILD}/INSTALL_DEPS)" SRC_INSTALL_DEPS="$(< ${BUILDSERVER_CACHE_DIR}/build/${PNAME}-${PVER}-${PBUILD}/SRC_INSTALL_DEPS)" if [[ -z ${SRC_INSTALL_DEPS} ]] then die "buildserver-build-uninstall-prerequisites: SRC_INSTALL_DEPS are empty, aborting." fi echo echo "---- dependencies ----" echo "INSTALL_DEPS:" for i in ${INSTALL_DEPS} do echo " * ${i}" done echo "SRC_INSTALL_DEPS:" for i in ${SRC_INSTALL_DEPS} do echo " * ${i}" done echo "----------------------" #echo "DEBUG: paused"; read # override packages path SAVED_PKGDIR="${PKGDIR}" PKGDIR="/var/cache/mage/tmp-packages" install -d "${PKGDIR}" # now install the packages (no srcinstall, when the user not explcitly want this) fetch_packages ${INSTALL_DEPS} || die "fetching packages" md5sum_packages ${INSTALL_DEPS} || die "md5 sum packages" unpack_packages ${INSTALL_DEPS} || die "unpacking packages" install_packages ${INSTALL_DEPS} || die "installing packages" if [[ ${CLEANPACKAGES} = 1 ]] then cleanpkg fi # restore packages path PKGDIR="${SAVED_PKGDIR}" ## always run auto etc-update echo "running etc-update" echo "-5" | etc-update # mark prerequisites as installed touch ${BUILDSERVER_CACHE_DIR}/build/${PNAME}-${PVER}-${PBUILD}/INSTALLED_PREREQUISITES