tazpanel annotate live.cgi @ rev 238
network.cgi: Add Wifi connection form
author | Christophe Lincoln <pankso@slitaz.org> |
---|---|
date | Tue Feb 28 12:00:50 2012 +0100 (2012-02-28) |
parents | 7855bd81abb7 |
children | 42a96c3bc97e |
rev | line source |
---|---|
pankso@24 | 1 #!/bin/sh |
pankso@24 | 2 # |
pankso@24 | 3 # CGI interface for SliTaz Live systems using Tazlito and TazUSB. |
pankso@24 | 4 # |
pankso@112 | 5 # Copyright (C) 2011 SliTaz GNU/Linux - BSD License |
pankso@49 | 6 # |
pascal@77 | 7 |
pascal@78 | 8 if [ "$1" == "call" ]; then |
pascal@78 | 9 case "$2" in |
pascal@78 | 10 merge_cleanup) |
pascal@78 | 11 mv -f $3.merged $3 |
pascal@78 | 12 for i in $4/*; do |
pascal@78 | 13 umount -d $i |
pascal@78 | 14 done |
pascal@78 | 15 rm -rf $4 |
pascal@78 | 16 exit ;; |
pascal@78 | 17 esac |
pascal@78 | 18 fi |
pascal@77 | 19 |
pankso@24 | 20 # Common functions from libtazpanel |
pankso@24 | 21 . lib/libtazpanel |
pankso@24 | 22 get_config |
pascal@81 | 23 header |
pankso@24 | 24 |
pankso@25 | 25 TITLE="- Live" |
pankso@25 | 26 |
pascal@78 | 27 # Build arguments to create a meta iso using 'tazlito merge' command |
pascal@78 | 28 merge_args() |
pascal@78 | 29 { |
pascal@78 | 30 tmp=$1 |
pascal@78 | 31 first=true |
pascal@78 | 32 i=1 |
pascal@78 | 33 while [ -n "$(GET input$i)" ]; do |
pascal@78 | 34 echo "$(stat -c "%s" $(GET input$i)) $(GET input$i) $(GET ram$i)" |
pascal@78 | 35 $((i++)) |
pascal@78 | 36 done | sort -nr | while read size file ram; do |
pascal@78 | 37 if $first; then |
pascal@78 | 38 cp $file $(GET metaoutput) |
pascal@78 | 39 echo -n "$ram $(GET metaoutput) " |
pascal@78 | 40 first=false |
pascal@78 | 41 continue |
pascal@78 | 42 fi |
pascal@78 | 43 dir=$tmp/$(basename $file) |
pascal@78 | 44 mkdir $dir |
pascal@78 | 45 mount -o loop,ro $file $dir |
pascal@78 | 46 echo -n "$ram $dir/boot/rootfs.gz " |
pascal@78 | 47 done |
pascal@78 | 48 } |
pascal@78 | 49 |
pankso@24 | 50 # |
pankso@29 | 51 # Commands executed in Xterm first |
pankso@29 | 52 # |
pankso@29 | 53 |
pascal@77 | 54 case " $(GET) " in |
pascal@81 | 55 *\ write_iso\ *) |
pankso@49 | 56 $TERMINAL $TERM_OPTS \ |
pankso@30 | 57 -T "write-iso" \ |
pascal@81 | 58 -e "tazlito writeiso $(GET write_iso)" & ;; |
pascal@81 | 59 *\ gen_liveusb\ *) |
pankso@49 | 60 $TERMINAL $TERM_OPTS \ |
pankso@30 | 61 -T "Tazusb gen-liveusb" \ |
pascal@81 | 62 -e "tazusb gen-liveusb $(GET gen_liveusb); \ |
pankso@30 | 63 gettext \"ENTER to quit\"; read i" & ;; |
pascal@77 | 64 *\ loramoutput\ *) |
pascal@77 | 65 $TERMINAL $TERM_OPTS \ |
pascal@77 | 66 -T "build loram iso" \ |
pascal@77 | 67 -e "tazlito build-loram $(GET input) $(GET loramoutput) $(GET type)" & ;; |
pascal@78 | 68 *\ meta\ *) |
pascal@78 | 69 tmp=/tmp/$(basename $0).$$ |
pascal@78 | 70 cleanup="sh $0 call merge_cleanup $(GET output) $tmp" |
pascal@78 | 71 $TERMINAL $TERM_OPTS \ |
pascal@78 | 72 -T "build meta iso" \ |
pascal@78 | 73 -e "tazlito merge $(merge_args $tmp); \ |
pascal@78 | 74 gettext \"ENTER to quit\"; read i; \ |
pascal@78 | 75 $cleanup" & ;; |
pankso@29 | 76 esac |
pankso@29 | 77 |
pankso@29 | 78 # |
pankso@24 | 79 # Commands |
pankso@24 | 80 # |
pankso@24 | 81 |
pascal@81 | 82 case " $(GET) " in |
pascal@81 | 83 *\ create\ *) |
pankso@29 | 84 # |
paul@52 | 85 # Create a flavor file and ISO in options with all settings |
pankso@49 | 86 # Step by step interface and store files in cache. |
pankso@29 | 87 # |
pankso@29 | 88 gettext "TODO" ;; |
pankso@24 | 89 *) |
pankso@24 | 90 # |
pankso@24 | 91 # Default xHTML content |
pankso@24 | 92 # |
pankso@24 | 93 xhtml_header |
pankso@24 | 94 cat << EOT |
pankso@24 | 95 <div id="wrapper"> |
pankso@25 | 96 <h2>`gettext "SliTaz Live Systems"`</h2> |
pankso@24 | 97 <p>`gettext "Create and manage Live CD or USB SliTaz systems"`<p> |
pankso@24 | 98 </div> |
pankso@24 | 99 |
pascal@77 | 100 <a name="liveusb"></a> |
pankso@30 | 101 <h3>`gettext "Live USB"`</h3> |
pankso@30 | 102 <p> |
pankso@30 | 103 `gettext "Generate SliTaz LiveUSB media and boot in RAM! Insert a |
pankso@30 | 104 LiveCD into the cdrom drive, select the correct device and press |
pankso@30 | 105 Generate."` |
pankso@30 | 106 </p> |
pankso@30 | 107 <form method="get" action="$SCRIPT_NAME"> |
pankso@30 | 108 `gettext "USB Media to use:"` |
pascal@81 | 109 <select name="gen_liveusb"> |
pankso@30 | 110 EOT |
paul@205 | 111 # List disk if there is a plugged USB device |
pankso@30 | 112 if [ -d /proc/scsi/usb-storage ]; then |
pankso@30 | 113 for i in `blkid | cut -d ":" -f 1`; do |
pankso@30 | 114 echo "<option value='$i'>$i</option>" |
pankso@30 | 115 done |
pankso@30 | 116 else |
pankso@30 | 117 echo "<option value="">"`gettext "Not found"`"</option>" |
pankso@30 | 118 fi |
pankso@30 | 119 cat << EOT |
pankso@30 | 120 </select> |
paul@52 | 121 <input type="submit" value="`gettext "Generate"`" /> |
pankso@30 | 122 </form> |
pankso@30 | 123 |
pascal@77 | 124 <a name="livecd"></a> |
pascal@77 | 125 <h3>`gettext "Write a Live CD"`</h3> |
pascal@77 | 126 <p> |
pascal@77 | 127 `gettext "The command writeiso will generate an ISO image of the |
pascal@77 | 128 current filesystem as is, including all files in the /home directory. |
pascal@77 | 129 It is an easy way to remaster a SliTaz Live system, you just have |
pascal@77 | 130 to: boot, modify, writeiso."` |
pascal@77 | 131 </p> |
pascal@77 | 132 <form method="get" action="$SCRIPT_NAME"> |
pascal@77 | 133 `gettext "Compression type:"` |
pascal@81 | 134 <select name="write_iso"> |
pascal@77 | 135 <option value="gzip">gzip</option> |
pascal@77 | 136 <option value="lzma">lzma</option> |
pascal@77 | 137 <option value="none">none</option> |
pascal@77 | 138 </select> |
pascal@77 | 139 <input type="submit" value="`gettext "Write ISO"`" /> |
pascal@77 | 140 </form> |
pascal@77 | 141 |
pascal@77 | 142 <h3>`gettext "Live CD tools"`</h3> |
pascal@77 | 143 <a name="loram"></a> |
pascal@77 | 144 <h4>`gettext "Convert ISO to loram"`</h4> |
pascal@77 | 145 <p> |
pascal@77 | 146 `gettext "This command will convert an ISO image of a SliTaz Live CD |
pascal@77 | 147 to a new ISO image requiring less RAM to run."` |
pascal@77 | 148 </p> |
pascal@77 | 149 <form method="get" action="$SCRIPT_NAME#loram"> |
pascal@77 | 150 <table> |
pascal@77 | 151 <tr> |
pascal@77 | 152 <td>`gettext "ISO to convert"` |
pascal@77 | 153 <input type="text" name="input" value="/root/" /></td> |
pascal@77 | 154 </tr> |
pascal@77 | 155 <tr> |
pascal@77 | 156 <td><input type="radio" name="type" value="ram" checked />`gettext "The filesystem is always in RAM"`.</td> |
pascal@77 | 157 </tr> |
pascal@77 | 158 <tr> |
pascal@77 | 159 <td><input type="radio" name="type" value="smallcdrom" />`gettext "The filesystem may be on a small CDROM"`.</td> |
pascal@77 | 160 </tr> |
pascal@77 | 161 <tr> |
pascal@77 | 162 <td><input type="radio" name="type" value="cdrom" />`gettext "The filesystem may be on a large CDROM"`.</td> |
pascal@77 | 163 </tr> |
pascal@77 | 164 <tr> |
pascal@77 | 165 <td>`gettext "ISO to create"` |
pascal@77 | 166 <input type="text" name="loramoutput" value="/root/loram.iso" /></td> |
pascal@77 | 167 </tr> |
pascal@77 | 168 </table> |
pascal@77 | 169 <input type="submit" value="`gettext "Convert ISO to loram"`" /> |
pascal@77 | 170 </form> |
pascal@77 | 171 |
pascal@78 | 172 <a name="meta"></a> |
paul@82 | 173 <h4>`gettext "Build a meta ISO"`</h4> |
pascal@78 | 174 <p> |
pascal@78 | 175 `gettext "Combines several ISO flavors like nested Russian dolls. |
pascal@78 | 176 The amount of RAM available at startup will be used to select the |
pascal@78 | 177 utmost one."` |
pascal@78 | 178 </p> |
pascal@78 | 179 <form method="get" action="$SCRIPT_NAME#meta"> |
pascal@78 | 180 <table> |
pascal@78 | 181 EOT |
pascal@78 | 182 i="" |
pascal@78 | 183 while [ -n "$(GET addmeta)" ]; do |
pascal@78 | 184 [ -n "$(GET input$i)" ] || break |
pascal@78 | 185 j=$(($i + 1)) |
pascal@78 | 186 cat << EOT |
pascal@78 | 187 <tr> |
pascal@78 | 188 <td>`gettext "ISO number"` $j: $(GET input$i) |
pascal@78 | 189 <input type="hidden" name="input$j" value="$(GET input$i)" /></td> |
paul@127 | 190 <td>`gettext "Minimum RAM"`: $(GET ram$i) |
pascal@78 | 191 <input type="hidden" name="ram$j" value="$(GET ram$i)" /></td> |
pascal@78 | 192 </tr> |
pascal@78 | 193 EOT |
pascal@78 | 194 i=$j |
pascal@78 | 195 done |
pascal@78 | 196 metaoutput="$(GET metaoutput)" |
pascal@78 | 197 [ -n "$metaoutput" ] || metaoutput="/root/meta.iso" |
pascal@78 | 198 |
pascal@78 | 199 cat << EOT |
pascal@78 | 200 <tr> |
pascal@78 | 201 <td>`gettext "ISO to add"` |
pascal@78 | 202 <input type="text" name="input" value="/root/" /></td> |
paul@127 | 203 <td>`gettext "Minimum RAM"` |
pascal@78 | 204 <input type="text" name="ram" value="128M" /> |
pascal@78 | 205 <input type="submit" name="addmeta" value="`gettext "Add to the list"`" /></td> |
pascal@78 | 206 </tr> |
pascal@78 | 207 <tr> |
pascal@78 | 208 <td>`gettext "ISO to create"` |
pascal@78 | 209 <input type="text" name="metaoutput" value="$metaoutput" /></td> |
pascal@78 | 210 </tr> |
pascal@78 | 211 </table> |
pascal@78 | 212 <input type="submit" name="meta" value="`gettext "Build a meta ISO"`" /> |
pascal@78 | 213 </form> |
pascal@78 | 214 |
pankso@24 | 215 EOT |
pankso@24 | 216 ;; |
pankso@24 | 217 esac |
pankso@24 | 218 |
pankso@24 | 219 xhtml_footer |
pankso@24 | 220 exit 0 |