summaryrefslogtreecommitdiff
path: root/recipes-connectivity/ppp/files/init.patch
blob: e74e981421b70f1d73d479cdfc48e0b532460cee (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
diff -Naru old/init new/init
--- old/init	2017-09-05 19:07:19.810885424 -0500
+++ new/init	2017-09-05 19:08:05.106884083 -0500
@@ -8,11 +8,29 @@
 
 test -x /usr/sbin/pppd -a -f /etc/ppp/ppp_on_boot || exit 0
 if [ -x /etc/ppp/ppp_on_boot ]; then RUNFILE=1; fi
-
+: ${PPPTIMEOUT:=60}
+logger timeout is $PPPTIMEOUT
+[ -f /etc/default/ppp ] && . /etc/default/ppp
 case "$1" in
   start)
+      t0=($(cat /proc/uptime))                                                                                                                   
+      if (( CHECKREGISTRATION == 1 )) ; then while : ; do
+        REG=$(/usr/bin/radio-query --netreg)	
+        [[ $REG == "REGISTERED" ]] && break
+        t1=($(cat /proc/uptime))                                                                                                                   
+        diff=$(awk "BEGIN{print int($t1-$t0)}")
+        logger -s "Modem not ready. Waited $diff of $PPPTIMEOUT seconds"
+        if ((diff > PPPTIMEOUT)) ; then
+           logger -s "Timed out waiting for modem registration"
+	   exit 1
+        fi
+        sleep 1
+      done ; fi
+
+      logger "Starting up PPP link: pppd"
       echo -n "Starting up PPP link: pppd"
       if [ "$RUNFILE" = "1" ]; then
+        logger "ppp_on_boot"
         /etc/ppp/ppp_on_boot
       else
         pppd call provider