Magellan Linux

Diff of /branches/mage-next/src/mage4.functions.sh

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 876 by niro, Thu May 21 19:07:14 2009 UTC revision 1085 by niro, Mon Jun 28 18:15:44 2010 UTC
# Line 198  install_files() Line 198  install_files()
198   is_config_protected "${pathto}"   is_config_protected "${pathto}"
199   retval="$?"   retval="$?"
200    
201   # 0 - not protected        #   # 0 - not protected         #
202   # 1 - error                #   # 1 - error                 #
203   # 2 - protected            #   # 2 - protected             #
204   # 3 - protected but masked #   # 3 - protected but masked  #
205     # 4 - protected but ignored #
206    
207   case ${retval} in   case ${retval} in
208   # file is not protected - (over)write it   # file is not protected - (over)write it
# Line 252  install_files() Line 253  install_files()
253   (( MAGE_PROTECT_COUNTER++ ))   (( MAGE_PROTECT_COUNTER++ ))
254   export MAGE_PROTECT_COUNTER   export MAGE_PROTECT_COUNTER
255   ;;   ;;
256    
257     # file is protected but ignored, delete the update/do nothing
258     4)
259     if [[ ${VERBOSE} = on ]]
260     then
261     echo -en "${COLRED}"
262     echo -n "! ignr "
263     echo -en "${COLDEFAULT}"
264     echo " === FILE: ${MROOT}${pathto}"
265     fi
266     # simply do nothing here
267     ;;
268   esac   esac
269   done < ${BUILDDIR}/${pkgname}/.files   done < ${BUILDDIR}/${pkgname}/.files
270    
# Line 809  remove_files() Line 822  remove_files()
822   is_config_protected "${pathto}"   is_config_protected "${pathto}"
823   retval="$?"   retval="$?"
824    
825   # 0 - not protected        #   # 0 - not protected         #
826   # 1 - error                #   # 1 - error                 #
827   # 2 - protected            #   # 2 - protected             #
828   # 3 - protected but masked #   # 3 - protected but masked  #
829     # 4 - protected but ignored #
830    
831   case ${retval} in   case ${retval} in
832   # file is not protected - delete it   # file is not protected - delete it
# Line 831  remove_files() Line 845  remove_files()
845   echo " === FILE: ${MROOT}${pathto}"   echo " === FILE: ${MROOT}${pathto}"
846   fi   fi
847   ;;   ;;
848    
849     # file is protected but ignored, delete the update/do nothing
850     4)
851     if [[ ${VERBOSE} = on ]]
852     then
853     echo -en "${COLRED}"
854     echo -n "! ignr "
855     echo -en "${COLDEFAULT}"
856     echo " === FILE: ${MROOT}${pathto}"
857     fi
858     # simply do nothing here
859     ;;
860   esac   esac
861   ;;   ;;
862   1)   1)
# Line 1153  fetch_packages() Line 1179  fetch_packages()
1179   echo -e " fetching (${count_current}/${count_total}): ${pkg} ... "   echo -e " fetching (${count_current}/${count_total}): ${pkg} ... "
1180   [[ ${VERBOSE} = off ]] && opt="--quiet"   [[ ${VERBOSE} = off ]] && opt="--quiet"
1181   wget \   wget \
1182   --passive-ftp \   ${WGET_FETCH_OPTIONS} \
  --tries 3 \  
  --continue \  
  --progress bar \  
1183   --directory-prefix=${PKGDIR} \   --directory-prefix=${PKGDIR} \
1184   ${opt} ${mirr}/${PACKAGES_SERVER_PATH}/${pkg}   ${opt} ${mirr}/${PACKAGES_SERVER_PATH}/${pkg}
1185   if [[ $? = 0 ]]   if [[ $? = 0 ]]
# Line 1199  syncmage() Line 1222  syncmage()
1222   # clean up backup files (foo~)   # clean up backup files (foo~)
1223   find ${MAGEDIR} -name *~ -exec rm '{}' ';'   find ${MAGEDIR} -name *~ -exec rm '{}' ';'
1224    
1225   # check if an newer mage version is available   # check if a newer mage version is available
1226   is_newer_mage_version_available   is_newer_mage_version_available
1227  }  }
1228    
1229  syncmage_tarball()  syncmage_tarball()
1230  {  {
1231   local latest_tarball   local latest_tarball
1232     local latest_md5
1233   local temp="$(mktemp -d)"   local temp="$(mktemp -d)"
1234   local mirr mymirr   local mirr mymirr
1235    
1236     # try to get the md5 marked as latest on the server
1237     latest_md5="mage-latest.md5"
1238    
1239   # try to get the tarball marked as latest on the server   # try to get the tarball marked as latest on the server
1240   latest_tarball="mage-latest.tar.bz2"   latest_tarball="mage-latest.tar.bz2"
1241    
# Line 1218  syncmage_tarball() Line 1245  syncmage_tarball()
1245   mymirr="${mirr%/*}"   mymirr="${mirr%/*}"
1246    
1247   echo -ne "${COLBLUE} --- ${COLDEFAULT}"   echo -ne "${COLBLUE} --- ${COLDEFAULT}"
1248   echo "fetching latest tarball from ${mymirr} ..."   echo "fetching latest md5 from ${mymirr} ..."
1249     wget \
1250     ${WGET_FETCH_OPTIONS} \
1251     --directory-prefix=${temp} \
1252     ${mymirr}/rsync/tarballs/${latest_md5}
1253    
1254     echo -ne "${COLBLUE} --- ${COLDEFAULT}"
1255     echo "fetching latest tarball from ${mymirr} ..."
1256   wget \   wget \
1257   --passive-ftp \   ${WGET_FETCH_OPTIONS} \
  --tries 3 \  
  --continue \  
  --progress bar \  
1258   --directory-prefix=${temp} \   --directory-prefix=${temp} \
1259   ${mymirr}/rsync/tarballs/${latest_tarball}   ${mymirr}/rsync/tarballs/${latest_tarball}
1260   if [[ $? = 0 ]]   if [[ $? = 0 ]]
# Line 1237  syncmage_tarball() Line 1267  syncmage_tarball()
1267    
1268   if [[ -f ${temp}/${latest_tarball} ]]   if [[ -f ${temp}/${latest_tarball} ]]
1269   then   then
1270     # check md5
1271     if [[ ! -f ${temp}/${latest_md5} ]]
1272     then
1273     die "md5 is missing ... aborting"
1274     else
1275     ( cd ${temp}; md5sum --check ${lastest_md5} ) || die "md5 for ${lastest_tarball} failed"
1276     fi
1277    
1278   if [[ -d ${MAGEDIR} ]]   if [[ -d ${MAGEDIR} ]]
1279   then   then
1280   echo -ne "${COLBLUE} --- ${COLDEFAULT}"   echo -ne "${COLBLUE} --- ${COLDEFAULT}"
# Line 1252  syncmage_tarball() Line 1290  syncmage_tarball()
1290   if [[ -d ${temp} ]]   if [[ -d ${temp} ]]
1291   then   then
1292   echo -ne "${COLBLUE} --- ${COLDEFAULT}"   echo -ne "${COLBLUE} --- ${COLDEFAULT}"
1293   echo "clenaing temp-files ..."   echo "cleaning temp-files ..."
1294   rm -rf ${temp}   rm -rf ${temp}
1295   fi   fi
1296    
1297     # check if a newer mage version is available
1298     is_newer_mage_version_available
1299   else   else
1300   die "Could not fetch the latest tarball ... aborting"   die "Could not fetch the latest tarball ... aborting"
1301   fi   fi
# Line 1422  get_highest_magefile() Line 1463  get_highest_magefile()
1463  #        1 - error                                #  #        1 - error                                #
1464  #        2 - protected                            #  #        2 - protected                            #
1465  #        3 - protected but masked                 #  #        3 - protected but masked                 #
1466    #        4 - protected but ignored                #
1467  #                                                 #  #                                                 #
1468  ###################################################  ###################################################
1469  is_config_protected()  is_config_protected()
# Line 1430  is_config_protected() Line 1472  is_config_protected()
1472   local TEST   local TEST
1473   local PROTECTED   local PROTECTED
1474   local IFS   local IFS
1475     local i
1476     local x
1477    
1478   EXPFILE="${MROOT}$1"   EXPFILE="${MROOT}$1"
1479    
# Line 1439  is_config_protected() Line 1483  is_config_protected()
1483   # to be safe; it may be '§'   # to be safe; it may be '§'
1484   IFS=' '   IFS=' '
1485    
1486   # check ob in config protect   # check if config protected
1487   for i in ${CONFIG_PROTECT}   for i in ${CONFIG_PROTECT}
1488   do   do
1489   # ersetzen von $i nur wenn am anfang der variable   # only replace $i in the beginning of the variable
1490   TEST="${EXPFILE/#${MROOT}${i}/Protected}"   TEST="${EXPFILE/#${MROOT}${i}/Protected}"
1491   if [[ ${TEST} != ${EXPFILE} ]]   if [[ ${TEST} != ${EXPFILE} ]]
1492   then   then
1493   # setzen das es protected ist   # file is config proteced
1494   PROTECTED=TRUE   PROTECTED=TRUE
1495    
1496   # check ob nicht doch maskiert   # check if not masked
1497   for x in ${CONFIG_PROTECT_MASK}   for x in ${CONFIG_PROTECT_MASK}
1498   do   do
1499   TEST="${EXPFILE/#${MROOT}${x}/Protect_Masked}"   TEST="${EXPFILE/#${MROOT}${x}/Protect_Masked}"
# Line 1458  is_config_protected() Line 1502  is_config_protected()
1502   PROTECTED=MASKED   PROTECTED=MASKED
1503   fi   fi
1504   done   done
1505    
1506     # check if not ignored
1507     for x in ${CONFIG_PROTECT_IGNORE}
1508     do
1509     TEST="${EXPFILE/#${MROOT}${x}/Protect_Ignored}"
1510     if [[ ${TEST} != ${EXPFILE} ]]
1511     then
1512     PROTECTED=IGNORED
1513     fi
1514     done
1515   fi   fi
1516   done   done
1517    
# Line 1472  is_config_protected() Line 1526  is_config_protected()
1526   #echo "I'm protected, but masked - delete me"   #echo "I'm protected, but masked - delete me"
1527   return 3   return 3
1528   ;;   ;;
1529     IGNORED)
1530     #echo "I'm protected, but ignored - keep me, del update"
1531     return 4
1532     ;;
1533   *)   *)
1534   #echo "delete me"   #echo "delete me"
1535   return 0   return 0
# Line 2117  get_value_from_magefile() Line 2175  get_value_from_magefile()
2175   local SDEPEND   local SDEPEND
2176   local PROVIDE   local PROVIDE
2177   local PKGTYPE   local PKGTYPE
2178     local MAGE_TARGETS
2179     local SPLIT_PACKAGE_BASE
2180   local preinstall   local preinstall
2181   local postinstall   local postinstall
2182   local preremove   local preremove
# Line 2237  mage_install() Line 2297  mage_install()
2297   echo B:${pbuild}   echo B:${pbuild}
2298   fi   fi
2299    
2300   if [[ -z ${MAGE_TARGETS} ]]   if [[ -n ${MAGE_TARGETS} ]]
2301   then   then
2302   # basic svn compat   # basic svn compat
2303   if [[ -d ${SMAGESCRIPTSDIR}/trunk ]]   if [[ -d ${SMAGESCRIPTSDIR}/trunk ]]
2304   then   then
2305   for i in ${SMAGESCRIPTSDIR}/trunk/*/${pname}/${pname}-${pver}-${pbuild}.smage2   for i in ${SMAGESCRIPTSDIR}/trunk/*/${pname/${MAGE_TARGETS}/}/${pname/${MAGE_TARGETS}/}-${pver}-${pbuild}.smage2
2306   do   do
2307   smage2file="${i}"   smage2file="${i}"
2308   done   done
2309   else   else
2310   smage2file=${SMAGESCRIPTSDIR}/${pname}/${pname}-${pver}-${pbuild}.smage2   smage2file=${SMAGESCRIPTSDIR}/${pname/${MAGE_TARGETS}/}/${pname/${MAGE_TARGETS}/}-${pver}-${pbuild}.smage2
2311   fi   fi
2312    
2313     elif [[ -n ${SPLIT_PACKAGE_BASE} ]]
2314     then
2315     # basic svn compat
2316     if [[ -d ${SMAGESCRIPTSDIR}/trunk ]]
2317     then
2318     for i in ${SMAGESCRIPTSDIR}/trunk/*/${SPLIT_PACKAGE_BASE}/${SPLIT_PACKAGE_BASE}-${pver}-${pbuild}.smage2
2319     do
2320     smage2file="${i}"
2321     done
2322     else
2323     smage2file=${SMAGESCRIPTSDIR}/${SPLIT_PACKAGE_BASE}/${SPLIT_PACKAGE_BASE}-${pver}-${pbuild}.smage2
2324     fi
2325    
2326   else   else
2327   # basic svn compat   # basic svn compat
2328   if [[ -d ${SMAGESCRIPTSDIR}/trunk ]]   if [[ -d ${SMAGESCRIPTSDIR}/trunk ]]
2329   then   then
2330   for i in ${SMAGESCRIPTSDIR}/trunk/*/${pname/${MAGE_TARGETS}/}/${pname/${MAGE_TARGETS}/}-${pver}-${pbuild}.smage2   for i in ${SMAGESCRIPTSDIR}/trunk/*/${pname}/${pname}-${pver}-${pbuild}.smage2
2331   do   do
2332   smage2file="${i}"   smage2file="${i}"
2333   done   done
2334   else   else
2335   smage2file=${SMAGESCRIPTSDIR}/${pname/${MAGE_TARGETS}/}/${pname/${MAGE_TARGETS}/}-${pver}-${pbuild}.smage2   smage2file=${SMAGESCRIPTSDIR}/${pname}/${pname}-${pver}-${pbuild}.smage2
2336   fi   fi
2337   fi   fi
2338    
2339   if [ -f "${smage2file}" ]   if [ -f "${smage2file}" ]
2340   then   then
2341   echo -e " ${COLBLUE}***${COLDEFAULT} building package from source ... "   echo -e " ${COLBLUE}***${COLDEFAULT} building package from source ... "
# Line 2789  blacklisted() Line 2864  blacklisted()
2864   [[ ${USE_UNSTABLE} = true ]] && local MAGE_DISTRIBUTION=unstable   [[ ${USE_UNSTABLE} = true ]] && local MAGE_DISTRIBUTION=unstable
2865   [[ ${USE_TESTING} = true ]] && local MAGE_DISTRIBUTION=testing   [[ ${USE_TESTING} = true ]] && local MAGE_DISTRIBUTION=testing
2866    
2867   local EXCLUDED="/etc/mage-profile/package.blacklist-${ARCH}-${MAGE_DISTRIBUTION}"   # support both types for the moment
2868     if [[ -f /etc/mage-profile/package.blacklist-${ARCH}-${MAGE_DISTRIBUTION} ]]
2869     then
2870     local EXCLUDED="/etc/mage-profile/package.blacklist-${ARCH}-${MAGE_DISTRIBUTION}"
2871     else
2872     local EXCLUDED="/etc/mage-profile/package.blacklist-${ARCH}"
2873     fi
2874    
2875   # return 0 if the list not exist; nothin is masked   # return 0 if the list not exist; nothin is masked
2876   [[ ! -f ${EXCLUDED} ]] && return 0   [[ ! -f ${EXCLUDED} ]] && return 0

Legend:
Removed from v.876  
changed lines
  Added in v.1085