tazpkg rev 430 4.3
Make recharge) able to handle only one specified repository; Check for repository's ID (a verry little file containing md5sum of packages.md5) and recharge only if it changed (or doesnt exists) when recharging. (4.3)
author | Antoine Bodin <gokhlayeh@slitaz.org> |
---|---|
date | Fri Feb 25 03:38:14 2011 +0100 (2011-02-25) |
parents | 8cff0e3c661e |
children | 3719533763de |
files | tazpkg |
line diff
1.1 --- a/tazpkg Thu Feb 24 23:51:02 2011 +0100 1.2 +++ b/tazpkg Fri Feb 25 03:38:14 2011 +0100 1.3 @@ -2226,14 +2226,42 @@ 1.4 # Recharge packages.list from a mirror. 1.5 # 1.6 check_root 1.7 - 1.8 - for path in $LOCALSTATE $LOCALSTATE/undigest/*; do 1.9 + if [ "$2" = main ]; then 1.10 + repository_to_recharge=$LOCALSTATE 1.11 + elif [ "$2" ]; then 1.12 + if [ -d "$LOCALSTATE/undigest/$2" ]; then 1.13 + repository_to_recharge=$LOCALSTATE/undigest/$2 1.14 + else 1.15 + echo "\$LOCALSTATE/undigest/$2 `gettext \"doesn't exists.\"`" >&2 1.16 + exit 1 1.17 + fi 1.18 + else 1.19 + repository_to_recharge="$LOCALSTATE $LOCALSTATE/undigest/*" 1.20 + fi 1.21 + for path in $repository_to_recharge; do 1.22 [ -f $path/mirror ] || continue 1.23 + cd $path 1.24 + 1.25 + # Quietly check if recharging is needed. 1.26 + [ -f ID ] && mv ID ID.bak 1.27 + download_from "$(cat mirror)" ID >/dev/null 2>&1 1.28 + if [ -f ID ] && fgrep -q `cat ID.bak` ID; then 1.29 + if [ "$path" = "$LOCALSTATE" ]; then 1.30 + repository_name=Main 1.31 + else 1.32 + repository_name="`gettext \"Undigest\"` $(basename $path)" 1.33 + fi 1.34 + echo "$repository_name `gettext \"is up to date.\"`" 1.35 + rm ID.bak 1.36 + continue 1.37 + fi 1.38 + [ -f ID ] && rm -f ID.bak 1.39 + 1.40 echo "" 1.41 if [ "$path" != "$LOCALSTATE" ]; then 1.42 echo -e "`gettext \"Recharging undigest\"` $(basename $path):" 1.43 fi 1.44 - cd $path 1.45 + 1.46 if [ -f "packages.list" ]; then 1.47 gettext "Creating backup of the last packages list..." 1.48 mv -f packages.desc packages.desc.bak 2>/dev/null