linkpi_firmware_history/rootfs/link/shell/update.sh_bak

55 lines
1.7 KiB
Plaintext
Raw Permalink Normal View History

2024-02-15 22:07:39 +01:00
if [ ! -z "$(ls -A /link/update)" ]; then
mkdir /tmp/history/misc/timezone
cp -rd /link/config/config.json /link/config/push.json /link/config/record.json /tmp/history/
cp -rd /link/config/button.json /link/config/defLays.json /link/config/port.json /tmp/history/
cp -rd /link/config/lang.json /link/config/videoBuffer.json /link/config/ntp.json /tmp/history/
cp -rd /link/config/uart.json /link/config/intercom.json /tmp/history/
cp -rd /link/config/misc/timezone/tzselect.json /tmp/history/misc/timezone/
mv /link/update/* /link/update/update.tar
tar -xof /link/update/update.tar -C /
sleep 1
if [ -c "/dev/mtd1" ]; then
if [ -f "/link/update/kernel" ]; then
flash_erase /dev/mtd1 0 0
nandwrite -p /dev/mtd1 /link/update/kernel
fi
if [ -f "/link/update/logo.bin" ]; then
flash_erase /dev/mtd2 0 0
nandwrite -p /dev/mtd2 /link/update/logo.bin
fi
if [ -f "/link/update/logo.jpg" ]; then
flash_erase /dev/mtd3 0 0
nandwrite -p /dev/mtd3 /link/update/logo.jpg
fi
else
if [ -f "/link/update/kernel" ]; then
dd if=/link/update/kernel of=/dev/mmcblk0p2
fi
if [ -f "/link/update/logo.bin" ]; then
dd if=/link/update/logo.bin of=/dev/mmcblk0p3
fi
if [ -f "/link/update/logo.jpg" ]; then
dd if=/link/update/logo.jpg of=/dev/mmcblk0p4
fi
fi
rm /link/update/*
if [ -f "/link/config/reboot" ]; then
rm /link/config/reboot
reboot
fi
fi
if [ -f "/link/shell/runOnce.sh" ]; then
chmod 777 /link/shell/runOnce.sh
/link/shell/runOnce.sh
rm /link/shell/runOnce.sh
fi