tazpanel annotate floppy.cgi @ rev 527
Add hosts.cgi; update translations
author | Aleksej Bobylev <al.bobylev@gmail.com> |
---|---|
date | Wed Aug 26 05:51:08 2015 +0300 (2015-08-26) |
parents | |
children | 551a881b8292 |
rev | line source |
---|---|
pascal@516 | 1 #!/bin/sh |
pascal@516 | 2 # |
pascal@516 | 3 # Floppy set CGI interface |
pascal@516 | 4 # |
pascal@516 | 5 # Copyright (C) 2015 SliTaz GNU/Linux - BSD License |
pascal@516 | 6 # |
pascal@516 | 7 |
pascal@516 | 8 # Common functions from libtazpanel |
pascal@516 | 9 . lib/libtazpanel |
pascal@516 | 10 get_config |
pascal@516 | 11 |
pascal@516 | 12 |
pascal@516 | 13 case "$1" in |
pascal@516 | 14 menu) |
pascal@516 | 15 TEXTDOMAIN_original=$TEXTDOMAIN |
pascal@516 | 16 export TEXTDOMAIN='floppy' |
pascal@516 | 17 |
pascal@516 | 18 #which bootloader > /dev/null && |
pascal@516 | 19 cat <<EOT |
pascal@516 | 20 <li><a data-icon="slitaz" href="floppy.cgi">$(_ 'Boot floppy')</a></li> |
pascal@516 | 21 EOT |
pascal@516 | 22 export TEXTDOMAIN=$TEXTDOMAIN_original |
pascal@516 | 23 exit |
pascal@516 | 24 esac |
pascal@516 | 25 |
pascal@516 | 26 |
pascal@516 | 27 # |
pascal@516 | 28 # Commands |
pascal@516 | 29 # |
pascal@516 | 30 |
pascal@516 | 31 error= |
pascal@516 | 32 case " $(POST) " in |
pascal@516 | 33 *\ doformat\ *) |
pascal@516 | 34 fdformat $(POST fd) |
pascal@516 | 35 which mkfs.$(POST fstype) > /dev/null 2>&1 && |
pascal@516 | 36 mkfs.$(POST fstype) $(POST fd) |
pascal@516 | 37 ;; |
pascal@516 | 38 *\ write\ *) |
pascal@516 | 39 if [ "$(FILE fromimage tmpname)" ]; then |
pascal@516 | 40 dd if=$(FILE fromimage tmpname) of=$(POST tofd) |
pascal@516 | 41 rm -f $(FILE fromimage tmpname) |
pascal@516 | 42 else |
pascal@516 | 43 error="$(msg err 'Broken FILE support')" |
pascal@516 | 44 fi ;; |
pascal@516 | 45 *\ read\ *) |
pascal@516 | 46 dd if=$(POST fromfd) of=$(POST toimage) |
pascal@516 | 47 ;; |
pascal@516 | 48 *\ build\ *) |
pascal@516 | 49 cmd="" |
pascal@516 | 50 toremove="" |
pascal@516 | 51 while read key file ; do |
pascal@516 | 52 [ "$(FILE $file size)" ] || continue |
pascal@516 | 53 for i in $(seq 1 $(FILE $file count)); do |
pascal@516 | 54 cmd="$cmd $key $(FILE $file tmpname $i)" |
pascal@516 | 55 toremove="$toremove $(FILE $file tmpname $i)" |
pascal@516 | 56 done |
pascal@516 | 57 done <<EOT |
pascal@516 | 58 bootloader kernel |
pascal@516 | 59 --initrd initrd |
pascal@516 | 60 --initrd initrd2 |
pascal@516 | 61 --info info |
pascal@516 | 62 EOT |
pascal@516 | 63 error="$(msg err 'Broken FILE support !') |
pascal@516 | 64 <pre>$(httpinfo)</pre>" |
pascal@516 | 65 if [ "$cmd" ]; then |
pascal@516 | 66 for key in cmdline rdev video format mem ; do |
pascal@516 | 67 [ "$(POST $key)" ] || continue |
pascal@516 | 68 cmd="$cmd --$key '$(POST $key)'" |
pascal@516 | 69 done |
pascal@516 | 70 [ "$(POST edit)" ] || cmd="$cmd --dont-edit-cmdline" |
pascal@516 | 71 TITLE="$(_ 'TazPanel - floppy')" |
pascal@516 | 72 header |
pascal@516 | 73 xhtml_header |
pascal@516 | 74 cd $(POST workdir) |
pascal@516 | 75 echo "<pre>" |
pascal@516 | 76 eval $cmd 2>&1 |
pascal@516 | 77 echo "</pre>" |
pascal@516 | 78 [ "$toremove" ] && rm -f $toremove && rmdir $(dirname $toremove) |
pascal@516 | 79 xhtml_footer |
pascal@516 | 80 exit 0 |
pascal@516 | 81 fi |
pascal@516 | 82 ;; |
pascal@516 | 83 esac |
pascal@516 | 84 |
pascal@516 | 85 listfd() |
pascal@516 | 86 { |
pascal@516 | 87 echo "<select name=\"$1\">" |
pascal@516 | 88 ls /dev/fd[0-9]* | sed 's|.*|<option>&</option>|' |
pascal@516 | 89 echo "</select>" |
pascal@516 | 90 } |
pascal@516 | 91 |
pascal@516 | 92 TITLE="$(_ 'TazPanel - floppy')" |
pascal@516 | 93 header |
pascal@516 | 94 xhtml_header |
pascal@516 | 95 echo "$error" |
pascal@516 | 96 |
pascal@516 | 97 cat <<EOT |
pascal@516 | 98 <form method="post" enctype="multipart/form-data"> |
pascal@516 | 99 EOT |
pascal@516 | 100 [ -w /dev/fd0 ] && cat <<EOT |
pascal@516 | 101 <section> |
pascal@516 | 102 <header> |
pascal@516 | 103 $(_ 'Floppy disk format') |
pascal@516 | 104 </header> |
pascal@516 | 105 <button type="submit" name="doformat" data-icon="start" >$(_ 'Format disk' )</button> |
pascal@516 | 106 $(listfd fd) filesystem: |
pascal@516 | 107 <select name "fstype"> |
pascal@516 | 108 <option>$(_ 'none')</option> |
pascal@516 | 109 $(ls /sbin/mkfs.* | sed '/dev/d;s|.*/mkfs.\(.*\)|<option>\1</option>|') |
pascal@516 | 110 </select> |
pascal@516 | 111 </section> |
pascal@516 | 112 |
pascal@516 | 113 <section> |
pascal@516 | 114 <header> |
pascal@516 | 115 $(_ 'Floppy disk transfert') |
pascal@516 | 116 </header> |
pascal@516 | 117 <table> |
pascal@516 | 118 <tbody> |
pascal@516 | 119 <tr> |
pascal@516 | 120 <td> |
pascal@516 | 121 <button type="submit" name="write" data-icon="start" >$(_ 'Write image' )</button> |
pascal@516 | 122 $(listfd tofd) <<< <input name="fromimage" type="file"> |
pascal@516 | 123 </td> |
pascal@516 | 124 </tr> |
pascal@516 | 125 <tr> |
pascal@516 | 126 <td> |
pascal@516 | 127 <button type="submit" name="read" data-icon="start" >$(_ 'Read image' )</button> |
pascal@516 | 128 $(listfd fromfd) >>> <input name="toimage" type="text" value="/tmp/floppy.img"> |
pascal@516 | 129 <td> |
pascal@516 | 130 </tr> |
pascal@516 | 131 </tbody> |
pascal@516 | 132 </table> |
pascal@516 | 133 </section> |
pascal@516 | 134 EOT |
pascal@516 | 135 cat <<EOT |
pascal@516 | 136 <section> |
pascal@516 | 137 <header> |
pascal@516 | 138 $(_ 'Boot floppy set builder') |
pascal@516 | 139 </header> |
pascal@516 | 140 |
pascal@516 | 141 <table> |
pascal@516 | 142 <tbody><tr> |
pascal@516 | 143 <td>$(_ 'Linux kernel:')</td> |
pascal@516 | 144 <td><input name="kernel" size="37" type="file"> <i>$(_ 'required')</i></td> |
pascal@516 | 145 </tr> |
pascal@516 | 146 <tr> |
pascal@516 | 147 <td>$(_ 'Initramfs / Initrd:')</td> |
pascal@516 | 148 <td><input name="initrd[]" size="37" type="file" multiple> <i>$(_ 'optional')</i></td> |
pascal@516 | 149 </tr> |
pascal@516 | 150 <tr> |
pascal@516 | 151 <td>$(_ 'Extra initramfs:')</td> |
pascal@516 | 152 <td><input name="initrd2[]" size="37" type="file" multiple> <i>$(_ 'optional')</i></td> |
pascal@516 | 153 </tr> |
pascal@516 | 154 <tr> |
pascal@516 | 155 <td>$(_ 'Boot message:')</td> |
pascal@516 | 156 <td><input name="info" size="37" type="file"> <i>$(_ 'optional')</i></td> |
pascal@516 | 157 </tr> |
pascal@516 | 158 <tr> |
pascal@516 | 159 <td>$(_ 'Default cmdline:')</td> |
pascal@516 | 160 <td id="cmdline"><input name="cmdline" size="36" type="text"> <input name="edit" checked="checked" type="checkbox">$(_ 'edit') |
pascal@516 | 161 <i>$(_ 'optional')</i></td> |
pascal@516 | 162 </tr> |
pascal@516 | 163 <tr> |
pascal@516 | 164 <td>$(_ 'Root device:')</td> |
pascal@516 | 165 <td><input name="rdev" size="8" value="/dev/ram0" type="text"> |
pascal@516 | 166 $(_ 'Flags:') <select name="flags"> |
pascal@516 | 167 <option selected="selected" value="1">R/O</option> |
pascal@516 | 168 <option value="0">R/W</option> |
pascal@516 | 169 </select> |
pascal@516 | 170 VESA: <select name="video"> |
pascal@516 | 171 <option value="-3">Ask</option> |
pascal@516 | 172 <option value="-2">Extended</option> |
pascal@516 | 173 <option value="-1" selected="selected">Standard</option> |
pascal@516 | 174 <option value="0">0</option> |
pascal@516 | 175 <option value="1">1</option> |
pascal@516 | 176 <option value="2">2</option> |
pascal@516 | 177 <option value="3">3</option> |
pascal@516 | 178 <option value="4">4</option> |
pascal@516 | 179 <option value="5">5</option> |
pascal@516 | 180 <option value="6">6</option> |
pascal@516 | 181 <option value="7">7</option> |
pascal@516 | 182 <option value="8">8</option> |
pascal@516 | 183 <option value="9">9</option> |
pascal@516 | 184 <option value="10">10</option> |
pascal@516 | 185 <option value="11">11</option> |
pascal@516 | 186 <option value="12">12</option> |
pascal@516 | 187 <option value="13">13</option> |
pascal@516 | 188 <option value="14">14</option> |
pascal@516 | 189 <option value="15">15</option> |
pascal@516 | 190 <option value="3840">80x25</option> |
pascal@516 | 191 <option value="3841">80x50</option> |
pascal@516 | 192 <option value="3842">80x43</option> |
pascal@516 | 193 <option value="3843">80x28</option> |
pascal@516 | 194 <option value="3845">80x30</option> |
pascal@516 | 195 <option value="3846">80x34</option> |
pascal@516 | 196 <option value="3847">80x60</option> |
pascal@516 | 197 <option value="778">132x43</option> |
pascal@516 | 198 <option value="777">132x25</option> |
pascal@516 | 199 <option value="824">320x200x8</option> |
pascal@516 | 200 <option value="781">320x200x15</option> |
pascal@516 | 201 <option value="782">320x200x16</option> |
pascal@516 | 202 <option value="783">320x200x24</option> |
pascal@516 | 203 <option value="800">320x200x32</option> |
pascal@516 | 204 <option value="818">896x672x24</option> |
pascal@516 | 205 <option value="915">320x240x15</option> |
pascal@516 | 206 <option value="821">320x240x16</option> |
pascal@516 | 207 <option value="917">320x240x24</option> |
pascal@516 | 208 <option value="918">320x240x32</option> |
pascal@516 | 209 <option value="819">896x672x32</option> |
pascal@516 | 210 <option value="931">400x300x15</option> |
pascal@516 | 211 <option value="822">400x300x16</option> |
pascal@516 | 212 <option value="933">400x300x24</option> |
pascal@516 | 213 <option value="934">400x300x32</option> |
pascal@516 | 214 <option value="820">512x384x8</option> |
pascal@516 | 215 <option value="947">512x384x15</option> |
pascal@516 | 216 <option value="823">512x384x16</option> |
pascal@516 | 217 <option value="949">512x384x24</option> |
pascal@516 | 218 <option value="950">512x384x32</option> |
pascal@516 | 219 <option value="962">640x350x8</option> |
pascal@516 | 220 <option value="963">640x350x15</option> |
pascal@516 | 221 <option value="964">640x350x16</option> |
pascal@516 | 222 <option value="965">640x350x24</option> |
pascal@516 | 223 <option value="966">640x350x32</option> |
pascal@516 | 224 <option value="768">640x400x8</option> |
pascal@516 | 225 <option value="899">640x400x15</option> |
pascal@516 | 226 <option value="825">640x400x16</option> |
pascal@516 | 227 <option value="901">640x400x24</option> |
pascal@516 | 228 <option value="902">640x400x32</option> |
pascal@516 | 229 <option value="769">640x480x8</option> |
pascal@516 | 230 <option value="784">640x480x15</option> |
pascal@516 | 231 <option value="785">640x480x16</option> |
pascal@516 | 232 <option value="786">640x480x24</option> |
pascal@516 | 233 <option value="826">640x480x32</option> |
pascal@516 | 234 <option value="879">800x500x8</option> |
pascal@516 | 235 <option value="880">800x500x15</option> |
pascal@516 | 236 <option value="881">800x500x16</option> |
pascal@516 | 237 <option value="882">800x500x24</option> |
pascal@516 | 238 <option value="883">800x500x32</option> |
pascal@516 | 239 <option value="771">800x600x8</option> |
pascal@516 | 240 <option value="787">800x600x15</option> |
pascal@516 | 241 <option value="788">800x600x16</option> |
pascal@516 | 242 <option value="789">800x600x24</option> |
pascal@516 | 243 <option value="827">800x600x32</option> |
pascal@516 | 244 <option value="815">896x672x8</option> |
pascal@516 | 245 <option value="816">1600x1200x8</option> |
pascal@516 | 246 <option value="817">1600x1200x16</option> |
pascal@516 | 247 <option value="874">1024x640x8</option> |
pascal@516 | 248 <option value="875">1024x640x15</option> |
pascal@516 | 249 <option value="876">1024x640x16</option> |
pascal@516 | 250 <option value="877">1024x640x24</option> |
pascal@516 | 251 <option value="878">1024x640x32</option> |
pascal@516 | 252 <option value="773">1024x768x8</option> |
pascal@516 | 253 <option value="790">1024x768x15</option> |
pascal@516 | 254 <option value="791">1024x768x16</option> |
pascal@516 | 255 <option value="792">1024x768x24</option> |
pascal@516 | 256 <option value="828">1024x768x32</option> |
pascal@516 | 257 <option value="869">1152x720x8</option> |
pascal@516 | 258 <option value="870">1152x720x15</option> |
pascal@516 | 259 <option value="871">1152x720x16</option> |
pascal@516 | 260 <option value="872">1152x720x24</option> |
pascal@516 | 261 <option value="873">1152x720x32</option> |
pascal@516 | 262 <option value="775">1280x1024x8</option> |
pascal@516 | 263 <option value="793">1280x1024x15</option> |
pascal@516 | 264 <option value="794">1280x1024x16</option> |
pascal@516 | 265 <option value="795">1280x1024x24</option> |
pascal@516 | 266 <option value="829">1280x1024x32</option> |
pascal@516 | 267 <option value="835">1400x1050x8</option> |
pascal@516 | 268 <option value="837">1400x1050x16</option> |
pascal@516 | 269 <option value="838">1400x1040x24</option> |
pascal@516 | 270 <option value="864">1440x900x15</option> |
pascal@516 | 271 <option value="866">1440x900x16</option> |
pascal@516 | 272 <option value="867">1440x900x24</option> |
pascal@516 | 273 <option value="868">1440x900x32</option> |
pascal@516 | 274 <option value="893">1920x1200x8</option> |
pascal@516 | 275 </select> |
pascal@516 | 276 </td> |
pascal@516 | 277 </tr> |
pascal@516 | 278 <tr> |
pascal@516 | 279 <td>$(_ 'Output directory:')</td> |
pascal@516 | 280 <td id="workdir"><input name="workdir" size="36" type="text" value="/tmp"></td> |
pascal@516 | 281 </tr> |
pascal@516 | 282 <tr> |
pascal@516 | 283 <td>$(_ 'Floppy size:')</td> |
pascal@516 | 284 <td><select name="format"> |
pascal@516 | 285 <optgroup label="5¼ SD"> |
pascal@516 | 286 <option value="360">360 KB</option> |
pascal@516 | 287 </optgroup> |
pascal@516 | 288 <optgroup label="3½ SD"> |
pascal@516 | 289 <option value="720">720 KB</option> |
pascal@516 | 290 </optgroup> |
pascal@516 | 291 <optgroup label="5¼ HD"> |
pascal@516 | 292 <option value="1200">1.20 MB</option> |
pascal@516 | 293 </optgroup> |
pascal@516 | 294 <optgroup label="3½ HD"> |
pascal@516 | 295 <option value="1440" selected="selected">1.44 MB</option> |
pascal@516 | 296 <option value="1600">1.60 MB</option> |
pascal@516 | 297 <option value="1680">1.68 MB</option> |
pascal@516 | 298 <option value="1722">1.72 MB</option> |
pascal@516 | 299 <option value="1743">1.74 MB</option> |
pascal@516 | 300 <option value="1760">1.76 MB</option> |
pascal@516 | 301 <option value="1840">1.84 MB</option> |
pascal@516 | 302 <option value="1920">1.92 MB</option> |
pascal@516 | 303 <option value="1968">1.96 MB</option> |
pascal@516 | 304 </optgroup> |
pascal@516 | 305 <optgroup label="3½ ED"> |
pascal@516 | 306 <option value="2880">2.88 MB</option> |
pascal@516 | 307 <option value="3360">3.36 MB</option> |
pascal@516 | 308 <option value="3444">3.44 MB</option> |
pascal@516 | 309 <option value="3840">3.84 MB</option> |
pascal@516 | 310 <option value="3936">3.92 MB</option> |
pascal@516 | 311 </optgroup> |
pascal@516 | 312 <option value="0">$(_ 'no limit')</option> |
pascal@516 | 313 </select> |
pascal@516 | 314 $(_ 'RAM used') <select name="mem"> |
pascal@516 | 315 <option selected="selected" value="16">16 MB</option> |
pascal@516 | 316 <option value="15">15 MB</option> |
pascal@516 | 317 <option value="14">14 MB</option> |
pascal@516 | 318 <option value="13">13 MB</option> |
pascal@516 | 319 <option value="12">12 MB</option> |
pascal@516 | 320 <option value="11">11 MB</option> |
pascal@516 | 321 <option value="10">10 MB</option> |
pascal@516 | 322 <option value="9">9 MB</option> |
pascal@516 | 323 <option value="8">8 MB</option> |
pascal@516 | 324 <option value="7">7 MB</option> |
pascal@516 | 325 <option value="6">6 MB</option> |
pascal@516 | 326 <option value="5">5 MB</option> |
pascal@516 | 327 <option value="4">4 MB</option> |
pascal@516 | 328 </select> |
pascal@516 | 329 <button type="submit" name="build" data-icon="start" >$(_ 'Build floppy set' )</button> |
pascal@516 | 330 </td> |
pascal@516 | 331 </tr> |
pascal@516 | 332 </tbody></table> |
pascal@516 | 333 <footer> |
pascal@516 | 334 <p> |
pascal@516 | 335 $(_ 'Note') 1: $(_ 'the extra initramfs may be useful to add your own configuration files.') |
pascal@516 | 336 </p> |
pascal@516 | 337 <p> |
pascal@516 | 338 $(_ 'Note') 2: $(_ 'the keyboard is read for ESC or ENTER on every form feed (ASCII 12) in the boot message.') |
pascal@516 | 339 </p> |
pascal@516 | 340 </footer> |
pascal@516 | 341 </section> |
pascal@516 | 342 </form> |
pascal@516 | 343 EOT |
pascal@516 | 344 |
pascal@516 | 345 xhtml_footer |
pascal@516 | 346 exit 0 |