rev |
line source |
al@822
|
1 #!/bin/sh
|
al@828
|
2 # TazPkg - Tiny autonomous zone packages manager, hg.slitaz.org/tazpkg
|
al@828
|
3 # help - TazPkg module
|
al@822
|
4 # TazPkg help system
|
al@822
|
5
|
al@828
|
6
|
al@822
|
7 . /lib/libtaz.sh
|
al@822
|
8
|
al@840
|
9
|
al@840
|
10
|
al@840
|
11
|
al@840
|
12 # Print the usage.
|
al@840
|
13
|
al@840
|
14 usage () {
|
al@840
|
15 cat <<EOT
|
al@840
|
16
|
al@840
|
17 $(_ 'SliTaz package manager - Version: %s' $(colorize 34 $VERSION))
|
al@840
|
18
|
al@840
|
19 $(boldify "$(_ 'Usage:')")
|
al@840
|
20 $(_ 'tazpkg [command] [package|dir|pattern|list|cat|--opt] [dir|--opt]')
|
al@840
|
21
|
al@840
|
22 $(boldify "$(_ 'SHell:')") tazpkg shell
|
al@840
|
23
|
al@840
|
24 $(boldify "$(_ 'Commands:')")
|
al@840
|
25 $(optlist "\
|
al@840
|
26 usage $(_ 'Print this short usage')
|
al@840
|
27 -h help $(_ 'Show help on the TazPkg commands')
|
al@840
|
28 -a activity $(_ 'Show TazPkg activity log')
|
al@840
|
29 -cc clean-cache $(_ 'Clean all packages downloaded in cache directory')
|
al@875
|
30 list-cache $(_ 'List *.tazpkg packages downloaded to the cache')
|
al@840
|
31 shell $(_ 'Run interactive TazPkg shell')
|
al@840
|
32
|
al@840
|
33 -l list $(_ 'List installed packages on the system')
|
al@840
|
34 -lm list-mirror $(_ 'List all available packages on the mirror')
|
al@840
|
35 list-config $(_ 'List the configuration files')
|
al@840
|
36
|
al@840
|
37 -s search $(_ 'Search for a package by pattern or name')
|
al@840
|
38 -sp search-pkgname $(_ 'Search on mirror for package having a particular file')
|
al@840
|
39 -sf search-file $(_ 'Search for file in all installed packages files')
|
al@840
|
40
|
al@840
|
41 -g get $(_ 'Download a package into the current directory')
|
al@840
|
42 -i install $(_ 'Install a local package')
|
al@840
|
43 -gi get-install $(_ 'Download and install a package from the mirror')
|
al@840
|
44 install-list $(_ 'Install all packages from a list of packages')
|
al@840
|
45 get-install-list $(_ 'Download and install a list of packages from the mirror')
|
al@840
|
46 -r remove $(_ 'Remove the specified package and all installed files')
|
al@840
|
47 reconfigure $(_ 'Replay post install script from package')
|
al@840
|
48 link $(_ 'Link a package from another SliTaz installation')
|
al@840
|
49 set-release $(_ 'Change release and update packages')
|
al@840
|
50 add-flavor $(_ 'Install the flavor list of packages')
|
al@840
|
51 install-flavor $(_ 'Install the flavor list of packages and remove other ones')
|
al@840
|
52
|
al@840
|
53 info $(_ 'Print information about a package')
|
al@840
|
54 -d desc $(_ 'Print description of a package')
|
al@840
|
55 -lf list-files $(_ 'List the files installed with a package')
|
al@840
|
56 -b|u block|unblock $(_ 'Block an installed package version or unblock it for upgrade')
|
al@840
|
57 check $(_ 'Verify consistency of installed packages')
|
al@840
|
58 bugs $(_ 'Show known bugs in packages')
|
al@840
|
59 depends $(_ 'Display dependencies tree')
|
al@840
|
60 rdepends $(_ 'Display reverse dependencies tree')
|
al@840
|
61 -e extract $(_ 'Extract a (*.tazpkg) package into a directory')
|
al@840
|
62 pack $(_ 'Pack an unpacked or prepared package tree')
|
al@840
|
63 repack $(_ 'Create a package archive from an installed package')
|
al@840
|
64 repack-config $(_ 'Create a package archive with configuration files')
|
al@840
|
65 recompress $(_ 'Rebuild a package with a better compression ratio')
|
al@840
|
66 convert $(_ 'Convert alien package to tazpkg')
|
al@840
|
67 list-suggested $(_ 'Print list of suggested packages')
|
al@840
|
68
|
al@840
|
69 recharge $(_ 'Recharge your packages.list from the mirror')
|
al@840
|
70 up $(_ 'Check packages %s to list and install latest upgrades' $CHECKSUM)
|
al@840
|
71 -sm setup-mirror $(_ 'Change the mirror URL configuration')
|
al@840
|
72 setup-undigest $(_ 'Update an undigest mirror')
|
al@840
|
73 list-undigest $(_ 'List undigest mirrors')
|
al@840
|
74 add-undigest $(_ 'Add an undigest mirror')
|
al@840
|
75 remove-undigest $(_ 'Remove an undigest mirror')
|
paul@848
|
76 mkdb $(_ 'Make a TazPkg database for a folder with *.tazpkg packages')
|
al@840
|
77 ")
|
al@840
|
78 EOT
|
al@840
|
79 }
|
al@840
|
80
|
al@840
|
81
|
al@840
|
82
|
al@840
|
83
|
al@822
|
84 T="${1#-}"
|
al@822
|
85 DOC='/usr/share/doc/tazpkg/tazpkg.html'
|
al@822
|
86 QUERY="$T"
|
al@822
|
87
|
al@822
|
88 if [ -z "$T" ]; then
|
al@840
|
89 usage; exit 0
|
al@822
|
90 fi
|
al@822
|
91
|
al@822
|
92 commands="\
|
al@822
|
93 :usage::help,h::activity,log,a::clean-cache,cc::shell::list,l::list-mirror,lm:\
|
al@822
|
94 :list-config::search,s::search-pkgname,sp::search-file,sf::get,g::install,i:\
|
al@822
|
95 :get-install,gi::install-list,get-install-list::remove,r::reconfigure::link:\
|
al@822
|
96 :set-release::add-flavor,install-flavor::info::desc,d::list-files,lf:\
|
al@822
|
97 :block,b,unblock,u,chblock::check::bugs::depends,rdepends::extract,e::pack:\
|
al@822
|
98 :repack::repack-config::recompress::convert,c::list-suggested::recharge:\
|
al@822
|
99 :upgrade,up::setup-mirror,sm::add-undigest,setup-undigest::list-undigest:\
|
al@822
|
100 :remove-undigest:"
|
al@822
|
101
|
al@822
|
102 if [ ! $(echo $commands | grep -e "[:,]$T[:,]") ]; then
|
al@822
|
103 try1=$(echo $commands | grep -oe ":[^:]*$T[^:]*:")
|
al@822
|
104 if [ -z "$try1" ]; then
|
al@822
|
105 _ 'Sorry, no help for "%s"' "$QUERY"; newline; exit 0
|
al@822
|
106 fi
|
al@822
|
107
|
al@822
|
108 try2=$(echo "$try1" | tr -d : )
|
al@822
|
109
|
al@822
|
110 trynum=$(echo "$try2" | wc -l)
|
al@822
|
111 if [ "$trynum" -ne 1 ]; then
|
al@822
|
112 _p '%d help topic available:' '%d help topics available:' "$trynum" \
|
al@822
|
113 "$trynum"; newline
|
al@822
|
114 echo "$try2" | sed 's|^| * &|; s| ,| |; s|,|, |g'
|
al@822
|
115 exit 0
|
al@822
|
116 else
|
al@822
|
117 T="${try2%%,*}"
|
al@822
|
118 fi
|
al@822
|
119 else
|
al@822
|
120 try3=$(echo $commands | grep -oe "[:,]$T[:,]")
|
al@822
|
121 case $try3 in
|
al@822
|
122 :*) try4="$try3";;
|
al@822
|
123 ,*) try4=$(echo $commands | grep -oe ":[^:]*$try3" | cut -d, -f1);;
|
al@822
|
124 esac
|
al@822
|
125
|
al@822
|
126 T=$(echo $try4 | tr -d ':,')
|
al@822
|
127 fi
|
al@822
|
128
|
al@822
|
129 title=$(echo $commands | grep -oe ":$T\(,[^:]*\)*:" | tr -d : | sed 's|,|, |g')
|
al@822
|
130
|
al@822
|
131
|
al@844
|
132 # style: <article id="TOPIC">
|
al@886
|
133 HLP=$(sed "/article id=\"$T\"/,/<\/article/!d; s|</*article[^>]*>||; s|<h3>.*</h3>||" $DOC)
|
al@822
|
134
|
al@822
|
135 if [ -z "$HLP" ]; then
|
al@822
|
136 _ 'Sorry, no help for "%s"' "$QUERY"
|
al@822
|
137 exit 0
|
al@822
|
138 fi
|
al@822
|
139
|
al@822
|
140 PRE=$(echo "$HLP" | sed "/^$/d; /<pre>/,/<\/pre\>/{s|.*| &|; s| |·|g}; \
|
al@822
|
141 s|^ </*pre>$||; s|<pre>||; s|</pre>||; s| ·#| #|;" | tr '\n' ' ' | \
|
al@822
|
142 sed 's|[ ][ ]*| |g;' | \
|
al@822
|
143 sed 's|[ ]*<dl>|O\n|g; s|[ ]*</dl>|L\n|g; s|[ ]*</*dt>||g;' | \
|
al@822
|
144 sed 's|[ ]*<dd>| |g; s|</dd>|\n|g;' | \
|
al@895
|
145 sed 's|[ ]*<ul>|O\n|g; s|[ ]*</ul>|L\n|g; s|[ ]*<li>|* |g; s|</li>|\n|g;' | \
|
al@822
|
146 sed 's|<h4>|<b>|g; s|</h4>|</b>\n|g' | \
|
al@822
|
147 sed 's|[ ]*<p>[ ]*||g; s|[ ]*</p>|\n \n|g; s| |\n |g' | \
|
al@822
|
148 sed 's|<a [^>]*>||g; s|</a>||g; s|·| |g' | \
|
al@822
|
149 sed 's|</*nobr>||g; s|­||g; s|^[ ]*||' | \
|
al@822
|
150 sed '/^$/d' | \
|
al@822
|
151 sed 's|<tt>|A|g; s|<code>|A|g; s|<em>|B|g; s|<strong>|B|g; \
|
al@822
|
152 s|</tt>|D|g; s|</code>|D|g; s|</em>|D|g; s|</strong>|C|g; \
|
al@822
|
153 s|DD|D|g;')
|
al@822
|
154
|
al@822
|
155 OPT=$(echo "$PRE" | sed '/O/,/L/!d; /[OL]/d')
|
al@822
|
156 OPTLIST=$(optlist "$OPT")
|
al@822
|
157
|
al@822
|
158 OPT0=$(echo "$PRE" | tr '\n' '@')
|
al@895
|
159 OPTA=$(echo "$OPT" | tr '\n' '@' | sed 's|\*|\\*|g;')
|
al@895
|
160 OPTB=$(echo "$OPTLIST" | tr '\n' '@' | sed 's|\*|\\*|g;')
|
al@822
|
161
|
al@822
|
162 PRE2=$(echo "$OPT0" | sed "s|$OPTA|$OPTB|" | tr '@' '\n' | sed '/O/d; s|L||')
|
al@822
|
163
|
al@822
|
164 [ ! -z "$TA" ] && T="$T, $TA"
|
al@822
|
165
|
al@840
|
166 title '%s' "$title"
|
al@894
|
167 emsg "$(longline "$PRE2" | sed 's|A|<c 33>|g; s|B|<c 36>|g; s|C|</b>|g; s|D|</c>|g; ')"
|
al@822
|
168 newline
|