--- trunk/mage/usr/lib/mage/mage4.functions.sh 2009/05/21 19:07:14 876 +++ trunk/mage/usr/lib/mage/mage4.functions.sh 2010/06/28 18:07:29 1083 @@ -198,10 +198,11 @@ is_config_protected "${pathto}" retval="$?" - # 0 - not protected # - # 1 - error # - # 2 - protected # - # 3 - protected but masked # + # 0 - not protected # + # 1 - error # + # 2 - protected # + # 3 - protected but masked # + # 4 - protected but ignored # case ${retval} in # file is not protected - (over)write it @@ -252,6 +253,18 @@ (( MAGE_PROTECT_COUNTER++ )) export MAGE_PROTECT_COUNTER ;; + + # file is protected but ignored, delete the update/do nothing + 4) + if [[ ${VERBOSE} = on ]] + then + echo -en "${COLRED}" + echo -n "! ignr " + echo -en "${COLDEFAULT}" + echo " === FILE: ${MROOT}${pathto}" + fi + # simply do nothing here + ;; esac done < ${BUILDDIR}/${pkgname}/.files @@ -809,10 +822,11 @@ is_config_protected "${pathto}" retval="$?" - # 0 - not protected # - # 1 - error # - # 2 - protected # - # 3 - protected but masked # + # 0 - not protected # + # 1 - error # + # 2 - protected # + # 3 - protected but masked # + # 4 - protected but ignored # case ${retval} in # file is not protected - delete it @@ -831,6 +845,18 @@ echo " === FILE: ${MROOT}${pathto}" fi ;; + + # file is protected but ignored, delete the update/do nothing + 4) + if [[ ${VERBOSE} = on ]] + then + echo -en "${COLRED}" + echo -n "! ignr " + echo -en "${COLDEFAULT}" + echo " === FILE: ${MROOT}${pathto}" + fi + # simply do nothing here + ;; esac ;; 1) @@ -1199,16 +1225,20 @@ # clean up backup files (foo~) find ${MAGEDIR} -name *~ -exec rm '{}' ';' - # check if an newer mage version is available + # check if a newer mage version is available is_newer_mage_version_available } syncmage_tarball() { local latest_tarball + local latest_md5 local temp="$(mktemp -d)" local mirr mymirr + # try to get the md5 marked as latest on the server + latest_md5="mage-latest.md5" + # try to get the tarball marked as latest on the server latest_tarball="mage-latest.tar.bz2" @@ -1218,6 +1248,16 @@ mymirr="${mirr%/*}" echo -ne "${COLBLUE} --- ${COLDEFAULT}" + echo "fetching latest md5 from ${mymirr} ..." + wget \ + --passive-ftp \ + --tries 3 \ + --continue \ + --progress bar \ + --directory-prefix=${temp} \ + ${mymirr}/rsync/tarballs/${latest_md5} + + echo -ne "${COLBLUE} --- ${COLDEFAULT}" echo "fetching latest tarball from ${mymirr} ..." wget \ @@ -1237,6 +1277,14 @@ if [[ -f ${temp}/${latest_tarball} ]] then + # check md5 + if [[ ! -f ${temp}/${latest_md5} ]] + then + die "md5 is missing ... aborting" + else + ( cd ${temp}; md5sum --check ${lastest_md5} ) || die "md5 for ${lastest_tarball} failed" + fi + if [[ -d ${MAGEDIR} ]] then echo -ne "${COLBLUE} --- ${COLDEFAULT}" @@ -1252,9 +1300,12 @@ if [[ -d ${temp} ]] then echo -ne "${COLBLUE} --- ${COLDEFAULT}" - echo "clenaing temp-files ..." + echo "cleaning temp-files ..." rm -rf ${temp} fi + + # check if a newer mage version is available + is_newer_mage_version_available else die "Could not fetch the latest tarball ... aborting" fi @@ -1422,6 +1473,7 @@ # 1 - error # # 2 - protected # # 3 - protected but masked # +# 4 - protected but ignored # # # ################################################### is_config_protected() @@ -1430,6 +1482,8 @@ local TEST local PROTECTED local IFS + local i + local x EXPFILE="${MROOT}$1" @@ -1439,17 +1493,17 @@ # to be safe; it may be '§' IFS=' ' - # check ob in config protect + # check if config protected for i in ${CONFIG_PROTECT} do - # ersetzen von $i nur wenn am anfang der variable + # only replace $i in the beginning of the variable TEST="${EXPFILE/#${MROOT}${i}/Protected}" if [[ ${TEST} != ${EXPFILE} ]] then - # setzen das es protected ist + # file is config proteced PROTECTED=TRUE - # check ob nicht doch maskiert + # check if not masked for x in ${CONFIG_PROTECT_MASK} do TEST="${EXPFILE/#${MROOT}${x}/Protect_Masked}" @@ -1458,6 +1512,16 @@ PROTECTED=MASKED fi done + + # check if not ignored + for x in ${CONFIG_PROTECT_IGNORE} + do + TEST="${EXPFILE/#${MROOT}${x}/Protect_Ignored}" + if [[ ${TEST} != ${EXPFILE} ]] + then + PROTECTED=IGNORED + fi + done fi done @@ -1472,6 +1536,10 @@ #echo "I'm protected, but masked - delete me" return 3 ;; + IGNORED) + #echo "I'm protected, but ignored - keep me, del update" + return 4 + ;; *) #echo "delete me" return 0 @@ -2117,6 +2185,8 @@ local SDEPEND local PROVIDE local PKGTYPE + local MAGE_TARGETS + local SPLIT_PACKAGE_BASE local preinstall local postinstall local preremove @@ -2237,30 +2307,45 @@ echo B:${pbuild} fi - if [[ -z ${MAGE_TARGETS} ]] + if [[ -n ${MAGE_TARGETS} ]] then # basic svn compat if [[ -d ${SMAGESCRIPTSDIR}/trunk ]] then - for i in ${SMAGESCRIPTSDIR}/trunk/*/${pname}/${pname}-${pver}-${pbuild}.smage2 + for i in ${SMAGESCRIPTSDIR}/trunk/*/${pname/${MAGE_TARGETS}/}/${pname/${MAGE_TARGETS}/}-${pver}-${pbuild}.smage2 do smage2file="${i}" done else - smage2file=${SMAGESCRIPTSDIR}/${pname}/${pname}-${pver}-${pbuild}.smage2 + smage2file=${SMAGESCRIPTSDIR}/${pname/${MAGE_TARGETS}/}/${pname/${MAGE_TARGETS}/}-${pver}-${pbuild}.smage2 fi + + elif [[ -n ${SPLIT_PACKAGE_BASE} ]] + then + # basic svn compat + if [[ -d ${SMAGESCRIPTSDIR}/trunk ]] + then + for i in ${SMAGESCRIPTSDIR}/trunk/*/${SPLIT_PACKAGE_BASE}/${SPLIT_PACKAGE_BASE}-${pver}-${pbuild}.smage2 + do + smage2file="${i}" + done + else + smage2file=${SMAGESCRIPTSDIR}/${SPLIT_PACKAGE_BASE}/${SPLIT_PACKAGE_BASE}-${pver}-${pbuild}.smage2 + fi + else # basic svn compat if [[ -d ${SMAGESCRIPTSDIR}/trunk ]] then - for i in ${SMAGESCRIPTSDIR}/trunk/*/${pname/${MAGE_TARGETS}/}/${pname/${MAGE_TARGETS}/}-${pver}-${pbuild}.smage2 + for i in ${SMAGESCRIPTSDIR}/trunk/*/${pname}/${pname}-${pver}-${pbuild}.smage2 do smage2file="${i}" done else - smage2file=${SMAGESCRIPTSDIR}/${pname/${MAGE_TARGETS}/}/${pname/${MAGE_TARGETS}/}-${pver}-${pbuild}.smage2 + smage2file=${SMAGESCRIPTSDIR}/${pname}/${pname}-${pver}-${pbuild}.smage2 fi fi + if [ -f "${smage2file}" ] then echo -e " ${COLBLUE}***${COLDEFAULT} building package from source ... " @@ -2789,7 +2874,13 @@ [[ ${USE_UNSTABLE} = true ]] && local MAGE_DISTRIBUTION=unstable [[ ${USE_TESTING} = true ]] && local MAGE_DISTRIBUTION=testing - local EXCLUDED="/etc/mage-profile/package.blacklist-${ARCH}-${MAGE_DISTRIBUTION}" + # support both types for the moment + if [[ -f /etc/mage-profile/package.blacklist-${ARCH}-${MAGE_DISTRIBUTION} ]] + then + local EXCLUDED="/etc/mage-profile/package.blacklist-${ARCH}-${MAGE_DISTRIBUTION}" + else + local EXCLUDED="/etc/mage-profile/package.blacklist-${ARCH}" + fi # return 0 if the list not exist; nothin is masked [[ ! -f ${EXCLUDED} ]] && return 0