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

Tiny edits
author Paul Issott <paul@slitaz.org>
date Sun Mar 12 14:02:57 2017 +0000 (2017-03-12)
parents 33333de28e73
children ad9ff08f754a
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 work="$(pwd)"
14 export output=html
15 . /lib/libseb.sh
17 # Everything preformatted for a cmdline style output
18 cat << EOT
19 <!DOCTYPE html>
20 <html>
21 <head>
22 <meta charset="utf-8" />
23 <title>SliTaz Embedded Builder</title>
24 <style type="text/css">
25 h1 { color: #aaa; font-size: 140%; } .info { color: #800057; }
26 hr { border: 1px solid #ddd; }
27 </style>
28 </head>
29 <h1>SliTaz Embedded Builder</h1>
30 <pre>
31 <a href="./seb.cgi">Summary</a> \
32 <a href="./seb.cgi?build">Build</a> \
33 <a href="./seb.cgi?packages">Packages</a> \
34 <a href="./seb.cgi?emulate">Emulate</a> \
35 <a href="./seb.cgi?debug">Debug</a> \
36 <a href="./seb.cgi?help">Help</a>
38 EOT
40 case " $(GET) " in
42 *\ help\ *) seb | sed '1,2d' ;;
43 *\ build\ *) seb -b ;;
44 *\ packages\ *) seb -p ;;
45 *\ emulate\ *) seb -e ;;
46 *\ debug\ *) seb env; seb testsuite ;;
48 *)
49 echo "Work path : <span class='info'>$work</span>"
50 if [ -d "$work/rootfs" ]; then
51 cat << EOT
52 Rootfs size : <span class='info'>$(du -sh $work/rootfs | awk '{print $1}')</span>
53 Rootiso size : <span class='info'>$(du -sh $work/rootiso | awk '{print $1}')</span>
54 EOT
55 else
56 echo "Seb OS : Not built yet!"
57 fi ;;
58 esac
60 cat << EOT
61 </pre>
62 </body>
63 </html>
64 EOT
65 exit 0