# HG changeset patch # User Aleksej Bobylev # Date 1447757113 -7200 # Node ID 67996045442a5cca9a6023c40ec2e4ddf9cbf537 # Parent f65503bd347b6d200442651db0b8811b1c555808 Module "getenv": better checking of 'installed.info'; module "get": display abridged wget status, move here test for package already installed from "tazpkg" code diff -r f65503bd347b -r 67996045442a modules/get --- a/modules/get Mon Nov 16 10:45:25 2015 +0200 +++ b/modules/get Tue Nov 17 12:45:13 2015 +0200 @@ -94,8 +94,8 @@ # Mirror URL can have a trailing slash or not. http://* | https://* | ftp://*) debug " wget -c -T 30 -U $UA ${1%/}/$2" - # TODO: display abridged wget status - wget -c -T 30 -U $UA ${1%/}/$2 + # Display abridged wget status (skip info about connections) + wget -c -T 30 -U $UA ${1%/}/$2 2>&1 | awk 'BEGIN{RS="\r"}$0~"%"{printf "%s\r",$0}' >&2 ;; *) debug " cp ${1%/}/$2 ." @@ -182,7 +182,8 @@ # Default 'http://mirror.slitaz.org/packages/cooking/' # -> 'http://mirror.slitaz.org/packages/extra/' debug "wget -T 30 -U '$UA' '${mirror%packages/*}packages/extra/$converted'" - wget -T 30 -U "$UA" "${mirror%packages/*}packages/extra/$converted";; + wget -T 30 -U "$UA" "${mirror%packages/*}packages/extra/$converted" \ + 2>&1 | awk 'BEGIN{RS="\r"}$0~"%"{printf "%s\r",$0}' >&2;; esac if [ -f "$converted" ]; then echo "$extra_cache/$converted"; exit 0 @@ -197,7 +198,8 @@ # Default 'http://mirror.slitaz.org/packages/cooking/' # -> 'http://mirror.slitaz.org/packages/get/' debug "wget -T 30 -U '$UA' '${mirror%packages/*}packages/get/$1'" - wget -T 30 -U "$UA" "${mirror%packages/*}packages/get/$1";; + wget -T 30 -U "$UA" "${mirror%packages/*}packages/get/$1" \ + 2>&1 | awk 'BEGIN{RS="\r"}$0~"%"{printf "%s\r",$0}' >&2;; esac if [ ! -f "$1" ]; then @@ -360,6 +362,20 @@ +# Command 'get-install' calls 'get', then 'install' modules. Check package presence here, on the +# first stage, if '--forced' option not given +if [ "$tazpkg_command" == 'get-install' -a -z "$forced" ]; then + awk -F$'\t' -vpv="$i" '$1==pv { exit 1 }' "$PKGS_DB/installed.info" + if [ "$?" -eq 1 ]; then + newline + _ '"%s" package is already installed.' "$(colorize 34 "$i")" + longline "$(_ 'You can use the --forced option to force installation.')" + newline + # Prevent execution 'install' stage: + exit 1 + fi +fi + if [ -n "$extra" ]; then # When '--extra' option given, extra-package has priority over 'regular' packages get_pkg_extra "$1" diff -r f65503bd347b -r 67996045442a modules/getenv --- a/modules/getenv Mon Nov 16 10:45:25 2015 +0200 +++ b/modules/getenv Tue Nov 17 12:45:13 2015 +0200 @@ -114,7 +114,7 @@ missing_file "$info_path" if [ ! -s "$info_path" ]; then # Empty installed.info - if [ -n "$(ls "$INSTALLED")" ]; then + if [ -n "$(find "$INSTALLED" -name 'receipt')" ]; then # Some packages are installed if [ "$(id -u)" -eq 0 ]; then # Root can re-create installed.info diff -r f65503bd347b -r 67996045442a tazpkg --- a/tazpkg Mon Nov 16 10:45:25 2015 +0200 +++ b/tazpkg Tue Nov 17 12:45:13 2015 +0200 @@ -453,18 +453,9 @@ get-install|-gi) # Download and install a package. check_cmd su pkg; shift + export tazpkg_command='get-install' # Get and install all the packages given on command line for i in $@; do - - awk -F$'\t' -vpv="$i" '$1==pv { exit 1 }' "$PKGS_DB/installed.info" - if [ "$?" -eq 1 ]; then - newline - _ '"%s" package is already installed.' "$(colorize 34 "$i")" - longline "$(_ 'You can use the --forced option to force installation.')" - newline - continue - fi - pkg="$(@@MODULES@@/get $i)" && @@MODULES@@/install "$pkg" done # Get and install all the packages listed in the file