1
0
mirror of https://github.com/DigitalDevices/octonet.git synced 2023-10-10 13:36:52 +02:00

Recovery/patch image startup

add variables to assist oem patches
improved parsing of html file listings
This commit is contained in:
mvoelkel 2015-12-07 15:00:55 +01:00
parent e8e203c014
commit b01cd1d64f

View File

@ -1,12 +1,15 @@
#!/bin/sh #!/bin/sh
IMAGE="octonet"
UPDSRV="download.digital-devices.de/download/linux"
case "$1" in case "$1" in
start) start)
sleep 3 sleep 3
if ! ubiattach -p /dev/mtd2; then if ! ubiattach -p /dev/mtd2; then
ubiformat /dev/mtd2 -e 0; ubiattach -p /dev/mtd2 ubiformat /dev/mtd2 -e 0; ubiattach -p /dev/mtd2
else #~ else
ubirmvol /dev/ubi0 -N rootfs #~ ubirmvol /dev/ubi0 -N rootfs
fi fi
if ! [ -e /dev/ubi0_0 ]; then ubimkvol /dev/ubi0 -s 64MiB -N config; fi if ! [ -e /dev/ubi0_0 ]; then ubimkvol /dev/ubi0 -s 64MiB -N config; fi
@ -15,30 +18,31 @@ case "$1" in
mkdir /config mkdir /config
mount -t ubifs /dev/ubi0_0 /config mount -t ubifs /dev/ubi0_0 /config
img=`ls /config/octonet.*.img` img=`ls /config/${IMAGE}.*.img`
if [ "$img" = "" ]; then if [ "$img" = "" ]; then
sleep 5 sleep 5
if [ -e /dev/sda1 ]; then if [ -e /dev/sda1 ]; then
mount -r /dev/sda1 /mnt mount -r /dev/sda1 /mnt
ls -l --color=never /mnt ls -l --color=never /mnt
cp /mnt/octonet.*.img /config cp /mnt/${IMAGE}.*.img /config
ls -l --color=never /config ls -l --color=never /config
sha256sum /config/octonet.*.img sha256sum /config/${IMAGE}.*.img
umount /mnt umount /mnt
fi fi
fi fi
img=`ls /config/octonet.*.img` img=`ls /config/${IMAGE}.*.img`
if [ "$img" = "" ]; then if [ "$img" = "" ]; then
udhcpc udhcpc -f -q
sleep 3 sleep 3
nimage=`wget http://download.digital-devices.de/download/linux/octonet/ -q -O -|grep img|sort|tail -n 1| cut -d\" -f 2` nimage=`wget http://${UPDSRV}/${IMAGE}/ -q -O -|grep -o "${IMAGE}\.[0-9]*\.img"|sort -u|tail -n 1`
wget -P /config http://download.digital-devices.de/download/linux/octonet/$nimage echo ${nimage}
wget -P /config http://${UPDSRV}/${IMAGE}/$nimage
fi fi
mount -t ubifs /dev/ubi0_1 /mnt mount -t ubifs /dev/ubi0_1 /mnt
rm -rf /mnt/* rm -rf /mnt/*
tar -x -C /mnt -f /config/octonet.*.img tar -x -C /mnt -f /config/${IMAGE}.*.img
umount /mnt umount /mnt
umount /config umount /config
reboot reboot