tazpkg diff modules/info @ rev 840
Add a bunch of modules with new-style support of 'root' (not all commands are modules yet); strip and compress resources.
author | Aleksej Bobylev <al.bobylev@gmail.com> |
---|---|
date | Fri Aug 28 16:10:34 2015 +0300 (2015-08-28) |
parents | 7acf0290bdb2 |
children | 45d90da42ede |
line diff
1.1 --- a/modules/info Wed Aug 12 13:49:16 2015 +0300 1.2 +++ b/modules/info Fri Aug 28 16:10:34 2015 +0300 1.3 @@ -6,9 +6,11 @@ 1.4 1.5 # Connect function libraries 1.6 . /lib/libtaz.sh 1.7 -# Get TazPkg configuration variables 1.8 -. /etc/slitaz/slitaz.conf 1.9 -. /etc/slitaz/tazpkg.conf 1.10 + 1.11 +# Get TazPkg working environment 1.12 +. @@MODULES@@/getenv 1.13 + 1.14 + 1.15 1.16 1.17 # Interactive mode 1.18 @@ -19,31 +21,31 @@ 1.19 # Unset variables that may absent in the receipt 1.20 unset EXTRAVERSION TAGS DEPENDS PROVIDE SIZES 1.21 1.22 -if [ -e "$1" ]; then 1.23 +if [ -e "$1" -a "${1%.tazpkg}" != "$1" ]; then 1.24 # Local package given 1.25 1.26 # Extract receipt from package 1.27 - PKG="$(realpath "$1")" 1.28 - TMP_DIR=$(mktemp -d); cd $TMP_DIR 1.29 + PKG=$(realpath "$1") 1.30 + TMP_DIR=$(mktemp -d); cd "$TMP_DIR" 1.31 cpio -F "$PKG" -i receipt >/dev/null 2>&1 1.32 1.33 - . receipt; rm -r $TMP_DIR 1.34 - STATE="$(_ 'local package')" 1.35 + . receipt; rm -r "$TMP_DIR" 1.36 + STATE=$(_ 'local package') 1.37 1.38 elif [ -d "$INSTALLED/$1" ]; then 1.39 # Installed package given 1.40 1.41 . "$INSTALLED/$1/receipt" 1.42 - STATE="$(_ 'installed package')" 1.43 + STATE=$(_ 'installed package') 1.44 1.45 if [ -e "$PKGS_DB/packages.info" ]; then 1.46 # Check if upgrade available 1.47 - NEWVER="$(awk -F$'\t' -vp="$1" '$1==p{print $2}' "$PKGS_DB/packages.info")" 1.48 + NEWVER=$(awk -F$'\t' -vp="$1" '$1==p{print $2}' "$PKGS_DB/packages.info") 1.49 if [ "$VERSION" != "$NEWVER" ]; then 1.50 VERSION="$VERSION $(_n '(new version "%s" available)' "$NEWVER")" 1.51 else 1.52 - OLDMD5="$(awk -F$'\t' -vp="$1" '$1==p{print $9}' "$PKGS_DB/installed.info")" 1.53 - NEWMD5="$(awk -F$'\t' -vp="$1" '$1==p{print $9}' "$PKGS_DB/packages.info")" 1.54 + OLDMD5=$(awk -F$'\t' -vp="$1" '$1==p{print $9}' "$PKGS_DB/installed.info") 1.55 + NEWMD5=$(awk -F$'\t' -vp="$1" '$1==p{print $9}' "$PKGS_DB/packages.info") 1.56 if [ "$OLDMD5" != "$NEWMD5" ]; then 1.57 VERSION="$VERSION $(_n '(new build available)')" 1.58 fi 1.59 @@ -57,19 +59,19 @@ 1.60 1.61 TMP_RECEIPT=$(mktemp) 1.62 awk -F$'\t' -vp="$1" '$1==p{ 1.63 - printf "PACKAGE=\"%s\"\n", $1 1.64 - printf "VERSION=\"%s\"\n", $2 1.65 - printf "CATEGORY=\"%s\"\n", $3 1.66 + printf "PACKAGE=\"%s\"\n", $1 1.67 + printf "VERSION=\"%s\"\n", $2 1.68 + printf "CATEGORY=\"%s\"\n", $3 1.69 printf "SHORT_DESC=\"%s\"\n", $4 1.70 - printf "WEB_SITE=\"%s\"\n", $5 1.71 - printf "TAGS=\"%s\"\n", $6 1.72 - printf "SIZES=\"%s\"\n", $7 1.73 - printf "DEPENDS=\"%s\"\n", $8 1.74 - }' "$PKGS_DB/packages.info" > $TMP_RECEIPT 1.75 + printf "WEB_SITE=\"%s\"\n", $5 1.76 + printf "TAGS=\"%s\"\n", $6 1.77 + printf "SIZES=\"%s\"\n", $7 1.78 + printf "DEPENDS=\"%s\"\n", $8 1.79 + }' "$PKGS_DB/packages.info" > "$TMP_RECEIPT" 1.80 1.81 - . $TMP_RECEIPT; rm $TMP_RECEIPT 1.82 - SIZES="$(echo $SIZES | tr ' ' '/')" 1.83 - STATE="$(_ 'mirrored package')" 1.84 + . "$TMP_RECEIPT"; rm "$TMP_RECEIPT" 1.85 + SIZES=$(echo $SIZES | tr ' ' '/') 1.86 + STATE=$(_ 'mirrored package') 1.87 else 1.88 newline 1.89 _ 'Package "%s" not available.' "$1" 1.90 @@ -87,7 +89,7 @@ 1.91 fi 1.92 1.93 1.94 -im && title 'TazPkg information' 1.95 +im && title 'TazPkg information' >&2 1.96 1.97 # Display localized short description 1.98 for LC in $LANG ${LANG%_*}; do 1.99 @@ -102,10 +104,10 @@ 1.100 1.101 emsg "$( 1.102 { 1.103 - _ 'Package : %s' "$PACKAGE" 1.104 - _ 'State : %s' "$STATE" 1.105 - _ 'Version : %s' "$VERSION$EXTRAVERSION" 1.106 - _ 'Category : %s' "$(_ $CATEGORY)" 1.107 + _ 'Package : %s' "$PACKAGE" 1.108 + _ 'State : %s' "$STATE" 1.109 + _ 'Version : %s' "$VERSION$EXTRAVERSION" 1.110 + _ 'Category : %s' "$(_ $CATEGORY)" 1.111 itemize "$(_ 'Short desc : %s' "$SHORT_DESC")" 1.112 _ 'Maintainer : %s' "$MAINTAINER" 1.113 _ 'License : %s' "$LICENSE" 1.114 @@ -119,5 +121,5 @@ 1.115 _ 'Size : %s' "$SIZES" 1.116 itemize "$(_ 'Tags : %s' "$TAGS")" 1.117 } | sed '/: $/d; s|^\([^:]*\):|<b>\1:</b>|')" 1.118 -im && footer 1.119 +im && footer >&2 1.120