mirror of
https://github.com/gtxaspec/wz_mini_hacks.git
synced 2024-11-25 14:57:19 +00:00
add additional file verification to upgrade-run.sh to prevent broken upgrades
This commit is contained in:
parent
569fbd4846
commit
cf02d1aeb9
@ -12,29 +12,31 @@ exec > >(busybox tee -a ${LOG_FILE}) 2>&1
|
|||||||
|
|
||||||
setup() {
|
setup() {
|
||||||
|
|
||||||
echo "Create Upgrade directory"
|
echo "Create Upgrade staging directory"
|
||||||
mkdir /opt/Upgrade
|
mkdir /opt/.Upgrade
|
||||||
|
|
||||||
echo "Create backup files directory"
|
echo "Create backup files directory"
|
||||||
mkdir /opt/Upgrade/preserve
|
mkdir /opt/.Upgrade/preserve
|
||||||
|
|
||||||
echo "Download latest master"
|
echo "Download latest master"
|
||||||
wget --no-check-certificate https://github.com/gtxaspec/wz_mini_hacks/archive/refs/heads/master.zip -O /opt/Upgrade/wz_mini.zip; sync
|
wget --no-check-certificate https://github.com/gtxaspec/wz_mini_hacks/archive/refs/heads/master.zip -O /opt/.Upgrade/wz_mini.zip; sync
|
||||||
|
|
||||||
echo "Extract archive"
|
echo "Extract master archive"
|
||||||
unzip /opt/Upgrade/wz_mini.zip -d /opt/Upgrade/
|
unzip /opt/.Upgrade/wz_mini.zip -d /opt/.Upgrade/
|
||||||
|
|
||||||
echo "Verify file integrity"
|
echo "Verify extracted file integrity"
|
||||||
cd /opt/Upgrade/wz_mini_hacks-master
|
cd /opt/.Upgrade/wz_mini_hacks-master
|
||||||
md5sum -c file.chk
|
md5sum -c file.chk
|
||||||
|
|
||||||
if [ $? -eq 0 ]; then
|
if [ $? -eq 0 ]; then
|
||||||
echo "files OK"
|
echo "File verification successful!"
|
||||||
|
echo "Move staging directory to perform upgrade"
|
||||||
|
mv /opt/.Upgrade/ /opt/Upgrade/
|
||||||
install_upgrade_script
|
install_upgrade_script
|
||||||
else
|
else
|
||||||
echo "Failure: archive has corrupted files"
|
echo "Failure: Extracted files may be corrupt. Aborting upgrade."
|
||||||
echo "Delete failed upgrade dir"
|
echo "Delete failed upgrade staging directory"
|
||||||
rm -rf /opt/Upgrade
|
rm -rf /opt/.Upgrade
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -98,6 +100,19 @@ fi
|
|||||||
|
|
||||||
echo "UPGRADE MODE"
|
echo "UPGRADE MODE"
|
||||||
|
|
||||||
|
echo "Verify extracted file integrity"
|
||||||
|
cd /opt/Upgrade/wz_mini_hacks-master
|
||||||
|
md5sum -c file.chk
|
||||||
|
|
||||||
|
if [ $? -eq 0 ]; then
|
||||||
|
echo "File verification successful!"
|
||||||
|
else
|
||||||
|
echo "Failure: Extracted files may be corrupt. Aborting upgrade."
|
||||||
|
echo "Delete failed upgrade directory"
|
||||||
|
rm -rf /opt/Upgrade
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
if [ -f /opt/wz_mini/tmp/.T20 ]; then
|
if [ -f /opt/wz_mini/tmp/.T20 ]; then
|
||||||
echo "Upgrading kernel"
|
echo "Upgrading kernel"
|
||||||
flashcp -v /opt/Upgrade/wz_mini_hacks-master/v2_install/v2_kernel.bin /dev/mtd1
|
flashcp -v /opt/Upgrade/wz_mini_hacks-master/v2_install/v2_kernel.bin /dev/mtd1
|
||||||
@ -133,6 +148,7 @@ reboot
|
|||||||
|
|
||||||
if [[ "$1" == "unattended" ]]; then
|
if [[ "$1" == "unattended" ]]; then
|
||||||
echo "Unattended upgrade!"
|
echo "Unattended upgrade!"
|
||||||
|
rm -rf /opt/.Upgrade
|
||||||
rm -rf /opt/Upgrade
|
rm -rf /opt/Upgrade
|
||||||
sync
|
sync
|
||||||
setup
|
setup
|
||||||
@ -149,11 +165,12 @@ else
|
|||||||
read -r -p "${1:-wz_mini, this will download the latest version from github and upgrade your system. Are you sure? [y/N]} " response
|
read -r -p "${1:-wz_mini, this will download the latest version from github and upgrade your system. Are you sure? [y/N]} " response
|
||||||
case "$response" in
|
case "$response" in
|
||||||
[yY][eE][sS]|[yY])
|
[yY][eE][sS]|[yY])
|
||||||
if [[ -d /opt/Upgrade ]]; then
|
if [[ -d /opt/.Upgrade ]]; then
|
||||||
echo "WARNING: Old Upgrade directory exists"
|
echo "WARNING: Old Upgrade directory exists"
|
||||||
read -r -p "${1:-Unable to proceed, must DELETE old Upgrade directory, are you sure? [y/N]} " response
|
read -r -p "${1:-Unable to proceed, must DELETE old Upgrade directory, are you sure? [y/N]} " response
|
||||||
case "$response" in
|
case "$response" in
|
||||||
[yY][eE][sS]|[yY])
|
[yY][eE][sS]|[yY])
|
||||||
|
rm -rf /opt/.Upgrade
|
||||||
rm -rf /opt/Upgrade
|
rm -rf /opt/Upgrade
|
||||||
sync
|
sync
|
||||||
setup
|
setup
|
||||||
|
6
file.chk
6
file.chk
@ -52,7 +52,7 @@ a8970288e72c871bff6a4484f1e733d6 SD_ROOT/wz_mini/bin/readelf
|
|||||||
41b56bb30f02bce5f5e2598073151e16 SD_ROOT/wz_mini/bin/ffmpeg
|
41b56bb30f02bce5f5e2598073151e16 SD_ROOT/wz_mini/bin/ffmpeg
|
||||||
e37474a12d76cae16336476cba61e8b8 SD_ROOT/wz_mini/bin/neofetch
|
e37474a12d76cae16336476cba61e8b8 SD_ROOT/wz_mini/bin/neofetch
|
||||||
7fcc716cda1e024dae1045050a135beb SD_ROOT/wz_mini/bin/audioplay_t31
|
7fcc716cda1e024dae1045050a135beb SD_ROOT/wz_mini/bin/audioplay_t31
|
||||||
03a42f7f175f88903c0dc52013f11205 SD_ROOT/wz_mini/bin/upgrade-run.sh
|
18acd856dd104377c35ca6121409f9cf SD_ROOT/wz_mini/bin/upgrade-run.sh
|
||||||
e6a6a9dd8ce138686083a3d4303cea40 SD_ROOT/wz_mini/bin/iperf3
|
e6a6a9dd8ce138686083a3d4303cea40 SD_ROOT/wz_mini/bin/iperf3
|
||||||
0468ffb319707687557353242a518923 SD_ROOT/wz_mini/bin/wg
|
0468ffb319707687557353242a518923 SD_ROOT/wz_mini/bin/wg
|
||||||
65510c6c4d0db4b4679fc92d1c617fdd SD_ROOT/wz_mini/bin/rtmp-stream.sh
|
65510c6c4d0db4b4679fc92d1c617fdd SD_ROOT/wz_mini/bin/rtmp-stream.sh
|
||||||
@ -189,3 +189,7 @@ bd383994491e4bdca81788c168feb2eb SD_ROOT/wz_mini/lib/libasound.so.2
|
|||||||
f6f0d5a9ebd916de6bdb9695067809ae SD_ROOT/wz_mini/lib/libaudioProcess.so
|
f6f0d5a9ebd916de6bdb9695067809ae SD_ROOT/wz_mini/lib/libaudioProcess.so
|
||||||
aa102e670336c6bf165f1a9925d9d4fc SD_ROOT/wz_mini/wz_mini.conf
|
aa102e670336c6bf165f1a9925d9d4fc SD_ROOT/wz_mini/wz_mini.conf
|
||||||
d41d8cd98f00b204e9800998ecf8427e SD_ROOT/wz_mini/tmp/.gitignore
|
d41d8cd98f00b204e9800998ecf8427e SD_ROOT/wz_mini/tmp/.gitignore
|
||||||
|
00b99816217a740f5169709ef01eddf6 v2_install/compile_image.sh
|
||||||
|
ff15869fe24297b9a5f75335a458a44f v2_install/fw_tool.sh
|
||||||
|
9625b325d7cf317bc9bc796312be82db v2_install/v2_kernel.bin
|
||||||
|
f01d641b98388e273c1f0ba682ebc75b v2_install/.gitignore
|
||||||
|
Loading…
Reference in New Issue
Block a user