fixed fw upgrade issues

This commit is contained in:
Alfonso Gamboa
2022-04-21 03:01:51 -07:00
parent 07eeeb57c3
commit 0ec18d876a
6 changed files with 93 additions and 19 deletions

View File

@@ -13,6 +13,7 @@ export PATH=/system/bin:$PATH
export LD_LIBRARY_PATH=/system/lib:/opt/wz_mini/lib
export LD_LIBRARY_PATH=/thirdlib:$LD_LIBRARY_PATH
export TERMINFO=/opt/wz_mini/usr/share/terminfo
export TERM=xterm-color
/opt/wz_mini/bin/busybox resize
#export TZ=UTC-8

View File

@@ -2,8 +2,7 @@
set -x
##DO NOT ENABLE FW UPGRADE. FW UPGRADE CAN POTENTIALLY CORRUPT THE KERNEL REQUIRING YOU TO REFLASH THE STOCK FIRMWARE.
DISABLE_FW_UPGRADE="true"
DISABLE_FW_UPGRADE="false"
HOSTNAME="WCV3"
@@ -86,8 +85,11 @@ fi
if [[ "$DISABLE_FW_UPGRADE" == "true" ]]; then
mkdir /tmp/Upgrade
mount -t tmpfs -o size=1,nr_inodes=1 none /tmp/Upgrade
echo -e "127.0.0.1 localhost \n127.0.0.1 wyze-upgrade-service.wyzecam.com" > /run/.storage/hosts_wz
mount --bind /run/.storage/hosts_wz /etc/hosts
echo -e "127.0.0.1 localhost \n127.0.0.1 wyze-upgrade-service.wyzecam.com" > /opt/wz_mini/tmp/.storage/hosts
mount --bind /opt/wz_mini/tmp/.storage/hosts /etc/hosts
else
mkdir /tmp/Upgrade
/opt/wz_mini/bin/busybox inotifyd /opt/wz_mini/usr/bin/watch_up.sh /tmp/Upgrade:n &
fi
if [[ "$REMOTE_SPOTLIGHT" == "true" ]]; then

0
SD_ROOT/wz_mini/usr/bin/iCamera Normal file → Executable file
View File

View File

@@ -0,0 +1,58 @@
#!/bin/sh
event="$1"
directory="$2"
file="$3"
case "$event" in
n) if [[ "$file" == "upgraderun.sh" ]]; then
pkill -f "sh /tmp/Upgrade/upgraderun.sh"
mv /tmp/Upgrade/upgraderun.sh /tmp/Upgrade/upgraderun.old
echo "squashed upgraderun.sh"
echo "start countdown"
secs=30
endTime=$(( $(date +%s) + secs ))
while [ $(date +%s) -lt $endTime ]; do
if pgrep -f 'upgraderun.sh' > /dev/null ; then
pkill -f "sh /tmp/Upgrade/upgraderun.sh"
pkillexitstatus=$?
if [ $pkillexitstatus -eq 0 ]; then
echo "matched upgraderun.sh, killed."
status=false
break 1
fi
fi
done
if [[ -e /tmp/Upgrade/app ]]; then
echo "found app image, flashing"
flashcp -v /tmp/Upgrade/app /dev/mtd3
/opt/wz_mini/bin/busybox sync
else
echo "no kernel image present"
fi
if [[ -e /tmp/Upgrade/kernel ]]; then
echo "found kernel image, flashing"
flashcp -v /tmp/Upgrade/kernel /dev/mtd1
/opt/wz_mini/bin/busybox sync
else
echo "no app image present"
fi
if [[ -e /tmp/Upgrade/rootfs ]]; then
echo "found rootfs image, flashing"
flashcp -v /tmp/Upgrade/rootfs /dev/mtd2
/opt/wz_mini/bin/busybox sync
else
echo "no root image present"
fi
/opt/wz_mini/bin/busybox sync
/opt/wz_mini/bin/busybox sync
sleep 5
/opt/wz_mini/bin/busybox reboot
fi;;
*) echo "This script must be run from inotifyd";;
esac