Index: scripts/globals.sh =================================================================== diff -u -rf45f4093470d79f74c79f5a162bff598215b5dda -r7f61c3b45a50145fe5c245018d481d6266166fa6 --- scripts/globals.sh (.../globals.sh) (revision f45f4093470d79f74c79f5a162bff598215b5dda) +++ scripts/globals.sh (.../globals.sh) (revision 7f61c3b45a50145fe5c245018d481d6266166fa6) @@ -105,6 +105,8 @@ SETUP_CONF_FILE="setup.conf" SETUP_ENABLE_MANUFACTURING_MODE="ManufacturingMode 1" +APPLICATION_PARAMS="&" + function confirm() { read -p "$1? [y,n]" -n 1 -r CONTINUE if [ "$CONTINUE" == "y" ]; then @@ -178,6 +180,10 @@ } COUT="/dev/null" +function setupConsoleout() { + # /dev/ttymxc1 + COUT="/dev/$(echo $(dmesg | grep "printk: console") | sed 's/.*printk: console.*\(tty.*\)].*/\1/')" +} function post_log_clear () { echo "" > $POSTLOG; } function post_err_clear () { echo "" > $POSTERR; } @@ -200,3 +206,255 @@ echo_dash_message "$1" echo_dash_comment } + + +function setupResolved() { + echo nameserver 8.8.8.8 > /etc/resolv.conf + echo nameserver 192.168.10.20 >> /etc/resolv.conf # these need to be removed when/if the IoT WiFi doens't need them + echo nameserver 192.168.10.21 >> /etc/resolv.conf # these need to be removed when/if the IoT WiFi doens't need them + systemctl start systemd-resolved.service +} + +function cleanupPOSTLogs() { + # cleanup the POST log file + post_log_clear + post_err_clear + post_out_clear + + post_log_star " ***** " + post_log "Start: $(timestamp)" # log the current date, time +} + +function killApplication() { + # ---------------------------------------- STOP denali in case running (sys not rebooted) + killall $DENALI_BIN +} + +function setupEthernet() { + #setting up ethernet----------------------- Ethernet + post_log_dash " Ethernet " + ieth=eth0 + udhcpc --timeout=5 --retries=2 -n -i $ieth + post_log "$(ip addr show $ieth)" # -details -statistics +} + +function setupCANBus() { + #setting up can interface ----------------- CANBus + post_log_dash " CANBus " + #current settings can be retrieved by the command below + #$ ip -details -statistics link show can0 + ip link set can0 up type can bitrate 250000 restart-ms 100 + ifconfig can0 txqueuelen 4000 + candump can0 -T1 # check if candump can successfully use the port. will terminate in 1ms + if [ $? -eq 0 ]; then + post_log_pass "$POSTMSG_CANBUS$POSTMSG_POSTFIX_PASSED" + post_log "$(ip link show can0)" # -details -statistics + else + post_log_fail "$POSTMSG_CANBUS$POSTMSG_POSTFIX_FAILED" + fi +} + +function setupSDCard() { + #mounting sdcard -------------------------- SD-CARD + post_log_dash " SD-CARD " + mkdir -p $SDCARD_MNT + mount $SDCARD_PRT $SDCARD_MNT + SDCTEST="$(mount | grep "$SDCARD_PRT on $SDCARD_MNT type $SDCARD_TYP_NAME (rw,")" + if ! [ -z "$SDCTEST" ]; then + SDINFO="$(df -h | grep -i $SDCARD_MNT)" + post_log_pass "$POSTMSG_SDCARD$POSTMSG_POSTFIX_PASSED" + post_log "$SDCTEST" + post_log "$SDINFO" + else + post_log_fail "$POSTMSG_SDCARD$POSTMSG_POSTFIX_FAILED" + fi +} + +function testRTC() { + #test the RTC ----------------------------- RTC + post_log_dash " RTC" + #may not be an accurate test but sufficient for now + #and could not find a way to get the rtc clock with the higher resolusion + #it should not be confused with date command which is system date/time and not hwclock + hwclock -r # if there is any issue with rtc hwclock will show errors + if [ $? -eq 0 ]; then + RTC1=$($CMD_RTC_EPOCH) + sleep 1 + RTC2=$($CMD_RTC_EPOCH) + if [ $(($RTC2 - $RTC1)) -eq 1 ]; then + post_log_pass "$POSTMSG_RTC$POSTMSG_POSTFIX_PASSED" + else + post_log_fail "$POSTMSG_RTC$POSTMSG_POSTFIX_FAILED" + fi + fi +} + +function setupWiFi() { + # ----------------------------------------- WiFi + post_log_dash " WiFi " + + # create the wpa supplicant folder for conf storing + iwlan=wlan0 + WPA_SUPPLICANT_DIR="/etc/wpa_supplicant/" + WPA_SUPPLICANT_CNF="wpa_supplicant-$iwlan.conf" + mkdir -p $WPA_SUPPLICANT_DIR + + # remove any software blocks + rfkill unblock wlan + + if [[ ! -z $(dmesg | grep "wlan: driver loaded") ]]; then + post_log_pass "$POSTMSG_WIFI$POSTMSG_POSTFIX_PASSED [driver]" + post_log "$(dmesg | grep -i wlan:)" + + # start the wpa_supplicant service + post_log "start wpa_supplicant service" + systemctl start wpa_supplicant@$iwlan.service + if [ $? -eq 0 ]; then + post_log_pass "$POSTMSG_WIFI$POSTMSG_POSTFIX_PASSED [service]" + # try to connect to WiFi + if [ -f $WPA_SUPPLICANT_DIR$WPA_SUPPLICANT_CNF ]; then + post_log_dash " WiFi Connection " + killall udhcpc + post_log "connecting to WiFi" + # run this manually in terminal if didn't work on bootup + udhcpc --timeout=5 --retries=2 -n -i $iwlan + fi + post_log "$(ip link show $iwlan)" # -details -statistics + else + post_log_fail "$POSTMSG_WIFI$POSTMSG_POSTFIX_FAILED" + post_log "$(systemctl --failed | grep wpa)" + fi + else + post_log_fail "$POSTMSG_WIFI$POSTMSG_POSTFIX_FAILED" + fi +} + +function setupBluetooth() { + # ----------------------------------------- Bluetooth + post_log_dash " Bluetooth " + /usr/share/silex-uart/silex-uart.sh stop 1>> $POSTOUT 2>> $POSTERR + sleep 1 + /usr/share/silex-uart/silex-uart.sh start 1>> $POSTOUT 2>> $POSTERR + sleep 5 + hciconfig hci0 up + if [ $? -eq 0 ]; then + post_log_pass "$POSTMSG_BLUETOOTH$POSTMSG_POSTFIX_PASSED" + post_log "$(hciconfig hci0)" + else + post_log_fail "$POSTMSG_BLUETOOTH$POSTMSG_POSTFIX_FAILED" + fi +} + +function testTouchscreen() { + #test the touch screen -------------------- Touch + post_log_dash " Touch " + # when successfully connected and can be loaded + # Sitronix touch driver 2.10.2 Release date: 20180809 + # atmel_mxt_ts 3-004a: Direct firmware load for maxtouch.cfg failed with error -2 + # atmel_mxt_ts 3-004a: Touchscreen size X1279Y799 + # input: Atmel maXTouch Touchscreen as /devices/platform/soc@0/soc@0:bus@30800000/30a50000.i2c/i2c-3/3-004a/input/input2 + # When NOT connected + # Sitronix touch driver 2.10.2 Release date: 20180809 + TSTEST="$(dmesg | grep "input: Atmel maXTouch Touchscreen as ")" + if [ "$?" -eq 0 ]; then + post_log_pass "$POSTMSG_TOUCH$POSTMSG_POSTFIX_PASSED" + post_log "$TSTEST" + else + post_log_fail "$POSTMSG_TOUCH$POSTMSG_POSTFIX_FAILED" + fi +} + +function testApplicationShasum() { + # ----------------------------------------- Sha256Sum + post_log_dash " Sha256Sum " + #check the denali applicatoin checksum + SHA_ACT=$(tail -c 83 $HOME/$DENALI_BIN | cut -c19-82) + SHA_EXP=$(head -c -83 $HOME/$DENALI_BIN | sha256sum -b --tag | cut -c14-77) + if [ "$SHA_ACT" == "$SHA_EXP" ]; then + post_log_pass "$POSTMSG_SHASUM$POSTMSG_POSTFIX_PASSED" + else + post_log_fail "$POSTMSG_SHASUM$POSTMSG_POSTFIX_FAILED" + fi +} + +function testCloudSystem() { + # ----------------------------------------- CloudSystem + post_log_dash " CloudSystem " + post_log "$(ip addr show $iwlan)" # -details -statistics + post_log "$(ping www.diality.com -I $iwlan -c 3 -4)" +} + +function startCloudSync() { + # ----------------------------------------- CloudSync + post_log_dash " CloudSync " + if [ -d $HOME/$CLOUDSYNC_FOLDER ]; then + # moving/ backing up the previous treatment logs so the new buff starts with fresh sequence + echo "Backing up CloudSync I/O buff" + CLOUDSYNC_PATH="$SDCARD_MNT"/"$CLOUDSYNC_FOLDER" + CLOUDSYNC_BACKUP="$CLOUDSYNC_PATH"_backup/$(timestamp)/ + mkdir -p $CLOUDSYNC_BACKUP + mv $CLOUDSYNC_PATH/* $CLOUDSYNC_BACKUP 1>> $POSTOUT 2>> $POSTERR + rm $HOME/$CLOUDSYNC_FOLDER/data/* 1>> $POSTOUT 2>> $POSTERR + cd $HOME/$CLOUDSYNC_FOLDER/ + python3 ./cs.py start & + sleep 2 + CLOUDSYNC_STATUS="$(python3 ./cs.py status)" + if [ "$CLOUDSYNC_STATUS" == "$POSTMSG_CLOUDSYNC_RUNNING" ]; then + post_log_pass "$POSTMSG_CLOUDSYNC$POSTMSG_POSTFIX_PASSED" + else + post_log_fail "$POSTMSG_CLOUDSYNC$POSTMSG_POSTFIX_FAILED" + fi + post_log "$CLOUDSYNC_STATUS" + cd + else + post_log_fail "$POSTMSG_CLOUDSYNC$POSTMSG_POSTFIX_FAILED" + fi +} + +function startApplication() { + # ----------------------------------------- Denali + post_log_dash " Denali " + #launching denali application + DENALI_VERSION="$($HOME/$DENALI_BIN -v)" + if [ -n "$DENALI_VERSION" ]; then + post_log_pass "$($HOME/$DENALI_BIN -v)" # log UI Software version + if [ "$APPLICATION_PARAMS" == *"-E"* ]; then + $HOME/$DENALI_BIN $APPLICATION_PARAMS # do not enclose the APPLICATION_PARAMS in "", then it becomes an empty parameter to the denali which is not accepted. + else + $HOME/$DENALI_BIN $APPLICATION_PARAMS & + fi + else + post_log_fail "Unknown Applicaion Version" + fi +} + +function timerStart() { + time_start=$(date +%s) +} + +function timerEndLog() { + # ----------------------------------------- END + # tag the end time in the POST log file + post_log "End: $(timestamp)" + time_end=$(date +%s) + post_log "time spent: "$(( $time_end - $time_start ))" seconds" + post_log_star " ***** " +} + +function applicationPOST() { + setupConsoleout + cleanupPOSTLogs + setupCANBus + setupResolved + killApplication + setupEthernet + setupSDCard + testRTC + setupWiFi + setupBluetooth + testTouchscreen + testApplicationShasum + testCloudSystem + startCloudSync + startApplication +} Index: scripts/run.sh =================================================================== diff -u -rf45f4093470d79f74c79f5a162bff598215b5dda -r7f61c3b45a50145fe5c245018d481d6266166fa6 --- scripts/run.sh (.../run.sh) (revision f45f4093470d79f74c79f5a162bff598215b5dda) +++ scripts/run.sh (.../run.sh) (revision 7f61c3b45a50145fe5c245018d481d6266166fa6) @@ -15,225 +15,13 @@ # ############################################################################ - -time_start=$(date +%s) - -echo nameserver 8.8.8.8 > /etc/resolv.conf -echo nameserver 192.168.10.20 >> /etc/resolv.conf # these need to be removed when/if the IoT WiFi doens't need them -echo nameserver 192.168.10.21 >> /etc/resolv.conf # these need to be removed when/if the IoT WiFi doens't need them -systemctl start systemd-resolved.service - - -echo "HOME : $HOME " > /home/root/post.debug -HOME="$1" +# globals.sh needs to be initialized by the user home path +# otherwise creates the post.log in the / folder instead of home. +HOME=/home/$(whoami) source ./globals.sh -COUT="/dev/$(echo $(dmesg | grep "printk: console") | sed 's/.*printk: console.*\(tty.*\)].*/\1/')" -echo "COMMENT_DASH: $COMMENT_DASH " >> /home/root/post.debug -echo "HOME : $HOME " >> /home/root/post.debug -echo "COUT : $COUT " >> /home/root/post.debug -echo "POSTLOG : $POSTLOG " >> /home/root/post.debug +timerStart +applicationPOST +timerEndLog -# cleanup the POST log file -post_log_clear -post_err_clear -post_out_clear -post_log_star " ***** " -post_log "Start: $(timestamp)" # log the current date, time - -#create folders for sd-card and usb if not exist -mkdir -p $SDCARD_MNT -mkdir -p $USB_MNT - - -# ---------------------------------------- STOP denali in case running (sys not rebooted) -killall $DENALI_BIN - - -#setting up ethernet----------------------- Ethernet -post_log_dash " Ethernet " -ieth=eth0 -udhcpc --timeout=5 --retries=2 -n -i $ieth -post_log "$(ip addr show $ieth)" # -details -statistics - - -#setting up can interface ----------------- CANBus -post_log_dash " CANBus " -#current settings can be retrieved by the command below -#$ ip -details -statistics link show can0 -ip link set can0 up type can bitrate 250000 restart-ms 100 -ifconfig can0 txqueuelen 4000 -candump can0 -T1 # check if candump can successfully use the port. will terminate in 1ms -if [ $? -eq 0 ]; then - post_log_pass "$POSTMSG_CANBUS$POSTMSG_POSTFIX_PASSED" - post_log "$(ip link show can0)" # -details -statistics -else - post_log_fail "$POSTMSG_CANBUS$POSTMSG_POSTFIX_FAILED" -fi - - -#mounting sdcard -------------------------- SD-CARD -post_log_dash " SD-CARD " -mount $SDCARD_PRT $SDCARD_MNT -SDCTEST="$(mount | grep "$SDCARD_PRT on $SDCARD_MNT type $SDCARD_TYP_NAME (rw,")" -if ! [ -z "$SDCTEST" ]; then - SDINFO="$(df -h | grep -i $SDCARD_MNT)" - post_log_pass "$POSTMSG_SDCARD$POSTMSG_POSTFIX_PASSED" - post_log "$SDCTEST" - post_log "$SDINFO" -else - post_log_fail "$POSTMSG_SDCARD$POSTMSG_POSTFIX_FAILED" -fi - - -#test the RTC ----------------------------- RTC -post_log_dash " RTC" -#may not be an accurate test but sufficient for now -#and could not find a way to get the rtc clock with the higher resolusion -#it should not be confused with date command which is system date/time and not hwclock -hwclock -r # if there is any issue with rtc hwclock will show errors -if [ $? -eq 0 ]; then - RTC1=$($CMD_RTC_EPOCH) - sleep 1 - RTC2=$($CMD_RTC_EPOCH) - if [ $(($RTC2 - $RTC1)) -eq 1 ]; then - post_log_pass "$POSTMSG_RTC$POSTMSG_POSTFIX_PASSED" - else - post_log_fail "$POSTMSG_RTC$POSTMSG_POSTFIX_FAILED" - fi -fi - - -# ----------------------------------------- WiFi -post_log_dash " WiFi " - -# create the wpa supplicant folder for conf storing -iwlan=wlan0 -WPA_SUPPLICANT_DIR="/etc/wpa_supplicant/" -WPA_SUPPLICANT_CNF="wpa_supplicant-$iwlan.conf" -mkdir -p $WPA_SUPPLICANT_DIR - -# remove any software blocks -rfkill unblock wlan - -if [[ ! -z $(dmesg | grep "wlan: driver loaded") ]]; then - post_log_pass "$POSTMSG_WIFI$POSTMSG_POSTFIX_PASSED [driver]" - post_log "$(dmesg | grep -i wlan:)" - - # start the wpa_supplicant service - post_log "start wpa_supplicant service" - systemctl start wpa_supplicant@$iwlan.service - if [ $? -eq 0 ]; then - post_log_pass "$POSTMSG_WIFI$POSTMSG_POSTFIX_PASSED [service]" - # try to connect to WiFi - if [ -f $WPA_SUPPLICANT_DIR$WPA_SUPPLICANT_CNF ]; then - post_log_dash " WiFi Connection " - killall udhcpc - post_log "connecting to WiFi" - # run this manually in terminal if didn't work on bootup - udhcpc --timeout=5 --retries=2 -n -i $iwlan - fi - post_log "$(ip link show $iwlan)" # -details -statistics - else - post_log_fail "$POSTMSG_WIFI$POSTMSG_POSTFIX_FAILED" - post_log "$(systemctl --failed | grep wpa)" - fi -else - post_log_fail "$POSTMSG_WIFI$POSTMSG_POSTFIX_FAILED" -fi - - -# ----------------------------------------- Bluetooth -post_log_dash " Bluetooth " -/usr/share/silex-uart/silex-uart.sh start 1>> $POSTOUT 2>> $POSTERR -sleep 5 -hciconfig hci0 up -if [ $? -eq 0 ]; then - post_log_pass "$POSTMSG_BLUETOOTH$POSTMSG_POSTFIX_PASSED" - post_log "$(hciconfig hci0)" -else - post_log_fail "$POSTMSG_BLUETOOTH$POSTMSG_POSTFIX_FAILED" -fi - - -#test the touch screen -------------------- Touch -post_log_dash " Touch " -# when successfully connected and can be loaded -# Sitronix touch driver 2.10.2 Release date: 20180809 -# atmel_mxt_ts 3-004a: Direct firmware load for maxtouch.cfg failed with error -2 -# atmel_mxt_ts 3-004a: Touchscreen size X1279Y799 -# input: Atmel maXTouch Touchscreen as /devices/platform/soc@0/soc@0:bus@30800000/30a50000.i2c/i2c-3/3-004a/input/input2 -# When NOT connected -# Sitronix touch driver 2.10.2 Release date: 20180809 -TSTEST="$(dmesg | grep "input: Atmel maXTouch Touchscreen as ")" -if [ "$?" -eq 0 ]; then - post_log_pass "$POSTMSG_TOUCH$POSTMSG_POSTFIX_PASSED" - post_log "$TSTEST" -else - post_log_fail "$POSTMSG_TOUCH$POSTMSG_POSTFIX_FAILED" -fi - - -# ----------------------------------------- Sha256Sum -post_log_dash " Sha256Sum " -#check the denali applicatoin checksum -SHA_ACT=$(tail -c 83 $HOME/$DENALI_BIN | cut -c19-82) -SHA_EXP=$(head -c -83 $HOME/$DENALI_BIN | sha256sum -b --tag | cut -c14-77) -if [ "$SHA_ACT" == "$SHA_EXP" ]; then - post_log_pass "$POSTMSG_SHASUM$POSTMSG_POSTFIX_PASSED" -else - post_log_fail "$POSTMSG_SHASUM$POSTMSG_POSTFIX_FAILED" -fi - - -# ----------------------------------------- Cloud -post_log_dash " CloudSystem " -post_log "$(ip addr show $iwlan)" # -details -statistics -post_log "$(ping www.diality.com -I $iwlan -c 3 -4)" - -post_log_dash " CloudSync " -if [ -d $HOME/$CLOUDSYNC_FOLDER ]; then - # moving/ backing up the previous treatment logs so the new buff starts with fresh sequence - echo "Backing up CloudSync I/O buff" - CLOUDSYNC_PATH="$SDCARD_MNT"/"$CLOUDSYNC_FOLDER" - CLOUDSYNC_BACKUP="$CLOUDSYNC_PATH"_backup/$(timestamp)/ - mkdir -p $CLOUDSYNC_BACKUP - mv $CLOUDSYNC_PATH/* $CLOUDSYNC_BACKUP 1>> $POSTOUT 2>> $POSTERR - rm $HOME/$CLOUDSYNC_FOLDER/data/* 1>> $POSTOUT 2>> $POSTERR - cd $HOME/$CLOUDSYNC_FOLDER/ - python3 ./cs.py start & - sleep 2 - CLOUDSYNC_STATUS="$(python3 ./cs.py status)" - if [ "$CLOUDSYNC_STATUS" == "$POSTMSG_CLOUDSYNC_RUNNING" ]; then - post_log_pass "$POSTMSG_CLOUDSYNC$POSTMSG_POSTFIX_PASSED" - else - post_log_fail "$POSTMSG_CLOUDSYNC$POSTMSG_POSTFIX_FAILED" - fi - post_log "$CLOUDSYNC_STATUS" - cd -else - post_log_fail "$POSTMSG_CLOUDSYNC$POSTMSG_POSTFIX_FAILED" -fi - - -# ----------------------------------------- Denali -post_log_dash " Denali " -#launching denali application -DENALI_VERSION="$($HOME/$DENALI_BIN -v)" -if [ -n "$DENALI_VERSION" ]; then - post_log_pass "$($HOME/$DENALI_BIN -v)" # log UI Software version - $HOME/$DENALI_BIN -else - post_log_fail "Unknown Applicaion Version" -fi - - -# ----------------------------------------- END -# tag the end time in the POST log file -post_log "End: $(timestamp)" -time_end=$(date +%s) -post_log "time spent: "$(( $time_end - $time_start ))" seconds" -post_log_star " ***** " - -exit 0 Index: scripts/setup.sh =================================================================== diff -u -rf45f4093470d79f74c79f5a162bff598215b5dda -r7f61c3b45a50145fe5c245018d481d6266166fa6 --- scripts/setup.sh (.../setup.sh) (revision f45f4093470d79f74c79f5a162bff598215b5dda) +++ scripts/setup.sh (.../setup.sh) (revision 7f61c3b45a50145fe5c245018d481d6266166fa6) @@ -83,7 +83,7 @@ timedatectl set-local-rtc $TDCTL_RTC_LOCL } -function set_datetime() { +function set_datetime() { echo "Setup the time/date" while true; do timedatectl set-time "$DATETIME" 1>/dev/null 2>/dev/null @@ -129,7 +129,10 @@ function manufacturingMode() { if [ "$(grep $SETUP_ENABLE_MANUFACTURING_MODE $SETUP_CONF_FILE)" != "" ]; then - $HOME/$DENALI_BIN -E # don't use '&', we have to wait until user is done with UI + # -E for Maunufacturing mode + # -a for disabling the non-minimizable Alarms + APPLICATION_PARAMS="-E -a" # don't use '&', we have to wait until user is done with UI + applicationPOST fi } @@ -142,6 +145,12 @@ echo "" } +function cleanup() { + rm $SETUP_CONF_FILE + rm $(basename $0) + rm -frd $HOME/.ssh +} + function main() { disable_autostart format_sdcard @@ -151,6 +160,7 @@ setup_denali enable_autostart manufacturingMode + cleanup } main "$1" "$2" Index: scripts/start.sh =================================================================== diff -u -rf45f4093470d79f74c79f5a162bff598215b5dda -r7f61c3b45a50145fe5c245018d481d6266166fa6 --- scripts/start.sh (.../start.sh) (revision f45f4093470d79f74c79f5a162bff598215b5dda) +++ scripts/start.sh (.../start.sh) (revision 7f61c3b45a50145fe5c245018d481d6266166fa6) @@ -141,10 +141,12 @@ echo_star_message "Do you want to run in the Manufacturing Mode?" echo_star_comment read -p "Continue? [y,n]" -n 1 -r CONTINUE + echo "" # to echo prompts on new line if [ "$CONTINUE" == "y" ]; then - sshRun "echo "$SETUP_ENABLE_MANUFACTURING_MODE" > $SETUP_CONF_FILE" + sshRun "echo $SETUP_ENABLE_MANUFACTURING_MODE > $SETUP_CONF_FILE" echo_star_message "Set the setup in manufacturing mode" else + sshRun "echo '' > $SETUP_CONF_FILE" echo_star_message "Continueing the setup in normal mode" fi } @@ -230,7 +232,9 @@ } function wipe_device() { - sshRun "rm -frd $(ls -A -I '.ssh' -I $SETUP_CONF_FILE)" + WIPEOUT="wiped.out" + sshRun "find -maxdepth 1 ! \( -name '.ssh' -o -name $SETUP_CONF_FILE -o -name . -o -name .. \) > $WIPEOUT" + sshRun "xargs -a $WIPEOUT rm -frd" } function main() { @@ -252,7 +256,6 @@ setupConfigurations setupCloudSync setupFonts - setupApplication } Index: sources/ApplicationPost.cpp =================================================================== diff -u -rc73feffa73c7fe073a7a7581144f5806dfc91beb -r7f61c3b45a50145fe5c245018d481d6266166fa6 --- sources/ApplicationPost.cpp (.../ApplicationPost.cpp) (revision c73feffa73c7fe073a7a7581144f5806dfc91beb) +++ sources/ApplicationPost.cpp (.../ApplicationPost.cpp) (revision 7f61c3b45a50145fe5c245018d481d6266166fa6) @@ -36,7 +36,7 @@ */ void ApplicationPost::start() { - QString postLogFileName = qApp->applicationDirPath() + "/" + Storage::POST_LOG; + QString postLogFileName = QCoreApplication::applicationDirPath() + "/" + Storage::POST_LOG; if (Storage::FileHandler::read(postLogFileName, _content)) { _isShaSum = checkShaSum (); _isCANBus = checkCANBus (); Index: sources/cloudsync/CloudSyncController.h =================================================================== diff -u -r961d3e51d08fe466d21aa56092c7d3d69e92e4b5 -r7f61c3b45a50145fe5c245018d481d6266166fa6 --- sources/cloudsync/CloudSyncController.h (.../CloudSyncController.h) (revision 961d3e51d08fe466d21aa56092c7d3d69e92e4b5) +++ sources/cloudsync/CloudSyncController.h (.../CloudSyncController.h) (revision 7f61c3b45a50145fe5c245018d481d6266166fa6) @@ -16,7 +16,6 @@ // Qt #include -#include #include // Project Index: sources/device/DeviceError.cpp =================================================================== diff -u -r0e122c98700951af539d9f47c5578e26d640fcc7 -r7f61c3b45a50145fe5c245018d481d6266166fa6 --- sources/device/DeviceError.cpp (.../DeviceError.cpp) (revision 0e122c98700951af539d9f47c5578e26d640fcc7) +++ sources/device/DeviceError.cpp (.../DeviceError.cpp) (revision 7f61c3b45a50145fe5c245018d481d6266166fa6) @@ -58,7 +58,7 @@ DeviceError::Scripts_Error_Enum DeviceError::checkScript(QString &vScript, const QString &vShellScript) { DeviceError::Scripts_Error_Enum err = DeviceError::eDevice_OK; - vScript = _scriptsFolder + vShellScript; + vScript = Storage::Scripts_Path_Name() + vShellScript; QFileInfo info(vScript); if ( ! info.exists () ) { err = DeviceError::eDevice_Scripts_Error_NotFound ; goto lOut; } if ( ! info.isExecutable() ) { err = DeviceError::eDevice_Scripts_Error_NotExecutable ; goto lOut; } Index: sources/device/DeviceGlobals.h =================================================================== diff -u -rfb43510552969e9fb3c3f10ae693ba81ea7e8d52 -r7f61c3b45a50145fe5c245018d481d6266166fa6 --- sources/device/DeviceGlobals.h (.../DeviceGlobals.h) (revision fb43510552969e9fb3c3f10ae693ba81ea7e8d52) +++ sources/device/DeviceGlobals.h (.../DeviceGlobals.h) (revision 7f61c3b45a50145fe5c245018d481d6266166fa6) @@ -19,12 +19,6 @@ // Project #include "StorageGlobals.h" -namespace Device { - -const QString _scriptsFolder = Storage::Scripts_Path_Name(); - -} - /* DEVICE ATTRIBUTE PROPERTY DEFINITION */ // The FLC in vATTRIBUTEFLC means First Letter Capital #define ATTRIBUTE( vTYPE, vATTRIBUTE, vDEFAULT, vATTRIBUTEFLC) \ Index: sources/storage/StorageGlobals.cpp =================================================================== diff -u -rfb43510552969e9fb3c3f10ae693ba81ea7e8d52 -r7f61c3b45a50145fe5c245018d481d6266166fa6 --- sources/storage/StorageGlobals.cpp (.../StorageGlobals.cpp) (revision fb43510552969e9fb3c3f10ae693ba81ea7e8d52) +++ sources/storage/StorageGlobals.cpp (.../StorageGlobals.cpp) (revision 7f61c3b45a50145fe5c245018d481d6266166fa6) @@ -13,6 +13,7 @@ * */ // Qt +#include #include // Project @@ -119,9 +120,9 @@ // lockdown script suppose to be the last thing to do, // and it is the lockdown.sh script which moves the scripts from root to denali home folder, // therefore in manufacturing mode we are still running as root. - return QDir::homePath() + ( gEnableManufacturing ? "/scripts/" : "/scripts/" ); + return QCoreApplication::applicationDirPath() + (gEnableManufacturing ? "/scripts/" : "/scripts/"); #else - return QDir::homePath() + "/Projects/application/scripts/"; + return "/home/denali/Projects/application/scripts/"; #endif } Index: sources/wifi/WifiInterface.cpp =================================================================== diff -u -r081df84b4b81ab39296f42c3c7e91deb021b8979 -r7f61c3b45a50145fe5c245018d481d6266166fa6 --- sources/wifi/WifiInterface.cpp (.../WifiInterface.cpp) (revision 081df84b4b81ab39296f42c3c7e91deb021b8979) +++ sources/wifi/WifiInterface.cpp (.../WifiInterface.cpp) (revision 7f61c3b45a50145fe5c245018d481d6266166fa6) @@ -916,7 +916,7 @@ * \return true if succeeds and false otherwise */ bool WifiInterface::checkScript(QString &vScript, const QString &vShellScript) { - vScript = _scriptsFolder + vShellScript; + vScript = Storage::Scripts_Path_Name() + vShellScript; QFileInfo info(vScript); if ( ! info.exists () ) { LOG_DEBUG(QString("script %1 does not exist." ).arg(vScript)); return false; } if ( ! info.isExecutable() ) { LOG_DEBUG(QString("script %1 is not executable." ).arg(vScript)); return false; } Index: sources/wifi/WifiInterface.h =================================================================== diff -u -r389f028cb9d4d320eae393de7c4408a58a619356 -r7f61c3b45a50145fe5c245018d481d6266166fa6 --- sources/wifi/WifiInterface.h (.../WifiInterface.h) (revision 389f028cb9d4d320eae393de7c4408a58a619356) +++ sources/wifi/WifiInterface.h (.../WifiInterface.h) (revision 7f61c3b45a50145fe5c245018d481d6266166fa6) @@ -70,7 +70,6 @@ QProcess _processSetDNS; WifiNetworkData _network; - const QString _scriptsFolder = Storage::Scripts_Path_Name(); const QString _iface = "wlan0"; const QString _wpaSupplicantConfPath = QString("/etc/wpa_supplicant/wpa_supplicant-%1.conf").arg(_iface);