Index: run.sh =================================================================== diff -u -r33ce323edd28935192fdb15010fd51eaa610aa58 -r15240b007cbf6643c31fabc7c94a7ba140a81b96 --- run.sh (.../run.sh) (revision 33ce323edd28935192fdb15010fd51eaa610aa58) +++ run.sh (.../run.sh) (revision 15240b007cbf6643c31fabc7c94a7ba140a81b96) @@ -7,6 +7,10 @@ export WORKSPACE=/opt/leahi export LOGFILE=$TEMP/leahi.manufacturing.log export DATE="date +%Y%m%d%H%M%S" +export LEAHI_APP_PARAMS="--platform eglfs" +export CLOUDSYNC_WORKSPACE=/home/root +export CLOUDSYNC_PARAMS="start" +export CLOUDSYNC_CONFIG=/var/configurations/CloudSync/config/config.json # the application needs this variable to be correctly set to susccessfully launch. # the egls.json file shall also correctly set and put in the pointing location. @@ -17,21 +21,44 @@ # 2 - mv LOGNAME post.log # -echo "" > $LOGFILE 2>&1 +echo "" > $LOGFILE 2>&1 -timedatectl set-timezone America/Los_Angeles >> $LOGFILE 2>&1 -timedatectl set-ntp 1 >> $LOGFILE 2>&1 -echo "[$($DATE)] Starting" >> $LOGFILE 2>&1 +timedatectl set-timezone America/Los_Angeles >> $LOGFILE 2>&1 +timedatectl set-ntp 1 >> $LOGFILE 2>&1 +echo "[$($DATE)] Starting" >> $LOGFILE 2>&1 -echo "[$($DATE)] Configuring the canbus '$P_CANBUS'" >> $LOGFILE 2>&1 -ip link set $P_CANBUS up type can bitrate 250000 >> $LOGFILE 2>&1 -ifconfig $P_CANBUS txqueuelen 4000 >> $LOGFILE 2>&1 -ifconfig $P_CANBUS up >> $LOGFILE 2>&1 +echo "[$($DATE)] Configuring the canbus '$P_CANBUS'" >> $LOGFILE 2>&1 +ip link set $P_CANBUS up type can bitrate 250000 >> $LOGFILE 2>&1 +ifconfig $P_CANBUS txqueuelen 4000 >> $LOGFILE 2>&1 +ifconfig $P_CANBUS up >> $LOGFILE 2>&1 -echo "[$($DATE)] Configuring wifi '$SSID_NAME' connection" >> $LOGFILE 2>&1 -nmcli dev wifi connect "$SSID_NAME" password "$SSID_PASS" >> $LOGFILE 2>&1 +echo "[$($DATE)] Configuring wifi '$SSID_NAME' connection" >> $LOGFILE 2>&1 +nmcli dev wifi connect "$SSID_NAME" password "$SSID_PASS" >> $LOGFILE 2>&1 +# remove manufacturing file if CloudSync config.json exists and mode is not 'registration' +if [ -f $CLOUDSYNC_CONFIG ] && ! `grep mode $CLOUDSYNC_CONFIG | grep registration > /dev/null 2>&1` && [ -f $WORKSPACE/manufacturing ]; then + rm $WORKSPACE/manufacturing +fi + +# update app and CloudSync params if in manufacturing mode +if [ -f $WORKSPACE/manufacturing ]; then + LEAHI_APP_PARAMS="$LEAHI_APP_PARAMS -E" + CLOUDSYNC_PARAMS="start debug upgrade" + + # clean out any old *.buf files + if [ -d /media/sd-card/cloudsync ]; then + rm /media/sd-card/cloudsync/*.buf > /dev/null 2>&1 + fi +else + LEAHI_APP_PARAMS="$LEAHI_APP_PARAMS --use-log-cloud-upload" +fi + +cd $CLOUDSYNC_WORKSPACE +echo "[$($DATE)] CloudSync starting in '$(pwd)'" >> $LOGFILE 2>&1 +$CLOUDSYNC_WORKSPACE/cs.py $CLOUDSYNC_PARAMS >> $LOGFILE 2>&1 +echo "[$($DATE)] CloudSync launched with parameters '$CLOUDSYNC_PARAMS'" >> $LOGFILE 2>&1 + cd $WORKSPACE -echo "[$($DATE)] Application starting in '$(pwd)'" >> $LOGFILE 2>&1 -$WORKSPACE/leahi --platform eglfs >> $LOGFILE 2>&1 & # -E removed for using -L for testing Leahi FW communication -echo "[$($DATE)] Application launched" >> $LOGFILE 2>&1 +echo "[$($DATE)] Application starting in '$(pwd)'" >> $LOGFILE 2>&1 +$WORKSPACE/leahi $LEAHI_APP_PARAMS >> $LOGFILE 2>&1 & # -E removed for using -L for testing Leahi FW communication +echo "[$($DATE)] Application launched with parameters '$LEAHI_APP_PARAMS'" >> $LOGFILE 2>&1