tazpanel diff boot.cgi @ rev 338

settings.cgi: set tz
author Pascal Bellard <pascal.bellard@slitaz.org>
date Wed Jan 02 14:12:12 2013 +0100 (2013-01-02)
parents 72e9955ebdff
children 4a8f56bb08cb
line diff
     1.1 --- a/boot.cgi	Wed Apr 11 20:12:41 2012 +0300
     1.2 +++ b/boot.cgi	Wed Jan 02 14:12:12 2013 +0100
     1.3 @@ -22,29 +22,29 @@
     1.4  		xhtml_header
     1.5  		cat << EOT
     1.6  <div id="wrapper">
     1.7 -	<h2>`gettext "Boot log files"`</h2>
     1.8 +	<h2>$(gettext 'Boot log files')</h2>
     1.9  </div>
    1.10  <div>
    1.11  	<a class="button" href="#kernel">
    1.12 -		<img src="$IMAGES/tux.png" />$(gettext "Kernel messages")</a>
    1.13 -	<a class="button" href="#boot">$(gettext "Boot scripts")</a>
    1.14 -	<a class="button" href="#slim">$(gettext "X server")</a>
    1.15 +		<img src="$IMAGES/tux.png" />$(gettext 'Kernel messages')</a>
    1.16 +	<a class="button" href="#boot">$(gettext 'Boot scripts')</a>
    1.17 +	<a class="button" href="#slim">$(gettext 'X server')</a>
    1.18  </div>
    1.19 -	<a name="kernel"></a>
    1.20 -	<h3>$(gettext "Kernel messages")</h3>
    1.21 +
    1.22 +	<h3 id="kernel">$(gettext 'Kernel messages')</h3>
    1.23 +
    1.24 +	<pre>$(cat /var/log/dmesg.log | syntax_highlighter kernel)</pre>
    1.25 +
    1.26 +	<h3 id="boot">$(gettext 'Boot scripts')</h3>
    1.27 +
    1.28 +	<pre>$(cat /var/log/boot.log | filter_taztools_msgs)</pre>
    1.29 +
    1.30 +	<h3 id="slim">$(gettext 'X server')</h3>
    1.31 +
    1.32  	<pre>
    1.33 -$(cat /var/log/dmesg.log)
    1.34 -	</pre>
    1.35 -	<a name="boot"></a>
    1.36 -	<h3>$(gettext "Boot scripts")</h3>
    1.37 -	<pre>
    1.38 -$(cat /var/log/boot.log | filter_taztools_msgs)
    1.39 -	</pre>
    1.40 -	<a name="slim"></a>
    1.41 -	<h3>$(gettext "X server")</h3>
    1.42 -	<pre>
    1.43 -$(tail -n 40 /var/log/slim.log)
    1.44 -	</pre>
    1.45 +$(tail -n 40 /var/log/slim.log | htmlize)
    1.46 +<hr /><a href="/index.cgi?file=/var/log/slim.log">$(gettext 'Show more...')</a>
    1.47 +</pre>
    1.48  EOT
    1.49  		;;
    1.50  	*\ daemons\ *)
    1.51 @@ -58,10 +58,8 @@
    1.52  
    1.53  		cat << EOT
    1.54  <div id="wrapper">
    1.55 -	<h2>`gettext "Manage daemons"`</h2>
    1.56 -	<p>
    1.57 -		`gettext "Check, start and stop daemons on SliTaz"`
    1.58 -	</p>
    1.59 +	<h2>$(gettext 'Manage daemons')</h2>
    1.60 +	<p>$(gettext 'Check, start and stop daemons on SliTaz')</p>
    1.61  </div>
    1.62  EOT
    1.63  		daemon=$(GET daemons)
    1.64 @@ -81,11 +79,11 @@
    1.65  		cat << EOT
    1.66  <thead>
    1.67  	<tr>
    1.68 -		<td>`gettext "Name"`</td>
    1.69 -		<td>`gettext "Description"`</td>
    1.70 -		<td>`gettext "Status"`</td>
    1.71 -		<td>`gettext "Action"`</td>
    1.72 -		<td>`gettext "PID"`</td>
    1.73 +		<td>$(gettext 'Name')</td>
    1.74 +		<td>$(gettext 'Description')</td>
    1.75 +		<td>$(gettext 'Status')</td>
    1.76 +		<td>$(gettext 'Action')</td>
    1.77 +		<td>$(gettext 'PID')</td>
    1.78  	</tr>
    1.79  </thead>
    1.80  EOT
    1.81 @@ -104,29 +102,30 @@
    1.82  			# First check if daemon is started at bootime
    1.83  			[ echo "RUN_DAEMONS" | fgrep $name ] && boot="on boot"
    1.84  			# Standard SliTaz busybox daemons and firewall
    1.85 +			echo -n "<td>"
    1.86  			case "$name" in
    1.87  				firewall)
    1.88 -					gettext "<td>SliTaz Firewall with iptable rules</td>" ;;
    1.89 +					gettext 'SliTaz Firewall with iptable rules' ;;
    1.90  				httpd)
    1.91 -					gettext "<td>Small and fast web server with CGI support</td>" ;;
    1.92 +					gettext 'Small and fast web server with CGI support' ;;
    1.93  				ntpd)
    1.94 -					gettext "<td>Network time protocol daemon</td>" ;;
    1.95 +					gettext 'Network time protocol daemon' ;;
    1.96  				ftpd)
    1.97 -					gettext "<td>Anonymous FTP server</td>" ;;
    1.98 +					gettext 'Anonymous FTP server' ;;
    1.99  				udhcpd)
   1.100 -					gettext "<td>Busybox DHCP server</td>" ;;
   1.101 +					gettext 'Busybox DHCP server' ;;
   1.102  				syslogd|klogd)
   1.103 -					gettext "<td>Linux Kernel log daemon</td>" ;;
   1.104 +					gettext 'Linux Kernel log daemon' ;;
   1.105  				crond)
   1.106 -					gettext "<td>Execute scheduled commands</td>" ;;
   1.107 +					gettext 'Execute scheduled commands' ;;
   1.108  				dnsd)
   1.109 -					gettext "<td>Small static DNS server daemon</td>" ;;
   1.110 +					gettext 'Small static DNS server daemon' ;;
   1.111  				tftpd)
   1.112 -					gettext "<td>Transfer a file on tftp request</td>" ;;
   1.113 +					gettext 'Transfer a file on tftp request' ;;
   1.114  				inetd)
   1.115 -					gettext "<td>Listen for network connections and launch programs</td>" ;;
   1.116 +					gettext 'Listen for network connections and launch programs' ;;
   1.117  				zcip)
   1.118 -					gettext "<td>Manage a ZeroConf IPv4 link-local address</td>" ;;
   1.119 +					gettext 'Manage a ZeroConf IPv4 link-local address' ;;
   1.120  				*)
   1.121  					# Description from receipt
   1.122  					[ -d "$LOCALSTATE/installed/$name" ] && pkg=$name
   1.123 @@ -134,25 +133,26 @@
   1.124  					[ -d "$LOCALSTATE/installed/${name}-pam" ] && pkg=${name}-pam
   1.125  					if [ "$pkg" ]; then
   1.126  						. $LOCALSTATE/installed/$pkg/receipt
   1.127 -						echo "<td>$SHORT_DESC</td>"
   1.128 +						echo -n "$SHORT_DESC"
   1.129  					else
   1.130 -						echo "<td>----</td>"
   1.131 +						echo -n "----"
   1.132  					fi ;;
   1.133  			esac
   1.134 +			echo "</td>"
   1.135  			# Attempt to get daemon status
   1.136 -			pidfile=`find /var/run -name *$name*.pid`
   1.137 -			[ "$pidfile" ] && pid=`cat $pidfile`
   1.138 +			pidfile=$(find /var/run -name *$name*.pid)
   1.139 +			[ "$pidfile" ] && pid=$(cat $pidfile)
   1.140  			# dbus
   1.141 -			[ -f /var/run/${name}/pid ] && pid=`cat /var/run/${name}/pid`
   1.142 +			[ -f /var/run/${name}/pid ] && pid=$(cat /var/run/${name}/pid)
   1.143  			# apache
   1.144 -			[ "$name" = "apache" ] && pid=`cat /var/run/$name/httpd.pid`
   1.145 +			[ "$name" = "apache" ] && pid=$(cat /var/run/$name/httpd.pid)
   1.146  			# Pidof works for many daemons
   1.147 -			[ "$pid" ] || pid=`pidof $name`
   1.148 +			[ "$pid" ] || pid=$(pidof $name)
   1.149  			if [ "$pid" ]; then
   1.150  				cat << EOT
   1.151 -<td><img src="$IMAGES/started.png" /></td>
   1.152 +<td><img src="$IMAGES/started.png" alt="Started" title="$(gettext 'Started')" /></td>
   1.153  <td><a href="$SCRIPT_NAME?daemons=stop=$name">
   1.154 -    <img src="$IMAGES/stop.png" /></a></td>
   1.155 +	<img src="$IMAGES/stop.png" alt="Stop" title="$(gettext 'Stop')" /></a></td>
   1.156  <td>
   1.157  EOT
   1.158  				for i in $pid; do
   1.159 @@ -162,67 +162,77 @@
   1.160  				done
   1.161  			else
   1.162  				cat << EOT
   1.163 -<td>-</td>
   1.164 +<td><img src="$IMAGES/stopped.png" alt="Stopped" title="$(gettext 'Stopped')" /></td>
   1.165  <td><a href="$SCRIPT_NAME?daemons=start=$name">
   1.166 -    <img src="$IMAGES/start.png" /></a></td>
   1.167 +    <img src="$IMAGES/start.png" alt="Start" title="$(gettext 'Start')" /></a></td>
   1.168  <td>-----
   1.169  EOT
   1.170  			fi
   1.171  			echo '</td></tr>'
   1.172  		done
   1.173  		table_end ;;
   1.174 +
   1.175  	*\ grub\ *)
   1.176 +		GRUBMENU="/boot/grub/menu.lst"
   1.177  		if [ "$(GET splash)" ]; then
   1.178  			default=$(GET default)
   1.179  			timeout=$(GET timeout)
   1.180  			splash=$(GET splash)
   1.181  			sed -i \
   1.182 -				-e s"/default .*/default $default/" \
   1.183 -				-e s"/timeout .*/timeout $timeout/" \
   1.184 -				-e s"#splashimage=.*#splashimage=$splash#" \
   1.185 -				/boot/grub/menu.lst
   1.186 +				-e s"|default .*|default $default # new|" \
   1.187 +				-e s"|timeout .*|timeout $timeout|" \
   1.188 +				-e s"|splashimage=.*|splashimage=$splash|" \
   1.189 +				$GRUBMENU
   1.190  		fi
   1.191 -		default=$(cat /boot/grub/menu.lst | grep ^default | cut -d " " -f 2)
   1.192 -		timeout=$(cat /boot/grub/menu.lst | grep ^timeout | cut -d " " -f 2)
   1.193 -		splash=$(cat /boot/grub/menu.lst | grep ^splashimage | cut -d "=" -f 2)
   1.194 +		default=$(cat $GRUBMENU | grep ^default | cut -d " " -f 2)
   1.195 +		timeout=$(cat $GRUBMENU | grep ^timeout | cut -d " " -f 2)
   1.196 +		splash=$(cat $GRUBMENU | grep ^splashimage | cut -d "=" -f 2)
   1.197  		xhtml_header
   1.198  				cat << EOT
   1.199  <div id="wrapper">
   1.200 -	<h2>$(gettext "GRUB Boot loader")</h2>
   1.201 -	<p>
   1.202 -		$(gettext "The first application started when the computer powers on")
   1.203 -	</p>
   1.204 +	<h2>$(gettext 'GRUB Boot loader')</h2>
   1.205 +
   1.206 +	<p>$(gettext 'The first application started when the computer powers on')</p>
   1.207  </div>
   1.208  
   1.209  <form method="get" action="$SCRIPT_NAME">
   1.210  	<input type="hidden" name="grub" />
   1.211 -<pre>
   1.212 -Default entry : <input type="text" name="default" value="$default" />
   1.213 -
   1.214 -Timeout       : <input type="text" name="timeout" value="$timeout" />
   1.215 -
   1.216 -Splash image  : <input type="text" name="splash" value="$splash" size="40" />
   1.217 -</pre>
   1.218 -	<input type="submit" value="$(gettext "Change")" />
   1.219 -	<a class="button" href="index.cgi?file=/boot/grub/menu.lst">
   1.220 -		<img src="$IMAGES/text.png" />View or edit menu.lst</a>
   1.221 +<table>
   1.222 +<tr><td>$(gettext 'Default entry:')</td>
   1.223 +	<td><input type="text" name="default" value="$default" /></td></tr>
   1.224 +<tr><td>$(gettext 'Timeout:')</td>
   1.225 +	<td><input type="text" name="timeout" value="$timeout" /></td></tr>
   1.226 +<tr><td>$(gettext 'Splash image:')</td>
   1.227 +	<td><input type="text" name="splash" value="$splash" size="40" /></td></tr>
   1.228 +</table>
   1.229 +	<input type="submit" value="$(gettext 'Change')" />
   1.230 +	<a class="button" href="index.cgi?file=$GRUBMENU">
   1.231 +		<img src="$IMAGES/text.png" />$(gettext 'View or edit menu.lst')</a>
   1.232  </form>
   1.233  
   1.234 -<h3>$(gettext "Boot entries")</h3>
   1.235 +<h3>$(gettext 'Boot entries')</h3>
   1.236  EOT
   1.237 +
   1.238 +
   1.239 +menu=$(tail -q -n +$(grep -n ^title $GRUBMENU | head -n1 | cut -d: -f1) $GRUBMENU \
   1.240 +	| sed -e "s|^$||g" \
   1.241 +	| sed -e "s|^title|</pre></li>\n<p><strong>$(gettext 'Entry') #</strong></p>\n<pre>\0|g" \
   1.242 +	| sed '/^[ \t]*$/d' \
   1.243 +	| tail -q -n +2)"</pre>"
   1.244 +
   1.245  	entry='-1'
   1.246 -	grep ^title /boot/grub/menu.lst | while read title
   1.247 +	echo "$menu" | while read line
   1.248  	do
   1.249 -		entry=$(($entry + 1))
   1.250 -		echo "<strong>$(gettext "Entry") $entry</strong>"
   1.251 -		echo '<pre>'
   1.252 -		grep -A 2 "$title" /boot/grub/menu.lst
   1.253 -		echo '</pre>'
   1.254 +		if [ -n "$(echo $line | grep '#</strong>')" ]; then
   1.255 +			entry=$(($entry + 1))
   1.256 +		fi
   1.257 +		echo $line | sed "s|#</strong>|$entry</strong>|"
   1.258  	done
   1.259 +
   1.260  	# Here we could check if an entry for gpxe is present if not
   1.261  	# display a form to add it.
   1.262  	[ -f "/boot/gpxe" ] && echo "<h3>gPXE</h3>" && \
   1.263 -		gettext "Web boot is available with gPXE"
   1.264 +		gettext 'Web boot is available with gPXE'
   1.265  	;;
   1.266  	*)
   1.267  		#
   1.268 @@ -232,37 +242,35 @@
   1.269  		xhtml_header
   1.270  		cat << EOT
   1.271  <div id="wrapper">
   1.272 -	<h2>$(gettext "Boot &amp; Start services")</h2>
   1.273 -	<p>
   1.274 -		$(gettext "Everything that happens before user login")
   1.275 -	</p>
   1.276 +	<h2>$(gettext 'Boot &amp; Start services')</h2>
   1.277 +	<p>$(gettext 'Everything that happens before user login')</p>
   1.278  </div>
   1.279  <div>
   1.280  	<a class="button" href="$SCRIPT_NAME?log">
   1.281 -		<img src="$IMAGES/text.png" />$(gettext "Boot logs")</a>
   1.282 +		<img src="$IMAGES/text.png" />$(gettext 'Boot logs')</a>
   1.283  	<a class="button" href="$SCRIPT_NAME?daemons">
   1.284 -		<img src="$IMAGES/recharge.png" />$(gettext "Manage daemons")</a>
   1.285 -	<a class="button" href="$SCRIPT_NAME?grub">$(gettext "Boot loader")</a>
   1.286 +		<img src="$IMAGES/recharge.png" />$(gettext 'Manage daemons')</a>
   1.287 +	<a class="button" href="$SCRIPT_NAME?grub">$(gettext 'Boot loader')</a>
   1.288  </div>
   1.289  
   1.290 -<h3>`gettext "Configuration files"`</h3>
   1.291 +<h3>$(gettext 'Configuration files')</h3>
   1.292  <ul>
   1.293 -	<li>`gettext "Main configuration file:"`
   1.294 +	<li>$(gettext 'Main configuration file:')
   1.295  		<a href="index.cgi?file=/etc/rcS.conf">rcS.conf</a></li>
   1.296 -	<li>`gettext "Login manager settings:"`
   1.297 +	<li>$(gettext 'Login manager settings:')
   1.298  		<a href="index.cgi?file=/etc/slim.conf">slim.conf</a></li>
   1.299  </ul>
   1.300  
   1.301 -<h3>`gettext "Kernel cmdline"`</h3>
   1.302 -<pre>
   1.303 -`cat /proc/cmdline`
   1.304 -</pre>
   1.305 -<h3>`gettext "Local startup commands"`</h3>
   1.306 -<pre>
   1.307 -$(cat /etc/init.d/local.sh | syntax_highlighter sh)
   1.308 -</pre>
   1.309 +<h3>$(gettext 'Kernel cmdline')</h3>
   1.310 +
   1.311 +<pre>$(cat /proc/cmdline)</pre>
   1.312 +
   1.313 +<h3>$(gettext 'Local startup commands')</h3>
   1.314 +
   1.315 +<pre>$(cat /etc/init.d/local.sh | syntax_highlighter sh)</pre>
   1.316 +
   1.317  <a class="button" href="index.cgi?file=/etc/init.d/local.sh&amp;action=edit">
   1.318 -<img src="$IMAGES/edit.png" />$(gettext "Edit script")</a>
   1.319 +<img src="$IMAGES/edit.png" />$(gettext 'Edit script')</a>
   1.320  EOT
   1.321  		;;
   1.322  esac