From 22838b714c0a7cf71bd06abbf1b8e5a81f765777 Mon Sep 17 00:00:00 2001
From: hwdsl2 <hwdsl2@users.noreply.github.com>
Date: Fri, 19 May 2023 21:28:19 -0500
Subject: [PATCH] Fix for Raspberry Pi

- Raspberry Pis (ARM-based) may take some time on boot to initialize
  network interfaces such as Wi-Fi. Increasing the service restart
  delay in rc.local from 15 seconds to 60 seconds helps ensure that
  the VPN is enabled on these network interfaces.
---
 vpnsetup_ubuntu.sh | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/vpnsetup_ubuntu.sh b/vpnsetup_ubuntu.sh
index d53e10c..ec01619 100755
--- a/vpnsetup_ubuntu.sh
+++ b/vpnsetup_ubuntu.sh
@@ -672,10 +672,14 @@ EOF
     else
       echo '#!/bin/sh' > /etc/rc.local
     fi
-cat >> /etc/rc.local <<'EOF'
+    rc_delay=15
+    if uname -m | grep -qi '^arm'; then
+      rc_delay=60
+    fi
+cat >> /etc/rc.local <<EOF
 
 # Added by hwdsl2 VPN script
-(sleep 15
+(sleep $rc_delay
 service ipsec restart
 service xl2tpd restart
 echo 1 > /proc/sys/net/ipv4/ip_forward)&