Merge branch 'master' into DetectAndAutoLoadEthernetDrivers

This commit is contained in:
Scott Kilau
2022-06-21 08:45:08 -05:00
13 changed files with 243 additions and 62 deletions

View File

@@ -50,6 +50,7 @@ echo "Launching latest upgrade-script"
/opt/wz_mini/bin/upgrade-run.sh backup_begin &
echo "Exit old script"
rm -f /dev/fd
exit 0
}
@@ -130,39 +131,45 @@ reboot
}
if [[ -e /tmp/dbgflag ]]; then
upgrade_mode_start
if [[ "$1" == "unattended" ]]; then
echo "Unattended upgrade!"
rm -rf /opt/Upgrade
sync
setup
else
if [ "$1" == "backup_begin" ]; then
backup_begin
else
if [[ -e /tmp/dbgflag ]]; then
upgrade_mode_start
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
case "$response" in
[yY][eE][sS]|[yY])
if [[ -d /opt/Upgrade ]]; then
echo "WARNING: Old Upgrade directory 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 declined system update, exit"
;;
esac
fi
if [ "$1" == "backup_begin" ]; then
backup_begin
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
case "$response" in
[yY][eE][sS]|[yY])
if [[ -d /opt/Upgrade ]]; then
echo "WARNING: Old Upgrade directory 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 declined system update, exit"
;;
esac
fi
fi
fi

View File

@@ -52,6 +52,13 @@ if [[ "$ENABLE_RTL8189FS_DRIVER" == "true" ]]; then
fi
fi
if [[ "$ENABLE_ATBM603X_DRIVER" == "true" ]]; then
echo "Enable atbm603x_wifi_sdio_24M"
if [ -f /opt/wz_mini/tmp/.T31 ]; then
sed -i 's/\/system\/driver\/atbm603x_wifi_sdio.ko/\/opt\/wz_mini\/lib\/modules\/3.10.14\_\_isvp_swan_1.0\_\_\/extra\/atbm603x_wifi_sdio_24M.ko/g' /opt/wz_mini/tmp/.storage/app_init.sh
fi
fi
##RTSP SERVER INIT
if [[ "$RTSP_HI_RES_ENABLED" == "true" ]] || [[ "$RTSP_LOW_RES_ENABLED" == "true" ]] && ! [[ -e /tmp/dbgflag ]]; then

View File

@@ -71,16 +71,71 @@ rename_interface() {
eth_wlan_up
}
rename_interface_and_setup_bonding() {
##Fool iCamera by renaming the hardline interface to wlan0
## $1 Bonding Interface, $2 Primary Interface, $3 Secondary Interface
bonding_interface=$1
primary_interface=$2
secondary_interface=$3
echo "renaming interfaces"
# Bring all interfaces down
ifconfig $bonding_interface down
ifconfig $primary_interface down
ifconfig $secondary_interface down
# Have to bring bonding interface up to be able to bond our slaves.
/opt/wz_mini/bin/busybox ip link set $bonding_interface up
# Rename the real wlan0 interface if needed/used
if [[ "$primary_interface" == "wlan0" ]]; then
/opt/wz_mini/bin/busybox ip link set $primary_interface name wlanold
/opt/wz_mini/bin/busybox ip addr flush dev wlanold
primary_interface="wlanold"
# Because we just changed the name of the primary interface, we need to
# tell the bonding driver about the name change as well.
echo "$primary_interface" > /sys/devices/virtual/net/$bonding_interface/bonding/primary
fi
if [[ "$secondary_interface" == "wlan0" ]]; then
/opt/wz_mini/bin/busybox ip link set $secondary_interface name wlanold
/opt/wz_mini/bin/busybox ip addr flush dev wlanold
secondary_interface="wlanold"
fi
# Enslave the Ethernet and Original Wifi interfaces
# under the bonding interface.
/opt/wz_mini/tmp/.bin/ifenslave $bonding_interface $primary_interface $secondary_interface
# Have to bring bonding interface down to be rename the interface
/opt/wz_mini/bin/busybox ip link set $bonding_interface down
# Name the bonding interface to be the "new" wlan0 interface
/opt/wz_mini/bin/busybox ip link set $bonding_interface name wlan0
# Bring the newly renamed wlan0 (actually the bond interface) back up
eth_wlan_up
}
eth_wlan_up() {
##Run DHCP client, and bind mount our fake wpa_cli.sh to fool iCamera
ifconfig wlan0 up
pkill udhcpc
udhcpc -i wlan0 -x hostname:$CUSTOM_HOSTNAME -p /var/run/udhcpc.pid -b
# If running with Interface Bonding enabled, kill any existing
# wpa_supplicant that might be running and spawn our own instead
if [[ "$BONDING_ENABLED" == "true" ]] && [[ "$ENABLE_USB_ETH" == "true" ]]; then
/opt/wz_mini/bin/busybox killall wpa_supplicant
wpa_supplicant -D nl80211 -i wlanold -c /tmp/wpa_supplicant.conf -B -s
fi
if [ -f /opt/wz_mini/tmp/.T20 ]; then
mount -o bind /opt/wz_mini/bin/wpa_cli.sh /system/bin/wpa_cli
else
mount -o bind /opt/wz_mini/bin/wpa_cli.sh /bin/wpa_cli
fi
break
}
@@ -108,7 +163,11 @@ wlanold_check() {
eth_wlan_up
else
echo "wlanold doesn't exist"
rename_interface $1
if [[ "$BONDING_ENABLED" == "true" ]] && [[ "$ENABLE_USB_ETH" == "true" ]]; then
rename_interface_and_setup_bonding bond0 "$BONDING_PRIMARY_INTERFACE" "$BONDING_SECONDARY_INTERFACE"
else
rename_interface $1
fi
fi
}
@@ -246,6 +305,27 @@ if [[ "$ENABLE_USB_ETH" == "true" ]]; then
esac
done
if [[ "$BONDING_ENABLED" == "true" ]]; then
if [[ "$BONDING_LINK_MONITORING_FREQ_MS" == "" ]]; then
"$BONDING_LINK_MONITORING_FREQ_MS" = "100"
fi
if [[ "$BONDING_DOWN_DELAY_MS" == "" ]]; then
"$BONDING_DOWN_DELAY_MS" = "5000"
fi
if [[ "$BONDING_UP_DELAY_MS" == "" ]]; then
"$BONDING_UP_DELAY_MS" = "5000"
fi
if [[ "$BONDING_PRIMARY_INTERFACE" == "" ]]; then
"$BONDING_PRIMARY_INTERFACE" = "eth0"
fi
if [[ "$BONDING_SECONDARY_INTERFACE" == "" ]]; then
"$BONDING_SECONDARY_INTERFACE" = "wlan0"
fi
# Insert the bonding driver into the kernel
insmod $KMOD_PATH/kernel/drivers/net/bonding/bonding.ko mode=active-backup miimon="$BONDING_LINK_MONITORING_FREQ_MS" downdelay="$BONDING_DOWN_DELAY_MS" updelay="$BONDING_UP_DELAY_MS" primary="$BONDING_PRIMARY_INTERFACE"
fi
swap_enable
netloop eth0
@@ -559,7 +639,7 @@ if [[ "$RTSP_LOW_RES_ENABLED" == "true" ]] || [[ "$RTSP_HI_RES_ENABLED" == "true
echo "delay RTSP for iCamera"
#This delay is required. Sometimes, if you start the rtsp server too soon, live view will break on the app.
sleep 5
LD_LIBRARY_PATH=/opt/wz_mini/lib /opt/wz_mini/bin/v4l2rtspserver $AUDIO_CH $AUDIO_FMT -U "$RTSP_LOGIN":"$RTSP_PASSWORD" -P "$RTSP_PORT" $DEVICE1 $DEVICE2 &
LD_LIBRARY_PATH=/opt/wz_mini/lib /opt/wz_mini/bin/v4l2rtspserver $AUDIO_CH $AUDIO_FMT -F0 -U "$RTSP_LOGIN":"$RTSP_PASSWORD" -P "$RTSP_PORT" $DEVICE1 $DEVICE2 &
fi
if ([[ "$RTSP_LOW_RES_ENABLED" == "true" ]] || [[ "$RTSP_HI_RES_ENABLED" == "true" ]]) && [[ "$RTMP_STREAM_ENABLED" == "true" ]] && ([[ "$RTSP_LOW_RES_ENABLE_AUDIO" == "true" ]] || [[ "$RTSP_HI_RES_ENABLE_AUDIO" == "true" ]]); then
@@ -572,6 +652,10 @@ if ([[ "$RTSP_LOW_RES_ENABLED" == "true" ]] || [[ "$RTSP_HI_RES_ENABLED" == "tru
/opt/wz_mini/bin/rtmp-stream.sh "$RMTP_STREAM_SERVICE" "$RTMP_AUDIO"
fi
if [[ "$NIGHT_DROP_DISABLE" == "true" ]]; then
touch /opt/wz_mini/tmp/.nd
fi
hostname_set
touch /opt/wz_mini/tmp/.wz_user_firstrun
pkill -f dumpload #Kill dumpload so it won't waste cpu or ram gathering cores and uploading them when something crashes

Binary file not shown.

View File

@@ -33,6 +33,14 @@ ENABLE_NFSv4="false"
ENABLE_RTL8189FS_DRIVER="false"
##### NETWORK INTERFACE BONDING #####
BONDING_ENABLED="false"
BONDING_PRIMARY_INTERFACE="eth0"
BONDING_SECONDARY_INTERFACE="wlan0"
BONDING_LINK_MONITORING_FREQ_MS="100"
BONDING_DOWN_DELAY_MS="5000"
BONDING_UP_DELAY_MS="5000"
#####ACCESSORIES#####
REMOTE_SPOTLIGHT="false"
REMOTE_SPOTLIGHT_HOST="0.0.0.0"
@@ -75,6 +83,7 @@ ENABLE_CIFS="false"
DISABLE_FW_UPGRADE="false"
AUDIO_PROMPT_VOLUME="50"
ENABLE_MP4_WRITE="false"
NIGHT_DROP_DISABLE="false"
#####DEBUG#####
#drops you to a shell via serial, doesn't load app_init.sh