Skip to content

Instantly share code, notes, and snippets.

@rickolous
Created March 28, 2020 20:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rickolous/f729449bd8c550112860fd89b2b73124 to your computer and use it in GitHub Desktop.
Save rickolous/f729449bd8c550112860fd89b2b73124 to your computer and use it in GitHub Desktop.
boot.sh from eWeLink FGHGF VG-IC-01 IP Camera
echo ""
echo "----enter to upgrade from sdcard----"
bUpgrade=0
if [ ! -f /var/sdcard ];then
mkdir /var/sdcard
mount /dev/mmcblk0p1 /var/sdcard
fi
cp /gm/tools/flashcp /usr/bin/
chmod +x /usr/bin/LEDLamp.sh
if [ -f /var/sdcard/LinksApi.bin ];then
touch /mnt/mtd/ipc/cfg/LinksApi.bin
fi
if [ -f /var/sdcard/LinkAfterApi ];then
bUpgrade=1
fi
if [ -f /var/sdcard/uboot.boot ];then
mv /var/sdcard/uboot.boot /var/sdcard/uboot.boot.use
fi
if [ -f /var/sdcard/kernel.boot ];then
mv /var/sdcard/kernel.boot /var/sdcard/kernel.boot.use
fi
if [ -f /var/sdcard/rootfs.boot ];then
mv /var/sdcard/rootfs.boot /var/sdcard/rootfs.boot.use
fi
if [ -f /var/sdcard/user.boot ];then
mv /var/sdcard/user.boot /var/sdcard/user.boot.use
fi
if [ -f /var/sdcard/app.boot ];then
mv /var/sdcard/app.boot /var/sdcard/app.boot.use
fi
if [ ! -f /var/sdcard/uboot.bin ];then
echo " uboot.bin not exist."
else
/usr/bin/LEDLamp.sh
flash_eraseall /dev/mtd0
/usr/bin/flashcp -v /var/sdcard/uboot.bin /dev/mtd0
mv /var/sdcard/uboot.bin /var/sdcard/uboot.bin.bak
bUpgrade=1
echo " uboot.bin is updated."
fi
if [ ! -f /var/sdcard/kernel.bin ];then
echo " kernel.bin not exist."
else
/usr/bin/LEDLamp.sh
flash_eraseall /dev/mtd1
/usr/bin/flashcp -v /var/sdcard/kernel.bin /dev/mtd1
mv /var/sdcard/kernel.bin /var/sdcard/kernel.bin.bak
bUpgrade=1
echo " kernel.bin is updated."
fi
if [ ! -f /var/sdcard/rootfs.bin ];then
echo " rootfs.bin not exist."
else
/usr/bin/LEDLamp.sh
flash_eraseall /dev/mtd2
/usr/bin/flashcp -v /var/sdcard/rootfs.bin /dev/mtd2
mv /var/sdcard/rootfs.bin /var/sdcard/rootfs.bin.bak
bUpgrade=1
echo " rootfs.bin is updated."
fi
if [ ! -f /var/sdcard/user.bin ];then
echo " user.bin not exist."
else
/usr/bin/LEDLamp.sh
# cp -rf /mnt/mtd/db /tmp
# umount /mnt/mtd
flash_eraseall -j /dev/mtd3
/usr/bin/flashcp -v /var/sdcard/user.bin /dev/mtd3
mv /var/sdcard/user.bin /var/sdcard/user.bin.bak
bUpgrade=1
# mount -t jffs2 /dev/mtdblock3 /mnt/mtd/
# cp -rf /tmp/db /mnt/mtd
# umount /mnt/mtd
echo " user.bin is updated."
fi
if [ ! -f /var/sdcard/app.bin ];then
echo " app.bin not exist."
else
/usr/bin/LEDLamp.sh
flash_eraseall /dev/mtd4
/usr/bin/flashcp -v /var/sdcard/app.bin /dev/mtd4
mv /var/sdcard/app.bin /var/sdcard/app.bin.bak
bUpgrade=1
echo " app.bin is updated."
fi
if [ "$bUpgrade" != "0" ];then
if [ -f /var/sdcard/after_upgrade.sh ];then
/var/sdcard/after_upgrade.sh
fi
umount /var/sdcard
reboot
echo "----leaved to upgrade from sdcard----"
exit
fi
echo "----leaved to upgrade from sdcard----"
umount /var/sdcard
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment