Procházet zdrojové kódy

don't wait for iCamera to mount mmc in wz_user

Alfonso Gamboa před 3 roky
rodič
revize
8309df4d2e
1 změnil soubory, kde provedl 16 přidání a 31 odebrání
  1. 16 31
      SD_ROOT/wz_mini/etc/init.d/wz_user.sh

+ 16 - 31
SD_ROOT/wz_mini/etc/init.d/wz_user.sh

@@ -39,20 +39,6 @@ first_run_check() {
 	fi
 	fi
 }
 }
 
 
-wait_sdroot() {
-##Stall execution if the micro-sd card isn't mounted yet, iCamera controls this internally.
-    while true
-    do
-	if [[ -d /media/mmc/wz_mini ]] || [[ -d /media/mmcblk0p1/wz_mini ]]; then
-	echo "sd card ready"
-	break
-	fi
-        echo "sdcard not ready yet..."
-        sleep 5
-    done
-
-}
-
 store_mac() {
 store_mac() {
 	echo "store original mac"
 	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
@@ -80,9 +66,9 @@ rename_interface() {
 	echo "renaming interfaces"
 	echo "renaming interfaces"
 	ifconfig $1 down
 	ifconfig $1 down
 	ifconfig wlan0 down
 	ifconfig wlan0 down
-        /media/mmc/wz_mini/bin/busybox ip link set wlan0 name wlanold
-        /media/mmc/wz_mini/bin/busybox ip addr flush dev wlanold
-        /media/mmc/wz_mini/bin/busybox ip link set $1 name wlan0
+        /opt/wz_mini/bin/busybox ip link set wlan0 name wlanold
+        /opt/wz_mini/bin/busybox ip addr flush dev wlanold
+        /opt/wz_mini/bin/busybox ip link set $1 name wlan0
 	eth_wlan_up
 	eth_wlan_up
 }
 }
 
 
@@ -92,9 +78,9 @@ eth_wlan_up() {
 	pkill udhcpc
 	pkill udhcpc
         udhcpc -i wlan0 -x hostname:$HOSTNAME -p /var/run/udhcpc.pid -b
         udhcpc -i wlan0 -x hostname:$HOSTNAME -p /var/run/udhcpc.pid -b
 	if [[ "$V2" == "true" ]]; then
 	if [[ "$V2" == "true" ]]; then
-        mount -o bind /media/mmc/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 /media/mmc/wz_mini/bin/wpa_cli.sh /bin/wpa_cli
+        mount -o bind /opt/wz_mini/bin/wpa_cli.sh /bin/wpa_cli
 	fi
 	fi
 	break
 	break
 }
 }
@@ -138,9 +124,9 @@ netloop() {
 }
 }
 
 
 swap_enable() {
 swap_enable() {
-        if [[ -e /media/mmc/wz_mini/swap ]]; then
+        if [[ -e /opt/wz_mini/swap ]]; then
                 echo "Swap exists, enable"
                 echo "Swap exists, enable"
-                swapon /media/mmc/wz_mini/swap
+                swapon /opt/wz_mini/swap
         else
         else
                 echo "Swap file missing!"
                 echo "Swap file missing!"
         fi
         fi
@@ -173,7 +159,6 @@ done
 }
 }
 
 
 first_run_check
 first_run_check
-wait_sdroot
 wait_wlan
 wait_wlan
 
 
 if cat /params/config/.product_config | grep WYZEC1-JZ; then
 if cat /params/config/.product_config | grep WYZEC1-JZ; then
@@ -339,18 +324,18 @@ if [[ "$ENABLE_WIREGUARD" == "true" ]]; then
 		fi
 		fi
 
 
 	if [ ! -f /opt/wz_mini/etc/wireguard/privatekey ]; then
 	if [ ! -f /opt/wz_mini/etc/wireguard/privatekey ]; then
-		(umask 277 && /media/mmc/wz_mini/bin/wg  genkey | /media/mmc/wz_mini/bin/busybox tee /opt/wz_mini/etc/wireguard/privatekey | /media/mmc/wz_mini/bin/wg  pubkey > /opt/wz_mini/etc/wireguard/publickey)
+		(umask 277 && /opt/wz_mini/bin/wg  genkey | /opt/wz_mini/bin/busybox tee /opt/wz_mini/etc/wireguard/privatekey | /opt/wz_mini/bin/wg  pubkey > /opt/wz_mini/etc/wireguard/publickey)
 	fi
 	fi
 
 
-	/media/mmc/wz_mini/bin/busybox ip link add dev wg0 type wireguard
-	/media/mmc/wz_mini/bin/busybox ip address add dev wg0 $WIREGUARD_IPV4
-	/media/mmc/wz_mini/bin/wg set wg0 private-key /opt/wz_mini/etc/wireguard/privatekey
-	/media/mmc/wz_mini/bin/busybox ip link set wg0 up
+	/opt/wz_mini/bin/busybox ip link add dev wg0 type wireguard
+	/opt/wz_mini/bin/busybox ip address add dev wg0 $WIREGUARD_IPV4
+	/opt/wz_mini/bin/wg set wg0 private-key /opt/wz_mini/etc/wireguard/privatekey
+	/opt/wz_mini/bin/busybox ip link set wg0 up
 	fi
 	fi
 
 
 	if [[ "$WIREGUARD_PEER_PUBLIC_KEY" != "" ]] && [[ "$WIREGUARD_PEER_ALLOWED_IPS" != "" ]] && [[ "$WIREGUARD_PEER_ENDPOINT" != "" ]] && [[ "$WIREGUARD_PEER_KEEP_ALIVE" != "" ]]; then
 	if [[ "$WIREGUARD_PEER_PUBLIC_KEY" != "" ]] && [[ "$WIREGUARD_PEER_ALLOWED_IPS" != "" ]] && [[ "$WIREGUARD_PEER_ENDPOINT" != "" ]] && [[ "$WIREGUARD_PEER_KEEP_ALIVE" != "" ]]; then
-		/media/mmc/wz_mini/bin/wg set wg0 peer $WIREGUARD_PEER_PUBLIC_KEY allowed-ips $WIREGUARD_PEER_ALLOWED_IPS endpoint $WIREGUARD_PEER_ENDPOINT persistent-keepalive $WIREGUARD_PEER_KEEP_ALIVE
-		/media/mmc/wz_mini/bin/busybox ip route add $WIREGUARD_PEER_ALLOWED_IPS dev wg0
+		/opt/wz_mini/bin/wg set wg0 peer $WIREGUARD_PEER_PUBLIC_KEY allowed-ips $WIREGUARD_PEER_ALLOWED_IPS endpoint $WIREGUARD_PEER_ENDPOINT persistent-keepalive $WIREGUARD_PEER_KEEP_ALIVE
+		/opt/wz_mini/bin/busybox ip route add $WIREGUARD_PEER_ALLOWED_IPS dev wg0
 	fi
 	fi
 else
 else
 	echo "wireguard disabled"
 	echo "wireguard disabled"
@@ -393,7 +378,7 @@ else
 fi
 fi
 
 
 if [[ "$REMOTE_SPOTLIGHT" == "true" ]]; then
 if [[ "$REMOTE_SPOTLIGHT" == "true" ]]; then
-	/media/mmc/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 enabled"
 else
 else
 	echo "remote accessory disabled"
 	echo "remote accessory disabled"
@@ -550,7 +535,7 @@ if [[ "$RTSP_LOW_RES_ENABLED" == "true" ]] || [[ "$RTSP_HI_RES_ENABLED" == "true
 	echo "delay RTSP for iCamera"
 	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.
 	#This delay is required. Sometimes, if you start the rtsp server too soon, live view will break on the app.
 	sleep 5
 	sleep 5
-	LD_LIBRARY_PATH=/media/mmc/wz_mini/lib /media/mmc/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 -U $RTSP_LOGIN:$RTSP_PASSWORD -P $RTSP_PORT $DEVICE1 $DEVICE2 &
 fi
 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
 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