slitaz-arm rev 45

merge
author Christophe Lincoln <pankso@slitaz.org>
date Sun Mar 09 10:14:33 2014 +0100 (2014-03-09)
parents 839d11d53db8 233135313b88
children b946dc4f933a
files spi
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/tools/mksd.sh	Sun Mar 09 10:14:33 2014 +0100
     1.3 @@ -0,0 +1,73 @@
     1.4 +#!/bin/sh
     1.5 +#
     1.6 +# Sleep to avoid: "kernel still uses old table: Device or resource busy"
     1.7 +#
     1.8 +. /lib/libtaz.sh
     1.9 +check_root
    1.10 +
    1.11 +if [ ! "$dev" ]; then
    1.12 +	echo "Missing: --dev= cmdline option" && exit 1
    1.13 +fi
    1.14 +
    1.15 +# Boot
    1.16 +echo -n "Creating partition: /dev/${dev}1 /boot"
    1.17 +fdisk /dev/${dev} >/dev/null << EOF
    1.18 +o
    1.19 +n
    1.20 +p
    1.21 +1
    1.22 +1
    1.23 ++140M
    1.24 +w
    1.25 +EOF
    1.26 +status
    1.27 +
    1.28 +# Swap
    1.29 +echo -n "Creating partition: /dev/${dev}2 swap"
    1.30 +sleep 2
    1.31 +fdisk /dev/${dev} 2>&1 >/dev/null  << EOF
    1.32 +n
    1.33 +p
    1.34 +2
    1.35 +
    1.36 ++420M
    1.37 +w
    1.38 +EOF
    1.39 +status
    1.40 +
    1.41 +# Root
    1.42 +echo -n "Creating partition: /dev/${dev}3 / (root)"
    1.43 +sleep 2
    1.44 +fdisk /dev/${dev} 2>&1 >/dev/null << EOF
    1.45 +n
    1.46 +p
    1.47 +3
    1.48 +
    1.49 +
    1.50 +w
    1.51 +EOF
    1.52 +status
    1.53 +
    1.54 +# Boot flag
    1.55 +echo -n "Setting boot flag on: /dev/${dev}1"
    1.56 +sleep 2
    1.57 +fdisk /dev/${dev} 2>&1 >/dev/null << EOF
    1.58 +a
    1.59 +1
    1.60 +w
    1.61 +EOF
    1.62 +status
    1.63 +
    1.64 +# Mkfs 2>&1 >/dev/null
    1.65 +#if fdisk -l /dev/${dev} | grep "^/dev/${dev}1"; then
    1.66 +	#debug "Creating: /boot FAT32 filesystem"
    1.67 +	#mkdosfs -F 32 -v -l -n "RPi-boot" /dev/${dev}1 
    1.68 +#fi
    1.69 +#if fdisk -l /dev/${dev} | grep "^/dev/${dev}2"; then
    1.70 +	#debug "Creating: swap memory filesystem"
    1.71 +	#mkswap -L "RPi-swap" /dev/${dev}2
    1.72 +#fi
    1.73 +#if fdisk -l /dev/${dev} | grep "^/dev/${dev}3"; then
    1.74 +	#debug "Creating: root ext4 filesystem"
    1.75 +	#mkfs.ext4 -L "RPi-root" /dev/${dev}3
    1.76 +#fi
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/tools/rpi-example.cgi	Sun Mar 09 10:14:33 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