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