--- trunk/mage/usr/lib/mage/smage2.sh 2011/06/03 21:22:00 1345 +++ trunk/mage/usr/lib/mage/smage2.sh 2011/06/04 09:20:09 1346 @@ -60,6 +60,26 @@ export BINDIR=${MROOT}/${BINDIR} fi +# sources the smage file and uses state from distribution file if exist +# may helpful for repository support later on +smagesource() +{ + local file="$1" + local mystate + local mycodename + + source ${file} + + [[ -n ${STATE} ]] && mystate="${STATE}" + if [ -f ${SMAGESCRIPTSDIR}/distribution ] + then + source ${SMAGESCRIPTSDIR}/distribution + [[ -n ${STATE} ]] && mystate="${STATE}" + fi + # now switch state and export it + STATE="${mystate}" +} + showversion() { echo -en "Magellan Source Install v${SMAGEVERSION} " @@ -1188,7 +1208,7 @@ MD5DIR="$3" [[ -z ${MD5DIR} ]] && MD5DIR="$(dirname ${SMAGENAME})/md5" - source ${SMAGENAME} || die "download source failed" + smagesource ${SMAGENAME} || die "download source failed" # overridable sourcedir; must be declared after source of the smage2 CALC_SOURCEDIR="${CALC_SOURCEDIR:="${SOURCEDIR}/${PNAME}"}" @@ -1262,7 +1282,7 @@ # get smage SMAGENAME="$2" MD5DIR="$(dirname ${SMAGENAME})/md5" - source ${SMAGENAME} || die "download source failed" + smagesource ${SMAGENAME} || die "download source failed" download_sources exit 0 @@ -1274,7 +1294,7 @@ # set correct SMAGENAME SMAGENAME="$2" MD5DIR="$(dirname ${SMAGENAME})/md5" - source ${SMAGENAME} || die "regen: smage2 not found" + smagesource ${SMAGENAME} || die "regen: smage2 not found" regen_mage_tree @@ -1336,7 +1356,7 @@ echo -e "${COLGREEN}create-src-tarball called for ${COLBLUE}${SMAGENAME}${COLGREEN} ...${COLDEFAULT}" - source ${SMAGENAME} || die "regen: smage2 not found" + smagesource ${SMAGENAME} || die "regen: smage2 not found" if [[ -d ${SOURCEDIR}/${PNAME} ]] then @@ -1385,7 +1405,7 @@ [ -z "${CFLAGS}" ] && die "no CFLAGS variable found in ${MAGERC}" [ -z "${CXXFLAGS}" ] && die "no CXXFLAGS variable found in ${MAGERC}" -source ${SMAGENAME} || die "source failed" +smagesource ${SMAGENAME} || die "source failed" PKGNAME="${PNAME}-${PVER}-${ARCH}-${PBUILD}" MD5DIR="$(dirname ${SMAGENAME})/md5" SMAGE_LOG_CMD="tee -a /var/log/smage/${PKGNAME}.log"