rev |
line source |
al@898
|
1 #!/bin/sh
|
al@898
|
2 #
|
al@898
|
3 # SliTaz Cooker CGI + Lighttpd web interface.
|
al@898
|
4 #
|
al@898
|
5
|
al@898
|
6 # Make request URI relative to the script name
|
al@898
|
7 base="$(dirname "$SCRIPT_NAME")"; [ "$base" == '/' ] && base=''
|
al@898
|
8 REQUEST_URI=$(echo "$REQUEST_URI" | sed "s|^$base/*|/|; s|\?.*||")
|
al@898
|
9
|
al@898
|
10 # Split the URI request to /pkg/cmd/arg
|
al@898
|
11 export pkg=$(echo "$REQUEST_URI" | cut -d/ -f2)
|
al@898
|
12 export cmd=$(echo "$REQUEST_URI" | cut -d/ -f3)
|
al@898
|
13 export arg=$(echo "$REQUEST_URI" | sed 's|^/[^/]*/[^/]*/||')
|
al@898
|
14
|
al@898
|
15
|
al@898
|
16 . /usr/lib/slitaz/httphelper.sh
|
al@898
|
17
|
al@898
|
18 [ -f "/etc/slitaz/cook.conf" ] && . /etc/slitaz/cook.conf
|
al@898
|
19 [ -f "./cook.conf" ] && . ./cook.conf
|
al@898
|
20 wok="$WOK"
|
al@898
|
21 title=${title:-SliTaz Cooker}
|
al@898
|
22 # Cooker DB files.
|
al@898
|
23 activity="$CACHE/activity"
|
al@898
|
24 commits="$CACHE/commits"
|
al@898
|
25 cooklist="$CACHE/cooklist"
|
al@898
|
26 cookorder="$CACHE/cookorder"
|
al@898
|
27 command="$CACHE/command"; touch $command
|
al@898
|
28 blocked="$CACHE/blocked"
|
al@898
|
29 broken="$CACHE/broken"
|
al@898
|
30 cooknotes="$CACHE/cooknotes"
|
al@898
|
31 cooktime="$CACHE/cooktime"
|
al@898
|
32 wokrev="$CACHE/wokrev"
|
al@933
|
33 webstat="$CACHE/webstat"
|
al@940
|
34 splitdb="$CACHE/split.db"
|
al@898
|
35
|
al@898
|
36 # Path to markdown to html convertor
|
al@898
|
37 cmark_opts='--smart -e table -e strikethrough -e autolink -e tagfilter'
|
al@898
|
38 if [ -n "$(which cmark 2>/dev/null)" ]; then
|
al@898
|
39 md2html="$(which cmark) $cmark_opts"
|
al@898
|
40 elif [ -x "./cmark" ]; then
|
al@898
|
41 md2html="./cmark $cmark_opts"
|
al@898
|
42 elif [ -n "$(which sundown 2>/dev/null)" ]; then
|
al@898
|
43 md2html=$(which sundown)
|
al@898
|
44 elif [ -x "./sundown" ]; then
|
al@898
|
45 md2html="./sundown"
|
al@898
|
46 fi
|
al@898
|
47
|
al@898
|
48
|
al@898
|
49
|
al@898
|
50
|
al@898
|
51 # Search form redirection
|
al@898
|
52 if [ -n "$(GET search)" ]; then
|
al@898
|
53 echo -e "HTTP/1.1 301 Moved Permanently\nLocation: $base/$(GET q)\n\n"
|
al@898
|
54 exit 0
|
al@898
|
55 fi
|
al@898
|
56
|
al@898
|
57
|
al@898
|
58 # Show the running command and it's progression
|
al@898
|
59
|
al@898
|
60 running_command() {
|
al@898
|
61 state="$(cat $command)"
|
al@923
|
62 local pct=''
|
al@898
|
63 if [ -n "$state" ];then
|
al@898
|
64 echo -n "$state</td></tr><tr><td>Completion</td>"
|
al@898
|
65 set -- $(grep "^$state" $cooktime)
|
al@898
|
66 [ -n "$1" -a $2 -ne 0 ] && pct=$((($(date +%s)-$3)*100/$2))
|
al@898
|
67 [ -n "$pct" ] && max="max='100'"
|
al@898
|
68 echo -n "<td><progress id='gauge' $max value='$pct' title='Click to stop updating' onclick='stopUpdating()'>"
|
al@898
|
69 echo -n "</progress> <span id='pct'>${pct:-?}%</span>"
|
al@898
|
70 [ "$2" -gt 60 ] &&
|
al@898
|
71 echo -n "</td></tr><tr><td>Estimated end time</td><td>$(date +%H:%M -ud @$(($2+$3)))"
|
al@898
|
72 else
|
al@898
|
73 echo 'not running'
|
al@898
|
74 fi
|
al@898
|
75 }
|
al@898
|
76
|
al@898
|
77
|
al@898
|
78 # HTML page header
|
al@898
|
79
|
al@898
|
80 page_header() {
|
al@1029
|
81 local theme t='' css pretitle='' command
|
al@898
|
82 theme=$(COOKIE theme)
|
al@898
|
83 [ "$theme" == 'default' ] && theme=''
|
al@898
|
84 [ -n "$theme" ] && theme="-$theme"
|
al@898
|
85 css="cooker$theme.css"
|
al@898
|
86
|
al@1012
|
87 if [ -n "$pkg" ]; then
|
al@1029
|
88 case "$pkg" in
|
al@1029
|
89 ~) pretitle="Tag \"$cmd\" - ";;
|
al@1029
|
90 *) pretitle="$pkg - ";;
|
al@1029
|
91 esac
|
al@1012
|
92 else
|
al@1029
|
93 command="$(cat $command)"
|
al@1029
|
94 [ -n "$command" ] && pretitle="$command - "
|
al@1012
|
95 fi
|
al@1043
|
96 [ -z "$favicon" ] && favicon='/slitaz-cooker.png'
|
al@1012
|
97
|
al@898
|
98 echo -e 'Content-Type: text/html; charset=UTF-8\n'
|
al@898
|
99
|
al@898
|
100 cat <<EOT
|
al@898
|
101 <!DOCTYPE html>
|
al@898
|
102 <html lang="en">
|
al@898
|
103 <head>
|
al@1012
|
104 <title>$pretitle$title</title>
|
al@898
|
105 <link rel="stylesheet" href="/$css">
|
al@1043
|
106 <link rel="icon" type="image/png" href="$favicon">
|
al@903
|
107 <link rel="search" href="$base/os.xml" title="$title" type="application/opensearchdescription+xml">
|
al@898
|
108 <!-- mobile -->
|
al@898
|
109 <meta name="viewport" content="width=device-width, initial-scale=1.0">
|
al@898
|
110 <meta name="theme-color" content="#222">
|
al@898
|
111 <!-- rss -->
|
al@898
|
112 <link rel="alternate" type="application/rss+xml" title="$title Feed" href="?rss">
|
al@898
|
113 </head>
|
al@898
|
114 <body>
|
al@898
|
115 <div id="container">
|
al@898
|
116 <header>
|
al@898
|
117 <h1><a href="$base/">$title</a></h1>
|
al@898
|
118 <div class="network">
|
al@898
|
119 <a href="http://www.slitaz.org/">Home</a>
|
al@898
|
120 <a href="http://bugs.slitaz.org/">Bugs</a>
|
al@898
|
121 <a href="http://hg.slitaz.org/wok-next/">Hg</a>
|
al@898
|
122 <a href="http://roadmap.slitaz.org/">Roadmap</a>
|
al@898
|
123 <a href="http://pizza.slitaz.me/">Pizza</a>
|
al@898
|
124 <a href="http://tank.slitaz.org/">Tank</a>
|
al@898
|
125 |
|
al@947
|
126 <a href="/cross/">Cross</a>
|
al@947
|
127 <a href="/i486.cgi">i486</a>
|
al@898
|
128 <a href="$base/cookiso.cgi">ISO</a>
|
al@898
|
129 <select onChange="window.location.href=this.value" style="display: none">
|
al@898
|
130 <option value=".">Go to…</option>
|
al@898
|
131 <option value="http://www.slitaz.org/">Home</option>
|
al@898
|
132 <option value="http://bugs.slitaz.org/">Bug tracker</option>
|
al@898
|
133 <option value="http://hg.slitaz.org/wok/">Hg wok</option>
|
al@898
|
134 <option value="http://roadmap.slitaz.org/">Roadmap</option>
|
al@898
|
135 <option value="http://pizza.slitaz.me/">Pizza</option>
|
al@898
|
136 <option value="http://tank.slitaz.org/">Tank</option>
|
al@898
|
137 <option disabled>---------</option>
|
al@898
|
138 <option value="cross/">Cross</option>
|
al@898
|
139 <option value="i486.cgi">i486</option>
|
al@898
|
140 <option value="cookiso.cgi">ISO</option>
|
al@898
|
141 </select>
|
al@898
|
142 </div>
|
al@898
|
143 </header>
|
al@898
|
144
|
al@898
|
145 <main>
|
al@898
|
146 EOT
|
al@898
|
147
|
al@898
|
148 [ -n "$(GET debug)" ] && echo "<pre><code class='language-ini'>$(env | sort)</code></pre>"
|
al@898
|
149 }
|
al@898
|
150
|
al@898
|
151
|
al@898
|
152 # HTML page footer
|
al@898
|
153
|
al@898
|
154 page_footer() {
|
al@898
|
155 date_now=$(date +%s)
|
al@898
|
156 sec_now=$(date +%S); sec_now=${sec_now#0} # remove one leading zero
|
al@898
|
157 wait_sec=$(( 60 - $sec_now ))
|
al@898
|
158 cat <<EOT
|
al@898
|
159 </main>
|
al@898
|
160
|
al@898
|
161 <footer>
|
al@898
|
162 <a href="http://www.slitaz.org/">SliTaz Website</a>
|
al@898
|
163 <a href="$base/">Cooker</a>
|
al@898
|
164 <a href="$base/doc/cookutils/cookutils.html">Documentation</a>
|
al@898
|
165 <a href="$base/?theme">Theme</a>
|
al@898
|
166 </footer>
|
al@898
|
167 </div>
|
al@898
|
168 <script src="/cooker.js"></script>
|
al@898
|
169 <script>refreshDate(${wait_sec}000, ${date_now}000)</script>
|
al@898
|
170 </body>
|
al@898
|
171 </html>
|
al@898
|
172 EOT
|
al@898
|
173 }
|
al@898
|
174
|
al@898
|
175
|
al@898
|
176 show_note() {
|
al@898
|
177 echo "<div class='bigicon-$1'>$2</div>"
|
al@898
|
178 }
|
al@898
|
179
|
al@898
|
180
|
al@898
|
181 not_found() {
|
al@898
|
182 local file="${1#$PKGS/}"; file="${file#$LOGS/}"; file="${file#$WOK/}"
|
al@898
|
183 echo "HTTP/1.1 404 Not Found"
|
al@898
|
184 page_header
|
al@898
|
185 echo "<h2>Not Found</h2>"
|
al@898
|
186 case $2 in
|
al@898
|
187 pkg)
|
al@898
|
188 show_note e "The requested package “$(basename "$(dirname "$file")")” was not found." ;;
|
al@898
|
189 *)
|
al@898
|
190 show_note e "The requested file “$file” was not found." ;;
|
al@898
|
191 esac
|
al@898
|
192 page_footer
|
al@898
|
193 }
|
al@898
|
194
|
al@898
|
195
|
al@898
|
196 manage_modified() {
|
al@898
|
197 local file="$1" option="$2" nul day mon year time hh mm ss date_s
|
al@898
|
198 if [ ! -f "$file" ]; then
|
al@898
|
199 if [ "$option" == 'silently-absent' ]; then
|
al@898
|
200 echo "HTTP/1.1 404 Not Found"
|
al@898
|
201 return
|
al@898
|
202 else
|
al@898
|
203 not_found "$file" "$2"
|
al@898
|
204 exit
|
al@898
|
205 fi
|
al@898
|
206 fi
|
al@898
|
207 [ "$option" == 'no-last-modified' ] && return
|
al@898
|
208 if [ -n "$HTTP_IF_MODIFIED_SINCE" ]; then
|
al@898
|
209 echo "$HTTP_IF_MODIFIED_SINCE" | \
|
al@898
|
210 while read nul day mon year time nul; do
|
al@898
|
211 case $mon in
|
al@898
|
212 Jan) mon='01';; Feb) mon='02';; Mar) mon='03';; Apr) mon='04';;
|
al@898
|
213 May) mon='05';; Jun) mon='06';; Jul) mon='07';; Aug) mon='08';;
|
al@898
|
214 Sep) mon='09';; Oct) mon='10';; Nov) mon='11';; Dec) mon='12';;
|
al@898
|
215 esac
|
al@898
|
216 hh=$(echo $time | cut -d: -f1)
|
al@898
|
217 mm=$(echo $time | cut -d: -f2)
|
al@898
|
218 ss=$(echo $time | cut -d: -f3)
|
al@898
|
219 date_s=$(date -ud "$year$mon$day$hh$mm.$ss" +%s)
|
al@898
|
220 # if [ "$date_s" -ge "$(date -ur "$file" +%s)" ]; then
|
al@898
|
221 # echo -e 'HTTP/1.1 304 Not Modified\n'
|
al@898
|
222 # exit
|
al@898
|
223 # fi
|
al@898
|
224 # TODO: improve caching control
|
al@898
|
225 done
|
al@898
|
226 fi
|
al@898
|
227 echo "Last-Modified: $(date -Rur "$file" | sed 's|UTC|GMT|')"
|
al@898
|
228 echo "Cache-Control: public, max-age=3600"
|
al@898
|
229 }
|
al@898
|
230
|
al@898
|
231
|
al@898
|
232 # Query '?pct=<package>': update percentage
|
al@898
|
233
|
al@898
|
234 if [ -n "$(GET pct)" ]; then
|
al@898
|
235 pkg="$(GET pct)"
|
al@898
|
236 state="$(cat $command)"
|
al@898
|
237 if [ "$state" == "cook:$pkg" ]; then
|
al@898
|
238 set -- $(grep "^$state" $cooktime)
|
al@898
|
239 [ -n "$1" ] && pct=$(( ($(date +%s) - $3) * 100 / $2 ))
|
al@898
|
240 echo "${pct:-?}"
|
al@898
|
241 else
|
al@898
|
242 echo 'reload'
|
al@898
|
243 fi
|
al@898
|
244 exit 0
|
al@898
|
245 fi
|
al@898
|
246
|
al@898
|
247
|
al@898
|
248 # Query '?poke': poke cooker
|
al@898
|
249
|
al@898
|
250 if [ -n "$(GET poke)" ]; then
|
al@898
|
251 touch $CACHE/cooker-request
|
al@898
|
252 echo -e "Location: ${HTTP_REFERER:-${REQUEST_URI%\?*}}\n"
|
al@898
|
253 exit
|
al@898
|
254 fi
|
al@898
|
255
|
al@898
|
256
|
al@898
|
257 # Query '?recook=<package>': query to recook package
|
al@898
|
258
|
al@898
|
259 if [ -n "$(GET recook)" ]; then
|
al@898
|
260 pkg="$(GET recook)"
|
al@898
|
261 case "$HTTP_USER_AGENT" in
|
al@898
|
262 *SliTaz*)
|
al@898
|
263 grep -qs "^$pkg$" $CACHE/recook-packages ||
|
al@898
|
264 echo "$pkg" >> $CACHE/recook-packages
|
al@898
|
265 esac
|
al@898
|
266 echo -e "Location: ${HTTP_REFERER:-${REQUEST_URI%\?*}}\n"
|
al@898
|
267 exit
|
al@898
|
268 fi
|
al@898
|
269
|
al@898
|
270
|
al@898
|
271 # Query '/i/<log>/<pkg>': show indicator icon
|
al@898
|
272 # Can't use ?query - not able to change '+' to '%2B' in the sed rules (see log handler)
|
al@898
|
273
|
al@898
|
274 if [ "$pkg" == 'i' ]; then
|
al@898
|
275 echo -en "Content-Type: image/svg+xml\n\n<svg xmlns='http://www.w3.org/2000/svg' height='12' width='8'><path d='"
|
al@898
|
276 if [ $LOGS/$cmd -nt $PKGS/$arg.tazpkg ]; then
|
al@898
|
277 echo "m1 2-1 1v8l1 1h6l1-1v-8l-1-1z' fill='#090'/></svg>"
|
al@898
|
278 else
|
al@898
|
279 echo "m0 3v8l1 1h6l1-1v-8l-1-1h-6zm3 0h2v5h-2zm0 6h2v2h-2z' fill='#d00'/></svg>"
|
al@898
|
280 fi
|
al@898
|
281 exit
|
al@898
|
282 fi
|
al@898
|
283
|
al@898
|
284
|
al@982
|
285 # Query '/s/<pkg>': show status indicator icon
|
al@982
|
286 # Can't use ?query - not able to change '+' to '%2B' in the sed rules (see log handler)
|
al@982
|
287
|
al@982
|
288 if [ "$pkg" == 's' ]; then
|
al@982
|
289 # argument <pkg> is in $cmd variable
|
al@982
|
290 echo -en "Content-Type: image/svg+xml\n\n<svg xmlns='http://www.w3.org/2000/svg' height='12' width='8'><path d='"
|
al@1005
|
291 # packages.info updates with each new package, so we'll find actual info here
|
al@1005
|
292 if grep -q "^$cmd"$'\t' $PKGS/packages.info; then
|
al@982
|
293 echo "m1 2-1 1v8l1 1h6l1-1v-8l-1-1z' fill='#090'/></svg>"
|
al@982
|
294 else
|
al@982
|
295 echo "m0 3v8l1 1h6l1-1v-8l-1-1h-6zm3 0h2v5h-2zm0 6h2v2h-2z' fill='#d00'/></svg>"
|
al@982
|
296 fi
|
al@982
|
297 exit
|
al@982
|
298 fi
|
al@982
|
299
|
al@982
|
300
|
al@898
|
301 # Query '?theme[=<theme>]': change UI theme
|
al@898
|
302
|
al@898
|
303 if [ -n "$(GET theme)" ]; then
|
al@898
|
304 theme="$(GET theme)"
|
al@924
|
305 ref="$(echo "$HTTP_REFERER" | sed 's|:|%3A|g; s|/|%2F|g; s|\?|%3F|g; s|\+|%2B|g;')"
|
al@898
|
306 case $theme in
|
al@898
|
307 theme)
|
al@898
|
308 current=$(COOKIE theme)
|
al@898
|
309 page_header
|
al@898
|
310 cat <<EOT
|
al@898
|
311 <section>
|
al@898
|
312 <h2>Change theme</h2>
|
al@898
|
313 <p>Current theme: “${current:-default}”. Select other:</p>
|
al@898
|
314 <ul>
|
al@898
|
315 $(
|
al@903
|
316 for i in default emerald sky goldenrod midnight like2016 terminal; do
|
al@924
|
317 [ "$i" == "${current:-default}" ] || echo "<li><a href=\"$base/?theme=$i&ref=$ref\">$i</a></li>"
|
al@898
|
318 done
|
al@898
|
319 )
|
al@898
|
320 </ul>
|
al@898
|
321 </section>
|
al@898
|
322 EOT
|
al@898
|
323 page_footer
|
al@898
|
324 exit 0
|
al@898
|
325 ;;
|
al@903
|
326 default|emerald|sky|goldenrod|midnight|like2016|terminal)
|
al@924
|
327 ref="$(GET ref)"
|
al@924
|
328 [ -n "$ref" ] || ref="$base/"
|
al@898
|
329 # Expires in a year
|
al@898
|
330 expires=$(date -uRd @$(($(date +%s)+31536000)) | sed 's|UTC|GMT|')
|
al@924
|
331 echo -e "HTTP/1.1 302 Found\nLocation: $ref\nCache-Control: no-cache\nSet-Cookie: theme=$theme; expires=$expires\n\n"
|
al@898
|
332 exit 0
|
al@898
|
333 ;;
|
al@898
|
334 esac
|
al@898
|
335 fi
|
al@898
|
336
|
al@898
|
337
|
al@898
|
338 #case "$QUERY_STRING" in
|
al@898
|
339 # stuff*)
|
al@898
|
340 # file="$wok/$(GET stuff)"
|
al@898
|
341 # manage_modified "$file"
|
al@898
|
342 # ;;
|
al@898
|
343 #
|
al@898
|
344 # pkg=*|receipt=*|description=*|files=*|log=*|man=*|doc=*|info=*)
|
al@898
|
345 # type=${QUERY_STRING%%=*}
|
al@898
|
346 # pkg=$(GET $type)
|
al@898
|
347 # case "$type" in
|
al@898
|
348 # description)
|
al@898
|
349 # manage_modified "$wok/$pkg/receipt" 'no-last-modified'
|
al@898
|
350 # manage_modified "$wok/$pkg/description.txt" 'silently-absent'
|
al@898
|
351 # ;;
|
al@898
|
352 # log)
|
al@898
|
353 # manage_modified "$wok/${pkg%%.log*}/receipt" 'no-last-modified'
|
al@898
|
354 # manage_modified "$LOGS/$pkg"
|
al@898
|
355 # ;;
|
al@898
|
356 # *)
|
al@898
|
357 # manage_modified "$wok/$pkg/receipt" pkg
|
al@898
|
358 # ;;
|
al@898
|
359 # esac
|
al@898
|
360 # ;;
|
al@898
|
361 #esac
|
al@898
|
362
|
al@898
|
363
|
al@898
|
364 # RSS feed generator
|
al@898
|
365 # URI: ?rss[&limit={1..100}]
|
al@898
|
366
|
al@898
|
367 if [ -n "$(GET rss)" ]; then
|
al@898
|
368 limit=$(GET limit); limit="${limit:-12}"; [ "$limit" -gt 100 ] && limit='100'
|
al@898
|
369 pubdate=$(date -Rur$(ls -t $FEEDS/*.xml | head -n1) | sed 's|UTC|GMT|')
|
al@898
|
370 cooker_url="http://$HTTP_HOST$base/"
|
al@898
|
371 cat <<EOT
|
al@898
|
372 Content-Type: application/rss+xml
|
al@898
|
373
|
al@898
|
374 <?xml version="1.0" encoding="utf-8" ?>
|
al@898
|
375 <rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
|
al@898
|
376 <channel>
|
al@898
|
377 <title>$title</title>
|
al@898
|
378 <description>The SliTaz packages cooker feed</description>
|
al@898
|
379 <link>$cooker_url</link>
|
al@898
|
380 <lastBuildDate>$pubdate</lastBuildDate>
|
al@898
|
381 <pubDate>$pubdate</pubDate>
|
al@898
|
382 <atom:link href="$cooker_url?rss" rel="self" type="application/rss+xml" />
|
al@898
|
383 EOT
|
al@898
|
384 for rss in $(ls -t $FEEDS/*.xml | head -n$limit); do
|
al@898
|
385 sed "s|http[^=]*=|$cooker_url|; s|<guid|& isPermaLink=\"false\"|g; s|</pubDate| GMT&|g" $rss
|
al@898
|
386 done
|
al@898
|
387 cat <<EOT
|
al@898
|
388 </channel>
|
al@898
|
389 </rss>
|
al@898
|
390 EOT
|
al@898
|
391 exit 0
|
al@898
|
392 fi
|
al@898
|
393
|
al@898
|
394
|
al@903
|
395 ### OpenSearch ###
|
al@903
|
396
|
al@903
|
397 # Query '/os.xml': get OpenSearch Description
|
al@903
|
398
|
al@903
|
399 if [ "$pkg" == 'os.xml' ]; then
|
al@903
|
400 cat <<EOT
|
al@903
|
401 Content-Type: application/xml; charset=UTF-8
|
al@903
|
402
|
al@903
|
403 <?xml version="1.0" encoding="UTF-8"?>
|
al@903
|
404 <OpenSearchDescription xmlns="http://a9.com/-/spec/opensearch/1.1/">
|
al@903
|
405 <ShortName>$title</ShortName>
|
al@903
|
406 <Description>SliTaz packages search</Description>
|
al@903
|
407 <Image width="16" height="16" type="image/png">http://$HTTP_HOST/images/logo.png</Image>
|
al@903
|
408 <Url type="text/html" method="GET" template="http://$HTTP_HOST$base/{searchTerms}"/>
|
al@903
|
409 <Url type="application/x-suggestions+json" method="GET" template="http://$HTTP_HOST$base/">
|
al@903
|
410 <Param name="oss" value="{searchTerms}"/>
|
al@903
|
411 </Url>
|
al@903
|
412 <SearchForm>http://$HTTP_HOST$base/</SearchForm>
|
al@903
|
413 <InputEncoding>UTF-8</InputEncoding>
|
al@903
|
414 </OpenSearchDescription>
|
al@903
|
415 EOT
|
al@903
|
416 exit 0
|
al@903
|
417 fi
|
al@903
|
418
|
al@903
|
419 # Query '?oss[=<term>]': OpenSearch suggestions
|
al@903
|
420
|
al@903
|
421 if [ -n "$(GET oss)" ]; then
|
al@903
|
422 term="$(GET oss | tr -cd '[:alnum:]+-')"
|
al@903
|
423 echo -e 'Content-Type: application/x-suggestions+json; charset=UTF-8\n'
|
al@903
|
424 cd $wok
|
al@903
|
425 ls | fgrep "$term" | head -n10 | awk -vterm="$term" '
|
al@903
|
426 BEGIN{printf("[\"%s\",[", term)}
|
al@903
|
427 {printf("%s\"%s\"", NR != 1 ? "," : "", $0)}
|
al@903
|
428 END {printf("]]")}
|
al@903
|
429 '
|
al@903
|
430 exit 0
|
al@903
|
431 fi
|
al@903
|
432
|
al@903
|
433
|
al@898
|
434
|
al@898
|
435
|
al@898
|
436 #
|
al@898
|
437 # Functions
|
al@898
|
438 #
|
al@898
|
439
|
al@898
|
440
|
al@898
|
441 # Unpack to stdout
|
al@898
|
442
|
al@898
|
443 docat() {
|
al@898
|
444 case "$1" in
|
al@898
|
445 *gz) zcat ;;
|
al@898
|
446 *bz2) bzcat ;;
|
al@898
|
447 *xz) xzcat ;;
|
al@898
|
448 *) cat
|
al@898
|
449 esac < $1
|
al@898
|
450 }
|
al@898
|
451
|
al@898
|
452
|
al@898
|
453 # Tiny texinfo converter
|
al@898
|
454
|
al@898
|
455 info2html() {
|
al@898
|
456 sed \
|
al@898
|
457 -e 's|&|\&|g; s|<|\<|g; s|>|\>|g' \
|
al@898
|
458 -e 's|^\* \(.*\)::|* <a href="#\1">\1</a> |' \
|
al@898
|
459 -e 's|\*note \(.*\)::|<a href="#\1">\1</a>|' \
|
al@898
|
460 -e '/^File: / s|(dir)|Top|g' \
|
al@898
|
461 -e '/^File: / s|Next: \([^,]*\)|<a class="button" href="#\1">Next: \1</a>|' \
|
al@898
|
462 -e '/^File: / s|Prev: \([^,]*\)|<a class="button" href="#\1">Prev: \1</a>|' \
|
al@898
|
463 -e '/^File: / s|Up: \([^,]*\)|<a class="button" href="#\1">Up: \1</a>|' \
|
al@898
|
464 -e '/^File: / s|^.* Node: \([^,]*\), *\(.*\)$|<pre id="\1">\2|' \
|
al@898
|
465 -e '/^<pre id=/ s|^\([^>]*>\)\(<a[^>]*>Next: [^,]*\), *\(<a[^>]*>Prev: [^,]*\), *\(<a[^>]*>Up: .*\)|\1 \3 \4 \2|' \
|
al@898
|
466 -e '/^Tag Table:$/,/^End Tag Table$/d' \
|
al@898
|
467 -e '/INFO-DIR/,/^END-INFO-DIR/d' \
|
al@898
|
468 -e "s|https*://[^>),'\"\`’ ]*|<a href=\"&\">&</a>|g" \
|
al@898
|
469 -e "s|ftp://[^>),\"\` ]*|<a href=\"&\">&</a>|g" \
|
al@898
|
470 -e 's|^\* Menu:|<b>Menu:</b>|' \
|
al@898
|
471 -e "s|^|</pre>|"
|
al@898
|
472 }
|
al@898
|
473
|
al@898
|
474
|
al@898
|
475 # Put some colors into log and DB files.
|
al@898
|
476
|
al@898
|
477 syntax_highlighter() {
|
al@898
|
478 case $1 in
|
al@898
|
479 log)
|
al@898
|
480 # If variables not defined - define them with some rare values
|
al@898
|
481 : ${_src=#_#_#}
|
al@898
|
482 : ${_install=#_#_#}
|
al@898
|
483 : ${_fs=#_#_#}
|
al@898
|
484 : ${_stuff=#_#_#}
|
al@898
|
485 # Use one-letter html tags to save some bytes :)
|
al@998
|
486 # <b>is error (red)</b> <u>is warning (orange)</u> <i>is informative (green)</i>
|
al@1002
|
487 sed \
|
al@1002
|
488 -e 's/&/\&/g; s/</\</g; s/>/\>/g' \
|
al@898
|
489 -e 's#OK$#<i>OK</i>#' \
|
al@898
|
490 -e 's#\([Dd]one\)$#<i>\1</i>#' \
|
al@898
|
491 -e 's#Success$#<i>Success</i>#' \
|
al@898
|
492 -e 's#\([^a-z]\)ok$#\1<i>ok</i>#' \
|
al@898
|
493 -e 's#\([^a-z]\)yes$#\1<i>yes</i>#' \
|
al@912
|
494 -e 's#\([^a-z]\)ON$#\1<i>ON</i>#' \
|
al@898
|
495 -e 's#\([^a-z]\)no$#\1<u>no</u>#' \
|
al@898
|
496 -e 's#\([^a-z]\)none$#\1<u>none</u>#' \
|
al@898
|
497 -e 's#\([^a-z]\)false$#\1<u>false</u>#' \
|
al@912
|
498 -e 's#\([^a-z]\)OFF$#\1<u>OFF</u>#' \
|
al@898
|
499 -e 's#\(^checking .*\.\.\. \)\(.*\)$#\1<i>\2</i>#' \
|
al@898
|
500 \
|
al@898
|
501 -e 's#\( \[Y[nm/]\?\] n\)$# <u>\1</u>#' \
|
al@898
|
502 -e 's#\( \[N[ym/]\?\] y\)$# <i>\1</i>#' \
|
al@898
|
503 -e 's# y$# <i>y</i>#' \
|
al@898
|
504 -e 's# n$# <u>n</u>#' \
|
al@898
|
505 -e 's#(NEW) *$#<b>(NEW)</b>#' \
|
al@898
|
506 \
|
al@898
|
507 -e 's#.*(pkg/local).*#<i>\0</i>#' \
|
al@898
|
508 -e 's#.*(web/cache).*#<u>\0</u>#' \
|
al@898
|
509 \
|
al@898
|
510 -e 's#\([^a-zA-Z]\)\([Ee]rror\)$#\1<b>\2</b>#' \
|
al@898
|
511 -e 's#ERROR:#<b>ERROR:</b>#g' \
|
al@898
|
512 \
|
al@909
|
513 -e 's#^.*[Ff][Aa][Ii][Ll][Ee][Dd].*#<b>\0</b>#' \
|
al@898
|
514 -e 's#^.*[Ff]atal.*#<b>\0</b>#' \
|
al@989
|
515 -e '/non-fatal/ s|</*b>||g' \
|
al@898
|
516 -e 's#^.*[Nn]ot found.*#<b>\0</b>#' \
|
al@898
|
517 -e 's#^.*[Nn]o such file.*#<b>\0</b>#' \
|
al@898
|
518 -e 's#^.*No package .* found.*#<b>\0</b>#' \
|
al@898
|
519 -e 's#^.*Unable to find.*#<b>\0</b>#' \
|
al@938
|
520 -e 's#[^a-zA-Z-][Ii]nvalid.*#<b>\0</b>#' \
|
al@914
|
521 -e 's#\([Nn][Oo][Tt] found\.*\)$#<b>\1</b>#' \
|
al@914
|
522 -e 's#\(found\.*\)$#<i>\1</i>#' \
|
al@898
|
523 \
|
al@898
|
524 -e 's#^.*WARNING:.*#<u>\0</u>#' \
|
al@898
|
525 -e 's#^.*warning:.*#<u>\0</u>#' \
|
al@898
|
526 -e 's#^.* [Ee]rror:* .*#<b>\0</b>#' \
|
al@898
|
527 -e 's#^.*terminated.*#<b>\0</b>#' \
|
al@898
|
528 -e 's#\(missing\)#<b>\1</b>#g' \
|
al@898
|
529 -e 's#^.*[Cc]annot find.*#<b>\0</b>#' \
|
al@898
|
530 -e 's#^.*unrecognized options.*#<u>\0</u>#' \
|
al@898
|
531 -e 's#^.*does not.*#<u>\0</u>#' \
|
al@898
|
532 -e 's#^.*[Ii]gnoring.*#<u>\0</u>#' \
|
al@898
|
533 -e 's#^.*note:.*#<u>\0</u>#' \
|
al@898
|
534 \
|
al@898
|
535 -e 's#^.* will not .*#<u>\0</u>#' \
|
al@898
|
536 -e 's!^Hunk .* succeeded at .*!<u>\0</u>!' \
|
al@898
|
537 -e 's#^.* Warning: .*#<u>\0</u>#' \
|
al@898
|
538 \
|
al@898
|
539 -e "s#^Executing:\([^']*\).#<em>\0</em>#" \
|
al@898
|
540 -e "s#^Making.*#<em>\0</em>#" \
|
al@898
|
541 -e "s#^Scanning dependencies of target .*#<em>\0</em>#" \
|
al@898
|
542 -e "s#^====\([^']*\).#<span class='span-line'>\0</span>#g" \
|
al@898
|
543 -e "s#^[a-zA-Z0-9]\([^']*\) :: #<span class='span-sky'>\0</span>#g" \
|
al@898
|
544 -e "s#[fh]tt*ps*://[^ '\"]*#<a href='\0'>\0</a>#g" \
|
al@898
|
545 \
|
al@941
|
546 -e 's|^<u>\(.*libtool: warning: relinking.*\)</u>|\1|' \
|
al@941
|
547 -e 's|^<u>\(.*libtool: warning: .* has not been installed in .*\)</u>|\1|' \
|
al@941
|
548 -e 's|^<u>\(.*checking for a sed.*\)</u>|\1|' \
|
al@1048
|
549 -e 's|^<u><b>\(.*inlining failed.*\)</b></u>|<u>\1</u>|' \
|
al@941
|
550 \
|
al@941
|
551 -e "s|$_src|<var>\${src}</var>|g;
|
al@941
|
552 s|$_install|<var>\${install}</var>|g;
|
al@941
|
553 s|$_fs|<var>\${fs}</var>|g;
|
al@941
|
554 s|$_stuff|<var>\${stuff}</var>|g" \
|
al@1002
|
555 \
|
al@1017
|
556 -e "s|\[\([01]\)m\[3\([1-7]\)m|<span class='c\2\1'>|g;
|
al@1017
|
557 s|\[\([01]\);3\([1-7]\)m|<span class='c\2\1'>|g;
|
al@1022
|
558 s|\[3\([1-7]\)m|<span class='c\10'>|g;
|
al@1002
|
559 s|\[\([01]\);0m|<span class='c0\1'>|g;
|
al@1016
|
560 s|\[0m|</span>|g;
|
al@1017
|
561 s|\[m|</span>|g;
|
al@1022
|
562 s|\[0;10m|</span>|g;
|
al@1022
|
563 s|\[K||g;" \
|
al@1002
|
564 \
|
al@913
|
565 -e "s|\[9\([1-6]\)m|<span class='c\10'>|;
|
al@942
|
566 s|\[39m|</span>|;
|
al@1022
|
567 #s|\[1m|<span class='c01'>|g;
|
al@1022
|
568 s|\[1m|<span style='font-weight:bold'>|g; s|(B|</span>|g;
|
al@1022
|
569 s|\[m||g;
|
al@1022
|
570 " \
|
al@1002
|
571 -e "s!^|\(+.*\)!|<span class='c20'>\1</span>!;
|
al@1002
|
572 s!^|\(-.*\)!|<span class='c10'>\1</span>!;
|
al@1002
|
573 s!^|\(@@.*@@\)\$!|<span class='c30'>\1</span>!;"
|
al@1002
|
574 \
|
al@1002
|
575
|
al@898
|
576 ;;
|
al@898
|
577
|
al@898
|
578 files)
|
al@898
|
579 # Highlight the Busybox's `ls` output
|
al@898
|
580 awk '{
|
al@898
|
581 part1 = substr($0, 0, 16);
|
al@898
|
582 part2 = substr($0, 17, 9);
|
al@898
|
583 part3 = substr($0, 26, 9);
|
al@898
|
584 part4 = substr($0, 35);
|
al@898
|
585 if (part2 != "root ") part2 = "<span class=\"c11\">" part2 "</span>";
|
al@898
|
586 if (part3 != "root ") part3 = "<span class=\"c11\">" part3 "</span>";
|
al@898
|
587 print part1 part2 part3 part4;
|
al@898
|
588 }' | \
|
al@924
|
589 sed "s|\[0m/|/\[0m|g;
|
al@924
|
590 s|\[\([01]\);3\([1-7]\)m|<a class='c\2\1'>|g;
|
al@898
|
591 s|\[\([01]\);0m|<a class='c0\1'>|g;
|
al@898
|
592 s|\[0m|</a>|g;
|
al@898
|
593 s|^\(lrwxrwxrwx\)|<span class='c61'>\1</span>|;
|
al@898
|
594 s|^\(-rwxr-xr-x\)|<span class='c21'>\1</span>|;
|
al@898
|
595 s|^\(-rw-r--r--\)|<span class='c31'>\1</span>|;
|
al@924
|
596 s|^\(drwxr-xr-x\)|<span class='c41'>\1</span>|;
|
al@1010
|
597 s|^\([lrwxs-][lrwxs-]*\)|<span class='c11'>\1</span>|;
|
al@898
|
598 "
|
al@898
|
599 ;;
|
al@898
|
600 esac
|
al@898
|
601 }
|
al@898
|
602
|
al@898
|
603
|
al@898
|
604 show_code() {
|
al@898
|
605 echo -n "<pre><code class=\"language-$1\">"
|
al@898
|
606 sed 's|&|\&|g; s|<|\<|g; s|>|\>|g'
|
al@898
|
607 echo '</code></pre>'
|
al@898
|
608 }
|
al@898
|
609
|
al@898
|
610
|
al@898
|
611 datalist() {
|
al@940
|
612 cut -d$'\t' -f2 $splitdb | tr ' ' '\n' | sort -u | awk '
|
al@898
|
613 BEGIN{printf("<datalist id=\"packages\">")}
|
al@940
|
614 {printf("<option>%s",$1)}
|
al@898
|
615 END {printf("</datalist>")}
|
al@898
|
616 '
|
al@898
|
617 }
|
al@898
|
618
|
al@898
|
619
|
al@898
|
620 mklog() {
|
al@898
|
621 awk '
|
al@898
|
622 BEGIN { printf("<pre class=\"log dog\">\n") }
|
al@898
|
623 { print }
|
al@898
|
624 END { print "</pre>" }'
|
al@898
|
625 }
|
al@898
|
626
|
al@898
|
627
|
al@898
|
628 summary() {
|
al@898
|
629 log="$1"
|
al@898
|
630 pkg="$(basename ${log%%.log*})"
|
al@898
|
631
|
al@898
|
632 if [ -f "$log" ]; then
|
al@898
|
633 if grep -q "cook:$pkg$" $command; then
|
al@898
|
634 show_note i "The Cooker is currently building $pkg"
|
al@898
|
635 elif fgrep -q "Summary for:" $log; then
|
al@904
|
636 sed '/^Summary for:/,$!d' $log | awk '
|
al@898
|
637 BEGIN { print "<section>" }
|
al@904
|
638 function row(line) {
|
al@904
|
639 split(line, s, " : ");
|
al@904
|
640 printf("\t<tr><td>%s</td><td>%s</td></tr>\n", s[1], s[2]);
|
al@904
|
641 }
|
al@904
|
642 function row2(line, rowNum) {
|
al@904
|
643 split(line, s, " : ");
|
al@938
|
644 if (rowNum == 1) {
|
al@938
|
645 print "<thead>";
|
al@904
|
646 printf("\t<tr><th>%s</th><th>%s</th><th>%s</th><th>%s</th><th>%s</th></tr>\n", s[1], s[2], s[3], s[4], s[5]);
|
al@938
|
647 print "</thead><tbody>";
|
al@938
|
648 }
|
al@904
|
649 else
|
al@904
|
650 printf("\t<tr><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td></tr>\n", s[1], s[2], s[3], s[4], s[5]);
|
al@904
|
651 }
|
al@898
|
652 {
|
al@904
|
653 if (NR==1) { printf("<h3>%s</h3>\n<table>\n", $0); next }
|
al@904
|
654 if ($0 ~ "===") { seen++; if (seen == 1) next; else exit; }
|
al@904
|
655 if ($0 ~ "---") {
|
al@904
|
656 seen2++;
|
al@938
|
657 if (seen2 == 1) print "</table>\n\n<table class=\"pkgslist\">"
|
al@904
|
658 next
|
al@898
|
659 }
|
al@904
|
660 if (seen2) row2($0, seen2); else row($0);
|
al@898
|
661 }
|
al@938
|
662 END { print "</tbody></table></section>" }
|
al@898
|
663 '
|
al@898
|
664 elif fgrep -q "Debug information" $log; then
|
al@898
|
665 echo -e '<section>\n<h3>Debug information</h3>'
|
al@898
|
666 sed -e '/^Debug information/,$!d; /^===/d; /^$/d' $log | sed -n '1!p' | \
|
al@898
|
667 if [ -n "$2" ]; then
|
al@979
|
668 syntax_highlighter log | sed 's|\([^0-9 ]\)\([0-9][0-9]*\):|\1<a href="#l\2">\2</a>:|'
|
al@898
|
669 else
|
al@898
|
670 sed 's|^[0-9][0-9]*:||' | syntax_highlighter log
|
al@898
|
671 fi | mklog
|
al@898
|
672 echo '</section>'
|
al@898
|
673 fi
|
al@898
|
674 else
|
al@898
|
675 [ -n "$pkg" -a -d "$wok/$pkg" ] && show_note e "No log for $pkg"
|
al@898
|
676 fi
|
al@898
|
677 }
|
al@898
|
678
|
al@898
|
679
|
al@898
|
680 active() {
|
al@898
|
681 [ "$cmd" == "$1" -o "$cmd" == "${2:-$1}" ] && echo -n ' active'
|
al@898
|
682 }
|
al@898
|
683
|
al@898
|
684
|
al@898
|
685 pkg_info() {
|
al@998
|
686 local log active bpkg short_desc=''
|
al@898
|
687 log="$LOGS/$pkg.log"
|
al@898
|
688
|
al@996
|
689 echo -n "<h2><a href=\"$base/${requested_pkg:-$pkg}\">${requested_pkg:-$pkg}</a>"
|
al@998
|
690 # Get short description for existing packages
|
al@998
|
691 [ -f $PKGS/packages.info ] &&
|
al@998
|
692 short_desc="$(awk -F$'\t' -vp="${requested_pkg:-$pkg}" '{if ($1 == p) { printf("%s", $4); exit; }}' $PKGS/packages.info)"
|
paul@1006
|
693 # If package does not exist (not created yet or broken), get short description
|
al@998
|
694 # (but only for "main" package) from receipt
|
al@998
|
695 [ -n "$short_desc" ] || short_desc="$(. $wok/$pkg/receipt; echo "$SHORT_DESC")"
|
al@998
|
696 echo ": $short_desc</h2>"
|
al@898
|
697 echo '<div id="info">'
|
al@898
|
698 echo "<a class='button icon receipt$(active receipt stuff)' href='$base/$pkg/receipt'>receipt & stuff</a>"
|
al@898
|
699
|
al@1003
|
700 # In the receipts $EXTRAVERSION is defined using $kvers, get it here [copy from 'cook' set_paths()]
|
al@1003
|
701 if [ -f "$wok/linux/receipt" ]; then
|
al@1003
|
702 kvers=$(. $wok/linux/receipt; echo $VERSION)
|
al@1003
|
703 kbasevers=$(echo $kvers | cut -d. -f1,2)
|
al@1003
|
704 elif [ -f "$INSTALLED/linux-api-headers/receipt" ]; then
|
al@1003
|
705 kvers=$(. $INSTALLED/linux-api-headers/receipt; echo $VERSION)
|
al@1003
|
706 kbasevers=$(echo $kvers | cut -d. -f1,2)
|
al@1003
|
707 fi
|
al@1003
|
708
|
al@898
|
709 unset WEB_SITE WANTED
|
al@898
|
710 . $wok/$pkg/receipt
|
al@898
|
711
|
al@898
|
712 [ -n "$WEB_SITE" ] &&
|
al@898
|
713 echo "<a class='button icon website' href='$WEB_SITE' target='_blank' rel='noopener noreferrer'>web site</a>"
|
al@898
|
714
|
al@1003
|
715 [ -f "$wok/$pkg/taz/$PACKAGE-$VERSION$EXTRAVERSION/receipt" ] &&
|
al@898
|
716 echo "<a class='button icon files$(active files)' href='$base/$pkg/files'>files</a>"
|
al@898
|
717
|
al@925
|
718 [ -n "$(ls $wok/$pkg/description*.txt)" ] &&
|
al@925
|
719 echo "<a class='button icon desc$(active description)' href='$base/$pkg/description'>description</a>"
|
al@898
|
720
|
al@925
|
721 [ -n "$TARBALL" -a -s "$SRC/$TARBALL" -o -d "$wok/$pkg/taz" ] &&
|
al@925
|
722 echo "<a class='button icon download' href='$base/$pkg/download'>download</a>"
|
al@898
|
723
|
al@898
|
724 echo "<a class='button icon browse' href='$base/$pkg/browse/'>browse</a>"
|
al@898
|
725
|
al@1002
|
726 [ -x ./man2html.bin -a -d "$wok/$pkg/install/usr/share/man" ] &&
|
al@898
|
727 echo "<a class='button icon doc$(active man)' href='$base/$pkg/man/'>man</a>"
|
al@898
|
728
|
al@898
|
729 [ -d "$wok/$pkg/install/usr/share/doc" -o -d "$wok/$pkg/install/usr/share/gtk-doc" ] &&
|
al@898
|
730 echo "<a class='button icon doc$(active doc)' href='$base/$pkg/doc/'>doc</a>"
|
al@898
|
731
|
al@898
|
732 [ -d "$wok/$pkg/install/usr/share/info" ] &&
|
al@898
|
733 echo "<a class='button icon doc$(active info)' href='$base/$pkg/info/#Top'>info</a>"
|
al@898
|
734
|
al@989
|
735 if [ -n "$LFS" ]; then
|
al@989
|
736 printf "<a class='button icon doc' href='%s' target='_blank' rel='noopener noreferrer'>" "$LFS"
|
al@989
|
737 [ "${LFS/blfs/}" != "$LFS" ] && printf "B"
|
al@989
|
738 printf "LFS</a>\n"
|
al@989
|
739 fi
|
al@981
|
740
|
al@898
|
741 [ -s "$log" ] &&
|
al@898
|
742 echo "<a class='button icon log$(active log)' href='$base/$pkg/log/'>logs</a>"
|
al@898
|
743
|
al@898
|
744 echo '</div>'
|
al@898
|
745 }
|
al@898
|
746
|
al@898
|
747
|
al@898
|
748 mktable() {
|
al@898
|
749 sed 's# : #|#' | awk -vc="$1" '
|
al@898
|
750 BEGIN { printf("<table class=\"%s\">\n", c); FS="|" }
|
al@898
|
751 { printf("<tr><td>%s</td>", $1);
|
al@898
|
752 if (NF == 2) printf("<td>%s</td>", $2);
|
al@898
|
753 printf("</tr>\n", $2) }
|
al@898
|
754 END { print "</table>" }'
|
al@898
|
755 }
|
al@898
|
756
|
al@898
|
757
|
al@898
|
758 section() {
|
al@898
|
759 local i=$(basename "$1")
|
al@898
|
760 echo -e '\n\n<section>'
|
al@898
|
761 [ $(wc -l < $1) -gt $2 ] && echo "<a class='button icon more r' href='?$i'>${3#*|}</a>"
|
al@898
|
762 echo "<h2>${3%|*}</h2>"
|
al@898
|
763 mktable "$i"
|
al@898
|
764 echo '</section>'
|
al@898
|
765 }
|
al@898
|
766
|
al@898
|
767
|
al@908
|
768 show_desc() {
|
al@908
|
769 echo "<section><h3>Description of “$1”</h3>"
|
al@908
|
770 if [ -n "$md2html" ]; then
|
al@908
|
771 $md2html $2
|
al@908
|
772 else
|
al@908
|
773 show_code markdown < $2
|
al@908
|
774 fi
|
al@908
|
775 echo "</section>"
|
al@908
|
776 }
|
al@908
|
777
|
al@908
|
778
|
al@924
|
779 # Return all the names of packages bundled in this receipt
|
al@924
|
780
|
al@924
|
781 all_names() {
|
al@1022
|
782 # Get package names from $SPLIT variable
|
al@1022
|
783 local split=$(echo $SPLIT \
|
al@1022
|
784 | awk '
|
al@1022
|
785 BEGIN { RS = " "; FS = ":"; }
|
al@1022
|
786 { print $1; }' \
|
al@1022
|
787 | tr '\n' ' ')
|
al@1022
|
788 local split_space=" $split "
|
al@1022
|
789 if ! head -n1 $WOK/$pkg/receipt | fgrep -q 'v2'; then
|
al@1022
|
790 # For receipts v1: $SPLIT may present in the $WANTED package,
|
al@1022
|
791 # but split packages have their own receipts
|
al@1022
|
792 echo $PACKAGE
|
al@1022
|
793 elif [ "${split_space/ $PACKAGE /}" != "$split_space" ]; then
|
al@924
|
794 # $PACKAGE included somewhere in $SPLIT (probably in the end).
|
al@924
|
795 # We should build packages in the order defined in the $SPLIT.
|
al@1022
|
796 echo $split
|
al@924
|
797 else
|
al@924
|
798 # We'll build the $PACKAGE, then all defined in the $SPLIT.
|
al@1022
|
799 echo $PACKAGE $split
|
al@924
|
800 fi
|
al@924
|
801 }
|
al@924
|
802
|
al@924
|
803
|
al@924
|
804 toolchain_version() {
|
al@1007
|
805 echo "<tr><td><a href='$base/$1'>$1</a></td>"
|
al@1007
|
806 awk -F$'\t' -vpkg="$1" '
|
al@1007
|
807 BEGIN { version = description = "---"; }
|
al@1007
|
808 {
|
al@1007
|
809 if ($1 == pkg) { version = $2; description = $4; }
|
al@1007
|
810 }
|
al@1007
|
811 END { printf("<td>%s</td><td>%s</td></tr>", version, description); }
|
al@1007
|
812 ' $PKGS/packages.info
|
al@924
|
813 }
|
al@924
|
814
|
al@924
|
815
|
al@924
|
816 files_header() {
|
al@924
|
817 echo '<section><h3>Available downloads:</h3>'
|
al@924
|
818 echo '<table><thead><tr><th>File</th><th>Size</th><th>Description</th></tr></thead><tbody>'
|
al@924
|
819 }
|
al@924
|
820
|
al@924
|
821
|
al@933
|
822 # Update statistics used in web interface.
|
al@933
|
823 # There is no need to recalculate the statistics every time the page is displayed.
|
al@940
|
824 # Note, $webstat file must be owned by www, otherwise this function will not be able to do the job.
|
al@933
|
825
|
al@933
|
826 update_webstat() {
|
al@938
|
827 echo '<div id="waitme">'
|
al@938
|
828 show_note i 'Please wait while statistics are being collected.'
|
al@938
|
829 echo "</div>"
|
al@938
|
830
|
al@933
|
831 # for receipts:
|
al@933
|
832 rtotal=$(ls $WOK/*/arch.$ARCH | wc -l)
|
al@933
|
833 rcooked=$(ls -d $WOK/*/taz | wc -l)
|
al@933
|
834 runbuilt=$(($rtotal - $rcooked))
|
al@933
|
835 rblocked=$(wc -l < $blocked)
|
al@933
|
836 rbroken=$(wc -l < $broken)
|
al@933
|
837
|
al@933
|
838 # for packages:
|
al@936
|
839 ptotal=$(cut -d$'\t' -f2 $CACHE/split.db | tr ' ' '\n' | sort -u | wc -l)
|
al@933
|
840 pcooked=$(ls $PKGS/*.tazpkg | wc -l)
|
al@933
|
841 punbuilt=$(($ptotal - $pcooked))
|
al@933
|
842 pblocked=$(
|
al@933
|
843 while read i; do
|
al@933
|
844 sed "/^$i\t/!d" $CACHE/split.db
|
al@933
|
845 done < $blocked | cut -d$'\t' -f2 | tr ' ' '\n' | wc -l)
|
al@933
|
846 pbroken=$(
|
al@933
|
847 while read i; do
|
al@933
|
848 sed "/^$i\t/!d" $CACHE/split.db
|
al@933
|
849 done < $broken | cut -d$'\t' -f2 | tr ' ' '\n' | wc -l)
|
al@933
|
850
|
al@933
|
851 cat > $webstat <<EOT
|
al@933
|
852 rtotal="$rtotal"; rcooked="$rcooked"; runbuilt="$runbuilt"; rblocked="$rblocked"; rbroken="$rbroken"
|
al@933
|
853 ptotal="$ptotal"; pcooked="$pcooked"; punbuilt="$punbuilt"; pblocked="$pblocked"; pbroken="$pbroken"
|
al@933
|
854 EOT
|
al@938
|
855
|
al@938
|
856 echo '<script>document.getElementById("waitme").remove();</script>'
|
al@933
|
857 }
|
al@933
|
858
|
al@933
|
859
|
al@898
|
860
|
al@898
|
861
|
al@898
|
862 #
|
al@898
|
863 # Load requested page
|
al@898
|
864 #
|
al@898
|
865
|
al@898
|
866 if [ -z "$pkg" ]; then
|
al@898
|
867
|
al@898
|
868 page_header
|
al@898
|
869 if [ -n "$QUERY_STRING" -a "$QUERY_STRING" != 'debug' ]; then
|
al@898
|
870
|
al@898
|
871 for list in activity cooknotes cooklist; do
|
al@898
|
872 [ -n "$(GET $list)" ] || continue
|
al@898
|
873 [ "$list" == 'cooklist' ] && nb="- Packages: $(wc -l < $cooklist)"
|
al@898
|
874 echo '<section id="content2">'
|
al@898
|
875 echo "<h2>DB: $list $nb</h2>"
|
al@905
|
876 tac $CACHE/$list | sed 's|cooker.cgi?pkg=||; s|%2B|+|g;
|
al@898
|
877 s|\[ Done|<span class="r c20">Done|;
|
al@898
|
878 s|\[ Failed|<span class="r c10">Failed|;
|
al@1027
|
879 s|\[ -Failed|<span class="r c10"><del>Failed</del>|;
|
al@898
|
880 s| \]|</span>|' | mktable $list
|
al@898
|
881 echo '</section>'
|
al@898
|
882 done
|
al@898
|
883
|
al@898
|
884 if [ -n "$(GET broken)" ]; then
|
al@938
|
885 echo '<section id="content2">'
|
al@898
|
886 echo "<h2>DB: broken - Packages: $(wc -l < $broken)</h2>"
|
al@898
|
887 sort $CACHE/broken | sed "s|^[^']*|<a href='$base/\0'>\0</a>|g" | mktable
|
al@938
|
888 echo '</section>'
|
al@898
|
889 fi
|
al@898
|
890
|
al@898
|
891 case "$QUERY_STRING" in
|
al@898
|
892 *.log)
|
al@898
|
893 log=$LOGS/$QUERY_STRING
|
al@898
|
894 name=$(basename $log)
|
al@898
|
895 if [ -f "$log" ]; then
|
al@898
|
896 echo "<h2>Log for: ${name%.log}</h2>"
|
al@898
|
897 if fgrep -q "Summary" $log; then
|
al@898
|
898 echo '<pre class="log">'
|
al@942
|
899 grep -A 20 'Summary' $log | syntax_highlighter log
|
al@898
|
900 echo '</pre>'
|
al@898
|
901 fi
|
al@898
|
902 echo '<pre class="log">'
|
al@898
|
903 syntax_highlighter log < $log
|
al@898
|
904 echo '</pre>'
|
al@986
|
905 if [ "$QUERY_STRING" == 'pkgdb.log' ]; then
|
al@985
|
906 # Display button only for SliTaz web browser
|
al@985
|
907 case "$HTTP_USER_AGENT" in
|
al@985
|
908 *SliTaz*)
|
al@985
|
909 if [ -f $CACHE/cooker-request -a -n "$HTTP_REFERER" ]; then
|
al@985
|
910 if grep -qs '^pkgdb$' $CACHE/recook-packages; then
|
al@985
|
911 show_note i "The package database has been requested for re-creation"
|
al@985
|
912 else
|
al@985
|
913 echo "<a class='button' href='$base/?recook=pkgdb'>Re-create the DB</a>"
|
al@985
|
914 fi
|
al@985
|
915 fi
|
al@985
|
916 ;;
|
al@985
|
917 esac
|
al@985
|
918 fi
|
al@898
|
919 else
|
al@898
|
920 show_note e "No log file: $log"
|
al@898
|
921 fi
|
al@898
|
922 ;;
|
al@924
|
923 toolchain)
|
al@924
|
924 cat <<EOT
|
al@924
|
925 <div id="content2">
|
al@924
|
926 <section>
|
al@924
|
927 <h2>SliTaz GNU/Linux toolchain</h2>
|
al@924
|
928
|
al@924
|
929 <table>
|
al@924
|
930 <tr><td>Build date</td> <td colspan="2">$(sed -n '/^Cook date/s|[^:]*: \(.*\)|\1|p' $LOGS/slitaz-toolchain.log)</td></tr>
|
al@924
|
931 <tr><td>Build duration</td> <td colspan="2">$(sed -n '/^Cook time/s|[^:]*: \(.*\)|\1|p' $LOGS/slitaz-toolchain.log)</td></tr>
|
al@924
|
932 <tr><td>Architecture</td> <td colspan="2">$ARCH</td></tr>
|
al@1024
|
933 <tr><td>Host system</td> <td colspan="2">$BUILD_SYSTEM</td></tr>
|
al@1024
|
934 <tr><td>Target system</td> <td colspan="2">$HOST_SYSTEM</td></tr>
|
al@924
|
935 <tr><th>Package</th><th>Version</th><th>Description</th></tr>
|
al@924
|
936 $(toolchain_version slitaz-toolchain)
|
al@924
|
937 $(toolchain_version binutils)
|
al@924
|
938 $(toolchain_version linux-api-headers)
|
al@924
|
939 $(toolchain_version gcc)
|
al@924
|
940 $(toolchain_version glibc)
|
al@924
|
941 </table>
|
al@924
|
942
|
al@924
|
943 <p>Toolchain documentation: <a target="_blank" rel="noopener noreferrer"
|
al@924
|
944 href="http://doc.slitaz.org/en:cookbook:toolchain">http://doc.slitaz.org/en:cookbook:toolchain</a>
|
al@924
|
945 </p>
|
al@924
|
946
|
al@924
|
947 </section>
|
al@924
|
948 </div>
|
al@924
|
949 EOT
|
al@924
|
950 ;;
|
al@898
|
951 esac
|
al@898
|
952 page_footer
|
al@898
|
953 exit 0
|
al@898
|
954 fi
|
al@898
|
955
|
al@898
|
956
|
al@898
|
957 # We may have a toolchain.cgi script for cross cooker's
|
al@898
|
958 if [ -f "toolchain.cgi" ]; then
|
al@898
|
959 toolchain="toolchain.cgi"
|
al@898
|
960 else
|
al@924
|
961 toolchain="?toolchain"
|
al@898
|
962 fi
|
al@933
|
963
|
paul@900
|
964 # Main page with summary. Count only packages included in ARCH,
|
al@898
|
965 # use 'cooker arch-db' to manually create arch.$ARCH files.
|
al@933
|
966
|
al@898
|
967 cat <<EOT
|
al@898
|
968 <div id="content2">
|
al@898
|
969
|
al@898
|
970 <section>
|
al@898
|
971 <form method="get" action="" class="search r">
|
al@898
|
972 <input type="hidden" name="search" value="pkg"/>
|
al@898
|
973 <button type="submit" title="Search">Search</button>
|
al@898
|
974 <input type="search" name="q" placeholder="Package" list="packages" autocorrect="off" autocapitalize="off"/>
|
al@898
|
975 </form>
|
al@898
|
976
|
al@898
|
977 <h2>Summary</h2>
|
al@898
|
978 EOT
|
al@898
|
979
|
al@898
|
980 mktable <<EOT
|
al@898
|
981 Cooker state : $(running_command)
|
al@898
|
982 Wok revision : <a href='$WOK_URL' target='_blank' rel='noopener noreferrer'>$(cat $wokrev)</a>
|
al@898
|
983 Commits to cook : $(wc -l < $commits)
|
al@898
|
984 Current cooklist : $(wc -l < $cooklist)
|
al@898
|
985 Architecture : $ARCH, <a href="$toolchain">toolchain</a>
|
al@898
|
986 Server date : <span id='date'>$(date -u '+%F %R %Z')</span>
|
al@898
|
987 EOT
|
al@898
|
988
|
al@898
|
989 # If command is "cook:*", update gauge and percentage periodically.
|
al@898
|
990 # If different package is cooking, reload the page (with new settings)
|
al@898
|
991 cmd="$(cat $command)"
|
al@898
|
992 case "$cmd" in
|
al@898
|
993 cook:*)
|
al@898
|
994 pkg=${cmd#*:}
|
al@898
|
995 echo "<script>updatePkg = '${pkg//+/%2B}';</script>"
|
al@898
|
996 ;;
|
al@898
|
997 esac
|
al@898
|
998
|
al@933
|
999 # Do we need to update the statistics?
|
al@933
|
1000 [ "$webstat" -nt "$activity" ] || update_webstat
|
al@933
|
1001 . $webstat
|
al@933
|
1002
|
al@933
|
1003 pct=0; [ "$rtotal" -gt 0 ] && pct=$(( ($rcooked * 100) / $rtotal ))
|
al@933
|
1004
|
al@933
|
1005 cat <<EOT
|
al@933
|
1006 <div class="meter"><progress max="100" value="$pct">${pct}%</progress><span>${pct}%</span></div>
|
al@933
|
1007
|
al@933
|
1008 <table class="webstat"><thead>
|
al@933
|
1009 <tr><th> </th><th>Total </th><th>Cooked </th><th>Unbuilt </th><th>Blocked </th><th>Broken </th></tr>
|
al@933
|
1010 </thead><tbody>
|
al@933
|
1011 <tr><td>Receipts</td><td>$rtotal</td><td>$rcooked</td><td>$runbuilt</td><td>$rblocked</td><td>$rbroken</td></tr>
|
al@933
|
1012 <tr><td>Packages</td><td>$ptotal</td><td>$pcooked</td><td>$punbuilt</td><td>$pblocked</td><td>$pbroken</td></tr>
|
al@933
|
1013 </tbody></table>
|
al@933
|
1014 EOT
|
al@933
|
1015
|
al@898
|
1016 if [ -e "$CACHE/cooker-request" -a ! -s $command ]; then
|
al@898
|
1017 if [ "$activity" -nt "$CACHE/cooker-request" ]; then
|
al@898
|
1018 echo '<a class="button icon bell r" href="?poke">Wake up</a>'
|
al@898
|
1019 else
|
al@898
|
1020 show_note i 'Cooker will be launched in the next 5 minutes.'
|
al@898
|
1021 fi
|
al@898
|
1022 fi
|
al@898
|
1023
|
al@898
|
1024 cat <<EOT
|
al@898
|
1025 <p>
|
al@898
|
1026 Service logs:
|
al@898
|
1027 <a href="?cookorder.log">cookorder</a> ·
|
al@898
|
1028 <a href="?commits.log">commits</a> ·
|
al@898
|
1029 <a href="?pkgdb.log">pkgdb</a>
|
al@898
|
1030 </p>
|
al@898
|
1031 </section>
|
al@898
|
1032 EOT
|
al@898
|
1033
|
al@898
|
1034 tac $activity | head -n12 | sed 's|cooker.cgi?pkg=||;
|
al@898
|
1035 s|\[ Done|<span class="r c20">Done|;
|
al@898
|
1036 s|\[ Failed|<span class="r c10">Failed|;
|
al@1027
|
1037 s|\[ -Failed|<span class="r c10"><del>Failed</del>|;
|
al@898
|
1038 s| \]|</span>|;
|
al@898
|
1039 s|%2B|\+|g' | \
|
al@898
|
1040 section $activity 12 "Activity|More activity"
|
al@898
|
1041
|
al@898
|
1042 [ -s "$cooknotes" ] && tac $cooknotes | head -n12 | \
|
al@898
|
1043 section $cooknotes 12 "Cooknotes|More notes"
|
al@898
|
1044
|
al@898
|
1045 [ -s "$commits" ] &&
|
al@898
|
1046 section $commits 20 "Commits|More commits" < $commits
|
al@898
|
1047
|
al@898
|
1048 [ -s "$cooklist" ] && head -n 20 $cooklist | \
|
al@898
|
1049 section $cooklist 20 "Cooklist|Full cooklist"
|
al@898
|
1050
|
al@898
|
1051 [ -s "$broken" ] && head -n20 $broken | sed "s|^[^']*|<a href='\0'>\0</a>|g" | \
|
al@898
|
1052 section $broken 20 "Broken|All broken packages"
|
al@898
|
1053
|
al@898
|
1054 [ -s "$blocked" ] && sed "s|^[^']*|<a href='\0'>\0</a>|g" $blocked | \
|
al@898
|
1055 section $blocked 12 "Blocked|All blocked packages"
|
al@898
|
1056
|
al@898
|
1057 cd $PKGS
|
al@1025
|
1058 # About BusyBox's `ls`
|
al@1025
|
1059 # On the Tank server: BusyBox v1.18.4 (2012-03-14 03:32:25 CET) multi-call binary.
|
paul@1030
|
1060 # It supported the option `-e`, output with `-let` options like this:
|
al@1025
|
1061 # -rw-r--r-- 1 user group 100000 Fri Nov 3 10:00:00 2017 filename
|
al@1025
|
1062 # 1 2 3 4 5 6 7 8 9 10 11
|
paul@1030
|
1063 # Newer BusyBox v1.27.2 doesn't support option `-e` and has no configs to
|
al@1025
|
1064 # configure it or return the option back. It supported the long option
|
al@1025
|
1065 # `--full-time` instead, but output is different:
|
al@1025
|
1066 # -rw-r--r-- 1 user group 100000 2017-11-03 10:00:00 +0200 filename
|
al@1025
|
1067 # 1 2 3 4 5 6 7 8 9
|
al@1025
|
1068 if ls -let >/dev/null 2>&1; then
|
al@1025
|
1069 ls -let *.tazpkg \
|
al@1025
|
1070 | awk '
|
al@1025
|
1071 (NR<=20){
|
al@1025
|
1072 sub(/:[0-9][0-9]$/, "", $9);
|
al@1025
|
1073 mon = index(" JanFebMarAprMayJunJulAugSepOctNovDec", $7) / 3;
|
al@1025
|
1074 printf("%d-%02d-%02d %s : <a href=\"get/%s\">%s</a>\n", $10, mon, $8, $9, $11, $11);
|
al@1025
|
1075 }' \
|
al@1025
|
1076 | section $activity 1000 "Latest cook"
|
al@1025
|
1077 else
|
al@1025
|
1078 ls -lt --full-time *.tazpkg \
|
al@1025
|
1079 | awk '
|
al@1025
|
1080 (NR<=20){
|
al@1025
|
1081 sub(/:[0-9][0-9]$/, "", $7);
|
al@1025
|
1082 printf("%s %s : <a href=\"get/%s\">%s</a>\n", $6, $7, $9, $9);
|
al@1025
|
1083 }' \
|
al@1025
|
1084 | section $activity 1000 "Latest cook"
|
al@1025
|
1085 fi
|
al@898
|
1086
|
al@898
|
1087 echo '</div>'
|
al@898
|
1088 datalist
|
al@898
|
1089 page_footer
|
al@898
|
1090 exit 0
|
al@898
|
1091 fi
|
al@898
|
1092
|
al@898
|
1093
|
al@1007
|
1094 # show tag
|
al@1007
|
1095
|
al@1007
|
1096 if [ "$pkg" == '~' -a -n "$cmd" ]; then
|
al@1007
|
1097 tag="$cmd"
|
al@1007
|
1098 page_header
|
al@1007
|
1099 cat <<EOT
|
al@1007
|
1100 <div id="content2">
|
al@1007
|
1101 <section>
|
al@1007
|
1102 <h2>Tag “$tag”</h2>
|
al@1007
|
1103
|
al@1007
|
1104 <table>
|
al@1007
|
1105 <thead>
|
al@1007
|
1106 <tr><th>Name</th><th>Description</th><th>Category</th></tr>
|
al@1007
|
1107 </thead>
|
al@1007
|
1108 <tbody>
|
al@1007
|
1109 EOT
|
al@1029
|
1110 sort $PKGS/packages.info \
|
al@1029
|
1111 | awk -F$'\t' -vtag=" $tag " -vbase="$base" '{
|
al@1007
|
1112 if (index(" " $6 " ", tag)) {
|
al@1007
|
1113 url = base "/" $1 "/";
|
al@1007
|
1114 gsub("+", "%2B", url);
|
al@1029
|
1115 printf("<tr><td><img src=\"%s/s/%s\"> ", base, $1);
|
al@1029
|
1116 printf("<a href=\"%s\">%s</a></td><td>%s</td><td>%s</td></tr>\n", url, $1, $4, $3);
|
al@1007
|
1117 }
|
al@1029
|
1118 }'
|
al@1029
|
1119 echo '</tbody></table></section></div>'
|
al@1007
|
1120 page_footer
|
al@1007
|
1121 exit 0
|
al@1007
|
1122 fi
|
al@1007
|
1123
|
al@1007
|
1124
|
al@898
|
1125 case "$cmd" in
|
al@898
|
1126 '')
|
al@898
|
1127 page_header
|
al@898
|
1128
|
al@989
|
1129 requested_pkg="$pkg"
|
al@898
|
1130 # Package info.
|
al@940
|
1131 if [ ! -f "$wok/$pkg/receipt" ]; then
|
al@940
|
1132 # Let's look at the cases when the package was not found
|
al@940
|
1133
|
al@940
|
1134 # Maybe query is the exact name of split package? -> proceed to main package
|
al@940
|
1135 mainpkg=$(awk -F$'\t' -vpkg=" $pkg " '{
|
al@940
|
1136 if (index(" " $2 " ", pkg)) {print $1; exit}
|
al@940
|
1137 }' $splitdb)
|
al@940
|
1138
|
al@940
|
1139 # No, so let's find any matches among packages names (both main and split)
|
al@940
|
1140 if [ -z "$mainpkg" ]; then
|
al@940
|
1141 pkgs=$(cut -d$'\t' -f2 $splitdb | tr ' ' '\n' | fgrep "$pkg")
|
al@940
|
1142 # Nothing matched
|
al@940
|
1143 if [ -z "$pkgs" ]; then
|
al@940
|
1144 echo "<h2>Not Found</h2>"
|
al@940
|
1145 show_note e "The requested package <b>$pkg</b> was not found on this server."
|
al@940
|
1146 page_footer; exit 0
|
al@940
|
1147 fi
|
al@940
|
1148 # Search results page
|
al@898
|
1149 echo "<section><h2>Package names matching “$pkg”</h2>"
|
al@898
|
1150 echo "<table><thead><tr><th>Name</th><th>Description</th><th>Category</th></tr></thead><tbody>"
|
al@940
|
1151 query="$pkg"
|
al@940
|
1152 for pkg in $pkgs; do
|
al@940
|
1153 # Find main package
|
al@940
|
1154 mainpkg=$(awk -F$'\t' -vpkg=" $pkg " '{
|
al@940
|
1155 if (index(" " $2 " ", pkg)) {print $1; exit}
|
al@940
|
1156 }' $splitdb)
|
al@940
|
1157 unset SHORT_DESC CATEGORY; . $wok/$mainpkg/receipt
|
al@940
|
1158
|
al@898
|
1159 unset SHORT_DESC CATEGORY
|
al@940
|
1160 [ -e "$wok/$mainpkg/taz/$PACKAGE-$VERSION/receipt" ] &&
|
al@940
|
1161 . $wok/$mainpkg/taz/$PACKAGE-$VERSION/receipt
|
al@940
|
1162
|
al@940
|
1163 echo -n "<tr><td><a href="$base/$pkg">${pkg//$query/<mark>$query</mark>}</a>"
|
al@940
|
1164 [ "$pkg" == "$mainpkg" ] || echo -n " (${mainpkg//$query/<mark>$query</mark>})"
|
al@940
|
1165 echo -n "</td><td>$SHORT_DESC</td><td>$CATEGORY</td></tr>"
|
al@898
|
1166 done
|
al@898
|
1167 echo '</tbody></table></section>'
|
al@940
|
1168 page_footer; exit 0
|
al@898
|
1169 fi
|
al@940
|
1170 pkg="$mainpkg"
|
al@898
|
1171 fi
|
al@898
|
1172
|
al@940
|
1173 log=$LOGS/$pkg.log
|
al@940
|
1174 pkg_info
|
al@940
|
1175
|
al@898
|
1176 # Check for a log file and display summary if it exists.
|
al@898
|
1177 summary "$log"
|
al@898
|
1178
|
al@994
|
1179
|
al@1007
|
1180 # Show tag list
|
al@1007
|
1181 taglist=$(
|
al@1007
|
1182 for i in $pkg $(awk -F$'\t' -vp="$pkg" '{if ($1 == p) print $2}' $splitdb); do
|
al@1007
|
1183 [ -s "$PKGS/packages.info" ] &&
|
al@1007
|
1184 awk -F$'\t' -vpkg="$i" '{
|
al@1007
|
1185 if ($1 == pkg) { print $6; exit; }
|
al@1007
|
1186 }' "$PKGS/packages.info"
|
al@1007
|
1187 done \
|
al@1007
|
1188 | tr ' ' '\n' \
|
al@1007
|
1189 | sort -u
|
al@1007
|
1190 )
|
al@1007
|
1191 if [ -n "$taglist" ]; then
|
al@1007
|
1192 echo -n '<section><h3>Tags</h3><p>'
|
al@1007
|
1193 lasttag=$(echo "$taglist" | tail -n1)
|
al@1007
|
1194 for tag in $taglist; do
|
al@1007
|
1195 echo -n "<a href=\"$base/~/${tag//+/%2B}\">$tag</a>"
|
al@1007
|
1196 [ "$tag" != "$lasttag" ] && echo -n " · "
|
al@1007
|
1197 done
|
al@1007
|
1198 echo '</p></section>'
|
al@1007
|
1199 fi
|
al@994
|
1200
|
al@994
|
1201
|
al@1007
|
1202 # Informational table with dependencies
|
al@989
|
1203 pkg="$requested_pkg"
|
al@994
|
1204 inf="$(mktemp -d)"
|
al@994
|
1205
|
al@995
|
1206 # 1/3: Build dependencies (from receipt and pkgdb)
|
al@997
|
1207 for i in $WANTED $BUILD_DEPENDS $(awk -F$'\t' -vp=" $pkg " '{if (index(" " $2 " ", p) && (" " $1 " " != p)) print $1}' $splitdb); do
|
al@994
|
1208 echo "$i" >> $inf/a
|
al@994
|
1209 done
|
al@994
|
1210
|
al@994
|
1211 # 2/3: Runtime dependencies (from pkgdb)
|
al@994
|
1212 {
|
al@994
|
1213 [ -s "$PKGS/packages.info" ] &&
|
al@994
|
1214 awk -F$'\t' -vp="$pkg" '{
|
al@994
|
1215 if ($1 == p) print $8
|
al@994
|
1216 }' "$PKGS/packages.info"
|
al@994
|
1217 } | tr ' ' '\n' | sort -u > $inf/b
|
al@994
|
1218
|
al@994
|
1219 # 3/3: Required by (from pkgdb)
|
al@994
|
1220 {
|
al@995
|
1221 for i in $pkg $(awk -F$'\t' -vp="$pkg" '{if ($1 == p) print $2}' $splitdb); do
|
al@994
|
1222 [ -s "$PKGS/packages.info" ] &&
|
al@994
|
1223 awk -F$'\t' -vp=" $i " '{
|
al@994
|
1224 if (index(" " $8 " ", p)) print $1
|
al@994
|
1225 }' "$PKGS/packages.info"
|
al@994
|
1226
|
al@994
|
1227 [ -s "$PKGS/bdeps.txt" ] &&
|
al@994
|
1228 awk -F$'\t' -vp=" $i " '{
|
al@994
|
1229 if (index(" " $2 " ", p)) print $1
|
al@994
|
1230 }' $PKGS/bdeps.txt
|
al@994
|
1231 done
|
al@994
|
1232 } | sort -u > $inf/c
|
al@994
|
1233
|
al@982
|
1234 cat <<EOT
|
al@982
|
1235 <section>
|
al@989
|
1236 <h3>Related packages</h3>
|
al@989
|
1237 <table class="third">
|
al@982
|
1238 <thead>
|
al@982
|
1239 <tr>
|
al@982
|
1240 <th>Build dependencies</th>
|
al@989
|
1241 <th>Runtime dependencies</th>
|
al@982
|
1242 <th>Required by</th>
|
al@982
|
1243 </tr>
|
al@982
|
1244 </thead>
|
al@982
|
1245 <tbody>
|
al@989
|
1246 EOT
|
al@989
|
1247
|
al@994
|
1248 awk -vinf="$inf" -vbase="$base" '
|
al@994
|
1249 function linki(i) {
|
al@994
|
1250 if (i) return sprintf("<img src=\"%s/s/%s\"> <a href=\"%s/%s\">%s</a>", base, i, base, i, i);
|
al@994
|
1251 }
|
al@994
|
1252 BEGIN{
|
al@994
|
1253 do {
|
al@994
|
1254 a = b = c = "";
|
al@994
|
1255 getline a < inf "/a";
|
al@994
|
1256 getline b < inf "/b";
|
al@994
|
1257 getline c < inf "/c";
|
al@994
|
1258 printf("<tr><td>%s </td><td>%s </td><td>%s </td></tr>", linki(a), linki(b), linki(c));
|
al@994
|
1259 } while ( a b c )
|
al@994
|
1260 }'
|
al@982
|
1261 cat <<EOT
|
al@982
|
1262 </tbody>
|
al@982
|
1263 </table>
|
al@982
|
1264 </section>
|
al@982
|
1265 EOT
|
al@994
|
1266 # Clean
|
al@994
|
1267 rm -r $inf
|
al@994
|
1268
|
al@994
|
1269
|
al@994
|
1270
|
al@982
|
1271
|
al@898
|
1272 # Display <Recook> button only for SliTaz web browser
|
al@971
|
1273 case "$HTTP_USER_AGENT" in
|
al@971
|
1274 *SliTaz*)
|
al@971
|
1275 if [ -f $CACHE/cooker-request -a -n "$HTTP_REFERER" ]; then
|
al@971
|
1276 if grep -qs "^$pkg$" $CACHE/recook-packages; then
|
al@971
|
1277 show_note i "The package “$pkg” has been requested for recook"
|
al@971
|
1278 else
|
al@971
|
1279 echo "<a class='button' href='$base/?recook=${pkg//+/%2B}'>Recook $pkg</a>"
|
al@898
|
1280 fi
|
al@971
|
1281 fi
|
al@971
|
1282 ;;
|
al@971
|
1283 esac
|
al@898
|
1284 ;;
|
al@898
|
1285
|
al@898
|
1286 receipt)
|
al@898
|
1287 page_header
|
al@898
|
1288 pkg_info
|
al@898
|
1289 echo "<a class='button receipt' href='$base/$pkg/receipt'>receipt</a>"
|
al@898
|
1290 ( cd $wok/$pkg; find stuff -type f 2>/dev/null ) | sort | \
|
al@898
|
1291 awk -vb="$base/$pkg" '{printf("<a class=\"button\" href=\"%s/%s\">%s</a>\n", b, $0, $0)}'
|
al@898
|
1292
|
al@898
|
1293 show_code bash < $wok/$pkg/receipt
|
al@898
|
1294 ;;
|
al@898
|
1295
|
al@898
|
1296 stuff)
|
al@898
|
1297 page_header
|
al@898
|
1298 pkg_info
|
al@898
|
1299 file="$pkg/stuff/$arg"
|
al@898
|
1300 echo "<a class='button' href='$base/$pkg/receipt'>receipt</a>"
|
al@898
|
1301 ( cd $wok/$pkg; find stuff -type f 2>/dev/null ) | sort | \
|
al@898
|
1302 awk -vb="$base/$pkg" -va="stuff/$arg" '{
|
al@898
|
1303 printf("<a class=\"button%s\" href=\"%s/%s\">%s</a>\n", a==$0 ? " receipt" : "", b, $0, $0)
|
al@898
|
1304 }'
|
al@898
|
1305
|
al@898
|
1306 if [ -f "$wok/$file" ]; then
|
al@898
|
1307 case $file in
|
al@898
|
1308 *.desktop|*.theme) class="ini" ;;
|
al@898
|
1309 *.patch|*.diff|*.u) class="diff" ;;
|
al@898
|
1310 *.sh) class="bash" ;;
|
al@898
|
1311 *.conf*|*.ini)
|
al@898
|
1312 class="bash"
|
al@898
|
1313 [ -n "$(cut -c1 < $wok/$file | fgrep '[')" ] && class="ini"
|
al@898
|
1314 ;;
|
al@898
|
1315 *.pl) class="perl" ;;
|
al@898
|
1316 *.c|*.h|*.awk) class="clike" ;;
|
al@898
|
1317 *.svg) class="svg" ;;
|
al@898
|
1318 *Makefile*) class="makefile" ;;
|
al@898
|
1319 *.po|*.pot) class="bash" ;;
|
al@898
|
1320 *.css) class="css" ;;
|
al@898
|
1321 *.htm|*.html) class="html" ;;
|
al@898
|
1322 *.js) class="js" ;;
|
al@898
|
1323 *.txt) class="asciidoc" ;;
|
al@898
|
1324 *)
|
al@898
|
1325 case $(head -n1 $wok/$file) in
|
al@898
|
1326 *!/bin/sh*|*!/bin/bash*) class="bash" ;;
|
al@898
|
1327 esac
|
al@898
|
1328 if [ -z "$class" -a "$(head -n1 $wok/$file | cut -b1)" == '#' ]; then
|
al@898
|
1329 class="bash"
|
al@898
|
1330 fi
|
al@898
|
1331 if [ -z "$class" ]; then
|
al@898
|
1332 # Follow Busybox restrictions. Search for non-printable chars
|
al@898
|
1333 if [ $(tr -d '[:alnum:][:punct:][:blank:][:cntrl:]' < "$wok/$file" | wc -c) -gt 0 ]; then
|
al@898
|
1334 raw="true"
|
al@898
|
1335 fi
|
al@898
|
1336 fi
|
al@898
|
1337 ;;
|
al@898
|
1338 esac
|
al@898
|
1339
|
al@898
|
1340 # Display image
|
al@898
|
1341 case $file in
|
al@898
|
1342 *.png|*.svg|*.jpg|*.jpeg|*.ico)
|
al@898
|
1343 echo "<img src='$base/$pkg/browse/stuff/$arg' style='display: block; max-width: 100%; margin: auto'/>"
|
al@898
|
1344 ;;
|
al@898
|
1345 esac
|
al@898
|
1346
|
al@898
|
1347 # Display colored listing for all text-based documents (also for *.svg)
|
al@898
|
1348 case $file in
|
al@898
|
1349 *.png|*.jpg|*.jpeg|*.ico) ;;
|
al@898
|
1350 *)
|
al@898
|
1351 if [ -z "$raw" ]; then
|
al@898
|
1352 cat $wok/$file | show_code $class
|
al@898
|
1353 fi
|
al@898
|
1354 ;;
|
al@898
|
1355 esac
|
al@898
|
1356
|
al@898
|
1357 # Display hex dump for binary files
|
al@898
|
1358 if [ -n "$raw" ]; then
|
al@898
|
1359 hexdump -C $wok/$file | show_code #| sed 's|^\([0-9a-f][0-9a-f]*\)|<span class="c2">\1</span>|'
|
al@898
|
1360 fi
|
al@898
|
1361 else
|
al@898
|
1362 show_note e "File “$file” absent!"
|
al@898
|
1363 fi
|
al@898
|
1364 ;;
|
al@898
|
1365
|
al@898
|
1366 files)
|
al@898
|
1367 page_header
|
al@898
|
1368 pkg_info
|
al@898
|
1369
|
al@898
|
1370 # find main package
|
al@898
|
1371 wanted=$(. $wok/$pkg/receipt; echo $WANTED)
|
al@898
|
1372 main=${wanted:-$pkg}
|
al@1010
|
1373 devpkg=''; [ -d "$wok/$main-dev" ] && devpkg="$main-dev"
|
al@915
|
1374
|
al@1010
|
1375 splitsets=$(echo $SPLIT" " \
|
al@1010
|
1376 | awk '
|
al@1010
|
1377 BEGIN { RS = " "; FS = ":"; }
|
al@1010
|
1378 { print $2; }' \
|
al@1010
|
1379 | sort -u \
|
al@1010
|
1380 | tr '\n' ' ' \
|
al@1010
|
1381 | sed 's|^ *||; s| *$||')
|
al@915
|
1382
|
al@1010
|
1383 splitpkgs=$(echo $SPLIT" " \
|
al@1010
|
1384 | awk '
|
al@1010
|
1385 BEGIN { RS = " "; FS = ":"; }
|
al@1010
|
1386 { print $1; }' \
|
al@1010
|
1387 | tr '\n' ' ' \
|
al@1010
|
1388 | sed 's|^ *||; s| *$||')
|
al@1010
|
1389
|
al@1010
|
1390 # we need the version
|
al@915
|
1391 if [ -f "$WOK/linux/receipt" ]; then
|
al@915
|
1392 kvers=$(. $WOK/linux/receipt; echo $VERSION)
|
al@915
|
1393 kbasevers=$(echo $kvers | cut -d. -f1,2)
|
al@915
|
1394 elif [ -f "$INSTALLED/linux-api-headers/receipt" ]; then
|
al@915
|
1395 kvers=$(. $INSTALLED/linux-api-headers/receipt; echo $VERSION)
|
al@915
|
1396 kbasevers=$(echo $kvers | cut -d. -f1,2)
|
al@915
|
1397 fi
|
al@898
|
1398 ver=$(. $wok/$main/receipt; echo $VERSION$EXTRAVERSION)
|
al@898
|
1399
|
al@1010
|
1400 echo "<section><h3>Quick jump:</h3>"
|
al@924
|
1401
|
al@924
|
1402
|
al@1010
|
1403 for part in head body; do
|
al@898
|
1404
|
al@1010
|
1405 for set in '' $splitsets; do
|
al@1010
|
1406 pkgsofset=$(echo $SPLIT" " \
|
al@1010
|
1407 | awk -vset="$set" -vmain="$main" -vdev="$devpkg" '
|
al@1010
|
1408 BEGIN {
|
al@1010
|
1409 RS = " "; FS = ":";
|
al@1010
|
1410 if (!set) print main;
|
al@1010
|
1411 if (!set && dev) print dev;
|
al@1010
|
1412 }
|
al@1010
|
1413 {
|
al@1010
|
1414 if ($2 == set) print $1;
|
al@1010
|
1415 }' \
|
al@1010
|
1416 | sort -u)
|
al@898
|
1417
|
al@1010
|
1418 set_description=''
|
al@1010
|
1419 [ -n "$splitsets" ] &&
|
al@1010
|
1420 case "$set" in
|
al@1010
|
1421 '')
|
al@1010
|
1422 set_description=' (default set)'
|
al@1010
|
1423 set_title='Default set'
|
al@1010
|
1424 ;;
|
al@1010
|
1425 *)
|
al@1010
|
1426 set_description=" (set “$set”)"
|
al@1010
|
1427 set_title="Set “$set”"
|
al@1010
|
1428 ;;
|
al@1010
|
1429 esac
|
al@898
|
1430
|
al@1010
|
1431 install="$wok/$main/install"
|
al@1010
|
1432 [ -n "$set" ] && install="$install-$set"
|
al@898
|
1433
|
al@1010
|
1434 case $part in
|
al@1010
|
1435 head)
|
al@1010
|
1436 [ -n "$splitsets" ] &&
|
al@1010
|
1437 case "$set" in
|
al@1010
|
1438 '') echo "<ul><li>Default set:";;
|
al@1010
|
1439 *) echo "<li>Set “$set”:";;
|
al@1010
|
1440 esac
|
al@1010
|
1441 echo -e '\t<ul>'
|
al@1010
|
1442 echo "$pkgsofset" | sed 'p' | xargs printf "\t\t<li><a href='#%s'>%s</a></li>\n"
|
al@1010
|
1443 cat <<EOT
|
al@1010
|
1444 <li id='li-repeats$set' style='display:none'>
|
al@1010
|
1445 <a href='#repeats$set'>repeatedly packaged files</a></li>
|
al@1010
|
1446 <li id='li-empty$set' style='display:none'>
|
al@1010
|
1447 <a href='#empty$set'>unpackaged empty folders</a></li>
|
al@1010
|
1448 <li id='li-outoftree$set' style='display:none'>
|
al@1010
|
1449 <a href='#outoftree$set'>out-of-tree files</a></li>
|
al@1010
|
1450 <li id='li-orphans$set' style='display:none'>
|
al@1010
|
1451 <a href='#orphans$set'>unpackaged files</a>
|
al@1010
|
1452 <span id='orphansTypes$set'></span></li>
|
al@1010
|
1453 EOT
|
al@1010
|
1454 echo -e '\t</ul>'
|
al@1010
|
1455 [ -n "$splitsets" ] && echo "</li>"
|
al@1010
|
1456 ;;
|
al@1010
|
1457 body)
|
al@1010
|
1458 all_files=$(mktemp)
|
al@1010
|
1459 cd $install; find ! -type d | sed 's|\.||' > $all_files
|
al@964
|
1460
|
al@1010
|
1461 # ------------------------------------------------------
|
al@1010
|
1462 # Packages content
|
al@1010
|
1463 # ------------------------------------------------------
|
al@1010
|
1464 packaged=$(mktemp)
|
al@1010
|
1465 for p in $pkgsofset; do
|
al@1010
|
1466 namever="$p-$ver"
|
al@1010
|
1467 if [ -d "$wok/$p/taz/$p-$ver" ]; then
|
al@1010
|
1468 indir=$p
|
al@1010
|
1469 elif [ -d "$wok/$main/taz/$p-$ver" ]; then
|
al@1010
|
1470 indir=$main
|
al@1010
|
1471 fi
|
al@1010
|
1472 dir="$wok/$indir/taz/$p-$ver/fs"
|
al@912
|
1473
|
al@1010
|
1474 size=$(du -hs $dir | awk '{ sub(/\.0/, ""); print $1 }')
|
al@1010
|
1475
|
al@1010
|
1476 echo
|
al@1010
|
1477 echo "<section id='$p'>"
|
al@1010
|
1478 echo " <h3>Contents of package “$namever” (${size:-empty}):</h3>"
|
al@1010
|
1479 echo ' <pre class="files">'
|
al@1010
|
1480 if [ -s "$wok/$indir/taz/$p-$ver/files.list" ]; then
|
al@1010
|
1481 echo -en '<span class="underline">permissions·lnk·user ·group · size·date & time ·name\n</span>'
|
al@1010
|
1482 cd $dir
|
al@1010
|
1483 find . -print0 \
|
al@1010
|
1484 | sort -z \
|
al@1010
|
1485 | xargs -0 ls -ldp --color=always \
|
al@1010
|
1486 | syntax_highlighter files \
|
al@1010
|
1487 | sed "s|\([^>]*\)>\.\([^<]*\)\(<.*\)$|\1 href='$base/$indir/browse/taz/$p-$ver/fs\2'>\2\3|;" \
|
al@1010
|
1488 | awk 'BEGIN { FS="\""; }
|
al@1010
|
1489 { gsub("+", "%2B", $2); print; }'
|
al@1010
|
1490 else
|
al@1010
|
1491 echo 'No files'
|
al@1010
|
1492 fi
|
al@1010
|
1493 echo '</pre>'
|
al@1010
|
1494 echo '</section>'
|
al@1010
|
1495
|
al@1010
|
1496 cat $wok/$indir/taz/$p-$ver/files.list >> $packaged
|
al@1010
|
1497 done
|
al@1010
|
1498 # ------------------------------------------------------
|
al@1010
|
1499 # /Packages content
|
al@1010
|
1500 # ------------------------------------------------------
|
al@1010
|
1501
|
al@1010
|
1502 # ------------------------------------------------------
|
al@1010
|
1503 # Repeatedly packaged files
|
al@1010
|
1504 # ------------------------------------------------------
|
al@1010
|
1505 repeats=$(mktemp)
|
al@1010
|
1506 sort $packaged | uniq -d > $repeats
|
al@1010
|
1507 if [ -s "$repeats" ]; then
|
al@1010
|
1508 echo
|
al@1010
|
1509 echo "<script>document.getElementById('li-repeats$set').style.display = 'list-item'</script>"
|
al@1010
|
1510 echo "<section id='repeats$set'>"
|
al@1010
|
1511 echo " <h3>Repeatedly packaged files$set_description:</h3>"
|
al@1010
|
1512 cd $install
|
al@1010
|
1513
|
al@1010
|
1514 IFS=$'\n'
|
al@1010
|
1515 echo -n ' <pre class="files">'
|
al@1010
|
1516 echo -en '<span class="underline">permissions·lnk·user ·group · size·date & time ·name\n</span>'
|
al@1010
|
1517 while read i; do
|
al@1010
|
1518 find .$i -exec ls -ldp --color=always '{}' \; \
|
al@1010
|
1519 | syntax_highlighter files \
|
al@1010
|
1520 | sed 's|>\./|>/|'
|
al@1010
|
1521 done < $repeats
|
al@1010
|
1522 echo '</pre>'
|
al@1010
|
1523 echo '</section>'
|
al@1010
|
1524 unset IFS
|
al@1010
|
1525 fi
|
al@1010
|
1526 rm $repeats
|
al@1010
|
1527 # ------------------------------------------------------
|
al@1010
|
1528 # /Repeatedly packaged files
|
al@1010
|
1529 # ------------------------------------------------------
|
al@1010
|
1530
|
al@1010
|
1531 # ------------------------------------------------------
|
al@1010
|
1532 # Unpackaged empty folders
|
al@1010
|
1533 # ------------------------------------------------------
|
al@1010
|
1534 emptydirs=$(mktemp)
|
al@1010
|
1535 cd $install
|
al@1010
|
1536 IFS=$'\n'
|
al@1010
|
1537 find -type d \
|
al@1010
|
1538 | sed 's|\.||' \
|
al@1010
|
1539 | while read d; do
|
al@1010
|
1540 [ -z "$(ls "$wok/$main/install$d")" ] || continue
|
al@1010
|
1541 echo $d
|
al@1010
|
1542 done \
|
al@1010
|
1543 | while read d; do
|
al@1010
|
1544 notfound='yes'
|
al@1010
|
1545 for p in $(cd $wok/$main/taz; ls); do
|
al@1010
|
1546 if [ -d "$wok/$main/taz/$p/fs$d" ]; then
|
al@1010
|
1547 notfound=''
|
al@1010
|
1548 break
|
al@1010
|
1549 fi
|
al@1010
|
1550 done
|
al@1010
|
1551 [ -n "$notfound" ] &&
|
al@1010
|
1552 ls -ldp --color=always .$d \
|
al@1010
|
1553 | syntax_highlighter files \
|
al@1010
|
1554 | sed 's|>\./|>/|'
|
al@1010
|
1555 done > $emptydirs
|
al@1010
|
1556 unset IFS
|
al@1010
|
1557 if [ -s "$emptydirs" ]; then
|
al@1010
|
1558 echo
|
al@1010
|
1559 echo "<script>document.getElementById('li-empty$set').style.display = 'list-item'</script>"
|
al@1010
|
1560 echo "<section id='empty$set'>"
|
al@1010
|
1561 echo " <h3>Unpackaged empty folders$set_description:</h3>"
|
al@1010
|
1562 echo -n ' <pre class="files">'
|
al@1010
|
1563 echo -en '<span class="underline">permissions·lnk·user ·group · size·date & time ·name\n</span>'
|
al@1010
|
1564 cat $emptydirs
|
al@1010
|
1565 echo '</pre>'
|
al@1010
|
1566 echo '</section>'
|
al@1010
|
1567 fi
|
al@1010
|
1568 rm $emptydirs
|
al@1010
|
1569 # ------------------------------------------------------
|
al@1010
|
1570 # /Unpackaged empty folders
|
al@1010
|
1571 # ------------------------------------------------------
|
al@1010
|
1572
|
al@1010
|
1573 # ------------------------------------------------------
|
al@1010
|
1574 # Out-of-tree files
|
al@1010
|
1575 # ------------------------------------------------------
|
al@1010
|
1576 outoftree=$(mktemp)
|
al@1010
|
1577 awk -F$'\n' -vall="$all_files" '
|
al@1010
|
1578 {
|
al@1010
|
1579 if (FILENAME == all) files_all[$1] = "1";
|
al@1010
|
1580 else files_pkg[$1] = "1";
|
al@1010
|
1581 }
|
al@1010
|
1582 END {
|
al@1010
|
1583 for (i in files_pkg) {
|
al@1010
|
1584 if (! files_all[i]) print i;
|
al@1010
|
1585 }
|
al@1010
|
1586 }
|
al@1010
|
1587 ' "$all_files" "$packaged" > $outoftree
|
al@1010
|
1588
|
al@1010
|
1589 if [ -d "$install" -a -s "$outoftree" ]; then
|
al@1010
|
1590 echo
|
al@1010
|
1591 echo "<script>document.getElementById('li-outoftree$set').style.display = 'list-item'</script>"
|
al@1010
|
1592 echo "<section id='outoftree$set'>"
|
al@1010
|
1593 echo " <h3>Out-of-tree files$set_description:</h3>"
|
al@1010
|
1594 echo -n ' <pre class="files">'
|
al@1010
|
1595 echo -en '<span class="underline">permissions·lnk·user ·group · size·date & time ·name\n</span>'
|
al@1010
|
1596 IFS=$'\n'
|
al@1010
|
1597 while read outoftree_line; do
|
al@1010
|
1598 # Find the package out-of-tree file belongs to
|
al@1010
|
1599 for i in $pkgsofset; do
|
al@1010
|
1600 if grep -q "^$outoftree_line$" $wok/$main/taz/$i-$ver/files.list; then
|
al@1010
|
1601 cd $wok/$main/taz/$i-$ver/fs
|
al@1010
|
1602 ls -ldp --color=always ".$outoftree_line" \
|
al@1010
|
1603 | syntax_highlighter files \
|
al@1010
|
1604 | sed "s|\([^>]*\)>\.\([^<]*\)\(<.*\)$|\1 href='$base/$main/browse/taz/$i-$ver/fs\2'>\2\3|;" \
|
al@1010
|
1605 | awk 'BEGIN { FS="\""; }
|
al@1010
|
1606 { gsub("+", "%2B", $2); print; }'
|
al@1010
|
1607 fi
|
al@1010
|
1608 done
|
al@1010
|
1609 done < $outoftree
|
al@1010
|
1610 unset IFS
|
al@1010
|
1611 echo '</pre>'
|
al@1010
|
1612 echo '</section>'
|
al@1010
|
1613 fi
|
al@1010
|
1614 rm $outoftree
|
al@1010
|
1615 # ------------------------------------------------------
|
al@1010
|
1616 # /Out-of-tree files
|
al@1010
|
1617 # ------------------------------------------------------
|
al@1010
|
1618
|
al@1010
|
1619 # ------------------------------------------------------
|
al@1010
|
1620 # Unpackaged files
|
al@1010
|
1621 # ------------------------------------------------------
|
al@1010
|
1622 orphans=$(mktemp)
|
al@1011
|
1623 awk -F$'\n' -vall="$all_files" '
|
al@1010
|
1624 {
|
al@1010
|
1625 if (FILENAME == all) files_all[$1] = "1";
|
al@1010
|
1626 else files_pkg[$1] = "1";
|
al@1010
|
1627 }
|
al@1010
|
1628 END {
|
al@1010
|
1629 for (i in files_all) {
|
al@1010
|
1630 if (! files_pkg[i]) print i;
|
al@1010
|
1631 }
|
al@1010
|
1632 }
|
al@1019
|
1633 ' "$all_files" "$packaged" | sort > $orphans
|
al@1010
|
1634 if [ -d "$install" -a -s "$orphans" ]; then
|
al@1010
|
1635 echo
|
al@1010
|
1636 echo "<script>document.getElementById('li-orphans$set').style.display = 'list-item'</script>"
|
al@1010
|
1637 echo "<section id='orphans$set'>"
|
al@1010
|
1638 echo " <h3>Unpackaged files$set_description:</h3>"
|
al@1010
|
1639 table=$(mktemp)
|
al@1010
|
1640 awk '
|
al@1010
|
1641 function tag(text, color) {
|
al@1010
|
1642 printf("<span class=\"c%s1\">%s</span> ", color, text);
|
al@1010
|
1643 printf("%s\n", $0);
|
al@1010
|
1644 }
|
al@1048
|
1645 /\/perllocal\.pod$/ || /\/\.packlist$/ ||
|
al@1048
|
1646 /\/share\/bash-completion\// || /\/etc\/bash_completion\.d\// ||
|
al@1048
|
1647 /\/lib\/systemd\// || /\.pyc$/ || /\.pyo$/ ||
|
al@1048
|
1648 /\/fonts\.scale$/ || /\/fonts\.dir$/ || /\.la$/ {
|
al@1010
|
1649 tag("---", 0); next }
|
al@1010
|
1650 /\.pod$/ { tag("pod", 5); next }
|
al@1010
|
1651 /\/share\/man\// { tag("man", 5); next }
|
al@1010
|
1652 /\/share\/doc\// || /\/share\/gtk-doc\// || /\/share\/info\// ||
|
al@1010
|
1653 /\/share\/devhelp\// { tag("doc", 5); next }
|
al@1010
|
1654 /\/share\/icons\// { tag("ico", 2); next }
|
al@1010
|
1655 /\/share\/locale\// { tag("loc", 4); next }
|
al@1042
|
1656 /\.h$/ || /\.a$/ || /\.pc$/ || /\/bin\/.*-config$/ ||
|
al@1010
|
1657 /\/Makefile.*$/ { tag("dev", 3); next }
|
al@1010
|
1658 /\/share\/help\// || /\/share\/appdata\// { tag("gnm", 6); next }
|
al@1010
|
1659 { tag("???", 1) }
|
al@1010
|
1660 ' "$orphans" > $table
|
al@1010
|
1661
|
al@1010
|
1662 # Summary table
|
al@1010
|
1663 orphans_types='()'
|
al@1010
|
1664 for i in head body; do
|
al@1010
|
1665 case $i in
|
al@1010
|
1666 head) echo -n '<table class="summary"><tr>';;
|
al@1010
|
1667 body) echo -n '<th> </th></tr><tr>';;
|
al@1010
|
1668 esac
|
al@1010
|
1669 for j in '???1' dev3 loc4 ico2 doc5 man5 pod5 gnm6 '---0'; do
|
al@1010
|
1670 tag=${j:0:3}; class="c${j:3:1}0"; [ "$class" == 'c00' ] && class='c01'
|
al@1010
|
1671 case $i in
|
al@1010
|
1672 head) echo -n "<th class='$class'>$tag</th>";;
|
al@1010
|
1673 body)
|
al@1010
|
1674 tagscount="$(grep ">$tag<" $table | wc -l)"
|
al@1010
|
1675 printf '<td>%s</td>' "$tagscount"
|
al@1010
|
1676 [ "$tagscount" -gt 0 ] && orphans_types="${orphans_types/)/ $tag)}"
|
al@1010
|
1677 ;;
|
al@1010
|
1678 esac
|
al@1010
|
1679 done
|
al@1010
|
1680 done
|
al@1010
|
1681 echo '<td> </td></tr></table>'
|
al@1010
|
1682 orphans_types="${orphans_types/( /(}"
|
al@1010
|
1683 [ "$orphans_types" != '()' ] &&
|
al@1010
|
1684 echo "<script>document.getElementById('orphansTypes$set').innerText = '${orphans_types// /, }';</script>"
|
al@1010
|
1685
|
al@1011
|
1686 suffix=''; [ -n "$set" ] && suffix="-$set"
|
al@1010
|
1687 echo -n ' <pre class="files">'
|
al@1010
|
1688 echo -en '<span class="underline">tag·permissions·lnk·user ·group · size·date & time ·name\n</span>'
|
al@1010
|
1689 IFS=$'\n'
|
al@1010
|
1690 while read orphan_line; do
|
al@1010
|
1691 echo -n "${orphan_line/span> */span>} "
|
al@1011
|
1692 cd $install
|
al@1010
|
1693 ls -ldp --color=always ".${orphan_line#*</span> }" \
|
al@1010
|
1694 | syntax_highlighter files \
|
al@1010
|
1695 | sed "s|\([^>]*\)>\.\([^<]*\)\(<.*\)$|\1 href='$base/$main/browse/install$suffix\2'>\2\3|;" \
|
al@1010
|
1696 | awk 'BEGIN { FS="\""; }
|
al@1010
|
1697 { gsub("+", "%2B", $2); print; }'
|
al@1010
|
1698 done < $table
|
al@1010
|
1699 unset IFS
|
al@1010
|
1700 echo '</pre>'
|
al@1010
|
1701 echo '</section>'
|
al@1010
|
1702 rm $table
|
al@1010
|
1703 fi
|
al@1010
|
1704 rm $orphans
|
al@1010
|
1705 # ------------------------------------------------------
|
al@1010
|
1706 # /Unpackaged files
|
al@1010
|
1707 # ------------------------------------------------------
|
al@1010
|
1708
|
al@1010
|
1709 rm $all_files $packaged
|
al@1010
|
1710 ;;
|
al@912
|
1711 esac
|
al@1010
|
1712 done # /set
|
al@912
|
1713
|
al@1010
|
1714 case "$part" in
|
al@1010
|
1715 head)
|
al@1010
|
1716 [ -n "$splitsets" ] && echo "</ul>"
|
al@1010
|
1717 echo "</section>"
|
al@1010
|
1718 ;;
|
al@1010
|
1719 esac
|
al@1010
|
1720 done # /part
|
al@1010
|
1721
|
al@898
|
1722 ;;
|
al@898
|
1723
|
al@898
|
1724 description)
|
al@898
|
1725 page_header
|
al@898
|
1726 pkg_info
|
al@908
|
1727 descs="$(ls $WOK/$pkg/description*.txt)"
|
al@908
|
1728 if [ -n "$descs" ]; then
|
al@898
|
1729 echo '<div id="content2">'
|
al@908
|
1730 [ -f "$WOK/$pkg/description.txt" ] && show_desc "$pkg" "$WOK/$pkg/description.txt"
|
al@908
|
1731 for i in $descs; do
|
al@908
|
1732 case $i in
|
al@908
|
1733 */description.txt) continue ;;
|
al@908
|
1734 *) package=$(echo $i | cut -d. -f2) ;;
|
al@908
|
1735 esac
|
al@908
|
1736 show_desc "$package" "$i"
|
al@908
|
1737 done
|
al@898
|
1738 echo '</div>'
|
al@898
|
1739 else
|
al@898
|
1740 show_note w "No description of $pkg"
|
al@898
|
1741 fi
|
al@898
|
1742 ;;
|
al@898
|
1743
|
al@898
|
1744 log)
|
al@898
|
1745 page_header
|
al@898
|
1746 pkg_info
|
al@898
|
1747 [ -z "$arg" ] && arg=$(stat -c %Y $LOGS/$pkg.log)
|
al@898
|
1748
|
al@898
|
1749 echo '<div class="btnList">'
|
al@924
|
1750 acc='l' # access key for the latest log is 'L'
|
al@898
|
1751 while read log; do
|
al@924
|
1752 # for all $pkg.log, $pkg.log.0 .. $pkg.log.9, $pkg-pack.log (if any)
|
al@898
|
1753 timestamp=$(stat -c %Y $log)
|
al@898
|
1754 class=''
|
al@898
|
1755 if [ "$arg" == "$timestamp" ]; then
|
al@898
|
1756 class=' log'
|
al@898
|
1757 logfile="$log"
|
al@898
|
1758 fi
|
al@924
|
1759 case $log in *-pack.log) acc='p';; esac # access key for the packing log is 'P'
|
al@898
|
1760 echo -n "<a class='button$class' data-acc='$acc' accesskey='$acc' href='$base/$pkg/log/$timestamp'>"
|
al@898
|
1761 echo "$(stat -c %y $log | cut -d: -f1,2)</a>"
|
al@898
|
1762 case $acc in
|
al@898
|
1763 l) acc=0;;
|
al@898
|
1764 *) acc=$((acc+1));;
|
al@898
|
1765 esac
|
al@898
|
1766 done <<EOT
|
al@898
|
1767 $(find $LOGS -name "$pkg.log*" | sort)
|
al@924
|
1768 $(find $LOGS -name "$pkg-pack.log")
|
al@898
|
1769 EOT
|
al@898
|
1770 echo '</div>'
|
al@898
|
1771
|
al@898
|
1772 if [ -z "$logfile" ]; then
|
al@898
|
1773 show_note e "Requested log is absent"
|
al@898
|
1774 page_footer
|
al@898
|
1775 exit 0
|
al@898
|
1776 fi
|
al@898
|
1777
|
al@898
|
1778 # Define cook variables for syntax highlighter
|
al@898
|
1779 if [ -s "$WOK/$pkg/receipt" ]; then
|
al@898
|
1780 . "$WOK/$pkg/receipt"
|
al@898
|
1781 _wok='/home/slitaz/wok'
|
al@898
|
1782 _src="$_wok/$pkg/source/$PACKAGE-$VERSION"
|
al@898
|
1783 _install="$_wok/$pkg/install"
|
al@898
|
1784 _fs="$_wok/$pkg/taz/$PACKAGE-$VERSION/fs"
|
al@898
|
1785 _stuff="$_wok/$pkg/stuff"
|
al@898
|
1786 fi
|
al@898
|
1787
|
al@898
|
1788 # if [ ! -f "gzlog/$pkg.$arg" ]; then
|
al@898
|
1789 # {
|
al@898
|
1790 # summary "$logfile" links
|
al@898
|
1791 #
|
al@898
|
1792 # syntax_highlighter log < $logfile | awk '
|
al@898
|
1793 # BEGIN { print "<pre class=\"log\">"; }
|
al@898
|
1794 # { printf("<a name=\"l%d\" href=\"#l%d\">%5d</a> %s\n", NR, NR, NR, $0); }
|
al@898
|
1795 # END { print "</pre>"; }
|
al@898
|
1796 # '
|
al@898
|
1797 #
|
al@898
|
1798 # page_footer
|
al@898
|
1799 # } | gzip > gzlog/$pkg.$arg
|
al@898
|
1800 # fi
|
al@898
|
1801
|
al@898
|
1802 blog=$(basename $logfile)
|
al@898
|
1803 summary "$logfile" links
|
al@898
|
1804
|
al@898
|
1805 # disable next `sed` for the 'like2016' theme
|
al@898
|
1806 theme=$(COOKIE theme); theme=${theme:-default}; [ "$theme" != 'like2016' ] && theme=''
|
al@898
|
1807 cat $logfile | syntax_highlighter log | \
|
al@898
|
1808 sed -e "/(pkg\/local$theme):/ s|: \([^<]*\)|<img src='$base/i/$blog/\1'> \1|" | \
|
al@898
|
1809 awk '
|
al@898
|
1810 BEGIN { print "<pre class=\"log\">"; }
|
al@972
|
1811 { printf("<span id=\"l%d\">%s</span><a href=\"#l%d\"></a>\n", NR, $0, NR); }
|
al@898
|
1812 END { print "</pre>"; }
|
al@898
|
1813 '
|
al@898
|
1814 ;;
|
al@898
|
1815
|
al@898
|
1816
|
al@898
|
1817 man|doc|info)
|
al@898
|
1818 page_header
|
al@898
|
1819 pkg_info
|
al@898
|
1820 echo '<div style="max-height: 6.4em; overflow: auto; padding: 0 4px">'
|
al@898
|
1821
|
al@898
|
1822 dir="wok/$pkg/install/usr/share/$cmd"
|
al@898
|
1823 [ "$cmd" == 'doc' ] && dir="$dir wok/$pkg/install/usr/share/gtk-doc"
|
al@898
|
1824 if [ "$cmd" == 'doc' -a -z "$arg" ]; then
|
al@898
|
1825 try=$(for i in $dir; do find $i -name 'index.htm*'; done | sed q)
|
al@898
|
1826 [ -n "$try" ] && arg="$try"
|
al@898
|
1827 fi
|
al@898
|
1828 while read i; do
|
al@898
|
1829 [ -s "$i" ] || continue
|
al@898
|
1830 case "$i" in
|
al@898
|
1831 *.jp*g|*.png|*.gif|*.svg|*.css) continue
|
al@898
|
1832 esac
|
al@898
|
1833 i=${i#$dir/}
|
al@898
|
1834 [ -n "$arg" ] || arg="$i"
|
al@898
|
1835 class=''; [ "$arg" == "$i" ] && class=" doc"
|
al@898
|
1836 case "$cmd" in
|
al@898
|
1837 man)
|
al@898
|
1838 case $i in
|
al@898
|
1839 man*) lang='';;
|
al@898
|
1840 *) lang="${i%%/*}: ";;
|
al@898
|
1841 esac
|
al@898
|
1842 man=$(basename $i .gz)
|
al@898
|
1843 echo "<a class='button$class' href='$base/$pkg/man/$i'>$lang${man%.*} (${man##*.})</a>"
|
al@898
|
1844 ;;
|
al@898
|
1845 doc)
|
al@898
|
1846 echo "<a class='button$class' href='$base/$pkg/doc/$i'>$(basename $i .gz)</a>"
|
al@898
|
1847 ;;
|
al@898
|
1848 info)
|
al@898
|
1849 info=$(basename $i)
|
al@898
|
1850 echo "<a class='button$class' href='$base/$pkg/info/$i#Top'>${info/.info/}</a>"
|
al@898
|
1851 ;;
|
al@898
|
1852 esac
|
al@898
|
1853 done <<EOT
|
al@898
|
1854 $(for i in $dir; do find $i -type f; done | sort)
|
al@898
|
1855 EOT
|
al@898
|
1856 echo '</div>'
|
al@898
|
1857
|
al@898
|
1858 [ -f "$arg" ] || arg="$dir/$arg"
|
al@898
|
1859 if [ -f "$arg" ]; then
|
al@898
|
1860 tmp="$(mktemp)"
|
al@898
|
1861 docat "$arg" > $tmp
|
al@898
|
1862 [ -s "$tmp" ] &&
|
al@898
|
1863 case "$cmd" in
|
al@898
|
1864 info)
|
al@898
|
1865 echo '<div id="content2" class="texinfo"><pre class="first">'
|
al@898
|
1866 info2html < "$tmp"
|
al@898
|
1867 echo '</pre></div>'
|
al@898
|
1868 ;;
|
al@898
|
1869 doc)
|
al@898
|
1870 case "$arg" in
|
al@898
|
1871 *.sgml|*.devhelp2) class='xml';;
|
al@898
|
1872 *.py) class='python';; # pycurl package
|
al@898
|
1873 *.css) class='css';;
|
al@976
|
1874 *.sh) class='bash';;
|
al@976
|
1875 *)
|
al@976
|
1876 first=$(head -n1 "$tmp")
|
al@976
|
1877 if [ "${first:0:1}" == '#' ]; then
|
al@976
|
1878 class='bash' # first line begins with '#'
|
al@976
|
1879 else
|
al@976
|
1880 class='asciidoc'
|
al@976
|
1881 fi;;
|
al@898
|
1882 esac
|
al@898
|
1883 case "$arg" in
|
al@898
|
1884 *.htm*)
|
al@898
|
1885 case $arg in
|
al@898
|
1886 wok/*) page="${arg#wok/}"; page="$base/$pkg/browse/${page#*/}";;
|
al@898
|
1887 *) page="$base/$pkg/browse/install/usr/share/$cmd/$arg";;
|
al@898
|
1888 esac
|
paul@929
|
1889 # make the iframe height so long to contain its contents without scrollbar
|
al@898
|
1890 echo "<iframe id='idoc' src='$page' width='100%' onload='resizeIframe(this)'></iframe>"
|
al@898
|
1891 ;;
|
al@898
|
1892 *.pdf)
|
al@898
|
1893 case $arg in
|
al@898
|
1894 wok/*) page="${arg#wok/}"; page="$base/$pkg/browse/${page#*/}";;
|
al@898
|
1895 *) page="$base/$pkg/browse/install/usr/share/$cmd/$arg";;
|
al@898
|
1896 esac
|
al@898
|
1897 cat <<EOT
|
al@898
|
1898 <object id="idoc" data="$page" width="100%" height="100%" type="application/pdf" style="min-height: 600px">
|
al@898
|
1899 $(show_note w "Missing PDF plugin.<br/>Get the file <a href="$page">$(basename "$page")</a>.")
|
al@898
|
1900 </object>
|
al@898
|
1901 EOT
|
al@898
|
1902 ;;
|
al@958
|
1903 *.md|*.markdown)
|
al@958
|
1904 echo '<section>'
|
al@958
|
1905 $md2html "$tmp"
|
al@958
|
1906 echo '</section>'
|
al@958
|
1907 ;;
|
al@898
|
1908 *)
|
al@898
|
1909 show_code $class < "$tmp"
|
al@898
|
1910 ;;
|
al@898
|
1911 esac
|
al@898
|
1912 ;;
|
al@898
|
1913 man)
|
al@898
|
1914 #export TEXTDOMAIN='man2html'
|
al@898
|
1915 echo "<div id='content2'>"
|
al@898
|
1916
|
al@1002
|
1917 html=$(./man2html.bin "$tmp" | sed -e '1,/<header>/d' -e '/<footer>/,$d' \
|
al@898
|
1918 -e 's|<a href="file:///[^>]*>\([^<]*\)</a>|\1|g' \
|
al@898
|
1919 -e 's|<a href="?[1-9]\+[^>]*>\([^<]*\)</a>|\1|g')
|
al@898
|
1920
|
al@898
|
1921 if [ -n "$(echo "$html" | fgrep 'The requested file /tmp/tmp.')" ]; then
|
al@898
|
1922 # Process the pre-formatted man-cat page
|
al@912
|
1923 # (for example see sudo package without groff in build dependencies)
|
al@912
|
1924 sed -i '
|
al@898
|
1925 s|M-bM-^@M-^S|—|g;
|
al@898
|
1926 s|M-bM-^@M-^\\|<b>|g;
|
al@898
|
1927 s|M-bM-^@M-^]|</b>|g
|
al@898
|
1928 s|M-bM-^@M-^X|<u>|g;
|
al@898
|
1929 s|M-bM-^@M-^Y|</u>|g;
|
al@898
|
1930 s|M-BM-||g;
|
al@912
|
1931 s|++oo|•|g;
|
al@912
|
1932 s|&|\&|g; s|<|\<|g; s|>|\>|g;
|
al@898
|
1933 ' "$tmp"
|
al@912
|
1934 for i in a b c d e f g h i j k l m n o p q r s t u v w x y z \
|
al@912
|
1935 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z \
|
al@912
|
1936 0 1 2 3 4 5 6 7 8 9 _ - '\\+' '\.' /; do
|
al@912
|
1937 sed -i "s|$i$i|<b>$i</b>|g; s|_$i|<u>$i</u>|g" "$tmp"
|
al@912
|
1938 done
|
al@912
|
1939 echo '<pre class="catman">'
|
al@912
|
1940 sed 's|</b><b>||g; s|</u><u>||g; s|</u><b>_</b><u>|_|g; s|</b> <b>| |g;' "$tmp"
|
al@898
|
1941 echo '</pre>'
|
al@898
|
1942 else
|
al@898
|
1943 echo "$html"
|
al@898
|
1944 fi
|
al@898
|
1945 echo "</div>"
|
al@898
|
1946 ;;
|
al@898
|
1947 esac
|
al@898
|
1948 rm -f $tmp
|
al@898
|
1949 else
|
paul@1006
|
1950 show_note e "File “$arg” does not exist!"
|
al@898
|
1951 fi
|
al@898
|
1952 ;;
|
al@898
|
1953
|
al@924
|
1954 download)
|
al@924
|
1955 page_header
|
al@924
|
1956 pkg_info
|
al@924
|
1957 show=0
|
al@924
|
1958
|
al@924
|
1959 . $wok/$pkg/receipt
|
al@924
|
1960
|
al@924
|
1961 if [ -n "$TARBALL" -a -s "$SRC/$TARBALL" ]; then
|
al@924
|
1962 files_header
|
al@924
|
1963 echo "<tr><td><a href='$base/src/$TARBALL'>$TARBALL</a></td>"
|
al@924
|
1964 ls -lh "$SRC/$TARBALL" | awk '{printf("<td>%sB</td>", $5)}'
|
al@924
|
1965 echo "<td>Sources for building the package “$pkg”</td></tr>"
|
al@924
|
1966 show=1
|
al@924
|
1967 fi
|
al@924
|
1968
|
al@924
|
1969 if [ -d "$wok/$pkg/taz" ]; then
|
al@924
|
1970 [ "$show" -eq 1 ] || files_header
|
al@924
|
1971
|
al@924
|
1972 for i in $(all_names); do
|
al@924
|
1973 [ -e "$wok/$pkg/taz/$i-$VERSION$EXTRAVERSION/receipt" ] || continue
|
al@924
|
1974 . $wok/$pkg/taz/$i-$VERSION$EXTRAVERSION/receipt
|
al@924
|
1975
|
al@924
|
1976 for filename in "$PACKAGE-$VERSION$EXTRAVERSION.tazpkg" "$PACKAGE-$VERSION$EXTRAVERSION-$ARCH.tazpkg"; do
|
al@924
|
1977 [ -f "$PKGS/$filename" ] &&
|
al@924
|
1978 cat <<EOT
|
al@924
|
1979 <tr>
|
al@924
|
1980 <td><a href="$base/get/$filename">$filename</a></td>
|
al@924
|
1981 <td>$(ls -lh ./packages/$filename | awk '{printf("%sB", $5)}')</td>
|
al@924
|
1982 <td>$SHORT_DESC</td>
|
al@924
|
1983 </tr>
|
al@924
|
1984 EOT
|
al@924
|
1985 done
|
al@924
|
1986 done
|
al@924
|
1987 show=1
|
al@924
|
1988 fi
|
al@924
|
1989
|
al@924
|
1990 if [ "$show" -eq 1 ]; then
|
al@924
|
1991 echo '</tbody></table></section>'
|
al@924
|
1992 else
|
al@924
|
1993 show_note w "Sorry, there's nothing to download…"
|
al@924
|
1994 fi
|
al@924
|
1995 ;;
|
al@924
|
1996
|
al@898
|
1997 esac
|
al@898
|
1998
|
al@898
|
1999
|
al@898
|
2000 page_footer
|
al@898
|
2001 exit 0
|