tazpkg rev 864
Module "getenv": better checking of 'installed.info'; module "get": display abridged wget status, move here test for package already installed from "tazpkg" code
author | Aleksej Bobylev <al.bobylev@gmail.com> |
---|---|
date | Tue Nov 17 12:45:13 2015 +0200 (2015-11-17) |
parents | f65503bd347b |
children | 46bfd486a20c |
files | modules/get modules/getenv tazpkg |
line diff
1.1 --- a/modules/get Mon Nov 16 10:45:25 2015 +0200 1.2 +++ b/modules/get Tue Nov 17 12:45:13 2015 +0200 1.3 @@ -94,8 +94,8 @@ 1.4 # Mirror URL can have a trailing slash or not. 1.5 http://* | https://* | ftp://*) 1.6 debug " wget -c -T 30 -U $UA ${1%/}/$2" 1.7 - # TODO: display abridged wget status 1.8 - wget -c -T 30 -U $UA ${1%/}/$2 1.9 + # Display abridged wget status (skip info about connections) 1.10 + wget -c -T 30 -U $UA ${1%/}/$2 2>&1 | awk 'BEGIN{RS="\r"}$0~"%"{printf "%s\r",$0}' >&2 1.11 ;; 1.12 *) 1.13 debug " cp ${1%/}/$2 ." 1.14 @@ -182,7 +182,8 @@ 1.15 # Default 'http://mirror.slitaz.org/packages/cooking/' 1.16 # -> 'http://mirror.slitaz.org/packages/extra/' 1.17 debug "wget -T 30 -U '$UA' '${mirror%packages/*}packages/extra/$converted'" 1.18 - wget -T 30 -U "$UA" "${mirror%packages/*}packages/extra/$converted";; 1.19 + wget -T 30 -U "$UA" "${mirror%packages/*}packages/extra/$converted" \ 1.20 + 2>&1 | awk 'BEGIN{RS="\r"}$0~"%"{printf "%s\r",$0}' >&2;; 1.21 esac 1.22 if [ -f "$converted" ]; then 1.23 echo "$extra_cache/$converted"; exit 0 1.24 @@ -197,7 +198,8 @@ 1.25 # Default 'http://mirror.slitaz.org/packages/cooking/' 1.26 # -> 'http://mirror.slitaz.org/packages/get/' 1.27 debug "wget -T 30 -U '$UA' '${mirror%packages/*}packages/get/$1'" 1.28 - wget -T 30 -U "$UA" "${mirror%packages/*}packages/get/$1";; 1.29 + wget -T 30 -U "$UA" "${mirror%packages/*}packages/get/$1" \ 1.30 + 2>&1 | awk 'BEGIN{RS="\r"}$0~"%"{printf "%s\r",$0}' >&2;; 1.31 esac 1.32 1.33 if [ ! -f "$1" ]; then 1.34 @@ -360,6 +362,20 @@ 1.35 1.36 1.37 1.38 +# Command 'get-install' calls 'get', then 'install' modules. Check package presence here, on the 1.39 +# first stage, if '--forced' option not given 1.40 +if [ "$tazpkg_command" == 'get-install' -a -z "$forced" ]; then 1.41 + awk -F$'\t' -vpv="$i" '$1==pv { exit 1 }' "$PKGS_DB/installed.info" 1.42 + if [ "$?" -eq 1 ]; then 1.43 + newline 1.44 + _ '"%s" package is already installed.' "$(colorize 34 "$i")" 1.45 + longline "$(_ 'You can use the --forced option to force installation.')" 1.46 + newline 1.47 + # Prevent execution 'install' stage: 1.48 + exit 1 1.49 + fi 1.50 +fi 1.51 + 1.52 if [ -n "$extra" ]; then 1.53 # When '--extra' option given, extra-package has priority over 'regular' packages 1.54 get_pkg_extra "$1"
2.1 --- a/modules/getenv Mon Nov 16 10:45:25 2015 +0200 2.2 +++ b/modules/getenv Tue Nov 17 12:45:13 2015 +0200 2.3 @@ -114,7 +114,7 @@ 2.4 missing_file "$info_path" 2.5 if [ ! -s "$info_path" ]; then 2.6 # Empty installed.info 2.7 - if [ -n "$(ls "$INSTALLED")" ]; then 2.8 + if [ -n "$(find "$INSTALLED" -name 'receipt')" ]; then 2.9 # Some packages are installed 2.10 if [ "$(id -u)" -eq 0 ]; then 2.11 # Root can re-create installed.info
3.1 --- a/tazpkg Mon Nov 16 10:45:25 2015 +0200 3.2 +++ b/tazpkg Tue Nov 17 12:45:13 2015 +0200 3.3 @@ -453,18 +453,9 @@ 3.4 get-install|-gi) 3.5 # Download and install a package. 3.6 check_cmd su pkg; shift 3.7 + export tazpkg_command='get-install' 3.8 # Get and install all the packages given on command line 3.9 for i in $@; do 3.10 - 3.11 - awk -F$'\t' -vpv="$i" '$1==pv { exit 1 }' "$PKGS_DB/installed.info" 3.12 - if [ "$?" -eq 1 ]; then 3.13 - newline 3.14 - _ '"%s" package is already installed.' "$(colorize 34 "$i")" 3.15 - longline "$(_ 'You can use the --forced option to force installation.')" 3.16 - newline 3.17 - continue 3.18 - fi 3.19 - 3.20 pkg="$(@@MODULES@@/get $i)" && @@MODULES@@/install "$pkg" 3.21 done 3.22 # Get and install all the packages listed in the file