tazwok rev 66
Improved 'cmp' command
author | Christophe Lincoln <pankso@slitaz.org> |
---|---|
date | Fri Jun 06 14:01:57 2008 +0200 (2008-06-06) |
parents | b9c07e7e2c49 |
children | d01cb4c66571 |
files | tazwok |
line diff
1.1 --- a/tazwok Thu Jun 05 21:02:30 2008 +0200 1.2 +++ b/tazwok Fri Jun 06 14:01:57 2008 +0200 1.3 @@ -87,6 +87,7 @@ 1.4 \033[1mCommands: \033[0m\n 1.5 usage Print this short usage. 1.6 stats Print Tazwok statistics from the config file and the wok. 1.7 + cmp|compare Compare the wok and the cooked pkgs (--remove old pkgs). 1.8 list List all packages in the wok tree or by category. 1.9 info Get informations about a package in the wok. 1.10 check-log Check the process log file of a package. 1.11 @@ -558,20 +559,39 @@ 1.12 ================================================================================" 1.13 echo "" 1.14 ;; 1.15 - cmp) 1.16 - # Compare the wok and packages repository. 1.17 + cmp|compare) 1.18 + # Compare the wok and packages repository to help maintaining 1.19 + # a mirror. 1.20 echo "" 1.21 echo -e "\033[1mWok and packages comparaison\033[0m 1.22 ================================================================================" 1.23 for pkg in $WOK/* 1.24 do 1.25 . $pkg/receipt 1.26 + echo "$PACKAGE-$VERSION.tazpkg" >> /tmp/wok.list 1.27 if [ ! -f $PACKAGES_REPOSITORY/$PACKAGE-$VERSION.tazpkg ]; then 1.28 echo "Missing package: $PACKAGE ($VERSION)" 1.29 fi 1.30 done 1.31 + for pkg in `cd $PACKAGES_REPOSITORY && ls *.tazpkg` 1.32 + do 1.33 + if ! grep -q ^$pkg /tmp/wok.list; then 1.34 + echo $pkg >> /tmp/pkgs.old 1.35 + if [ "$2" = "--remove" ]; then 1.36 + echo "Removing package: $pkg" 1.37 + rm $PACKAGES_REPOSITORY/$pkg 1.38 + else 1.39 + echo "Old package: $pkg" 1.40 + fi 1.41 + fi 1.42 + done 1.43 + cd /tmp 1.44 echo "================================================================================" 1.45 + echo "Wok: `cat wok.list | wc -l` - \ 1.46 +Cooked: `ls -1 $PACKAGES_REPOSITORY/*.tazpkg 2>/dev/null | wc -l` - \ 1.47 +Old: `cat pkgs.old | wc -l`" 1.48 echo "" 1.49 + rm -f wok.list pkgs.old 1.50 ;; 1.51 list) 1.52 # List packages in wok directory. User can specifiy a category