# HG changeset patch # User Christophe Lincoln # Date 1394356473 -3600 # Node ID 5d870dbf26412c165f6ccb33831b0102a9fc638e # Parent 839d11d53db8c97d89cf46739130778820bc6489# Parent 233135313b88b83caff83245cd0f06b06e730494 merge diff -r 839d11d53db8 -r 5d870dbf2641 tools/mksd.sh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tools/mksd.sh Sun Mar 09 10:14:33 2014 +0100 @@ -0,0 +1,73 @@ +#!/bin/sh +# +# Sleep to avoid: "kernel still uses old table: Device or resource busy" +# +. /lib/libtaz.sh +check_root + +if [ ! "$dev" ]; then + echo "Missing: --dev= cmdline option" && exit 1 +fi + +# Boot +echo -n "Creating partition: /dev/${dev}1 /boot" +fdisk /dev/${dev} >/dev/null << EOF +o +n +p +1 +1 ++140M +w +EOF +status + +# Swap +echo -n "Creating partition: /dev/${dev}2 swap" +sleep 2 +fdisk /dev/${dev} 2>&1 >/dev/null << EOF +n +p +2 + ++420M +w +EOF +status + +# Root +echo -n "Creating partition: /dev/${dev}3 / (root)" +sleep 2 +fdisk /dev/${dev} 2>&1 >/dev/null << EOF +n +p +3 + + +w +EOF +status + +# Boot flag +echo -n "Setting boot flag on: /dev/${dev}1" +sleep 2 +fdisk /dev/${dev} 2>&1 >/dev/null << EOF +a +1 +w +EOF +status + +# Mkfs 2>&1 >/dev/null +#if fdisk -l /dev/${dev} | grep "^/dev/${dev}1"; then + #debug "Creating: /boot FAT32 filesystem" + #mkdosfs -F 32 -v -l -n "RPi-boot" /dev/${dev}1 +#fi +#if fdisk -l /dev/${dev} | grep "^/dev/${dev}2"; then + #debug "Creating: swap memory filesystem" + #mkswap -L "RPi-swap" /dev/${dev}2 +#fi +#if fdisk -l /dev/${dev} | grep "^/dev/${dev}3"; then + #debug "Creating: root ext4 filesystem" + #mkfs.ext4 -L "RPi-root" /dev/${dev}3 +#fi diff -r 839d11d53db8 -r 5d870dbf2641 tools/rpi-example.cgi --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tools/rpi-example.cgi Sun Mar 09 10:14:33 2014 +0100 @@ -0,0 +1,37 @@ +#!/bin/sh +# +# Tiny CGI SHell example for SliTaz RPi +# +# $ startd httpd +# URL: http://rpi.ip/adm/ +# +echo "Content type: text/plain" +echo "" + +# Only for root +[ $(id -u) == 0 ] || exit 1 + +cpu_temp() { + awk '{printf "%3.1f C", $1/1000}' \ + /sys/class/thermal/thermal_zone0/temp +} + +# tazberry rpi_stats +cat << EOT +SliTaz Raspberry Pi Stats +------------------------- + +Kernel : $(uname -snrm) +Uptime :$(uptime | cut -d "," -f 1,2) +CPU Temp : $(cpu_temp) + +Memory and filesystem usages +---------------------------- +$(free -m) + +$(df -h) + +Network interfaces +------------------ +$(ifconfig) +EOT