slitaz-arm rev 42

Add tools/ dir with small CGI example for the RPi
author Christophe Lincoln <pankso@slitaz.org>
date Sun Mar 09 07:55:56 2014 +0100 (2014-03-09)
parents 72c65922ada2
children 233135313b88
files spi tools/rpi-example.cgi
line diff
     1.1 --- a/spi	Sat Mar 08 08:41:14 2014 +0000
     1.2 +++ b/spi	Sun Mar 09 07:55:56 2014 +0100
     1.3 @@ -1,6 +1,6 @@
     1.4  #!/bin/sh
     1.5  #
     1.6 -# Spi - SliTaz Raspberry Pi Tool
     1.7 +# Spi - SliTaz Raspberry Pi Build Tool
     1.8  #
     1.9  # Copyright (C) 2012-2014 SliTaz ARM - BSD License
    1.10  # Author: Christophe Lincoln <pankso@slitaz.org>
    1.11 @@ -278,8 +278,10 @@
    1.12  		
    1.13  		# Force turbo
    1.14  		if [ "$turbo" ]; then
    1.15 -			echo -n "Config: force_turbo=1"
    1.16 -			echo "force_turbo=1" >> ${boot}/config.txt; status
    1.17 +			if ! fgrep 'force_turbo=1' ${boot}/config.txt; then
    1.18 +				echo -n "Config: force_turbo=1"
    1.19 +				echo "force_turbo=1" >> ${boot}/config.txt; status
    1.20 +			fi
    1.21  		fi
    1.22  		
    1.23  		# Kernel
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/tools/rpi-example.cgi	Sun Mar 09 07:55:56 2014 +0100
     2.3 @@ -0,0 +1,37 @@
     2.4 +#!/bin/sh
     2.5 +#
     2.6 +# Tiny CGI SHell example for SliTaz RPi
     2.7 +#
     2.8 +# $ startd httpd
     2.9 +# URL: http://rpi.ip/adm/
    2.10 +#
    2.11 +echo "Content type: text/plain"
    2.12 +echo ""
    2.13 +
    2.14 +# Only for root
    2.15 +[ $(id -u) == 0 ] || exit 1
    2.16 +
    2.17 +cpu_temp() {
    2.18 +	awk '{printf "%3.1f C", $1/1000}' \
    2.19 +		/sys/class/thermal/thermal_zone0/temp
    2.20 +}
    2.21 +
    2.22 +# tazberry rpi_stats
    2.23 +cat << EOT
    2.24 +SliTaz Raspberry Pi Stats
    2.25 +-------------------------
    2.26 +
    2.27 +Kernel   : $(uname -snrm)
    2.28 +Uptime   :$(uptime | cut -d "," -f 1,2)
    2.29 +CPU Temp : $(cpu_temp)
    2.30 +
    2.31 +Memory and filesystem usages
    2.32 +----------------------------
    2.33 +$(free -m)
    2.34 +
    2.35 +$(df -h)
    2.36 +
    2.37 +Network interfaces
    2.38 +------------------
    2.39 +$(ifconfig)
    2.40 +EOT