tazpanel annotate boot.cgi @ rev 467
Add some tazpanel.fr.html links
author | Pascal Bellard <pascal.bellard@slitaz.org> |
---|---|
date | Sun Apr 26 18:40:28 2015 +0200 (2015-04-26) |
parents | 6bd26fb55b06 |
children | 836e45b5567b |
rev | line source |
---|---|
pankso@50 | 1 #!/bin/sh |
pankso@50 | 2 # |
paul@82 | 3 # Boot CGI script - All what happens before login (grub, rcS, slim) |
pankso@50 | 4 # |
al@419 | 5 # Copyright (C) 2011-2015 SliTaz GNU/Linux - BSD License |
pankso@50 | 6 # |
pankso@50 | 7 |
al@419 | 8 |
pankso@50 | 9 # Common functions from libtazpanel and source main boot config file. |
al@419 | 10 |
pankso@50 | 11 . lib/libtazpanel |
pankso@50 | 12 . /etc/rcS.conf |
al@419 | 13 get_config |
pascal@81 | 14 header |
pankso@50 | 15 |
al@443 | 16 TITLE=$(_ 'TazPanel - Boot') |
pankso@50 | 17 |
al@419 | 18 |
al@419 | 19 # Print last 40 lines of given file with "more" link |
al@419 | 20 |
al@426 | 21 loghead() { |
al@419 | 22 case $2 in |
al@419 | 23 htmlize) tail -n40 $1 | htmlize;; |
al@426 | 24 *) tail -n40;; |
al@419 | 25 esac |
pascal@411 | 26 [ $(wc -l < $1) -gt 40 ] && cat <<EOT |
al@443 | 27 <hr/><a data-icon="view" href="index.cgi?file=$1">$(_ 'Show more...')</a> |
pascal@411 | 28 EOT |
pascal@411 | 29 } |
pascal@411 | 30 |
al@419 | 31 |
pankso@50 | 32 # |
pankso@50 | 33 # Commands |
pankso@50 | 34 # |
pankso@50 | 35 |
pascal@81 | 36 case " $(GET) " in |
pascal@451 | 37 *\ syslog\ *) |
pascal@451 | 38 logtype="$(GET syslog)" |
pascal@454 | 39 [ "${logtype:-syslog}" == "syslog" ] && logtype=messages |
pascal@451 | 40 xhtml_header |
pascal@453 | 41 [ -w /etc/syslog.conf ] && cat <<EOT |
pascal@453 | 42 <a href="index.cgi?file=/etc/syslog.conf&action=edit" data-img="conf"></a>syslog.conf |
pascal@453 | 43 EOT |
pascal@451 | 44 cat <<EOT |
pascal@451 | 45 <h2>$(_ 'System logs')</h2> |
pascal@451 | 46 |
pascal@451 | 47 <ul id="tabs"> |
pascal@451 | 48 EOT |
pascal@451 | 49 for i in $(sed '/var\/log/!d;s|.*/log/||' /etc/syslog.conf); do |
pascal@451 | 50 unset act |
pascal@451 | 51 [ "$i" == "$logtype" ] && act=' class="active"' |
pascal@451 | 52 cat <<EOT |
pascal@451 | 53 <li$act><a href="?syslog=$i" title="$(sed "/$i$/!d;s/[\t ].*//" /etc/syslog.conf)">$i</a></li> |
pascal@451 | 54 EOT |
pascal@451 | 55 done |
pascal@451 | 56 cat <<EOT |
pascal@451 | 57 </ul> |
pascal@451 | 58 |
pascal@451 | 59 <section> |
pascal@451 | 60 <div> |
pascal@451 | 61 <pre>$(syntax_highlighter kernel < /var/log/$logtype | \ |
pascal@451 | 62 loghead /var/log/$logtype)</pre> |
pascal@451 | 63 </div> |
pascal@451 | 64 </section> |
pascal@451 | 65 EOT |
pascal@451 | 66 ;; |
pascal@130 | 67 *\ log\ *) |
al@419 | 68 unset actboot actslim actxlog actkernel colors |
pascal@411 | 69 case "$(GET log)" in |
al@419 | 70 boot) |
al@419 | 71 actboot=' class="active"' |
al@419 | 72 output="$(filter_taztools_msgs < /var/log/boot.log)" |
al@419 | 73 colors=' class="term log"';; |
al@419 | 74 slim) |
al@419 | 75 actslim=' class="active"' |
al@419 | 76 output="$(loghead /var/log/slim.log htmlize)" ;; |
al@419 | 77 xlog) |
al@419 | 78 actxlog=' class="active"' |
al@419 | 79 output="$(syntax_highlighter xlog < /var/log/Xorg.0.log | loghead /var/log/Xorg.0.log)" ;; |
al@419 | 80 *) |
al@419 | 81 actkernel=' class="active"' |
al@419 | 82 output="$(syntax_highlighter kernel < /var/log/dmesg.log | loghead /var/log/dmesg.log)" ;; |
pascal@411 | 83 esac |
pascal@130 | 84 xhtml_header |
al@419 | 85 cat <<EOT |
al@443 | 86 <h2>$(_ 'Boot log files')</h2> |
al@419 | 87 |
pascal@411 | 88 <ul id="tabs"> |
al@443 | 89 <li$actkernel><a href="?log=kernel">$(_ 'Kernel messages')</a></li> |
al@443 | 90 <li$actboot ><a href="?log=boot" >$(_ 'Boot scripts' )</a></li> |
al@443 | 91 <li$actxlog ><a href="?log=xlog" >$(_ 'X server' )</a></li> |
al@443 | 92 <li$actslim ><a href="?log=slim" >$(_ 'X session' )</a></li> |
pascal@411 | 93 </ul> |
al@419 | 94 |
al@419 | 95 <section> |
al@419 | 96 <div> |
al@419 | 97 <pre$colors>$output</pre> |
al@419 | 98 </div> |
al@419 | 99 </section> |
pascal@130 | 100 EOT |
pascal@130 | 101 ;; |
al@419 | 102 |
al@419 | 103 |
pascal@81 | 104 *\ daemons\ *) |
pankso@51 | 105 # |
pankso@51 | 106 # Everything until user login |
pankso@51 | 107 # |
al@419 | 108 # Start and stop a daemon. |
al@419 | 109 # (I think we don't need a 'restart' since 2 clicks and you are done) |
pankso@51 | 110 . /etc/rcS.conf |
pankso@51 | 111 xhtml_header |
al@292 | 112 |
al@419 | 113 cat <<EOT |
al@443 | 114 <h2>$(_ 'Manage daemons')</h2> |
al@419 | 115 |
al@443 | 116 <p>$(_ 'Check, start and stop daemons on SliTaz')</p> |
pankso@51 | 117 EOT |
pascal@143 | 118 daemon=$(GET daemons) |
pascal@143 | 119 case "$daemon" in |
pascal@143 | 120 start=*) |
pascal@143 | 121 sleep 1 |
pascal@143 | 122 /etc/init.d/${daemon#start=} start | log ;; |
pascal@143 | 123 stop=*) |
pascal@143 | 124 /etc/init.d/${daemon#stop=} stop | log ;; |
pascal@143 | 125 pid=*) |
pascal@143 | 126 echo "<pre>" |
pascal@383 | 127 ps ww | sed 1q |
pascal@383 | 128 for i in $(echo ${daemon#pid=} | sed 's/%20/ /g'); do |
pascal@383 | 129 ps ww | sed "/^ $i /!d" |
pascal@383 | 130 done |
pascal@143 | 131 echo "</pre>" ;; |
pascal@143 | 132 esac |
al@419 | 133 |
paul@205 | 134 # Daemon list |
al@419 | 135 cat <<EOT |
al@419 | 136 <section> |
al@419 | 137 <table class="zebra wide daemons"> |
al@419 | 138 <thead> |
al@419 | 139 <tr> |
al@443 | 140 <td>$(_ 'Name')</td> |
al@443 | 141 <td>$(_ 'Description')</td> |
al@443 | 142 <td>$(_ 'Configuration')</td> |
al@443 | 143 <td>$(_ 'Status')</td> |
al@443 | 144 <td>$(_ 'Action')</td> |
al@443 | 145 <td>$(_ 'PID')</td> |
al@419 | 146 </tr> |
al@419 | 147 </thead> |
al@419 | 148 <tbody> |
pankso@51 | 149 EOT |
pankso@51 | 150 cd /etc/init.d |
al@419 | 151 list="$(ls | sed -e /.sh/d -e /rc./d -e /RE/d -e /daemon/d -e /firewall/d)" |
al@419 | 152 for name in $list; do |
al@419 | 153 unset pkg pid status SHORT_DESC boot cfg |
pankso@51 | 154 echo '<tr>' |
pankso@51 | 155 # Name |
pankso@51 | 156 echo "<td>$name</td>" |
al@419 | 157 # First check if daemon is started at boottime |
pankso@51 | 158 [ echo "RUN_DAEMONS" | fgrep $name ] && boot="on boot" |
paul@52 | 159 # Standard SliTaz busybox daemons and firewall |
al@303 | 160 echo -n "<td>" |
pascal@364 | 161 grep -qi "^${name}_OPTIONS=" /etc/daemons.conf && cfg="options|$cfg" |
pascal@373 | 162 for i in /etc/slitaz /etc /etc/$name ; do |
pascal@373 | 163 [ -s $i/$name.conf ] && cfg="edit::$i/$name.conf|$cfg" |
pascal@373 | 164 done |
pascal@364 | 165 [ -n "$(which $name)" ] && cfg="man|help|$cfg" |
pankso@51 | 166 case "$name" in |
pankso@51 | 167 firewall) |
al@443 | 168 _ 'SliTaz Firewall with iptable rules' ;; |
pankso@51 | 169 httpd) |
al@443 | 170 _ 'Small and fast web server with CGI support' ;; |
pankso@51 | 171 ntpd) |
al@443 | 172 _ 'Network time protocol daemon' ;; |
pankso@51 | 173 ftpd) |
pascal@364 | 174 cfg="man|help|edit::/etc/inetd.conf" |
al@443 | 175 _ 'Anonymous FTP server' ;; |
pankso@51 | 176 udhcpd) |
al@443 | 177 _ 'Busybox DHCP server' ;; |
pankso@51 | 178 syslogd|klogd) |
al@443 | 179 _ 'Linux Kernel log daemon' ;; |
pankso@76 | 180 crond) |
pascal@364 | 181 # FIXME crontab |
al@443 | 182 _ 'Execute scheduled commands' ;; |
pankso@76 | 183 dnsd) |
pascal@364 | 184 cfg="man|help|edit|options::-d" |
al@443 | 185 _ 'Small static DNS server daemon' ;; |
pankso@76 | 186 tftpd) |
pascal@364 | 187 cfg="man|help|edit::/etc/inetd.conf" |
al@443 | 188 _ 'Transfer a file on tftp request' ;; |
pankso@76 | 189 inetd) |
al@443 | 190 _ 'Listen for network connections and launch programs' ;; |
pankso@76 | 191 zcip) |
pascal@364 | 192 cfg="man|help|edit:Script:/etc/zcip.script|options::eth0 /etc/zcip.script" |
al@443 | 193 _ 'Manage a ZeroConf IPv4 link-local address' ;; |
pankso@51 | 194 *) |
paul@205 | 195 # Description from receipt |
pankso@51 | 196 [ -d "$LOCALSTATE/installed/$name" ] && pkg=$name |
pankso@51 | 197 [ -d "$LOCALSTATE/installed/${name%d}" ] && pkg=${name%d} |
pankso@51 | 198 [ -d "$LOCALSTATE/installed/${name}-pam" ] && pkg=${name}-pam |
pankso@51 | 199 if [ "$pkg" ]; then |
pascal@364 | 200 unset SHORT_DESC TAZPANEL_DAEMON |
al@419 | 201 #FIXME $PKGS_DB |
pankso@51 | 202 . $LOCALSTATE/installed/$pkg/receipt |
al@303 | 203 echo -n "$SHORT_DESC" |
pascal@366 | 204 cfg="${TAZPANEL_DAEMON:-$cfg|web::$WEB_SITE}" |
pankso@51 | 205 else |
al@303 | 206 echo -n "----" |
pankso@51 | 207 fi ;; |
pankso@51 | 208 esac |
al@303 | 209 echo "</td>" |
paul@205 | 210 # Attempt to get daemon status |
al@303 | 211 pidfile=$(find /var/run -name *$name*.pid) |
al@303 | 212 [ "$pidfile" ] && pid=$(cat $pidfile) |
al@419 | 213 # Dbus |
al@303 | 214 [ -f /var/run/${name}/pid ] && pid=$(cat /var/run/${name}/pid) |
al@419 | 215 # Apache |
al@303 | 216 [ "$name" = "apache" ] && pid=$(cat /var/run/$name/httpd.pid) |
paul@205 | 217 # Pidof works for many daemons |
al@303 | 218 [ "$pid" ] || pid=$(pidof $name) |
al@419 | 219 |
al@419 | 220 echo -n "<td style='white-space: nowrap'>" |
al@419 | 221 if [ -n "$cfg" ]; then |
pascal@364 | 222 IFS="|" |
pascal@364 | 223 for i in $cfg ; do |
pascal@364 | 224 IFS=":" |
pascal@364 | 225 set -- $i |
pascal@364 | 226 case "$1" in |
al@419 | 227 edit) |
al@419 | 228 cat <<EOT |
al@419 | 229 <a href="index.cgi?file=${3:-/etc/$name.conf}&action=edit" title="${2:-$name Configuration}" data-img="conf"></a> |
pascal@364 | 230 EOT |
pascal@364 | 231 ;; |
pascal@364 | 232 options) |
al@419 | 233 key=$(echo -n $name | tr [a-z] [A-Z])_OPTIONS |
pascal@364 | 234 cat <<EOT |
al@419 | 235 <a href="index.cgi?file=/etc/daemons.conf&action=setvar&var=$key&default=$3" title="${2:-$key}" data-img="opt"></a> |
pascal@364 | 236 EOT |
pascal@364 | 237 ;; |
al@419 | 238 man) |
al@419 | 239 cat <<EOT |
al@419 | 240 <a href="index.cgi?exec=man ${3:-$name}&back=boot.cgi%3Fdaemons" title="${2:-$name Manual}" data-img="man"></a> |
pascal@364 | 241 EOT |
pascal@364 | 242 ;; |
al@419 | 243 help) |
al@419 | 244 help='--help' |
al@419 | 245 case $name in |
al@419 | 246 cupsd|dropbear|gpm|slim|wpa_supplicant) help='-h' |
al@419 | 247 esac |
al@419 | 248 cat <<EOT |
al@419 | 249 <a href="index.cgi?exec=$(which ${3:-$name}) $help&back=boot.cgi%3Fdaemons" title="${2:-$name Help}" data-img="help"></a> |
pascal@364 | 250 EOT |
pascal@364 | 251 ;; |
pascal@364 | 252 web) cat <<EOT |
al@419 | 253 <a href="${i#$1:$2:}" title="${2:-$name website:} ${i#$1:$2:}" target="_blank" data-img="web"></a> |
pascal@364 | 254 EOT |
pascal@364 | 255 ;; |
pascal@364 | 256 esac |
pascal@364 | 257 done |
pascal@364 | 258 fi |
pascal@364 | 259 echo "</td>" |
pankso@51 | 260 if [ "$pid" ]; then |
al@419 | 261 cat <<EOT |
al@443 | 262 <td><span title="$(_ 'Started')" data-img="on"></span></td> |
al@443 | 263 <td><a href="?daemons=stop=$name" title="$(_ 'Stop')" data-img="stop"></a></td> |
pascal@143 | 264 <td> |
pascal@143 | 265 EOT |
pascal@143 | 266 for i in $pid; do |
al@419 | 267 cat <<EOT |
al@406 | 268 <a href="?daemons=pid=$i">$i</a> |
pascal@143 | 269 EOT |
pascal@143 | 270 done |
pankso@51 | 271 else |
al@419 | 272 cat <<EOT |
al@443 | 273 <td><span title="$(_ 'Stopped')" data-img="off"></span></td> |
al@443 | 274 <td><a href="?daemons=start=$name" title="$(_ 'Start')" data-img="start"></a></td> |
pascal@143 | 275 <td>----- |
pascal@143 | 276 EOT |
pankso@51 | 277 fi |
pascal@143 | 278 echo '</td></tr>' |
pankso@51 | 279 done |
al@419 | 280 echo '</thead></table></section>' ;; |
al@419 | 281 |
al@303 | 282 |
pankso@151 | 283 *\ grub\ *) |
al@303 | 284 GRUBMENU="/boot/grub/menu.lst" |
pankso@151 | 285 if [ "$(GET splash)" ]; then |
pankso@151 | 286 default=$(GET default) |
pankso@151 | 287 timeout=$(GET timeout) |
pankso@151 | 288 splash=$(GET splash) |
pankso@151 | 289 sed -i \ |
al@303 | 290 -e s"|default .*|default $default # new|" \ |
al@303 | 291 -e s"|timeout .*|timeout $timeout|" \ |
al@303 | 292 -e s"|splashimage=.*|splashimage=$splash|" \ |
al@303 | 293 $GRUBMENU |
pankso@151 | 294 fi |
al@419 | 295 default=$(cat $GRUBMENU | grep ^default | cut -d' ' -f2) |
al@419 | 296 timeout=$(cat $GRUBMENU | grep ^timeout | cut -d' ' -f2) |
al@419 | 297 splash=$(cat $GRUBMENU | grep ^splashimage | cut -d' ' -f2) |
pankso@151 | 298 xhtml_header |
al@419 | 299 cat <<EOT |
al@443 | 300 <h2>$(_ 'GRUB Boot loader')</h2> |
al@303 | 301 |
al@443 | 302 <p>$(_ 'The first application started when the computer powers on')</p> |
pankso@151 | 303 |
al@419 | 304 <form class="wide"> |
al@419 | 305 <section> |
al@419 | 306 <div> |
al@419 | 307 <input type="hidden" name="grub"/> |
al@419 | 308 <table> |
al@443 | 309 <tr><td>$(_ 'Default entry:')</td> |
al@419 | 310 <td><input type="text" name="default" value="${default##*=}"/></td></tr> |
al@443 | 311 <tr><td>$(_ 'Timeout:')</td> |
al@419 | 312 <td><input type="text" name="timeout" value="${timeout##*=}"/></td></tr> |
al@443 | 313 <tr><td>$(_ 'Splash image:')</td> |
al@419 | 314 <td><input type="text" name="splash" value="${splash##*=}" size="40"/></td></tr> |
al@419 | 315 </table> |
al@419 | 316 </div> |
al@419 | 317 <footer> |
al@443 | 318 <button type="submit" data-icon="ok">$(_ 'Change')</button> |
al@419 | 319 </footer> |
al@419 | 320 </section> |
pankso@151 | 321 </form> |
pankso@151 | 322 |
al@419 | 323 <form action="index.cgi"> |
al@419 | 324 <input type="hidden" name="file" value="$GRUBMENU"/> |
al@443 | 325 <button data-icon="text">$(_ 'View or edit menu.lst')</button> |
al@419 | 326 </form> |
al@419 | 327 |
al@419 | 328 |
al@419 | 329 <section> |
al@443 | 330 <header>$(_ 'Boot entries')</header> |
al@419 | 331 <div> |
pankso@151 | 332 EOT |
al@303 | 333 |
al@303 | 334 |
al@419 | 335 menu=$(tail -q -n +$(grep -n ^title $GRUBMENU | head -n1 | cut -d: -f1) $GRUBMENU | \ |
al@419 | 336 sed -e "s|^$||g" | \ |
al@443 | 337 sed -e "s|^title|</pre></div>\n</section>\n\n<section>\n\t<header>$(_ 'Entry') #</header>\n<div><pre style=\"white-space:pre-wrap\">\0|g" | \ |
al@419 | 338 sed '/^[ \t]*$/d' | \ |
al@419 | 339 tail -q -n +2)"</pre>" |
al@303 | 340 |
pankso@151 | 341 entry='-1' |
al@303 | 342 echo "$menu" | while read line |
pankso@151 | 343 do |
al@419 | 344 if [ -n "$(echo $line | grep '#</header>')" ]; then |
al@303 | 345 entry=$(($entry + 1)) |
al@303 | 346 fi |
al@419 | 347 echo $line | sed "s|#</header>|$entry</header>|" |
pankso@151 | 348 done |
al@303 | 349 |
al@419 | 350 echo '</section>' |
al@419 | 351 |
al@419 | 352 |
pankso@151 | 353 # Here we could check if an entry for gpxe is present if not |
pankso@151 | 354 # display a form to add it. |
al@419 | 355 [ -f "/boot/gpxe" ] && cat <<EOT |
al@419 | 356 <section> |
al@419 | 357 <header>gPXE</header> |
al@443 | 358 <div>$(_ 'Web boot is available with gPXE')</div> |
al@419 | 359 </section> |
al@419 | 360 EOT |
pankso@151 | 361 ;; |
al@419 | 362 |
al@419 | 363 |
pascal@454 | 364 *\ iso\ *) |
pascal@454 | 365 xhtml_header |
al@456 | 366 iso=$(POST iso); [ -s "$iso" ] || unset iso |
al@456 | 367 action=$(POST action); [ "$action" ] || action=$(GET action) |
pascal@454 | 368 workdir=$(POST workdir) |
pascal@454 | 369 [ -d $workdir ] || workdir=$(dirname $workdir) |
pascal@454 | 370 [ -w $workdir -a "$workdir" ] || workdir=/tmp |
al@456 | 371 |
pascal@454 | 372 echo "<h2>$(_ 'ISO mine')</h2>" |
al@456 | 373 |
al@456 | 374 [ "$iso" ] || msg err 'Invalid ISO image.' |
al@456 | 375 |
pascal@454 | 376 if [ "$iso" -a "$action" -a "$action" != "nop" ]; then |
pascal@454 | 377 case "$action" in |
al@456 | 378 install*) dev=$(POST instdev) ;; |
al@456 | 379 *) dev=$(POST usbkeydev) ;; |
pascal@454 | 380 esac |
pascal@455 | 381 cd $workdir |
pascal@454 | 382 cat <<EOT |
pascal@454 | 383 <section> |
pascal@454 | 384 <pre> |
pascal@455 | 385 $(taziso $iso $action $dev 2>&1) |
pascal@454 | 386 </pre> |
pascal@454 | 387 </section> |
pascal@454 | 388 EOT |
pascal@454 | 389 fi |
pascal@454 | 390 cat <<EOT |
pascal@454 | 391 <section> |
al@456 | 392 <form method="post" action="?iso" class="wide"> |
pascal@454 | 393 EOT |
pascal@454 | 394 cat <<EOT |
al@456 | 395 <table> |
al@456 | 396 <tr><td>ISO image file full path |
al@456 | 397 <span data-img="info" title="set /dev/cdrom for a physical CD-ROM"></span> |
al@456 | 398 </td> |
al@456 | 399 <td><input type="text" name="iso" value="$iso" size="50"/></td></tr> |
al@456 | 400 <tr><td>Working directory</td> |
pascal@458 | 401 <td><input type="text" name="workdir" value="$workdir" size="50"/></td></tr> |
pascal@458 | 402 <tr><td>Target partition |
pascal@458 | 403 <span data-img="info" title="For hard disk installation only. Will create /slitaz tree and keep other files. No partitioning and no formatting."></span> |
pascal@458 | 404 </td> |
al@456 | 405 <td><select name="instdev"> |
al@456 | 406 <option value="/dev/null">Choose a partition (optional)</option> |
pascal@454 | 407 EOT |
pascal@458 | 408 blkid | grep -iE "(msdos|vfat|ntfs|ext[234]|xfs|btrfs)" | \ |
pascal@458 | 409 sed 's|^/dev/\(.*\):.*LABEL="\([^"]*\).* TYPE="\([^"]*\).*|\1 "\2" \3|' | \ |
pascal@458 | 410 while read dev label type; do |
pascal@454 | 411 echo -n "<option value=\"/dev/$dev\">/dev/$dev $label " |
pascal@459 | 412 echo "$(blk2h < /sys/block/${dev:0:3}/$dev/size) $type</option>" |
pascal@454 | 413 done |
pascal@454 | 414 cat <<EOT |
al@456 | 415 </select></td></tr> |
pascal@458 | 416 <tr><td>USB key device |
pascal@458 | 417 <span data-img="info" title="For USB boot key only. Will erase the full device."></span> |
pascal@458 | 418 </td> |
al@456 | 419 <td><select name="usbkeydev"> |
al@456 | 420 <option value="/dev/null">Choose a USB key (optional)</option> |
pascal@454 | 421 EOT |
pascal@454 | 422 grep -l 1 /sys/block/*/removable | \ |
pascal@454 | 423 sed 's|/sys/block/\(.*\)/removable|\1|' | while read dev; do |
pascal@454 | 424 grep -qs 1 /sys/block/$DEV/ro && continue |
pascal@454 | 425 echo -n "<option value=\"/dev/$dev\">/dev/$dev " |
pascal@459 | 426 echo "$(blk2h < /sys/block/$dev/size) $(cat \ |
al@456 | 427 /sys/block/$i/device/model 2>/dev/null)</option>" |
pascal@454 | 428 done |
pascal@454 | 429 cat <<EOT |
al@456 | 430 </select></td></tr> |
al@456 | 431 </table> |
pascal@454 | 432 <footer> |
pascal@454 | 433 EOT |
al@456 | 434 |
pascal@454 | 435 if [ "$iso" ]; then |
pascal@454 | 436 cat <<EOT |
pascal@454 | 437 <select name="action"> |
pascal@454 | 438 <option value="nop">Choose an action</option> |
al@456 | 439 $(taziso $iso list | sed -e \ |
al@456 | 440 's/"\(.*\)"[\t ]*"\(.*\)"/<option value="\1\">\2<\/option>/' -e \ |
al@456 | 441 "s|value=\"$action\"|& selected|") |
pascal@454 | 442 </select> |
pascal@454 | 443 EOT |
pascal@454 | 444 elif [ "$action" ]; then |
pascal@454 | 445 cat <<EOT |
pascal@454 | 446 <input type="hidden" name="action" value="$action" /> |
pascal@454 | 447 EOT |
pascal@454 | 448 fi |
al@456 | 449 |
pascal@454 | 450 cat <<EOT |
pascal@454 | 451 <button data-icon="cd" name="mine">Mine</button> |
pascal@454 | 452 </footer> |
pascal@454 | 453 </form> |
pascal@454 | 454 </section> |
pascal@454 | 455 EOT |
pascal@454 | 456 ;; |
al@456 | 457 |
al@456 | 458 |
pankso@50 | 459 *) |
pankso@50 | 460 # |
pankso@51 | 461 # Default content with summary |
pankso@50 | 462 # |
pankso@50 | 463 . /etc/rcS.conf |
pankso@50 | 464 xhtml_header |
al@419 | 465 cat <<EOT |
al@443 | 466 <h2>$(_ 'Boot & Start services')</h2> |
pankso@51 | 467 |
al@443 | 468 <p>$(_ 'Everything that happens before user login')</p> |
pankso@57 | 469 |
al@419 | 470 <form> |
al@443 | 471 <button name="log" data-icon="logs" >$(_ 'Boot logs')</button> |
pascal@451 | 472 <button name="syslog" data-icon="logs" >$(_ 'System logs')</button> |
al@443 | 473 <button name="daemons" data-icon="daemons" data-root>$(_ 'Manage daemons')</button> |
pascal@434 | 474 EOT |
pascal@454 | 475 [ "$REMOTE_USER" == "root" -a -x /usr/bin/taziso ] && cat <<EOT |
pascal@454 | 476 <button name="iso" data-icon="cd" >$(_ 'ISO mine')</button> |
pascal@454 | 477 EOT |
pascal@434 | 478 [ -w /boot/grub/menu.lst ] && cat <<EOT |
al@443 | 479 <button name="grub" data-icon="grub" >$(_ 'Boot loader')</button> |
pascal@434 | 480 EOT |
pascal@434 | 481 cat <<EOT |
al@419 | 482 </form> |
al@303 | 483 |
al@303 | 484 |
al@419 | 485 <section> |
al@443 | 486 <header>$(_ 'Configuration files')</header> |
al@419 | 487 <form action="index.cgi" class="wide"> |
al@419 | 488 <table> |
al@443 | 489 <tr><td>$(_ 'Main configuration file:') <b>rcS.conf</b></td> |
al@443 | 490 <td><button name="file" value="/etc/rcS.conf" data-icon="view">$(_ 'View')</button></td></tr> |
al@443 | 491 <tr><td>$(_ 'Login manager settings:') <b>slim.conf</b></td> |
al@443 | 492 <td><button name="file" value="/etc/slim.conf" data-icon="view">$(_ 'View')</button></td></tr> |
al@419 | 493 </table> |
al@419 | 494 </form> |
al@419 | 495 </section> |
al@303 | 496 |
al@303 | 497 |
pascal@430 | 498 <section style="overflow-x: auto"> |
al@443 | 499 <header>$(_ 'Kernel cmdline')</header> |
al@426 | 500 <pre>$(cat /proc/cmdline)</pre> |
al@419 | 501 </section> |
al@419 | 502 |
al@419 | 503 |
al@419 | 504 <section> |
al@426 | 505 <header> |
al@443 | 506 $(_ 'Local startup commands') |
al@419 | 507 <form action="index.cgi"> |
al@419 | 508 <input type="hidden" name="file" value="/etc/init.d/local.sh"/> |
pascal@434 | 509 EOT |
pascal@434 | 510 [ -w /etc/init.d/local.sh ] && cat <<EOT |
al@443 | 511 <button name="action" value="edit" data-icon="edit">$(_ 'Edit')</button> |
pascal@434 | 512 EOT |
pascal@434 | 513 cat <<EOT |
al@419 | 514 </form> |
al@426 | 515 </header> |
al@426 | 516 <pre>$(cat /etc/init.d/local.sh | syntax_highlighter sh)</pre> |
al@419 | 517 </section> |
pankso@50 | 518 EOT |
pankso@50 | 519 ;; |
pankso@50 | 520 esac |
pankso@50 | 521 |
pankso@50 | 522 xhtml_footer |
pankso@50 | 523 exit 0 |