Explorar el Código

wip - setting RPi up for setup at boot

clementinecomputing hace 6 años
padre
commit
08ba2382c4
Se han modificado 2 ficheros con 36 adiciones y 4 borrados
  1. 26 0
      busunit/scripts/rc.local
  2. 10 4
      busunit/scripts/update_loop.sh

+ 26 - 0
busunit/scripts/rc.local

@@ -0,0 +1,26 @@
+#!/bin/sh -e
+#
+# rc.local
+#
+# Copyright (c) 2019 Clementine Computing LLC.
+#
+# This file is part of PopuFare.
+#
+# PopuFare is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# PopuFare is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with PopuFare.  If not, see <https://www.gnu.org/licenses/>.
+#
+
+/home/bus/bin/setup-serial.py 2>&1 >> /tmp/init.log
+/home/bus/bin/get_net_ids.sh 2>&1 >> /tmp/init.log
+
+exit 0

+ 10 - 4
busunit/scripts/update_loop.sh

@@ -34,6 +34,7 @@ checksum_path="$CHECKSUM_AND_VERSION_PATH"
 
 function spawn_supervisor
 {
+
   # If we have a client supervisor binary to run
   #
   if [ -f $BASEDIR/bin/client_supervisor ]; then
@@ -57,7 +58,10 @@ function spawn_supervisor
 #    fi
 
     
-      rm $supervisor_pidfile
+      # If we've gotten here, the client_supervisor process should
+      # be running or is stale, so cleanup and respawn
+      #
+      rm -f $supervisor_pidfile
 
       # then run the whole shebang...
       #
@@ -74,8 +78,6 @@ function spawn_supervisor
     rm -f  $BASEDIR/config/*.tgz.*
     $BASEDIR/bin/showmessage -b "Wait (~ 15 min)"
 
-    echo "..."
-
   fi
 }
 
@@ -94,7 +96,7 @@ function check_update
       echo -en "\t`echo $file | sed -r 's/^.*\/(.*)\.checksum$/\1/'`=`cat $file`"; 
     done; 
     echo;
-  ) | nc localhost $UPDATE_DAEMON_PORT  
+  ) | nc -q1 localhost $UPDATE_DAEMON_PORT
 }
 
 
@@ -119,6 +121,10 @@ while true; do
     (
       while read client_file checksum file_size server_path file_version; do
 
+        ## DEBUG
+        echo "# UPDATES DISABLED TEMPORARILY"
+        break;
+
         # If we've been asked to abort this update, do so before we start downloading if possible
         #
         if [ -f $UPDATE_ABORT_DROPFILE ]; then