Index: sources/storage/StorageGlobals.cpp =================================================================== diff -u -r0e122c98700951af539d9f47c5578e26d640fcc7 -r389f028cb9d4d320eae393de7c4408a58a619356 --- sources/storage/StorageGlobals.cpp (.../StorageGlobals.cpp) (revision 0e122c98700951af539d9f47c5578e26d640fcc7) +++ sources/storage/StorageGlobals.cpp (.../StorageGlobals.cpp) (revision 389f028cb9d4d320eae393de7c4408a58a619356) @@ -17,6 +17,10 @@ // Project #include "StorageGlobals.h" + +extern bool gEnableManufacturing ; +extern bool gUseRootHome ; + /*! * \brief Storage * \details The container of the constant global variable withing Storage namespace members. @@ -60,13 +64,20 @@ #endif // Screenshot store folder -const char *Screenshot_Base_Path_Name = "Screenshots/"; // this is the base path which will use the USB_Mount_Point to store the screenshots. + const char *Screenshot_Base_Path_Name = "Screenshots/"; // this is the base path which will use the USB_Mount_Point to store the screenshots. // Settings + static bool settings_secured = false; + const char *Settings_Path () { return gUseRootHome ? Settings_Path_Init : ( gEnableManufacturing ? ( settings_secured ? Settings_Path_Name: Settings_Path_Init ) : Settings_Path_Name ); } + void Settings_Secured() { settings_secured = true; } + #ifdef BUILD_FOR_TARGET - const char *Settings_Path_Name = "/home/root/.config/"; + //WARNING: This has to match with the crypt_setup.sh + const char *Settings_Path_Init = "/home/root/.config/"; // this is the manufacturing setup and the user is root. + const char *Settings_Path_Name = "/var/configurations/"; #else // should be in the project application folder. [is tracking by git] + const char *Settings_Path_Init = "/home/denali/Projects/application/resources/settings/"; const char *Settings_Path_Name = "/home/denali/Projects/application/resources/settings/"; #endif const char *Settings_Category_Instructions = "Instructions/Instructions"; @@ -84,10 +95,10 @@ // CloudSync credentials #ifdef BUILD_FOR_TARGET - const char *CloudSync_Base_Path_Name = "/home/root/.cloudSync/"; + const char *CloudSync_Base_Path_Name = gUseRootHome ? "/home/root/.cloudSync/" : "/var/configurations/CloudSync/"; #else // on VM it is a temporary file which is not being tracked - const char *CloudSync_Base_Path_Name = "/home/denali/Desktop/cloudsync/"; + const char *CloudSync_Base_Path_Name = "/home/denali/Desktop/CloudSync/"; #endif #ifdef BUILD_FOR_TARGET @@ -98,13 +109,21 @@ #endif // Scripts -#ifdef BUILD_FOR_TARGET - const char *Scripts_Path_Name = "/home/root/scripts/"; -#else - // should be in the project application folder. [is tracking by git] - const char *Scripts_Path_Name = "/home/denali/Projects/application/scripts/"; -#endif + const QString Scripts_Path_Name() { + #ifdef BUILD_FOR_TARGET + //TODO The manufacturing mode has to run as root + // after the lockdown.sh ran there would be no root user access + // and I am not sure how we reenalbe the root ssh + // and if it is a security risk to give denali access to sshd_config to enable the root ssh within UI App + // 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/" ); + #else + return QDir::homePath() + "/Projects/application/scripts/"; + #endif + } // Please notice that is the folder not the path // and it needs to be concatenated after SDCard_Base_Path_Name for each build configuration @@ -117,7 +136,7 @@ // FIXME : Not sure having global settings object is a good idea. #ifdef BUILD_FOR_TARGET - QSettings WifiSettings("/home/root/wifi.ini", QSettings::IniFormat); + QSettings WifiSettings("/home/denali/wifi.ini", QSettings::IniFormat); #else QSettings WifiSettings("/home/denali/wifi.ini"); #endif