tazpkg annotate modules/description @ rev 846

Remove "busybox" "prefixes" (thanks llev)
We used "busybox wget", etc. to be sure we called Busybox's "wget", not any other "wget". Workaround already done in "getenv" module.
author Aleksej Bobylev <al.bobylev@gmail.com>
date Fri Oct 09 13:14:01 2015 +0300 (2015-10-09)
parents a02e36d44d06
children 45d90da42ede
rev   line source
al@840 1 #!/bin/sh
al@840 2 # TazPkg - Tiny autonomous zone packages manager, hg.slitaz.org/tazpkg
al@840 3 # description - TazPkg module
al@840 4 # Display package description
al@840 5
al@840 6
al@840 7 # Connect function libraries
al@840 8 . /lib/libtaz.sh
al@840 9
al@840 10 # Get TazPkg working environment
al@840 11 . @@MODULES@@/getenv
al@840 12
al@840 13
al@840 14
al@840 15
al@840 16 # Interactive mode
al@840 17
al@840 18 im() { tty -s; }
al@840 19
al@840 20
al@840 21
al@840 22
al@840 23 unset desc
al@840 24
al@840 25 # 1) Localized description
al@844 26 for lang in $LANG ${LANG%_*}; do
al@844 27 [ -e "$PKGS_DB/descriptions.$lang.txt" ] || continue
al@840 28 desc="$(awk -vRS='' -vFS='\n' -vOFS='\n' -vp="$1" '
al@840 29 $1 == p { $1 = ""; print $0; exit; }
al@844 30 ' "$PKGS_DB/descriptions.$lang.txt" | sed '1d')"
al@840 31 done
al@840 32
al@840 33 # 2) Installed description
al@840 34 if [ -z "$desc" -a -s "$INSTALLED/$1/description.txt" ]; then
al@840 35 desc="$(cat "$INSTALLED/$1/description.txt")"
al@840 36 fi
al@840 37
al@840 38 # 3) Mirrored description
al@840 39 if [ -z "$desc" -a -s "$PKGS_DB/descriptions.txt" ]; then
al@840 40 desc="$(awk -vRS='' -vFS='\n' -vOFS='\n' -vp="$1" '
al@840 41 $1==p {$1 = ""; print $0; exit}
al@840 42 ' "$PKGS_DB/descriptions.txt" | sed '1d')"
al@840 43 fi
al@840 44
al@840 45 # 4) Short description only in interactive terminal
al@840 46 if [ -z "$desc" ] && im; then
al@844 47 for lang in $LANG ${LANG%_*}; do
al@844 48 [ -e "$PKGS_DB/packages-desc.$lang" ] || continue
al@844 49 desc=$(awk -F$'\t' -vp="$1" '$1==p {print $2; exit}' "$PKGS_DB/packages-desc.$lang")
al@840 50 done
al@840 51
al@840 52 [ -z "$desc" -a -s "$PKGS_DB/packages.info" ] &&
al@840 53 desc="$(awk -F$'\t' -vp="$1" '$1==p {print $4; exit}' "$PKGS_DB/packages.info")"
al@840 54 fi
al@840 55
al@840 56 if [ -n "$desc" ]; then
al@844 57 case $output in
al@844 58 html)
al@844 59 # Description for TazPanel in html format
al@844 60 if [ -n "$(which sundown)" ]; then
al@844 61 # Parse description as markdown
al@844 62 echo "$desc" | sundown
al@844 63 else
al@844 64 # Dump description within <pre> tag
al@844 65 echo '<pre class="pre-wrap">'
al@844 66 echo "$desc" | sed -e 's|\&|\&amp;|g; s|<|\&lt;|g; s|>|\&gt;|g'
al@844 67 echo '</pre>'
al@844 68 fi
al@844 69 ;;
al@844 70 *)
al@844 71 # Description for terminal tazpkg in plain text
al@844 72 # Title and footer only in interactive terminal
al@844 73 im && title 'Description of package "%s"' "$1"
al@844 74 echo "$desc"
al@844 75 im && footer
al@844 76 ;;
al@844 77 esac
al@844 78
al@840 79 else
al@840 80 im && _ 'Description absent.'
al@840 81 fi
al@844 82
al@844 83 exit 0