#!/bin/bash # get configuration BUILDSERVER_CONFIG_DIR="/etc/mage-buildserver" source ${BUILDSERVER_CONFIG_DIR}/buildserver.conf source ${BUILDSERVER_LIB_DIR}/buildserver-functions.sh # override #BUILDROOT="/mnt/test-buildroot" #BUILD_ARCH=( x86_64 i686 ) #BUILDROOT_PROFILE="R11" #SMAGE_SVN_REPO="svn://cvs.magellan-linux.de/smage/trunk" #MAGE_SVN_REPO="svn://cvs.magellan-linux.de/mage/trunk" SMAGEFILE="$1" if [[ -z ${SMAGEFILE} ]] then die "no smage file given. call '$(basename $0) with/relative/path/from/buildroot/svn/smage/to/smagefile'" fi for arch in ${BUILD_ARCH[*]} src do echo "SMAGEFILE=\"${SMAGEFILE}\"" > ${BUILDROOT}/${arch}/.runrc echo "PKG_SCP_REPO=\"${PKG_SCP_REPO}\"" >> ${BUILDROOT}/${arch}/.runrc echo "BUILD_ARCH=\"${arch}\"" >> ${BUILDROOT}/${arch}/.runrc cat >> ${BUILDROOT}/${arch}/.runrc << "EOF" 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 env-rebuild source /etc/profile # override die function die() { echo "ERROR: $@" return 1 } load_mage_features mage_setup if [ -f /var/cache/mage/smage/${SMAGEFILE} ] then smagesource /var/cache/mage/smage/${SMAGEFILE} else die "smagefile '/var/cache/mage/smage/${SMAGEFILE}' not found." fi if [[ ${BUILD_ARCH} = src ]] then TARGET_SRC_PKGFILE=( "/var/cache/mage/src-packages/${PNAME}-${PVER}-${PBUILD}.${SRCPKGSUFFIX}" ) for i in ${TARGET_SRC_PKGFILE} do if [ ! -f ${i} ] then die "${i} is missing" else scp "${i}" ${PKG_SCP_REPO}/${BUILD_ARCH}/ fi done else # honor split packages if [[ -n ${SPLIT_PACKAGES} ]] then split_save_variables for subpackage in ${SPLIT_PACKAGES} do # get the right variables for the split export PNAME="${subpackage}" split_info_${PNAME} TARGET_PKGFILE+=( "/var/cache/mage/packages/${PNAME}-${PVER}-${BUILD_ARCH}$(print_distrotag)-${PBUILD}.${PKGSUFFIX}" ) # restore smage environment split_restore_variables done # unset all saved smage variables split_unset_variables else TARGET_PKGFILE=( "/var/cache/mage/packages/${PNAME}-${PVER}-${BUILD_ARCH}$(print_distrotag)-${PBUILD}.${PKGSUFFIX}" ) fi for i in ${TARGET_PKGFILE} do if [ ! -f ${i} ] then die "${i} is missing" else scp "${i}" ${PKG_SCP_REPO}/${BUILD_ARCH}/ fi done fi EOF runarch-script ${arch} .runrc || die "${arch} package build failed" done