tazpkg rev 598
tazpkg: improve up output and small clean
author | Christophe Lincoln <pankso@slitaz.org> |
---|---|
date | Thu May 24 13:36:35 2012 +0200 (2012-05-24) |
parents | 269735758815 |
children | eb1a1a0d392a |
files | doc/tazpkg.en.html tazpkg |
line diff
1.1 --- a/doc/tazpkg.en.html Wed May 23 12:54:35 2012 +0000 1.2 +++ b/doc/tazpkg.en.html Thu May 24 13:36:35 2012 +0200 1.3 @@ -43,14 +43,14 @@ 1.4 a receipt and an optional description. Tazpkg also manages 1.5 dependencies based on package receipts. Each receipt contains 1.6 all the information about a package and can also include 1.7 -pre and post installation functions. The same receipt is 1.8 -used by Cookutils to compile sources and generate a .tazpkg 1.9 +pre and post installation functions. The same receipt is 1.10 +used by Cookutils to compile sources and generate a .tazpkg 1.11 package. 1.12 </p> 1.13 <p> 1.14 -Tazpkg is entirely built from scratch using SHell script, 1.15 -compatible with Bash; it runs under Ash—part of the Busybox 1.16 -project. Tazpkg is distributed under the free GNU license GPL V3. 1.17 +Tazpkg is entirely built from scratch using SHell script, 1.18 +compatible with Bash; it runs under Ash—part of the Busybox 1.19 +project. Tazpkg is distributed under the free GNU license GPL V3. 1.20 </p> 1.21 1.22 1.23 @@ -60,8 +60,8 @@ 1.24 <h3 id="list">list</h3> 1.25 1.26 <p> 1.27 -List packages installed on the system. This command displays 1.28 -a column list of all installed packages, It also allows you to list the 1.29 +List packages installed on the system. This command displays 1.30 +a column list of all installed packages, It also allows you to list the 1.31 categories, packages based on category and packages placed on hold. 1.32 You can also use the <tt><a href="#search">search</a></tt> command 1.33 for a list based on a term or package name: 1.34 @@ -108,7 +108,7 @@ 1.35 <h3 id="info">info</h3> 1.36 1.37 <p> 1.38 -Display any information available in the receipt for the 1.39 +Display any information available in the receipt for the 1.40 package in question—its version, category, maintainer, 1.41 Web site and any dependencies (see also Cookutils for more 1.42 information on receipts): 1.43 @@ -160,7 +160,7 @@ 1.44 <p> 1.45 Search for packages by owner or package name. This command 1.46 will search for the term wanted in the installed packages and the 1.47 -list of available packages on the mirror. To obtain the 1.48 +list of available packages on the mirror. To obtain the 1.49 latest list of installable packages on the mirror, just 1.50 run <code>tazpkg recharge</code> before conducting a search: 1.51 </p> 1.52 @@ -174,7 +174,7 @@ 1.53 <p> 1.54 The <tt>search-file</tt> command allows you to search for a file 1.55 among the files installed by the packages. This command is very 1.56 -useful to find the full path to a file and determine if 1.57 +useful to find the full path to a file and determine if 1.58 a file is present on the system. Example: 1.59 </p> 1.60 <pre> 1.61 @@ -187,10 +187,10 @@ 1.62 <p> 1.63 This command allows the installation of a local package with 1.64 the <tt>.tazpkg</tt> extension. See 1.65 -<tt><a href="#get-install">get-install</a></tt> to install a 1.66 +<tt><a href="#get-install">get-install</a></tt> to install a 1.67 package from the internet. Note that you can force the 1.68 installation via the <tt>--forced</tt>, <tt>uninstall</tt> and 1.69 -<tt>reinstall</tt> options 1.70 +<tt>reinstall</tt> options 1.71 or specify the root system where you want to install the 1.72 packages via the <tt>--root=</tt> option: 1.73 </p> 1.74 @@ -215,9 +215,9 @@ 1.75 <h3 id="link">link</h3> 1.76 1.77 <p> 1.78 -This command allows the installation of a package from another media 1.79 -device. The set up is done through symbolic links and consumes very little 1.80 -memory. It is generally used within the system RAM to install add-ons 1.81 +This command allows the installation of a package from another media 1.82 +device. The set up is done through symbolic links and consumes very little 1.83 +memory. It is generally used within the system RAM to install add-ons 1.84 from an USB key: 1.85 </p> 1.86 <pre> 1.87 @@ -256,7 +256,7 @@ 1.88 1.89 <p> 1.90 The <tt>pack</tt> command will create a package from a directory 1.91 -prepared in advance or from an unpacked package. It can 1.92 +prepared in advance or from an unpacked package. It can 1.93 also manually create a .tazpkg package (see the Cookutils documentation 1.94 for the automatic creation of packages). To pack a package: 1.95 </p> 1.96 @@ -282,8 +282,8 @@ 1.97 <p> 1.98 The <tt>repack-config</tt> command recreates a package 1.99 of the system configuration files (see 1.100 -<tt><a href="#list-config">list-config</a></tt>). It is enough 1.101 -to install the package to find the current configuration. To repack 1.102 +<tt><a href="#list-config">list-config</a></tt>). It is enough 1.103 +to install the package to find the current configuration. To repack 1.104 the configuration files: 1.105 </p> 1.106 <pre> 1.107 @@ -294,9 +294,9 @@ 1.108 <h3 id="recharge">recharge</h3> 1.109 1.110 <p> 1.111 -Recharge the list of available packages on the mirror. 1.112 +Recharge the list of available packages on the mirror. 1.113 This command will download the most recent <tt>packages.list</tt> 1.114 -of installable packages on the mirror and before starting 1.115 +of installable packages on the mirror and before starting 1.116 will save the old list. Once the list is updated, 1.117 you can then use the <tt><a href="#list">list</a></tt> and 1.118 <tt><a href="#search">search</a></tt> commands. To view 1.119 @@ -318,8 +318,8 @@ 1.120 part of system security, it helps to keep you secure with 1.121 the latest updates and fixes. The SliTaz project, 1.122 although tiny, provides regular updates on security and generally 1.123 -offers the latest versions of software. Note that this 1.124 -function is aimed at people with SliTaz installed on a 1.125 +offers the latest versions of software. Note that this 1.126 +function is aimed at people with SliTaz installed on a 1.127 hard drive. Updated packages in LiveCD mode will be lost on 1.128 system shutdown. To upgrade or display the full <tt>up</tt> options: 1.129 </p> 1.130 @@ -335,7 +335,7 @@ 1.131 1.132 <p> 1.133 The <tt>check</tt> command can check dependencies on installed 1.134 -packages and determine whether all the files needed for the 1.135 +packages and determine whether all the files needed for the 1.136 repacking of packages are present: 1.137 </p> 1.138 <pre> 1.139 @@ -377,7 +377,7 @@ 1.140 <p> 1.141 Get and install a package from a mirror on the internet. 1.142 The <tt>get-install</tt> command begins by checking whether the 1.143 -package exists on the mirror and if it has been already downloaded. 1.144 +package exists on the mirror and if it has been already downloaded. 1.145 For a list of packages on the mirror, we must 1.146 use the <tt><a href="#list-mirror">list-mirror</a></tt> command. 1.147 To install the package Grub: 1.148 @@ -390,9 +390,9 @@ 1.149 <h3 id="clean-cache">clean-cache</h3> 1.150 1.151 <p> 1.152 -Remove *.tazpkg packages downloaded to the cache. During 1.153 +Remove *.tazpkg packages downloaded to the cache. During 1.154 installation, Tazpkg keeps a copy of packages downloaded 1.155 -from the web. This is done to save bandwidth in case of 1.156 +from the web. This is done to save bandwidth in case of 1.157 reinstallation, but you may want to free up space on the hard 1.158 drive or re-download the packages: 1.159 </p> 1.160 @@ -477,7 +477,7 @@ 1.161 <h3 id="convert">convert</h3> 1.162 1.163 <p> 1.164 -Converts a Debian package (.deb), Redhat (.rpm), Slackware (.tgz) or 1.165 +Converts a Debian package (.deb), Redhat (.rpm), Slackware (.tgz) or 1.166 Archlinux (.pkg.tar.gz) package into a SliTaz package (.tazpkg): 1.167 </p> 1.168 <pre> 1.169 @@ -487,7 +487,7 @@ 1.170 1.171 <h3 id="set-release">set-release</h3> 1.172 <p> 1.173 -The <tt>set-release</tt> command changes the current version and 1.174 +The <tt>set-release</tt> command changes the current version and 1.175 upgrades all of the packages to the latest release: 1.176 </p> 1.177 <pre>
2.1 --- a/tazpkg Wed May 23 12:54:35 2012 +0000 2.2 +++ b/tazpkg Thu May 24 13:36:35 2012 +0200 2.3 @@ -1,7 +1,7 @@ 2.4 #!/bin/sh 2.5 # Tazpkg - Tiny autonomous zone packages manager. 2.6 # 2.7 -# This is a lightwight packages manager for *.tazpkg files written in SHell 2.8 +# This is a lightwight packages manager for *.tazpkg files written in SHell 2.9 # script. It works well with Busybox ash shell and bash. Tazpkg lets you 2.10 # list, install, remove, download or get information about a package. You can 2.11 # use 'tazpkg usage' to get a list of commands with short descriptions. Tazpkg 2.12 @@ -34,7 +34,7 @@ 2.13 COMMAND=$1 2.14 PACKAGE=${2%/} 2.15 PACKAGE_DIR="$(cd $(dirname $PACKAGE 2>/dev/null) 2>/dev/null; pwd)" 2.16 -[ -n "$PACKAGE" ] && 2.17 +[ -n "$PACKAGE" ] && 2.18 PACKAGE_FILE="$PACKAGE_DIR/${PACKAGE##*/}" 2.19 if [ -f "$PACKAGE" ]; then 2.20 # Set pkg basename for install, extract 2.21 @@ -159,7 +159,7 @@ 2.22 check_for_package_on_cmdline() 2.23 { 2.24 if [ -z "$PACKAGE" ]; then 2.25 - echo "" 2.26 + echo "" 2.27 gettext "Please specify a package name on the command line."; echo 2.28 echo "" 2.29 exit 0 2.30 @@ -302,7 +302,7 @@ 2.31 # get a virtual package from packages.equiv 2.32 virtual_pkg() 2.33 { 2.34 - for i in $(for rep in $priority; do 2.35 + for i in $(for rep in $priority; do 2.36 grep -hs "^$1=" $rep/packages.equiv 2.37 done | sed "s/^$1=//"); do 2.38 if echo $i | fgrep -q : ; then 2.39 @@ -330,10 +330,10 @@ 2.40 sed 's/^ *//') 2.41 [ "$pkg" ] && pkg=$(grep -sh "^$1-$pkg" \ 2.42 $rep/packages.list | head -1) 2.43 - 2.44 + 2.45 # Allow user to call a package with his version number. 2.46 [ "$pkg" ] || pkg=$(grep -sh "^$1$" $rep/packages.list | head -1) 2.47 - 2.48 + 2.49 [ "$pkg" ] || pkg=$(grep -sh "^$1-[0-9]" \ 2.50 $rep/packages.list | head -1) 2.51 [ "$pkg" ] || pkg=$(grep -sh "^$1-.[\.0-9]" \ 2.52 @@ -442,7 +442,7 @@ 2.53 { 2.54 # Avoid dirname errors by checking for argument. 2.55 [ "$1" ] || return 2.56 - 2.57 + 2.58 local dir 2.59 rm -f $1 2>/dev/null 2.60 dir="$1" 2.61 @@ -536,8 +536,8 @@ 2.62 [ -d "$ROOT$i" ] && continue 2.63 echo "- $i" 2.64 check=true 2.65 - done ; 2.66 - $check && for i in *; do 2.67 + done ; 2.68 + $check && for i in *; do 2.69 [ "$i" == "$PACKAGE" ] && continue 2.70 [ -s $i/files.list ] || continue 2.71 awk "{ printf \"$i %s\\n\",\$1 }" < $i/files.list 2.72 @@ -712,7 +712,7 @@ 2.73 fi 2.74 } 2.75 2.76 -# Install all missing deps. Auto install or ask user then install all missing 2.77 +# Install all missing deps. Auto install or ask user then install all missing 2.78 # deps from local dir, cdrom, media or from the mirror. In case we want to 2.79 # install packages from local, we need a packages.list to find the version. 2.80 install_deps() 2.81 @@ -927,10 +927,10 @@ 2.82 install_flavor() 2.83 { 2.84 check_root 2.85 - 2.86 + 2.87 # Get repositories priority list. 2.88 look_for_priority 2.89 - 2.90 + 2.91 FLAVOR=$1 2.92 ARG=$2 2.93 mkdir -p $TMP_DIR 2.94 @@ -1433,10 +1433,10 @@ 2.95 misc) gettext "misc" ;; 2.96 meta) gettext "meta" ;; 2.97 non-free) gettext "non-free" ;; 2.98 - 2.99 + 2.100 # Support custom categories by keeping them untranslated. 2.101 *) echo "$1" ;; 2.102 - 2.103 + 2.104 esac 2.105 } 2.106 2.107 @@ -1457,12 +1457,12 @@ 2.108 `gettext "misc"`) echo "misc" ;; 2.109 `gettext "meta"`) echo "meta" ;; 2.110 `gettext "non-free"`) echo "non-free" ;; 2.111 - 2.112 + 2.113 # If category is not one of those translated in native language, 2.114 # keep it untranslated. This allows both native and english 2.115 # language support. This also supports custom categories. 2.116 *) echo "$1" ;; 2.117 - 2.118 + 2.119 esac 2.120 } 2.121 2.122 @@ -1714,7 +1714,7 @@ 2.123 echo "" 2.124 echo -e "\033[1m`gettext \"Search result for file\"`\033[0m $2" 2.125 separator 2.126 - 2.127 + 2.128 if [ "$3" == "--mirror" ]; then 2.129 2.130 match=0 2.131 @@ -1762,7 +1762,7 @@ 2.132 eval_gettext "\$match file(s) found for: \$pkg"; echo 2.133 echo "" 2.134 fi ;; 2.135 - search-pkgname) 2.136 + search-pkgname) 2.137 # Search for a package name 2.138 if [ -z "$2" ]; then 2.139 echo "" 2.140 @@ -1774,7 +1774,7 @@ 2.141 echo "" 2.142 echo -e "\033[1m`gettext \"Search result for file\"`\033[0m $2" 2.143 separator 2.144 - 2.145 + 2.146 # Search for a file on mirror and output only the package name 2.147 match=0 2.148 for i in $LOCALSTATE/files.list.lzma \ 2.149 @@ -1799,7 +1799,7 @@ 2.150 check_root 2.151 check_for_package_on_cmdline 2.152 check_for_package_file 2.153 - 2.154 + 2.155 [ "$root" ] && ROOT="$root" && check_base_dir "$root" 2.156 [ "$list" ] && INSTALL_LIST="$list" 2.157 if [ "$rootconfig" ]; then 2.158 @@ -1822,8 +1822,8 @@ 2.159 fi 2.160 install_package $ROOT 2.161 update_desktop_database $ROOT 2.162 - update_mime_database $ROOT 2.163 - update_icon_database $ROOT 2.164 + update_mime_database $ROOT 2.165 + update_icon_database $ROOT 2.166 compile_glib_schemas $ROOT ;; 2.167 install-list|get-install-list) 2.168 # Install a set of packages from a list. 2.169 @@ -1905,8 +1905,8 @@ 2.170 # Remove packages. 2.171 check_root 2.172 check_for_package_on_cmdline 2.173 - 2.174 - [ "$root" ] && ROOT="$root" 2.175 + 2.176 + [ "$root" ] && ROOT="$root" 2.177 if [ ! -f "$ROOT$INSTALLED/$PACKAGE/receipt" ]; then 2.178 echo "" 2.179 eval_gettext "\$PACKAGE is not installed."; echo 2.180 @@ -2268,7 +2268,7 @@ 2.181 # must have only the choosen main mirror. 2.182 # 2.183 check_root 2.184 - 2.185 + 2.186 ARG=$2 2.187 if [ "$root" ]; then 2.188 LOCALSTATE=$root$LOCALSTATE 2.189 @@ -2285,11 +2285,11 @@ 2.190 fi 2.191 else 2.192 repository_to_recharge="$LOCALSTATE $LOCALSTATE/undigest/*" 2.193 - fi 2.194 + fi 2.195 for path in $repository_to_recharge; do 2.196 [ -f $path/mirror ] || continue 2.197 cd $path 2.198 - 2.199 + 2.200 # Quietly check if recharging is needed. 2.201 [ -f ID ] && mv ID ID.bak 2.202 download_from "$(cat mirror)" ID >/dev/null 2>/dev/null 2.203 @@ -2310,7 +2310,7 @@ 2.204 cat ID.bak > ID 2.205 rm ID.bak 2.206 fi 2.207 - 2.208 + 2.209 echo "" 2.210 if [ "$path" != "$LOCALSTATE" ]; then 2.211 echo -e "`gettext \"Recharging undigest\"` $(basename $path):" 2.212 @@ -2330,9 +2330,9 @@ 2.213 for i in desc md5 txt list equiv; do 2.214 download_from "$(cat mirror)" packages.$i 2.215 done 2.216 - download_from "$(cat mirror)" files.list.lzma 2.217 + download_from "$(cat mirror)" files.list.lzma 2.218 download_from "$(sed 's|packages/.*||' < mirror)" mirrors 2.219 - 2.220 + 2.221 if [ -f "packages.list.bak" ]; then 2.222 diff -u packages.list.bak packages.list | grep ^+[a-z] > packages.diff 2.223 sed -i s/+// packages.diff 2.224 @@ -2365,7 +2365,7 @@ 2.225 # upgradeable out-of-date. This new way is much, much more faster! 2.226 # Look into installed packages and get data from receipt, it is fast 2.227 # and easy to handle vars after using only md5sum to compare packages 2.228 - # 2.229 + # 2.230 # Options available for the command: up 2.231 if [ "$COMMAND" == "--help-up" ]; then 2.232 usage_up 2.233 @@ -2382,6 +2382,7 @@ 2.234 install="n" ;; 2.235 esac 2.236 done 2.237 + time=$(date +%s) 2.238 installed_sum=$LOCALSTATE/installed.$SUM 2.239 look_for_priority 2.240 for repo in $priority; do 2.241 @@ -2397,10 +2398,10 @@ 2.242 tazpkg recharge $repo_name 2.243 fi 2.244 done 2.245 - echo -en "\n\033[1m" 2.246 - gettext "Package" 2.247 - echo -en "\033[26G " && gettext "Update type" 2.248 - echo -e "\033[0m" 2.249 + newline 2.250 + boldify $(gettext "Package") \ 2.251 + $(echo -n $(indent 28 $(gettext "Version"))) \ 2.252 + $(echo -n $(indent 48 $(gettext "Status"))) 2.253 separator 2.254 cd $INSTALLED 2.255 echo "" > $UP_LIST 2.256 @@ -2421,19 +2422,22 @@ 2.257 # in this one. 2.258 grep -q ^$PACKAGE- $pkg_list || continue 2.259 2.260 + echo -n "$PACKAGE" 2.261 + echo -n $(indent 28 "$VERSION") 2.262 + 2.263 # Skip pkgs listed in $LOCALSTATE/blocked-packages.list 2.264 if $(grep -qs "^$PACKAGE" $BLOCKED); then 2.265 - blocked_count=$(($blocked_count+1)) 2.266 + blocked_count=$(($blocked_count + 1)) 2.267 + colorize 31 $(indent 48 $(gettext "Blocked")) 2.268 break 2.269 fi 2.270 - 2.271 + 2.272 new=$(grep "^$PACKAGE |" $pkg_desc | awk '{print $3}') 2.273 + 2.274 if [ "$VERSION" == "$new" ]; then 2.275 - echo -n "$PACKAGE" 2.276 - echo -e "\\033[26G `gettext \"New build :\"` $md5" 2.277 + colorize 34 $(indent 48 $(gettext "New build")) 2.278 else 2.279 - echo -n "$PACKAGE" 2.280 - echo -e "\\033[26G `gettext \"New version :\"` $new" 2.281 + colorize 32 $(indent 48 $(gettext "New version") $new) 2.282 fi 2.283 echo "$PACKAGE" >> $UP_LIST 2.284 break 2.285 @@ -2443,16 +2447,20 @@ 2.286 sed -i /^$/d $UP_LIST 2.287 upnb=$(cat $UP_LIST | wc -l) 2.288 pkgs=$(ls | wc -l) 2.289 + time=$(($(date +%s) - $time)) 2.290 if [ "$upnb" = 0 ]; then 2.291 install="n" 2.292 gettext -e "System is up-to-date...\n\n" 2.293 - else 2.294 - separator 2.295 + fi 2.296 + separator 2.297 + echo -n "$pkgs "; gettext "installed packages scanned in"; echo " ${time}s" 2.298 + newline 2.299 + if [ "$upnb" != 0 ]; then 2.300 echo -en "\033[1m" 2.301 if [ "$blocked_count" -gt 0 ]; then 2.302 blocks=`eval_gettext " (\$blocked_count blocked)"` 2.303 fi 2.304 - eval_gettext "You have \$upnb available upgrades\$blocks on \$pkgs installed packages" 2.305 + eval_gettext "You have \$upnb available upgrades\$blocks" 2.306 echo -e "\033[0m\n" 2.307 fi 2.308 # Pkgs to upgrade ? Skip, let install them all or ask user 2.309 @@ -2503,10 +2511,10 @@ 2.310 check) 2.311 # Check installed packages set. 2.312 check_root 2.313 - 2.314 + 2.315 # Get repositories priority list. 2.316 look_for_priority 2.317 - 2.318 + 2.319 cd $INSTALLED 2.320 for PACKAGE in `ls`; do 2.321 if [ ! -f $PACKAGE/receipt ]; then 2.322 @@ -2631,7 +2639,7 @@ 2.323 check_root 2.324 check_for_package_on_cmdline 2.325 check_for_packages_list 2.326 - 2.327 + 2.328 [ "$root" ] && ROOT="$root" && check_base_dir "$root" 2.329 if [ "$rootconfig" ]; then 2.330 if [ "$root" ]; then 2.331 @@ -2643,10 +2651,10 @@ 2.332 exit 1 2.333 fi 2.334 fi 2.335 - 2.336 + 2.337 # Get repositories priority list. 2.338 look_for_priority 2.339 - 2.340 + 2.341 CURRENT_DIR=$PWD 2.342 check_for_package_in_list 2.343 cd $CACHE_DIR 2.344 @@ -2672,7 +2680,7 @@ 2.345 check_root 2.346 check_for_package_on_cmdline 2.347 check_for_packages_list 2.348 - 2.349 + 2.350 DO_CHECK="" 2.351 [ "$forced" ] && DO_CHECK=no 2.352 [ "$root" ] && ROOT="$root" && check_base_dir "$root" 2.353 @@ -2726,8 +2734,8 @@ 2.354 PACKAGE_FILE=$CACHE_DIR/$PACKAGE.tazpkg 2.355 [ "$rootconfig" ] && LOCALSTATE=${LOCALSTATE#$root} 2.356 install_package $ROOT 2.357 - [ "$AUTOEXEC" != "no" ] && $PACKAGE $ROOT 2.358 - update_desktop_database $ROOT 2.359 + [ "$AUTOEXEC" != "no" ] && $PACKAGE $ROOT 2.360 + update_desktop_database $ROOT 2.361 update_mime_database $ROOT ;; 2.362 clean-cache|-cc) 2.363 # Remove all downloaded packages. 2.364 @@ -2879,7 +2887,7 @@ 2.365 convert|-c) 2.366 # convert misc package format to .tazpkg 2.367 check_for_package_file 2.368 - [ -n "$TARGET_DIR" -a -s "$TARGET_DIR/files.list.lzma" ] && 2.369 + [ -n "$TARGET_DIR" -a -s "$TARGET_DIR/files.list.lzma" ] && 2.370 TMPLOCALSTATE="$TARGET_DIR" 2.371 if [ "$(dd if=$PACKAGE_FILE bs=8 count=1 skip=1 2> /dev/null)" \ 2.372 == "debian-b" ]; then