tazpanel view live.cgi @ rev 77

live.cgi: add loram tool
author Pascal Bellard <pascal.bellard@slitaz.org>
date Tue Apr 12 21:22:41 2011 +0200 (2011-04-12)
parents 730f8bcacabc
children 73c42017a5a2
line source
1 #!/bin/sh
2 #
3 # CGI interface for SliTaz Live systems using Tazlito and TazUSB.
4 #
5 # Copyright (C) 2011 SliTaz GNU/Linux - GNU gpl v3
6 #
9 . /usr/bin/httpd_helper.sh
11 header
13 # Common functions from libtazpanel
14 . lib/libtazpanel
15 get_config
17 # Include gettext helper script.
18 . /usr/bin/gettext.sh
20 # Export package name for gettext.
21 TEXTDOMAIN='tazpanel'
22 export TEXTDOMAIN
24 TITLE="- Live"
26 #
27 # Commands executed in Xterm first
28 #
30 case " $(GET) " in
31 *\ write-iso\ *)
32 comp=${QUERY_STRING#write-iso=}
33 $TERMINAL $TERM_OPTS \
34 -T "write-iso" \
35 -e "tazlito writeiso $comp" & ;;
36 *\ gen-liveusb\ *)
37 dev=`httpd -d ${QUERY_STRING#gen-liveusb=}`
38 $TERMINAL $TERM_OPTS \
39 -T "Tazusb gen-liveusb" \
40 -e "tazusb gen-liveusb $dev; \
41 gettext \"ENTER to quit\"; read i" & ;;
42 *\ loramoutput\ *)
43 $TERMINAL $TERM_OPTS \
44 -T "build loram iso" \
45 -e "tazlito build-loram $(GET input) $(GET loramoutput) $(GET type)" & ;;
46 esac
48 #
49 # Commands
50 #
52 case "$QUERY_STRING" in
53 create)
54 #
55 # Create a flavor file and ISO in options with all settings
56 # Step by step interface and store files in cache.
57 #
58 gettext "TODO" ;;
59 *)
60 #
61 # Default xHTML content
62 #
63 xhtml_header
64 cat << EOT
65 <div id="wrapper">
66 <h2>`gettext "SliTaz Live Systems"`</h2>
67 <p>`gettext "Create and manage Live CD or USB SliTaz systems"`<p>
68 </div>
70 <a name="liveusb"></a>
71 <h3>`gettext "Live USB"`</h3>
72 <p>
73 `gettext "Generate SliTaz LiveUSB media and boot in RAM! Insert a
74 LiveCD into the cdrom drive, select the correct device and press
75 Generate."`
76 </p>
77 <form method="get" action="$SCRIPT_NAME">
78 `gettext "USB Media to use:"`
79 <select name="gen-liveusb">
80 EOT
81 # List disk if plugged USB device
82 if [ -d /proc/scsi/usb-storage ]; then
83 for i in `blkid | cut -d ":" -f 1`; do
84 echo "<option value='$i'>$i</option>"
85 done
86 else
87 echo "<option value="">"`gettext "Not found"`"</option>"
88 fi
89 cat << EOT
90 </select>
91 <input type="submit" value="`gettext "Generate"`" />
92 </form>
94 <a name="livecd"></a>
95 <h3>`gettext "Write a Live CD"`</h3>
96 <p>
97 `gettext "The command writeiso will generate an ISO image of the
98 current filesystem as is, including all files in the /home directory.
99 It is an easy way to remaster a SliTaz Live system, you just have
100 to: boot, modify, writeiso."`
101 </p>
102 <form method="get" action="$SCRIPT_NAME">
103 `gettext "Compression type:"`
104 <select name="write-iso">
105 <option value="gzip">gzip</option>
106 <option value="lzma">lzma</option>
107 <option value="none">none</option>
108 </select>
109 <input type="submit" value="`gettext "Write ISO"`" />
110 </form>
112 <h3>`gettext "Live CD tools"`</h3>
113 <a name="loram"></a>
114 <h4>`gettext "Convert ISO to loram"`</h4>
115 <p>
116 `gettext "This command will convert an ISO image of a SliTaz Live CD
117 to a new ISO image requiring less RAM to run."`
118 </p>
119 <form method="get" action="$SCRIPT_NAME#loram">
120 <table>
121 <tr>
122 <td>`gettext "ISO to convert"`
123 <input type="text" name="input" value="/root/" /></td>
124 </tr>
125 <tr>
126 <td><input type="radio" name="type" value="ram" checked />`gettext "The filesystem is always in RAM"`.</td>
127 </tr>
128 <tr>
129 <td><input type="radio" name="type" value="smallcdrom" />`gettext "The filesystem may be on a small CDROM"`.</td>
130 </tr>
131 <tr>
132 <td><input type="radio" name="type" value="cdrom" />`gettext "The filesystem may be on a large CDROM"`.</td>
133 </tr>
134 <tr>
135 <td>`gettext "ISO to create"`
136 <input type="text" name="loramoutput" value="/root/loram.iso" /></td>
137 </tr>
138 </table>
139 <input type="submit" value="`gettext "Convert ISO to loram"`" />
140 </form>
142 EOT
143 ;;
144 esac
146 xhtml_footer
147 exit 0