From 4c3b696e01fd1df17eed0bb8a869e3a51879c9f1 Mon Sep 17 00:00:00 2001 From: Alfonso Gamboa Date: Tue, 31 May 2022 00:15:42 -0700 Subject: [PATCH] upgrade mode file verification and upgrade prompts --- .gitignore | 1 + SD_ROOT/wz_mini/usr/bin/upgrade-run.sh | 47 ++++++++++++++++++++++++++ file.chk | 4 ++- 3 files changed, 51 insertions(+), 1 deletion(-) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..3f61590 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +generate_checksum.sh diff --git a/SD_ROOT/wz_mini/usr/bin/upgrade-run.sh b/SD_ROOT/wz_mini/usr/bin/upgrade-run.sh index 7b8cc47..eb339d6 100755 --- a/SD_ROOT/wz_mini/usr/bin/upgrade-run.sh +++ b/SD_ROOT/wz_mini/usr/bin/upgrade-run.sh @@ -24,6 +24,19 @@ wget --no-check-certificate https://github.com/gtxaspec/wz_mini_hacks/archive/re echo "Extract archive" unzip /opt/Upgrade/wz_mini.zip -d /opt/Upgrade/ +echo "Verify file integrity" +cd /opt/Upgrade/wz_mini_hacks-master +md5sum -c file.chk + +if [ $? -eq 0 ] +then + echo "files OK" + #exit 0 +else + echo "Failure: archive has corrupted files" + exit 1 +fi + cp /opt/wz_mini/wz_mini.conf /opt/Upgrade/preserve/ cp -r /opt/wz_mini/etc/ssh /opt/Upgrade/preserve/ cp -r /opt/wz_mini/etc/wireguard /opt/Upgrade/preserve/ @@ -36,6 +49,40 @@ upgrade_mode_start() { set -x +#WCV3 AUDIO GPIO +GPIO=63 + +#Check model, change GPIO is HL_PAN2 +if [[ "$V2" == "false" ]]; then + mount -t jffs2 /dev/mtdblock6 /configs + if [[ $(cat /configs/.product_config | grep PRODUCT_MODEL) == "PRODUCT_MODEL=HL_PAN2" ]]; then + umount /configs + GPIO=7 + fi +else + echo "v2, no need to check" +fi + + +#test for v2 +if [ -b /dev/mtdblock9 ]; then + mount -t jffs2 /dev/mtdblock9 /params + if cat /params/config/.product_config | grep WYZEC1-JZ; then + V2="true" + fi +fi + + +if [[ "$V2" == "true" ]]; then + insmod /opt/wz_mini/lib/modules/3.10.14_v2/kernel/audio.ko + LD_LIBRARY_PATH='/opt/wz_mini/lib' /opt/wz_mini/bin/audioplay_t20 /opt/wz_mini/usr/share/audio/upgrade_mode_v2.wav 70 + rmmod audio + else + insmod /opt/wz_mini/lib/modules/3.10.14__isvp_swan_1.0__/kernel/audio.ko spk_gpio=$GPIO alc_mode=0 mic_gain=0 + /opt/wz_mini/bin/audioplay_t31 /opt/wz_mini/usr/share/audio/upgrade_mode.wav 50 + rmmod audio + fi + echo UPGRADE MODE umount /opt/wz_mini/tmp diff --git a/file.chk b/file.chk index bc01f16..fd25bb2 100644 --- a/file.chk +++ b/file.chk @@ -58,6 +58,8 @@ fbbc2a8f362d05fc31557b1a534b42c6 SD_ROOT/wz_mini/bin/wget 2e4a762b311eb6bb82495956077e388d SD_ROOT/wz_mini/usr/share/misc/magic.mgc ce77db197f6f3a8965b64d2cd1ee74fb SD_ROOT/wz_mini/usr/share/terminfo.tar 1e078af535977a8d0bf4d393e5ac6448 SD_ROOT/wz_mini/usr/share/audio/swap_v2.wav +e2e7f9190edcfb31af42fb00c59919ab SD_ROOT/wz_mini/usr/share/audio/upgrade_mode_v2.wav +88b4726752434cd6af182520414e1d69 SD_ROOT/wz_mini/usr/share/audio/upgrade_mode.wav 99d3ad0812870a67893f247f779666ab SD_ROOT/wz_mini/usr/share/audio/swap.wav eaf86f91cb1b15b2191a8845ae88e3c8 SD_ROOT/wz_mini/usr/share/audio/init_v2.wav 02fed0e4b2382d839f630ce0477aba26 SD_ROOT/wz_mini/usr/share/audio/init.wav @@ -65,7 +67,7 @@ eaf86f91cb1b15b2191a8845ae88e3c8 SD_ROOT/wz_mini/usr/share/audio/init_v2.wav df71296985782eb0c111a95f36aa4648 SD_ROOT/wz_mini/usr/bin/watch_up.sh b339aee882a5d1c943ad08e4282ec3fd SD_ROOT/wz_mini/usr/bin/iCamera-dbg 20b061689308b2cee7edf3b9b906bca7 SD_ROOT/wz_mini/usr/bin/ucamera -7662dfb8e09ff85e05653c084483cf5b SD_ROOT/wz_mini/usr/bin/upgrade-run.sh +361443f420cbfc6402fef9d0b2510d36 SD_ROOT/wz_mini/usr/bin/upgrade-run.sh 47f88eecbd49de573335028dc72dab3e SD_ROOT/wz_mini/usr/bin/rtmp-stream.sh 4c780f0455481d106d47d89f0ae04ed5 SD_ROOT/wz_mini/lib/uClibc.tar 9afeb088e4cbabbe0b04033b560204d0 SD_ROOT/wz_mini/lib/libimp.so