#!/bin/bash # build all source packages for given distribution : ${MAGERC="/etc/mage.rc"} source /etc/mage.rc.global source ${MAGERC} source ${MLIBDIR}/mage4.functions.sh source ${MLIBDIR}/smage2.functions.sh if ! have_root_privileges then echo "You must be r00t" exit 1 fi DISTRI="$1" if [[ -z ${DISTRI} ]] then echo "No Distribution given ..." exit 1 fi blacklisted() { local EXCLUDED="${MROOT}/etc/mage-profile/package.blacklist-${ARCH}-${DISTRI}" # return 0 if the list not exist; nothin is masked [[ ! -f ${EXCLUDED} ]] && return 0 local SMAGEFILE="$1" smagesource ${SMAGEFILE} local EXPCAT EXPNAME EXPVER EXPBUILD while read EXPCAT EXPNAME EXPVER EXPBUILD do # ignore spaces and comments case "${EXPCAT}" in \#*|"") continue ;; esac # exclude full pver if [[ -n ${PCAT} ]] && [[ -n ${PNAME} ]] && [[ -n ${EXPCAT} ]] && [[ -n ${EXPNAME} ]] && [[ -n ${PVER} ]] && [[ -n ${PBUILD} ]] && [[ -n ${EXPVER} ]] && [[ -n ${EXPBUILD} ]] then [[ ${EXPCAT}/${EXPNAME}-${EXPVER}-${EXPBUILD} = ${PCAT}/${PNAME}-${PVER}-${PBUILD} ]] && return 1 fi # exclude pcat/pname only if [[ -n ${PCAT} ]] && [[ -n ${PNAME} ]] && [[ -n ${EXPCAT} ]] && [[ -n ${EXPNAME} ]] && [[ -z ${EXPVER} ]] && [[ -z ${EXPBUILD} ]] then [[ ${EXPCAT}/${EXPNAME} = ${PCAT}/${PNAME} ]] && return 1 fi done << EOF $(cat ${EXCLUDED}; echo) EOF return 0 } ALLSMAGES=$(grep -irl ${DISTRI} ${SMAGESCRIPTSDIR}/*/*.smage2) for smage in ${ALLSMAGES} do # continue if pkg already exists [[ -f ${PKGDIR}/sources/$(basename ${smage} .smage2).mpks ]] && continue # continue if a virtual pkg [[ -n $(grep -irl 'PKGTYPE="virtual"' ${smage}) ]] && continue [[ -n $(grep -irl 'PKGTYPE=virtual' ${smage}) ]] && continue # handle blacklisted packages blacklisted ${smage} || continue smage2 --create-src-tarball ${smage} done