tazpanel diff settings.cgi @ rev 470

settings.cgi: hide empty output of the `who` and `last` (in the Live CD/USB mode).
author Aleksej Bobylev <al.bobylev@gmail.com>
date Tue Apr 28 18:19:43 2015 +0300 (2015-04-28)
parents dd26a42bd40b
children 84d34ba7dc06
line diff
     1.1 --- a/settings.cgi	Sun Apr 26 18:09:20 2015 +0200
     1.2 +++ b/settings.cgi	Tue Apr 28 18:19:43 2015 +0300
     1.3 @@ -286,19 +286,27 @@
     1.4  		</footer>
     1.5  	</form>
     1.6  </section>
     1.7 +EOT
     1.8  
     1.9 -
    1.10 +		# `who` output is empty in the Live mode
    1.11 +		if [ -n "$(who)" ]; then
    1.12 +			cat <<EOT
    1.13  <section>
    1.14  	<header>$(_ 'Current user sessions')</header>
    1.15  	<pre>$(who)</pre>
    1.16  </section>
    1.17 +EOT
    1.18 +		fi
    1.19  
    1.20 -
    1.21 +		# `last` output is empty (just header) in the Live mode
    1.22 +		if [ "$(last | wc -l)" != "1" ]; then
    1.23 +			cat <<EOT
    1.24  <section>
    1.25  	<header>$(_ 'Last user sessions')</header>
    1.26  	<div class="scroll"><pre>$(last)</pre></div>
    1.27  </section>
    1.28  EOT
    1.29 +		fi
    1.30  		;;
    1.31  
    1.32