mirror of
https://github.com/gtxaspec/wz_mini_hacks.git
synced 2025-04-29 09:46:20 +00:00
add initial support for automated updates
This commit is contained in:
parent
0fe6a1ffa2
commit
e301cb2c06
@ -1,7 +1,7 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
#On the V2, for some reason iCamera runs "sh -c iwlist wlan0 scan | grep 'ESSID:"<your wifi ssid>"' every 5 seconds.
|
#On the V2, for some reason iCamera runs "sh -c iwlist wlan0 scan | grep 'ESSID:"<your wifi ssid>"' every 5 seconds.
|
||||||
#Let's fake the output, and increase put some sleep in to increase the "scan" times to every xx seconds to reduce load
|
#Let's fake the output, and put some sleep time to increase the "scan" frequency to every xx seconds to reduce load
|
||||||
|
|
||||||
ssid=$(cat /tmp/wpa_supplicant.conf | grep "ssid=\"" | cut -d'"' -f 2)
|
ssid=$(cat /tmp/wpa_supplicant.conf | grep "ssid=\"" | cut -d'"' -f 2)
|
||||||
|
|
||||||
|
@ -34,7 +34,7 @@ GPIO=63
|
|||||||
mount --bind /opt/wz_mini/bin/busybox /bin/busybox
|
mount --bind /opt/wz_mini/bin/busybox /bin/busybox
|
||||||
|
|
||||||
#test for v2
|
#test for v2
|
||||||
if [ -b /dev/mtdblock7 ]; then
|
if [ -b /dev/mtdblock9 ]; then
|
||||||
mount -t jffs2 /dev/mtdblock9 /params
|
mount -t jffs2 /dev/mtdblock9 /params
|
||||||
if cat /params/config/.product_config | grep WYZEC1-JZ; then
|
if cat /params/config/.product_config | grep WYZEC1-JZ; then
|
||||||
V2="true"
|
V2="true"
|
||||||
@ -152,21 +152,23 @@ if [[ "$DEBUG_ENABLED" == "true" ]]; then
|
|||||||
sed -i '/app_init.sh/,+4d' /opt/wz_mini/tmp/.storage/rcS
|
sed -i '/app_init.sh/,+4d' /opt/wz_mini/tmp/.storage/rcS
|
||||||
sed -i '/^# Run init/i/bin/sh /etc/profile' /opt/wz_mini/tmp/.storage/rcS
|
sed -i '/^# Run init/i/bin/sh /etc/profile' /opt/wz_mini/tmp/.storage/rcS
|
||||||
touch /tmp/dbgflag
|
touch /tmp/dbgflag
|
||||||
else
|
|
||||||
|
|
||||||
if [[ "$WEB_CAM_ENABLE" == "true" ]]; then
|
elif [[ "$WEB_CAM_ENABLE" == "true" ]]; then
|
||||||
sed -i '/app_init.sh/,+4d' /opt/wz_mini/tmp/.storage/rcS
|
sed -i '/app_init.sh/,+4d' /opt/wz_mini/tmp/.storage/rcS
|
||||||
sed -i '/^# Run init/i/opt/wz_mini/etc/init.d/wz_cam.sh' /opt/wz_mini/tmp/.storage/rcS
|
sed -i '/^# Run init/i/opt/wz_mini/etc/init.d/wz_cam.sh' /opt/wz_mini/tmp/.storage/rcS
|
||||||
touch /tmp/dbgflag
|
touch /tmp/dbgflag
|
||||||
fi
|
|
||||||
|
|
||||||
|
elif [[ -d /opt/Upgrade ]]; then
|
||||||
|
sed -i '/app_init.sh/,+4d' /opt/wz_mini/tmp/.storage/rcS
|
||||||
|
sed -i '/^# Run init/i/bin/sh /etc/profile' /opt/wz_mini/tmp/.storage/rcS
|
||||||
|
sed -i '/^# Mount configs.*/i/opt/wz_mini/usr/bin/upgrade-run.sh\n' /opt/wz_mini/tmp/.storage/rcS
|
||||||
|
touch /tmp/dbgflag
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if ! [[ -e /tmp/dbgflag ]]; then
|
if ! [[ -e /tmp/dbgflag ]]; then
|
||||||
# /opt/wz_mini/run_mmc.sh &
|
|
||||||
/opt/wz_mini/etc/init.d/wz_user.sh &
|
/opt/wz_mini/etc/init.d/wz_user.sh &
|
||||||
else
|
else
|
||||||
echo "debug enabled, ignore run_mmc.sh"
|
echo "debug enabled, ignore wz_user.sh"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
@ -6,6 +6,11 @@ exec 1> /opt/wz_mini/log/v3_post.log 2>&1
|
|||||||
|
|
||||||
set -x
|
set -x
|
||||||
|
|
||||||
|
if [[ -e /tmp/dbgflag ]];then
|
||||||
|
echo "debug mode, disabled"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
export WZMINI_CFG=/opt/wz_mini/wz_mini.conf
|
export WZMINI_CFG=/opt/wz_mini/wz_mini.conf
|
||||||
|
|
||||||
[ -f $WZMINI_CFG ] && source $WZMINI_CFG
|
[ -f $WZMINI_CFG ] && source $WZMINI_CFG
|
||||||
|
65
SD_ROOT/wz_mini/usr/bin/upgrade-run.sh
Executable file
65
SD_ROOT/wz_mini/usr/bin/upgrade-run.sh
Executable file
@ -0,0 +1,65 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
setup() {
|
||||||
|
mkdir /opt/Upgrade
|
||||||
|
mkdir /opt/Upgrade/preserve
|
||||||
|
wget --no-check-certificate https://github.com/gtxaspec/wz_mini_hacks/archive/refs/heads/master.zip -O /opt/Upgrade/wz_mini.zip; sync
|
||||||
|
unzip /opt/Upgrade/wz_mini.zip -d /opt/Upgrade/
|
||||||
|
cp /opt/wz_mini/wz_mini.conf /opt/Upgrade/preserve/
|
||||||
|
cp /opt/wz_mini/etc/ssh/authorized_keys /opt/Upgrade/preserve/
|
||||||
|
sync
|
||||||
|
reboot
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
upgrade_mode_start() {
|
||||||
|
exec 1>> /opt/v3_upgrade.log 2>&1
|
||||||
|
set -x
|
||||||
|
echo UPGRADE MODE
|
||||||
|
umount /opt/wz_mini/tmp
|
||||||
|
rm -rf /opt/wz_mini/*
|
||||||
|
mv /opt/Upgrade/wz_mini_hacks-master/SD_ROOT/wz_mini/* /opt/wz_mini/
|
||||||
|
rm -f /opt/factory_t31_ZMC6tiIDQN
|
||||||
|
mv /opt/Upgrade/wz_mini_hacks-master/SD_ROOT/factory_t31_ZMC6tiIDQN /opt/factory_t31_ZMC6tiIDQN
|
||||||
|
|
||||||
|
cp /opt/Upgrade/preserve/authorized_keys /opt/wz_mini/etc/
|
||||||
|
cp /opt/Upgrade/preserve/wz_mini.conf /opt/wz_mini/
|
||||||
|
rm -rf /opt/Upgrade
|
||||||
|
sync
|
||||||
|
reboot
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if [[ -e /tmp/dbgflag ]]; then
|
||||||
|
upgrade_mode_start
|
||||||
|
else
|
||||||
|
|
||||||
|
read -r -p "${1:-wz_mini, this will download the latest version and upgrade your system. Are you sure? [y/N]} " response
|
||||||
|
case "$response" in
|
||||||
|
[yY][eE][sS]|[yY])
|
||||||
|
if [[ -d /opt/Upgrade ]]; then
|
||||||
|
echo "old Upgrade dir exists"
|
||||||
|
read -r -p "${1:-Unable to proceed, must DELETE old Upgrade directory, are you sure? [y/N]} " response
|
||||||
|
case "$response" in
|
||||||
|
[yY][eE][sS]|[yY])
|
||||||
|
rm -rf /opt/Upgrade
|
||||||
|
sync
|
||||||
|
setup
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "User denied directory removal, exit"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
else
|
||||||
|
setup
|
||||||
|
fi
|
||||||
|
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "user denied update"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
fi
|
Loading…
x
Reference in New Issue
Block a user