Backup Script for ET9000

To make a backup image onto a USB stick you fist have to save an empty text file to the USB stick called etbackupstick.txt

You should now have a file called etbackupstick.txt on the USB Pen Drive.

Insert the USB Pen into the ET-9000

Upload the backup.sh and build-usb-image.sh files to the /tmp folder on the ET-9000.

Open a Telnet Window and enter the following 3 commands 1 line at a time.

su
cd /tmp
./backup.sh

This will create a folder on your USB Pen Drive called et9000
Inside the et9000 folder is your backed up image.


backup.sh
Code:
TARGET="XX"
build-usb-image.sh /media/hdd | tee /tmp/NFI-Backup.log
wait 3
if [ -f "/media/usb/etbackupstick" -o -f "/media/usb/etbackupstick.txt" ]
then
TARGET="/media/usb"
elif [ -f "/media/sdb1/etbackupstick" -o -f "/media/sdb1/etbackupstick.txt" ]
then
TARGET = "/media/sdb1"
elif [ -f "/media/sdc1/etbackupstick" -o -f "/media/sdc1/etbackupstick.txt" ]
then
TARGET = "/media/sdc1"
elif [ -f "/media/sdd1/etbackupstick" -o -f "/media/sdd1/etbackupstick.txt" ]
then
TARGET = "/media/sdd1"
fi
if [ $TARGET = "XX" ]
then
echo
else
echo please wait...
cp -r /media/hdd/et9000/ $TARGET
sleep 3
umount $TARGET
sleep 5
echo Backup finished and copied to your USB-stick
echo 
echo REMOVE YOUR USB STICK NOW !!!
fi
# USB BACKUP Utility for ENIGMA2
# Version 1.0 - 03-12.2010
# supports USB Backups

build-usb-image.sh
Code:
#
#############################################################
# USB BACKUP Utility for ENIGMA2
# Version 1.0 - 03-12.2010
# supports USB Backups
#############################################################
#
#!/bin/sh
VERSION="Version 1.0 - 03.12.2010"
DIRECTORY=$1
if grep et9000 /etc/hostname > /dev/null ; then
MODEL=et9000
OPTIONS="--eraseblock=0x20000 -n -l"
else
echo "No right MODEL Box detected !!!"
exit 0
fi
echo "________________________________________________________"
echo " "
echo "USB Backup Tool for $MODEL " $VERSION
echo "________________________________________________________"
echo " "
echo "Please be patience, a backup will now be made,"
echo "this will take approximately 2 minutes "
echo "________________________________________________________"
DATE=`date +%Y%m%d_%H%M%S`
IMAGEVERSION=`date +%Y%m%d`
MKFS=/usr/bin/mkfs.jffs2
BUILDIMAGE=/usr/bin/buildimage
NANDDUMP=/usr/bin/nanddump
EXTRA=$DIRECTORY/fullbackup_$MODEL/$DATE
if [ ! -f $MKFS ] ; then
echo $MKFS" not found"
exit 0
fi
if [ ! -f $BUILDIMAGE ] ; then
echo $BUILDIMAGE" not found"
exit 0
fi
if [ ! -f $NANDDUMP ] ; then
echo $NANDDUMP" not found"
exit 0
fi
rm -rf $DIRECTORY/bi
mkdir -p $DIRECTORY/bi
mkdir -p /tmp/bi/boot
mkdir -p /tmp/bi/root
 
if [ $MODEL = "et9000" ] ; then
mount -t jffs2 /dev/mtdblock2 /tmp/bi/boot
mount -t jffs2 /dev/mtdblock3 /tmp/bi/root
 
fi
if [ -s $BUILDIMAGE ] ; then
echo "Create boot.jffs2"
$MKFS --root=/tmp/bi/boot --faketime --output=$DIRECTORY/bi/boot.jffs2 $OPTIONS
echo "Create root.jffs2"
$MKFS --root=/tmp/bi/root --faketime --output=$DIRECTORY/bi/root.jffs2 $OPTIONS
fi
echo "Create kerneldump"
if [ $MODEL = "et9000" ] ; then
nanddump /dev/mtd1 -o -b > $DIRECTORY/bi/vmlinux.gz
fi
echo "________________________________________________________"
echo " "
echo "Creating $MODEL USB-Backup Image"
echo "________________________________________________________"
mkdir -p $DIRECTORY/$MODEL
mkdir -p $EXTRA
mv $DIRECTORY/bi/root.jffs2 $DIRECTORY/$MODEL/rootfs.bin
mv $DIRECTORY/bi/boot.jffs2 $DIRECTORY/$MODEL/boot.bin
mv $DIRECTORY/bi/vmlinux.gz $DIRECTORY/$MODEL/kernel.bin
echo "rename this file to 'force' to force an update without confirmation" > $DIRECTORY/$MODEL/noforce;
echo $MODEL-$IMAGEVERSION > $DIRECTORY/$MODEL/imageversion;
cp -r $DIRECTORY/$MODEL $EXTRA/$MODEL #copy the made back-up to images
if [ -f $DIRECTORY/$MODEL/rootfs.bin -a -f $DIRECTORY/$MODEL/boot.bin -a -f $DIRECTORY/$MODEL/kernel.bin -a -f $DIRECTORY/$MODEL/imageversion -a -f $DIRECTORY/$MODEL/noforce ] ; then
echo "________________________________________________________"
echo " "
echo "USB Image created on:" $DIRECTORY"/$MODEL "
echo "and there is made an extra copy on:" 
echo $EXTRA"/$MODEL"
echo "________________________________________________________" 
echo " "
echo " To restore the image: "
echo "Place the USB-stick in the front USB-port and switch the "
echo "$MODEL off and on with the powerswitch on the back of "
echo "the $MODEL. Follow the instructions on front-display." 
echo " "
else
echo "Image creation failed - "
echo "e.g. wrong backup destination or"
echo "no space left on backup device"
fi
umount /tmp/bi/root
umount /tmp/bi/boot
rm -rf /tmp/bi
rm -rf $DIRECTORY/bi
exit