mirror of
https://github.com/gtxaspec/wz_mini_hacks.git
synced 2025-08-08 03:24:03 +00:00
add v2 support
This commit is contained in:
@@ -1,14 +1,37 @@
|
||||
#!/bin/sh
|
||||
|
||||
exec 1>> /opt/wz_mini/log/watch_up.log 2>&1
|
||||
|
||||
set -x
|
||||
|
||||
event="$1"
|
||||
directory="$2"
|
||||
file="$3"
|
||||
|
||||
case "$event" in
|
||||
n) if [[ "$file" == "upgraderun.sh" ]]; then
|
||||
n) date; if [[ "$file" == "img" ]]; then
|
||||
|
||||
set -x
|
||||
|
||||
#hook the v2
|
||||
if cat /params/config/.product_config | grep WYZEC1-JZ; then
|
||||
while [ ! -f /tmp/Upgrade/upgraderun.sh ]
|
||||
do
|
||||
sed -i '/pgrep/,+4d' /tmp/Upgrade/upgraderun.sh
|
||||
find /tmp/Upgrade > /opt/upgrade_find.log &
|
||||
sleep 0.1
|
||||
done
|
||||
|
||||
else
|
||||
|
||||
#t31
|
||||
while [ ! -f /tmp/Upgrade/upgraderun.sh ]
|
||||
do
|
||||
pkill -f "sh /tmp/Upgrade/upgraderun.sh"
|
||||
mv /tmp/Upgrade/upgraderun.sh /tmp/Upgrade/upgraderun.old
|
||||
echo "squashed upgraderun.sh"
|
||||
sleep 0.1
|
||||
done
|
||||
|
||||
echo "start countdown"
|
||||
secs=30
|
||||
@@ -24,35 +47,49 @@ case "$event" in
|
||||
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
|
||||
if cat /params/config/.product_config | grep WYZEC1-JZ; then
|
||||
echo "v2 found"
|
||||
upgrade_path=$(find /tmp/Upgrade | grep upgradecp.sh)
|
||||
sed -i '/wc -c $KERNEL/,+14d' $upgrade_path
|
||||
#mv /tmp/Upgrade/upgraderun.sh /tmp/Upgrade/run_upg.sh
|
||||
#sh /tmp/Upgrade/run_upg.sh
|
||||
/tmp/Upgrade/system_upgrade.sh
|
||||
else
|
||||
echo "no app image present"
|
||||
|
||||
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
|
||||
|
||||
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
|
||||
echo reboot
|
||||
/opt/wz_mini/bin/busybox reboot
|
||||
|
||||
fi
|
||||
|
||||
fi;;
|
||||
*) echo "This script must be run from inotifyd";;
|
||||
esac
|
||||
|
Reference in New Issue
Block a user