download.sh
#!/bin/sh
# check the network first
serverip=$(cat /tmp/serverip)
while true; do
ping -c 5 $serverip; if [ $? = 0 ];then break; fidone# then disable the firewall
/etc/init.d/firewall stopcd /tmp
tftp -g -r rootfs.tar.gz $serverip
cd /
format.sh
#!/bin/sh
mmcdev=/dev/mmcblk0
# check device while true;do if [ -e $mmcdev ];then break; else sleep 1; fi doneecho "d
np1 w" |/usr/sbin/fdisk $mmcdevmmcpart=${mmcdev}p1
while true;do
if [ -e $mmcpart ];then break; else sleep 1; fidoneecho "y
" | /usr/sbin/mkfs.ext4 $mmcpart
install.sh
#!/bin/sh
mmcpart=/dev/mmcblk0p1
if [ ! -e $mmcpart ];then
echo "format the eMMC device failed"; exitfitarfile=/tmp/rootfs.tar.gz
if [ ! -f $tarfile ]; then
echo "download the armbian failed"; exitfimount $mmcpart /mnt
if [ $? = 1 ];then
echo "format the eMMC device failed"; exit ficd /mnt
tar vxzf $tarfile
cd /
umount /mnt
echo "install finish"