--- trunk/mage/usr/lib/mage/mage4.functions.sh 2009/08/04 19:52:16 892 +++ trunk/mage/usr/lib/mage/mage4.functions.sh 2010/06/28 18:46:57 1087 @@ -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) @@ -1153,10 +1179,7 @@ echo -e " fetching (${count_current}/${count_total}): ${pkg} ... " [[ ${VERBOSE} = off ]] && opt="--quiet" wget \ - --passive-ftp \ - --tries 3 \ - --continue \ - --progress bar \ + ${WGET_FETCH_OPTIONS} \ --directory-prefix=${PKGDIR} \ ${opt} ${mirr}/${PACKAGES_SERVER_PATH}/${pkg} if [[ $? = 0 ]] @@ -1199,15 +1222,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 + local opt + + # 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,15 +1246,19 @@ mymirr="${mirr%/*}" echo -ne "${COLBLUE} --- ${COLDEFAULT}" - echo "fetching latest tarball from ${mymirr} ..." + echo "fetching latest md5 from ${mymirr} ..." + [[ ${VERBOSE} = off ]] && opt="--quiet" + wget \ + ${WGET_FETCH_OPTIONS} \ + --directory-prefix=${temp} \ + ${opt} ${mymirr}/rsync/tarballs/${latest_md5} + echo -ne "${COLBLUE} --- ${COLDEFAULT}" + echo "fetching latest tarball from ${mymirr} ..." wget \ - --passive-ftp \ - --tries 3 \ - --continue \ - --progress bar \ + ${WGET_FETCH_OPTIONS} \ --directory-prefix=${temp} \ - ${mymirr}/rsync/tarballs/${latest_tarball} + ${opt} ${mymirr}/rsync/tarballs/${latest_tarball} if [[ $? = 0 ]] then break @@ -1237,6 +1269,16 @@ if [[ -f ${temp}/${latest_tarball} ]] then + # check md5 + if [[ ! -f ${temp}/${latest_md5} ]] + then + die "md5 is missing ... aborting" + else + echo -ne "${COLBLUE} --- ${COLDEFAULT}" + echo -n "checking md5sum... " + ( cd ${temp}; md5sum --check ${latest_md5} ) || die "md5 for ${latest_tarball} failed" + fi + if [[ -d ${MAGEDIR} ]] then echo -ne "${COLBLUE} --- ${COLDEFAULT}" @@ -1252,9 +1294,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 +1467,7 @@ # 1 - error # # 2 - protected # # 3 - protected but masked # +# 4 - protected but ignored # # # ################################################### is_config_protected() @@ -1430,6 +1476,8 @@ local TEST local PROTECTED local IFS + local i + local x EXPFILE="${MROOT}$1" @@ -1439,17 +1487,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 +1506,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 +1530,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 +2179,8 @@ local SDEPEND local PROVIDE local PKGTYPE + local MAGE_TARGETS + local SPLIT_PACKAGE_BASE local preinstall local postinstall local preremove @@ -2237,30 +2301,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 ... "