seb view tools/web/seb.cgi @ rev 28

Improve web/gui and use new tazweb --small
author Christophe Lincoln <pankso@slitaz.org>
date Tue Mar 14 22:05:35 2017 +0100 (2017-03-14)
parents 0fd432698aaf
children
line source
1 #!/bin/sh
2 #
3 # seb.cgi: SliTaz Embedded Builder CGI interface. Invoking seb to build
4 # a custom OS in the current dir or the one set in the work= config variable.
5 # The webserver must be run by root, so we use Busybox httpd to serve on
6 # a custom port and for localhost only (see seb httpd.conf).
7 #
8 # Example: # cd path/to/os; seb -w
9 #
10 . /usr/lib/slitaz/httphelper.sh
11 header
13 . /lib/libseb.sh
14 work="$(pwd)"
15 packages="/usr/share/seb/packages"
16 export output=html
18 # Everything preformatted for a cmdline style output
19 cat << EOT
20 <!DOCTYPE html>
21 <html>
22 <head>
23 <meta charset="utf-8" />
24 <title>SliTaz Embedded Builder</title>
25 <style type="text/css">
26 h1 { color: #888; font-size: 140%; } .info { color: #800057; }
27 hr { border: 1px solid #ddd; } .pkg { color: #800057; padding: 0 20px 0 0; }
28 </style>
29 </head>
30 <h1>SliTaz Embedded Builder</h1>
31 <pre>
32 <a href="./seb.cgi">Summary</a> \
33 <a href="./seb.cgi?build">Build</a> \
34 <a href="./seb.cgi?packages">Packages</a> \
35 <a href="./seb.cgi?emulate">Emulate</a> \
36 <a href="./seb.cgi?debug">Debug</a> \
37 <a href="./seb.cgi?help">Help</a>
39 EOT
41 case " $(GET) " in
43 *\ help\ *) seb | sed '1,2d' ;;
44 *\ build\ *) seb -b ;;
45 *\ emulate\ *) seb -e ;;
46 *\ debug\ *) seb env; seb testsuite ;;
47 *\ packages\ *)
48 title "Seb packages"
49 IFS=":"
50 echo "<table>"
51 ls ${packages} | while read pkg; do
52 . ${packages}/${pkg}
53 echo "<tr><td class='pkg'>$pkg</td><td>$desc</td></tr>"
54 done; unset IFS
55 echo "</table><hr />" ;;
57 *)
58 title "Seb summary"
59 echo "Work path : <span class='info'>$work</span>"
60 if [ -d "$work/rootfs" ]; then
61 cat << EOT
62 Rootfs size : <span class='info'>$(du -sh $work/rootfs | awk '{print $1}')</span>
63 Rootiso size : <span class='info'>$(du -sh $work/rootiso | awk '{print $1}')</span>
64 EOT
65 else
66 echo "Seb OS : Not built yet!"
67 fi; footer ;;
68 esac
70 cat << EOT
71 </pre>
72 </body>
73 </html>
74 EOT
75 exit 0