update new init scripts

This commit is contained in:
Alfonso Gamboa 2022-07-31 00:47:16 -07:00
parent 0702bb997c
commit 706879da81
36 changed files with 146 additions and 142 deletions

View File

@ -2,19 +2,19 @@
source /opt/wz_mini/wz_mini.conf source /opt/wz_mini/wz_mini.conf
echo "replace stock busybox" echo "Replace stock busybox"
mount --bind /opt/wz_mini/bin/busybox /bin/busybox mount --bind /opt/wz_mini/bin/busybox /bin/busybox
echo "replace stock fstab" echo "Replace stock fstab"
mount --bind /opt/wz_mini/etc/fstab /etc/fstab mount --bind /opt/wz_mini/etc/fstab /etc/fstab
echo "replace stock inittab" echo "Replace stock inittab"
mount --bind /opt/wz_mini/etc/inittab /etc/inittab mount --bind /opt/wz_mini/etc/inittab /etc/inittab
echo "bind /etc/profile for local/ssh shells" echo "Bind /etc/profile for local/ssh shells"
mount --bind /opt/wz_mini/etc/profile /etc/profile mount --bind /opt/wz_mini/etc/profile /etc/profile
if [ -d /lib/modules ]; then if [ -d /lib/modules ]; then
echo "mount kernel modules" echo "Mount kernel modules in /lib"
mount --bind /opt/wz_mini/lib/modules /lib/modules mount --bind /opt/wz_mini/lib/modules /lib/modules
fi fi

View File

@ -2,11 +2,11 @@
source /opt/wz_mini/wz_mini.conf source /opt/wz_mini/wz_mini.conf
echo "mount wz_mini tmpfs" echo "Mount wz_mini tmpfs"
mount -t tmpfs /opt/wz_mini/tmp mount -t tmpfs /opt/wz_mini/tmp
echo "create workspace directory" echo "Create workspace directory"
mkdir /opt/wz_mini/tmp/.storage mkdir /opt/wz_mini/tmp/.storage
echo "mounting global tmpfs" echo "Mounting global tmpfs"
mount -t tmpfs /tmp mount -t tmpfs /tmp

View File

@ -1,24 +1,5 @@
#!/bin/sh #!/bin/sh
set -x echo "Install busybox applets"
mkdir /opt/wz_mini/tmp/.bin
case "$1" in /opt/wz_mini/bin/busybox --install -s /opt/wz_mini/tmp/.bin
start)
echo "install busybox applets"
mkdir /opt/wz_mini/tmp/.bin
/opt/wz_mini/bin/busybox --install -s /opt/wz_mini/tmp/.bin
;;
stop)
;;
restart|reload)
"$0" stop
"$0" start
;;
*)
echo "Usage: $0 {start|stop|restart}"
exit 1
esac
exit $?

View File

@ -2,17 +2,17 @@
source /opt/wz_mini/wz_mini.conf source /opt/wz_mini/wz_mini.conf
set -x echo "Copy stock rcS"
echo "copy stock rcS"
cp /etc/init.d/rcS /opt/wz_mini/tmp/.storage/rcS cp /etc/init.d/rcS /opt/wz_mini/tmp/.storage/rcS
echo "Add verbose debugging to rcS"
sed -i '/^".*/aset -x' /opt/wz_mini/tmp/.storage/rcS sed -i '/^".*/aset -x' /opt/wz_mini/tmp/.storage/rcS
echo "Inject init.d scripts to rcS"
sed -i '/^# Run init script.*/i/opt/wz_mini/etc/rc.d/K01network \&\n' /opt/wz_mini/tmp/.storage/rcS sed -i '/^# Run init script.*/i/opt/wz_mini/etc/rc.d/K01network \&\n' /opt/wz_mini/tmp/.storage/rcS
sed -i '/^# Run init script.*/i/opt/wz_mini/etc/rc.d/K03rcd\n' /opt/wz_mini/tmp/.storage/rcS sed -i '/^# Run init script.*/i/opt/wz_mini/etc/rc.d/K03rcd\n' /opt/wz_mini/tmp/.storage/rcS
echo "Modify Global Paths in rcS"
sed -i '/sbin:/s/$/:\/opt\/wz_mini\/bin/' /opt/wz_mini/tmp/.storage/rcS sed -i '/sbin:/s/$/:\/opt\/wz_mini\/bin/' /opt/wz_mini/tmp/.storage/rcS
sed -i '/system\/\lib/s/$/:\/opt\/wz_mini\/lib/' /opt/wz_mini/tmp/.storage/rcS sed -i '/system\/\lib/s/$/:\/opt\/wz_mini\/lib/' /opt/wz_mini/tmp/.storage/rcS
@ -35,7 +35,7 @@ if [[ "$DEBUG_ENABLED" == "true" ]]; then
elif [[ "$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/rc.d/K02_webcam &' /opt/wz_mini/tmp/.storage/rcS sed -i '/^# Run init/i/opt/wz_mini/etc/rc.d/K02webcam &' /opt/wz_mini/tmp/.storage/rcS
touch /tmp/dbgflag touch /tmp/dbgflag
elif [[ -d /opt/Upgrade ]]; then elif [[ -d /opt/Upgrade ]]; then
@ -45,7 +45,7 @@ elif [[ -d /opt/Upgrade ]]; then
touch /tmp/dbgflag touch /tmp/dbgflag
fi fi
##ENABLE LIBCALLBACK BY DEFAULT echo "Enable libcallback"
if [[ "$LIBCALLBACK_ENABLE" == "true" ]] || ([[ "$RTSP_HI_RES_ENABLED" == "true" ]] || [[ "$RTSP_LOW_RES_ENABLED" == "true" ]]); then if [[ "$LIBCALLBACK_ENABLE" == "true" ]] || ([[ "$RTSP_HI_RES_ENABLED" == "true" ]] || [[ "$RTSP_LOW_RES_ENABLED" == "true" ]]); then
echo "set path for iCamera" echo "set path for iCamera"
sed -i 's/\/system\/bin\/iCamera/\/opt\/wz_mini\/usr\/bin\/iCamera/g' /opt/wz_mini/tmp/.storage/app_init.sh sed -i 's/\/system\/bin\/iCamera/\/opt\/wz_mini\/usr\/bin\/iCamera/g' /opt/wz_mini/tmp/.storage/app_init.sh

View File

@ -2,11 +2,12 @@
source /opt/wz_mini/wz_mini.conf source /opt/wz_mini/wz_mini.conf
echo "replace stock password" echo "Replace stock password"
cp /opt/wz_mini/etc/shadow /opt/wz_mini/tmp/.storage/shadow cp /opt/wz_mini/etc/shadow /opt/wz_mini/tmp/.storage/shadow
if [[ "$DEBUG_PASSWORD" == "true" ]]; then if [[ "$DEBUG_PASSWORD" == "true" ]]; then
sed -i 's/:[^:]*/:/' /opt/wz_mini/tmp/.storage/shadow sed -i 's/:[^:]*/:/' /opt/wz_mini/tmp/.storage/shadow
echo "Remove stock password"
fi fi
mount --bind /opt/wz_mini/tmp/.storage/shadow /etc/shadow mount --bind /opt/wz_mini/tmp/.storage/shadow /etc/shadow

View File

@ -3,9 +3,9 @@
source /opt/wz_mini/wz_mini.conf source /opt/wz_mini/wz_mini.conf
if [ -e /opt/wz_mini/etc/.first_boot ]; then if [ -e /opt/wz_mini/etc/.first_boot ]; then
echo "first boot already completed" echo "First boot already completed"
else else
echo "first boot, initializing" echo "First boot, initializing"
if [ -f /opt/wz_mini/tmp/.T20 ]; then if [ -f /opt/wz_mini/tmp/.T20 ]; then
#May need different gpio for PANv1 #May need different gpio for PANv1
#We don't rmmod this module, as it is marked [permanent] by the kernel on T20 #We don't rmmod this module, as it is marked [permanent] by the kernel on T20
@ -24,4 +24,3 @@ else
echo "Set first_boot" echo "Set first_boot"
touch /opt/wz_mini/etc/.first_boot touch /opt/wz_mini/etc/.first_boot
fi fi

View File

@ -3,9 +3,6 @@
source /opt/wz_mini/etc/rc.common source /opt/wz_mini/etc/rc.common
source /opt/wz_mini/wz_mini.conf source /opt/wz_mini/wz_mini.conf
set -x
## REPLACE STOCK MODULES
if [[ "$ENABLE_RTL8189FS_DRIVER" == "true" ]] || [[ "$ENABLE_RTL8189FS_DRIVER" == "" ]]; then if [[ "$ENABLE_RTL8189FS_DRIVER" == "true" ]] || [[ "$ENABLE_RTL8189FS_DRIVER" == "" ]]; then
echo "Enable 8189fs" echo "Enable 8189fs"
if [ -f /opt/wz_mini/tmp/.WYZEC1-JZ ]; then if [ -f /opt/wz_mini/tmp/.WYZEC1-JZ ]; then
@ -28,8 +25,8 @@ if [[ "$ENABLE_ATBM603X_DRIVER" == "true" ]] || [[ "$ENABLE_ATBM603X_DRIVER" ==
fi fi
fi fi
#Enable serial driver for car
if [ -f /opt/wz_mini/tmp/.CAR ] || [[ "$ENABLE_CAR_DRIVER" == "true" ]]; then if [ -f /opt/wz_mini/tmp/.CAR ] || [[ "$ENABLE_CAR_DRIVER" == "true" ]]; then
echo "Enable cp210x serial driver for car"
modprobe cp210x modprobe cp210x
fi fi
@ -37,26 +34,26 @@ fi
if ([[ "$RTSP_HI_RES_ENABLED" == "true" ]] || [[ "$RTSP_LOW_RES_ENABLED" == "true" ]]) && ! [[ -e /tmp/dbgflag ]]; then if ([[ "$RTSP_HI_RES_ENABLED" == "true" ]] || [[ "$RTSP_LOW_RES_ENABLED" == "true" ]]) && ! [[ -e /tmp/dbgflag ]]; then
if [[ "$RTSP_LOW_RES_ENABLED" == "true" ]] && [[ "$RTSP_HI_RES_ENABLED" == "true" ]]; then if [[ "$RTSP_LOW_RES_ENABLED" == "true" ]] && [[ "$RTSP_HI_RES_ENABLED" == "true" ]]; then
if [ -f /opt/wz_mini/tmp/.T20 ]; then if [ -f /opt/wz_mini/tmp/.T20 ]; then
echo "load video loopback driver at video6 video7" echo "Load video loopback driver at video6 video7"
insmod /opt/wz_mini/lib/modules/3.10.14/extra/v4l2loopback_V2.ko video_nr=6,7 insmod /opt/wz_mini/lib/modules/3.10.14/extra/v4l2loopback_V2.ko video_nr=6,7
else else
echo "load video loopback driver at video1 video2" echo "Load video loopback driver at video1 video2"
insmod /opt/wz_mini/lib/modules/3.10.14__isvp_swan_1.0__/extra/v4l2loopback.ko video_nr=1,2 insmod /opt/wz_mini/lib/modules/3.10.14__isvp_swan_1.0__/extra/v4l2loopback.ko video_nr=1,2
fi fi
elif [[ "$RTSP_LOW_RES_ENABLED" == "true" ]]; then elif [[ "$RTSP_LOW_RES_ENABLED" == "true" ]]; then
if [ -f /opt/wz_mini/tmp/.T20 ]; then if [ -f /opt/wz_mini/tmp/.T20 ]; then
echo "load video loopback driver at video7" echo "Load video loopback driver at video7"
insmod /opt/wz_mini/lib/modules/3.10.14/extra/v4l2loopback_V2.ko video_nr=7 insmod /opt/wz_mini/lib/modules/3.10.14/extra/v4l2loopback_V2.ko video_nr=7
else else
echo "load video loopback driver at video2" echo "Load video loopback driver at video2"
insmod /opt/wz_mini/lib/modules/3.10.14__isvp_swan_1.0__/extra/v4l2loopback.ko video_nr=2 insmod /opt/wz_mini/lib/modules/3.10.14__isvp_swan_1.0__/extra/v4l2loopback.ko video_nr=2
fi fi
elif [[ "$RTSP_HI_RES_ENABLED" == "true" ]]; then elif [[ "$RTSP_HI_RES_ENABLED" == "true" ]]; then
if [ -f /opt/wz_mini/tmp/.T20 ]; then if [ -f /opt/wz_mini/tmp/.T20 ]; then
echo "load video loopback driver at video6" echo "Load video loopback driver at video6"
insmod /opt/wz_mini/lib/modules/3.10.14/extra/v4l2loopback_V2.ko video_nr=6 insmod /opt/wz_mini/lib/modules/3.10.14/extra/v4l2loopback_V2.ko video_nr=6
else else
echo "load video loopback driver at video1" echo "Load video loopback driver at video1"
insmod /opt/wz_mini/lib/modules/3.10.14__isvp_swan_1.0__/extra/v4l2loopback.ko video_nr=1 insmod /opt/wz_mini/lib/modules/3.10.14__isvp_swan_1.0__/extra/v4l2loopback.ko video_nr=1
fi fi
fi fi
@ -68,9 +65,7 @@ if [[ "$ENABLE_NFSv4" == "true" ]]; then
insmod $KMOD_PATH/kernel/net/dns_resolver/dns_resolver.ko insmod $KMOD_PATH/kernel/net/dns_resolver/dns_resolver.ko
insmod $KMOD_PATH/kernel/fs/nfs/nfsv4.ko insmod $KMOD_PATH/kernel/fs/nfs/nfsv4.ko
insmod $KMOD_PATH/kernel/net/sunrpc/auth_gss/auth_rpcgss.ko insmod $KMOD_PATH/kernel/net/sunrpc/auth_gss/auth_rpcgss.ko
echo nfsv4 enabled echo "NFSv4 enabled"
else
echo nfsv4 disabled
fi fi
if [[ "$ENABLE_IPTABLES" == "true" ]]; then if [[ "$ENABLE_IPTABLES" == "true" ]]; then
@ -80,37 +75,35 @@ if [[ "$ENABLE_IPTABLES" == "true" ]]; then
insmod $KMOD_PATH/kernel/net/ipv4/netfilter/ipt_REJECT.ko insmod $KMOD_PATH/kernel/net/ipv4/netfilter/ipt_REJECT.ko
insmod $KMOD_PATH/kernel/net/ipv4/netfilter/iptable_filter.ko insmod $KMOD_PATH/kernel/net/ipv4/netfilter/iptable_filter.ko
insmod $KMOD_PATH/kernel/net/ipv4/netfilter/iptable_mangle.ko insmod $KMOD_PATH/kernel/net/ipv4/netfilter/iptable_mangle.ko
echo "iptables ipv4 enabled" echo "iptables IPv4 enabled"
if [[ "$ENABLE_IPV6" == "true" ]]; then if [[ "$ENABLE_IPV6" == "true" ]]; then
insmod $KMOD_PATH/kernel/net/ipv6/netfilter/ip6_tables.ko insmod $KMOD_PATH/kernel/net/ipv6/netfilter/ip6_tables.ko
insmod $KMOD_PATH/kernel/net/ipv6/netfilter/ip6t_REJECT.ko insmod $KMOD_PATH/kernel/net/ipv6/netfilter/ip6t_REJECT.ko
insmod $KMOD_PATH/kernel/net/ipv6/netfilter/ip6table_filter.ko insmod $KMOD_PATH/kernel/net/ipv6/netfilter/ip6table_filter.ko
insmod $KMOD_PATH/kernel/net/ipv6/netfilter/ip6table_mangle.ko insmod $KMOD_PATH/kernel/net/ipv6/netfilter/ip6table_mangle.ko
echo "iptables ipv6 enabled" echo "iptables IPv6 enabled"
fi fi
else
echo "iptables disabled"
fi fi
if [[ "$ENABLE_WIREGUARD" == "true" ]]; then if [[ "$ENABLE_WIREGUARD" == "true" ]]; then
insmod $KMOD_PATH/kernel/net/ipv4/tunnel4.ko insmod $KMOD_PATH/kernel/net/ipv4/tunnel4.ko
insmod $KMOD_PATH/kernel/net/ipv4/ip_tunnel.ko insmod $KMOD_PATH/kernel/net/ipv4/ip_tunnel.ko
insmod $KMOD_PATH/kernel/net/wireguard/wireguard.ko insmod $KMOD_PATH/kernel/net/wireguard/wireguard.ko
echo "Wireguard enabled"
fi fi
if [[ "$ENABLE_CIFS" == "true" ]]; then if [[ "$ENABLE_CIFS" == "true" ]]; then
insmod $KMOD_PATH/kernel/fs/cifs/cifs.ko insmod $KMOD_PATH/kernel/fs/cifs/cifs.ko
else echo "CIFS enabled"
echo "cifs disabled"
fi fi
if [[ "$ENABLE_USB_STORAGE" == "true" ]]; then if [[ "$ENABLE_USB_STORAGE" == "true" ]]; then
insmod $KMOD_PATH/kernel/drivers/scsi/scsi_mod.ko insmod $KMOD_PATH/kernel/drivers/scsi/scsi_mod.ko
insmod $KMOD_PATH/kernel/drivers/scsi/sd_mod.ko insmod $KMOD_PATH/kernel/drivers/scsi/sd_mod.ko
insmod $KMOD_PATH/kernel/drivers/usb/storage/usb-storage.ko insmod $KMOD_PATH/kernel/drivers/usb/storage/usb-storage.ko
else echo "usb_storage enabled"
echo "usb_storage disabled"
fi fi
if [[ "$ENABLE_EXT4" == "true" ]]; then if [[ "$ENABLE_EXT4" == "true" ]]; then
@ -121,9 +114,9 @@ if [[ "$ENABLE_EXT4" == "true" ]]; then
insmod $KMOD_PATH/kernel/fs/jbd2/jbd2.ko insmod $KMOD_PATH/kernel/fs/jbd2/jbd2.ko
insmod $KMOD_PATH/kernel/fs/mbcache.ko insmod $KMOD_PATH/kernel/fs/mbcache.ko
insmod $KMOD_PATH/kernel/fs/ext4/ext4.ko insmod $KMOD_PATH/kernel/fs/ext4/ext4.ko
echo "ext4 support enabled"
fi fi
echo "bonding kernel module setup"
if [[ "$BONDING_ENABLED" == "true" ]]; then if [[ "$BONDING_ENABLED" == "true" ]]; then
if [[ "$BONDING_LINK_MONITORING_FREQ_MS" == "" ]]; then if [[ "$BONDING_LINK_MONITORING_FREQ_MS" == "" ]]; then
BONDING_LINK_MONITORING_FREQ_MS="100" BONDING_LINK_MONITORING_FREQ_MS="100"
@ -146,4 +139,6 @@ if [[ "$BONDING_ENABLED" == "true" ]]; then
# Insert the bonding driver into the kernel # 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" fail_over_mac="$BONDING_FAIL_OVER_MAC" 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" fail_over_mac="$BONDING_FAIL_OVER_MAC"
echo "Network bonding enabled"
fi fi

View File

@ -2,33 +2,33 @@
#CAMERA CONFIGURATION FILES BACKUP #CAMERA CONFIGURATION FILES BACKUP
if [ -d /opt/.wz_backup ]; then if [ -d /opt/.wz_backup ]; then
echo "backup directory missing" echo "Factory config backup directory missing"
else else
echo "creating backup directory" echo "Creating factory config backup directory"
mkdir /opt/.wz_backup mkdir /opt/.wz_backup
fi fi
if [ -f /opt/wz_mini/tmp/.T31 ]; then if [ -f /opt/wz_mini/tmp/.T31 ]; then
echo "T31 platform backup" echo "T31 platform backup"
if [ -d /opt/.wz_backup/configs ]; then if [ -d /opt/.wz_backup/configs ]; then
echo "configs backup directory present, not backing up again" echo "Factory configs backup directory present, not backing up again"
else else
echo "backup /configs" echo "Backup /configs"
cp -R /configs/ /opt/.wz_backup/ cp -R /configs/ /opt/.wz_backup/
fi fi
elif [ -f /opt/wz_mini/tmp/.T20 ]; then elif [ -f /opt/wz_mini/tmp/.T20 ]; then
echo "T20 platform backup" echo "T20 platform backup"
if [ -d /opt/.wz_backup/configs ]; then if [ -d /opt/.wz_backup/configs ]; then
echo "configs backup directory present, not backing up again" echo "Factory configs backup directory present, not backing up again"
else else
echo "backup /configs" echo "Backup /configs"
cp -R /configs/ /opt/.wz_backup/ cp -R /configs/ /opt/.wz_backup/
fi fi
if [ -d /opt/.wz_backup/params ]; then if [ -d /opt/.wz_backup/params ]; then
echo "configs backup directory present, not backing up again" echo "Factory params backup directory present, not backing up again"
else else
echo "backup /params" echo "Backup /params"
cp -R /params/ /opt/.wz_backup/ cp -R /params/ /opt/.wz_backup/
fi fi
fi fi

View File

@ -1,8 +1,8 @@
#!/bin/sh #!/bin/sh
if [ -d /opt/wz_mini/usr/share/terminfo ]; then if [ -d /opt/wz_mini/usr/share/terminfo ]; then
echo "terminfo already present" echo "Terminfo already present"
else else
echo "terminfo not present, extract" echo "Terminfo not present, extract"
tar xf /opt/wz_mini/usr/share/terminfo.tar -C /opt/wz_mini/usr/share/ tar xf /opt/wz_mini/usr/share/terminfo.tar -C /opt/wz_mini/usr/share/
fi fi

View File

@ -1,7 +1,7 @@
#!/bin/sh #!/bin/sh
echo "replace factorycheck with dummy, to prevent bind unmount"
if [ -f /opt/wz_mini/tmp/.T31 ]; then if [ -f /opt/wz_mini/tmp/.T31 ]; then
mount --bind /opt/wz_mini/bin/factorycheck /system/bin/factorycheck mount --bind /opt/wz_mini/bin/factorycheck /system/bin/factorycheck
touch /tmp/usrflag touch /tmp/usrflag
echo "Replace factorycheck with dummy, to prevent bind unmount"
fi fi

View File

@ -13,9 +13,6 @@ fi
touch -- "$LOG_NAME".log touch -- "$LOG_NAME".log
exec 1> $LOG_NAME.log 2>&1 exec 1> $LOG_NAME.log 2>&1
set -x
echo "welcome to wz_init.sh" echo "welcome to wz_init.sh"
echo "PID $$" echo "PID $$"

View File

@ -1,13 +1,14 @@
#!/bin/sh #!/bin/sh
while true #Wait for wlan hardware to be intitialized in app_init.sh, this must be blocking.
do
if ifconfig wlan0 | grep "HWaddr"; then while true; do
echo "wlan0 hwaddr is up" if ifconfig wlan0 | grep "HWaddr"; then
break echo "wlan0 hwaddr is up"
else break
echo "wlan0 hwaddr not ready yet..." else
sleep 5 echo "wlan0 hwaddr not ready yet..."
fi sleep 5
done fi
done

View File

@ -2,9 +2,7 @@
source /opt/wz_mini/wz_mini.conf source /opt/wz_mini/wz_mini.conf
if [[ "$ENABLE_IPV6" == "true" ]]; then if ! [[ "$ENABLE_IPV6" == "true" ]]; then
echo "ipv6 enabled"
else
echo "ipv6 disabled"
sysctl -w net.ipv6.conf.all.disable_ipv6=1 sysctl -w net.ipv6.conf.all.disable_ipv6=1
echo "ipv6 disabled"
fi fi

View File

@ -8,7 +8,7 @@ if [[ "$ENABLE_WIREGUARD" == "true" ]]; then
if [[ "$WIREGUARD_IPV4" != "" ]]; then if [[ "$WIREGUARD_IPV4" != "" ]]; then
if [ -d /opt/wz_mini/etc/wireguard ]; then if [ -d /opt/wz_mini/etc/wireguard ]; then
echo "wireguard dir exists" echo "Wireguard dir exists"
else else
mkdir -p /opt/wz_mini/etc/wireguard mkdir -p /opt/wz_mini/etc/wireguard
fi fi
@ -28,5 +28,5 @@ if [[ "$ENABLE_WIREGUARD" == "true" ]]; then
/opt/wz_mini/bin/busybox ip route add "$WIREGUARD_PEER_ALLOWED_IPS" dev wg0 /opt/wz_mini/bin/busybox ip route add "$WIREGUARD_PEER_ALLOWED_IPS" dev wg0
fi fi
else else
echo "wireguard disabled" echo "Wireguard disabled"
fi fi

View File

@ -2,5 +2,5 @@
source /opt/wz_mini/wz_mini.conf source /opt/wz_mini/wz_mini.conf
echo "set hostname to $CUSTOM_HOSTNAME" echo "Set hostname to $CUSTOM_HOSTNAME"
hostname $CUSTOM_HOSTNAME hostname $CUSTOM_HOSTNAME

View File

@ -6,5 +6,6 @@ if [[ "$ENABLE_LOCAL_DNS" == "true" ]]; then
dnsmasq -C /opt/wz_mini/etc/dnsmasq.conf dnsmasq -C /opt/wz_mini/etc/dnsmasq.conf
rm -f /tmp/resolv.conf rm -f /tmp/resolv.conf
cp /opt/wz_mini/etc/resolv.conf /tmp/resolv.conf cp /opt/wz_mini/etc/resolv.conf /tmp/resolv.conf
echo "dnsmasq enabled"
fi fi

View File

@ -4,5 +4,6 @@ source /opt/wz_mini/wz_mini.conf
if [[ "$WEB_SERVER_ENABLED" == "true" ]]; then if [[ "$WEB_SERVER_ENABLED" == "true" ]]; then
httpd -p 80 -h /opt/wz_mini/www httpd -p 80 -h /opt/wz_mini/www
echo "httpd enabled"
fi fi

View File

@ -4,6 +4,6 @@ source /opt/wz_mini/etc/rc.common
wait_for_wlan_ip wait_for_wlan_ip
echo "store original mac"
cat /sys/class/net/wlan0/address | tr '[:lower:]' '[:upper:]' > /opt/wz_mini/tmp/wlan0_mac cat /sys/class/net/wlan0/address | tr '[:lower:]' '[:upper:]' > /opt/wz_mini/tmp/wlan0_mac
echo "store original mac"

View File

@ -14,9 +14,11 @@ if [[ "$RTSP_HI_RES_ENABLED" == "true" ]]; then
RTSP_PASSWORD=$(cat /opt/wz_mini/tmp/wlan0_mac) RTSP_PASSWORD=$(cat /opt/wz_mini/tmp/wlan0_mac)
fi fi
echo "Enable video ch 0"
/opt/wz_mini/bin/cmd video 0 on /opt/wz_mini/bin/cmd video 0 on
if [[ "$RTSP_HI_RES_ENABLE_AUDIO" == "true" ]]; then if [[ "$RTSP_HI_RES_ENABLE_AUDIO" == "true" ]]; then
echo "Enable audio ch 0"
/opt/wz_mini/bin/cmd audio 0 on /opt/wz_mini/bin/cmd audio 0 on
AUDIO_CH="-C 1" AUDIO_CH="-C 1"
AUDIO_FMT="-a S16_LE" AUDIO_FMT="-a S16_LE"
@ -40,6 +42,7 @@ if [[ "$RTSP_LOW_RES_ENABLED" == "true" ]]; then
LOW_VIDEO_DEV="/dev/video2" LOW_VIDEO_DEV="/dev/video2"
fi fi
echo "Enable video ch 1"
/opt/wz_mini/bin/cmd video 1 on /opt/wz_mini/bin/cmd video 1 on
if [[ "$RTSP_PASSWORD" = "" ]]; then if [[ "$RTSP_PASSWORD" = "" ]]; then
@ -47,6 +50,7 @@ if [[ "$RTSP_LOW_RES_ENABLED" == "true" ]]; then
fi fi
if [[ "$RTSP_LOW_RES_ENABLE_AUDIO" == "true" ]]; then if [[ "$RTSP_LOW_RES_ENABLE_AUDIO" == "true" ]]; then
echo "Enable video ch 1"
/opt/wz_mini/bin/cmd audio 1 on /opt/wz_mini/bin/cmd audio 1 on
AUDIO_CH="-C 1" AUDIO_CH="-C 1"
AUDIO_FMT="-a S16_LE" AUDIO_FMT="-a S16_LE"

View File

@ -26,8 +26,7 @@ while true; do
if ifconfig wlan0 | grep "$CONFIG"; then if ifconfig wlan0 | grep "$CONFIG"; then
break break
fi fi
echo "Network not ready yet, try again in 5 seconds"
echo " network not ready yet, try again in 5"
sleep 5 sleep 5
done done
} }
@ -37,8 +36,7 @@ while true; do
if ifconfig wlan0 | grep "inet addr"; then if ifconfig wlan0 | grep "inet addr"; then
break break
fi fi
echo "IP Address not aquired yet, try again in 5 seconds"
echo " network not ready yet, try again in 5"
sleep 5 sleep 5
done done
} }

View File

@ -5,9 +5,6 @@ source /opt/wz_mini/wz_mini.conf
wait_for_wlan wait_for_wlan
# Start all init scripts in /etc/init.d
# executing them in numerical order.
#
for i in /opt/wz_mini/etc/network/S??* ;do for i in /opt/wz_mini/etc/network/S??* ;do
# Ignore dangling symlinks (if any). # Ignore dangling symlinks (if any).
@ -53,9 +50,12 @@ done
if [ -f "$CUSTOM_SCRIPT_PATH" ]; then if [ -f "$CUSTOM_SCRIPT_PATH" ]; then
echo "starting custom script" echo "Starting custom script"
$CUSTOM_SCRIPT_PATH & $CUSTOM_SCRIPT_PATH &
else else
echo "no custom script configured in wz_mini.conf" echo "No custom script configured in wz_mini.conf"
fi fi
/opt/wz_mini/etc/rc.d/K15logging
echo "wz_mini done" > /dev/kmsg echo "wz_mini done" > /dev/kmsg

View File

@ -16,8 +16,6 @@ export WZMINI_CFG=/opt/wz_mini/wz_mini.conf
[ -f $WZMINI_CFG ] && source $WZMINI_CFG [ -f $WZMINI_CFG ] && source $WZMINI_CFG
set -x
echo "welcome to wz_cam.sh" echo "welcome to wz_cam.sh"
echo "PID $$" echo "PID $$"

View File

@ -1,8 +1,5 @@
#!/bin/sh #!/bin/sh
# Start all init scripts in /etc/init.d
# executing them in numerical order.
#
for i in /opt/wz_mini/etc/rc.d/S??* ;do for i in /opt/wz_mini/etc/rc.d/S??* ;do
# Ignore dangling symlinks (if any). # Ignore dangling symlinks (if any).

View File

@ -0,0 +1,23 @@
#!/bin/sh
source /opt/wz_mini/wz_mini.conf
echo "Store dmesg logs"
DMESG_LOG=/opt/wz_mini/log/dmesg
if [[ -e $DMESG_LOG.log || -L $DMESG_LOG.log ]] ; then
i=0
while [[ -e $DMESG_LOG.log.$i || -L $DMESG_LOG.log.$i ]] ; do
let i++
done
mv $DMESG_LOG.log $DMESG_LOG.log.$i
DMESG_LOG=$DMESG_LOG
fi
touch -- "$DMESG_LOG".log
dmesg > $DMESG_LOG.log 2>&1
echo "Deleting logs older than 5 boots..."
find /opt/wz_mini/log -name '*log*' | while read file; do
[ "${file#/opt/wz_mini/log/*log.}" -gt 5 ] && rm -v "$file"
done

View File

@ -10,18 +10,18 @@ if [ -e /opt/wz_mini/swap.gz ]; then
/opt/wz_mini/bin/audioplay_t31 /opt/wz_mini/usr/share/audio/swap.wav $AUDIO_PROMPT_VOLUME /opt/wz_mini/bin/audioplay_t31 /opt/wz_mini/usr/share/audio/swap.wav $AUDIO_PROMPT_VOLUME
rmmod audio rmmod audio
fi fi
echo "swap archive present, extracting" echo "Swap archive present, extracting"
gzip -d /opt/wz_mini/swap.gz gzip -d /opt/wz_mini/swap.gz
mkswap /opt/wz_mini/swap mkswap /opt/wz_mini/swap
sync;echo 3 > /proc/sys/vm/drop_caches sync;echo 3 > /proc/sys/vm/drop_caches
else else
echo "swap archive missing, not extracting" echo "Swap archive missing, not extracting"
fi fi
#SWAP FILE, REQUIRED FOR OPERATION! #SWAP FILE IS REQUIRED FOR OPERATION!
if [[ "$ENABLE_SWAP" == "true" ]] && [[ -e /opt/wz_mini/swap ]]; then if [[ "$ENABLE_SWAP" == "true" ]] && [[ -e /opt/wz_mini/swap ]]; then
echo "swap file found, enable" echo "Swap file found, enable"
/opt/wz_mini/bin/busybox swapon /opt/wz_mini/swap /opt/wz_mini/bin/busybox swapon /opt/wz_mini/swap
else else
echo "swap file missing" echo "Swap file missing"
fi fi

View File

@ -6,12 +6,11 @@ source /opt/wz_mini/wz_mini.conf
if [[ "$ENABLE_USB_DIRECT" == "true" ]]; then if [[ "$ENABLE_USB_DIRECT" == "true" ]]; then
HOST_MACADDR=$(echo "$CUSTOM_HOSTNAME"|md5sum|sed 's/^\(..\)\(..\)\(..\)\(..\)\(..\).*$/02:\1:\2:\3:\4:\5/') HOST_MACADDR=$(echo "$CUSTOM_HOSTNAME"|md5sum|sed 's/^\(..\)\(..\)\(..\)\(..\)\(..\).*$/02:\1:\2:\3:\4:\5/')
if [ -f /opt/wz_mini/tmp/.T20 ]; then
if [ -f /opt/wz_mini/tmp/.T20 ]; then
echo connect > /sys/devices/platform/jz-dwc2/dwc2/udc/dwc2/soft_connect echo connect > /sys/devices/platform/jz-dwc2/dwc2/udc/dwc2/soft_connect
sleep 1 sleep 1
devmem 0x10000040 32 0x0b800096 devmem 0x10000040 32 0x0b800096
sleep 1 sleep 1
devmem 0x13500000 32 0x001100cc devmem 0x13500000 32 0x001100cc
else else
#Set dwc2 ID_PIN driver memory #Set dwc2 ID_PIN driver memory
@ -24,12 +23,15 @@ if [[ "$ENABLE_USB_DIRECT" == "true" ]]; then
insmod $KMOD_PATH/kernel/drivers/usb/gadget/libcomposite.ko insmod $KMOD_PATH/kernel/drivers/usb/gadget/libcomposite.ko
if [ -f /opt/wz_mini/tmp/.T31 ]; then if [ -f /opt/wz_mini/tmp/.T31 ]; then
insmod /opt/wz_mini/lib/modules/3.10.14__isvp_swan_1.0__/kernel/drivers/usb/gadget/u_ether.ko insmod /opt/wz_mini/lib/modules/3.10.14__isvp_swan_1.0__/kernel/drivers/usb/gadget/u_ether.ko
insmod /opt/wz_mini/lib/modules/3.10.14__isvp_swan_1.0__/kernel/drivers/usb/gadget/usb_f_ncm.ko insmod /opt/wz_mini/lib/modules/3.10.14__isvp_swan_1.0__/kernel/drivers/usb/gadget/usb_f_ncm.ko
fi fi
insmod $KMOD_PATH/kernel/drivers/usb/gadget/g_ncm.ko iManufacturer=wz_mini_ncm host_addr="$HOST_MACADDR" dev_addr="$USB_DIRECT_MAC_ADDR" insmod $KMOD_PATH/kernel/drivers/usb/gadget/g_ncm.ko iManufacturer=wz_mini_ncm host_addr="$HOST_MACADDR" dev_addr="$USB_DIRECT_MAC_ADDR"
echo "USB Direct enabled"
else
echo "USB Direct disabled"
else
echo "USB Direct disabled"
fi fi

View File

@ -13,6 +13,9 @@ if [[ "$ENABLE_USB_RNDIS" == "true" ]]; then
insmod $KMOD_PATH/kernel/drivers/net/usb/rndis_host.ko insmod $KMOD_PATH/kernel/drivers/net/usb/rndis_host.ko
fi fi
echo "USB RNDIS enabled"
else else
echo "usb rndis disabled" echo "USB RNDIS disabled"
fi fi

View File

@ -12,7 +12,7 @@ if ! [[ "$BONDING_ENABLED" == "true" ]]; then
if [[ "$ENABLE_USB_ETH" == "true" ]] || [[ "$ENABLE_USB_DIRECT" == "true" ]] || [[ "$ENABLE_USB_RNDIS" == "true" ]]; then if [[ "$ENABLE_USB_ETH" == "true" ]] || [[ "$ENABLE_USB_DIRECT" == "true" ]] || [[ "$ENABLE_USB_RNDIS" == "true" ]]; then
##Fool iCamera by renaming the hardline interface to wlan0 ##Fool iCamera by renaming the hardline interface to wlan0
echo "renaming interfaces" echo "Renaming interfaces"
ifconfig $ALT_IFACE down ifconfig $ALT_IFACE down
ifconfig wlan0 down ifconfig wlan0 down
/opt/wz_mini/bin/busybox ip link set wlan0 name wlanold /opt/wz_mini/bin/busybox ip link set wlan0 name wlanold
@ -30,7 +30,7 @@ if ! [[ "$BONDING_ENABLED" == "true" ]]; then
fi fi
else else
echo "no alt iface enabled" echo "No alternate iface enabled"
fi fi
fi fi
} }

View File

@ -7,8 +7,8 @@ set -x
bonding_setup() { bonding_setup() {
#we need to wait until wlan0 is up #we need to wait until wlan0 is up
wait_for_wlan wait_for_wlan
##Fool iCamera by renaming the hardline interface to wlan0 ##Fool iCamera by renaming the hardline interface to wlan0
@ -48,26 +48,25 @@ wait_for_wlan
# Name the bonding interface to be the "new" wlan0 interface # Name the bonding interface to be the "new" wlan0 interface
/opt/wz_mini/bin/busybox ip link set bond0 name wlan0 /opt/wz_mini/bin/busybox ip link set bond0 name wlan0
# Bring the newly renamed wlan0 (actually the bond interface) back up # Bring the newly renamed wlan0 (actually the bond interface) back up in the next step
#Run the DHCP client, and bind mount our fake wpa_cli.sh to fool iCamera
##Run DHCP client, and bind mount our fake wpa_cli.sh to fool iCamera
ifconfig wlan0 up ifconfig wlan0 up
pkill udhcpc pkill udhcpc
udhcpc -i wlan0 -x hostname:$CUSTOM_HOSTNAME -p /var/run/udhcpc.pid -b udhcpc -i wlan0 -x hostname:$CUSTOM_HOSTNAME -p /var/run/udhcpc.pid -b
# If running with Interface Bonding enabled, kill any existing # If running with Interface Bonding enabled, kill any existing
# wpa_supplicant that might be running and spawn our own instead # wpa_supplicant that might be running and spawn our own instead
if [[ "$BONDING_ENABLED" == "true" ]] && ([[ "$ENABLE_USB_ETH" == "true" ]] || [[ "$ENABLE_USB_DIRECT" == "true" ]]); then if [[ "$BONDING_ENABLED" == "true" ]] && ([[ "$ENABLE_USB_ETH" == "true" ]] || [[ "$ENABLE_USB_DIRECT" == "true" ]]); then
/opt/wz_mini/bin/busybox killall wpa_supplicant /opt/wz_mini/bin/busybox killall wpa_supplicant
wpa_supplicant -D nl80211 -i wlanold -c /tmp/wpa_supplicant.conf -B -s wpa_supplicant -D nl80211 -i wlanold -c /tmp/wpa_supplicant.conf -B -s
fi fi
if [ -f /opt/wz_mini/tmp/.T20 ]; then if [ -f /opt/wz_mini/tmp/.T20 ]; then
mount -o bind /opt/wz_mini/bin/wpa_cli.sh /system/bin/wpa_cli mount -o bind /opt/wz_mini/bin/wpa_cli.sh /system/bin/wpa_cli
else else
mount -o bind /opt/wz_mini/bin/wpa_cli.sh /bin/wpa_cli mount -o bind /opt/wz_mini/bin/wpa_cli.sh /bin/wpa_cli
fi fi
} }

View File

@ -9,6 +9,7 @@ if [[ "$DISABLE_FW_UPGRADE" == "true" ]]; then
#echo -e "127.0.0.1 localhost \n127.0.0.1 wyze-upgrade-service.wyzecam.com" > /opt/wz_mini/tmp/.storage/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 #mount --bind /opt/wz_mini/tmp/.storage/hosts /etc/hosts
/opt/wz_mini/bin/busybox inotifyd /opt/wz_mini/usr/bin/watch_up.sh /tmp:n > /dev/null 2>&1 & /opt/wz_mini/bin/busybox inotifyd /opt/wz_mini/usr/bin/watch_up.sh /tmp:n > /dev/null 2>&1 &
echo "Firmware updates disabled"
else else
mkdir /tmp/Upgrade mkdir /tmp/Upgrade
/opt/wz_mini/bin/busybox inotifyd /opt/wz_mini/usr/bin/watch_up.sh /tmp:n > /dev/null 2>&1 & /opt/wz_mini/bin/busybox inotifyd /opt/wz_mini/usr/bin/watch_up.sh /tmp:n > /dev/null 2>&1 &

View File

@ -4,7 +4,7 @@ source /opt/wz_mini/wz_mini.conf
if [[ "$REMOTE_SPOTLIGHT" == "true" ]]; then if [[ "$REMOTE_SPOTLIGHT" == "true" ]]; then
/opt/wz_mini/bin/socat pty,link=/dev/ttyUSB0,raw tcp:"$REMOTE_SPOTLIGHT_HOST":9000 & /opt/wz_mini/bin/socat pty,link=/dev/ttyUSB0,raw tcp:"$REMOTE_SPOTLIGHT_HOST":9000 &
echo "remote accessory enabled" echo "Remote accessory support enabled"
else else
echo "remote accessory disabled" echo "Remote accessory support disabled"
fi fi

View File

@ -10,5 +10,5 @@ if [[ "$ENABLE_MP4_WRITE" == "true" ]]; then
echo "mp4_write enabled" echo "mp4_write enabled"
fi fi
else else
echo "mp4 write disabled" echo "mp4_write disabled"
fi fi

View File

@ -3,5 +3,6 @@
source /opt/wz_mini/wz_mini.conf source /opt/wz_mini/wz_mini.conf
if [[ "$NIGHT_DROP_DISABLE" == "true" ]]; then if [[ "$NIGHT_DROP_DISABLE" == "true" ]]; then
echo "Night Drop Disable, Enabled"
touch /opt/wz_mini/tmp/.nd touch /opt/wz_mini/tmp/.nd
fi fi

View File

@ -2,7 +2,6 @@
source /opt/wz_mini/wz_mini.conf source /opt/wz_mini/wz_mini.conf
#MOTORIZED CAMERA CONTROL
if [[ "$DISABLE_MOTOR" == "true" ]]; then if [[ "$DISABLE_MOTOR" == "true" ]]; then
echo "Motor Disabled" echo "Motor Disabled"
touch /opt/wz_mini/tmp/.ms touch /opt/wz_mini/tmp/.ms

View File

@ -0,0 +1,5 @@
#!/bin/sh
#This file executes last, after rc.local.d/