Index: sources/storage/StorageGlobals.cpp =================================================================== diff -u -r2a0e56982ad45cdd98a6d0425c53e52610c29961 -r5a4a26f106ba03759e3a89b19690fa678f8a3aca --- sources/storage/StorageGlobals.cpp (.../StorageGlobals.cpp) (revision 2a0e56982ad45cdd98a6d0425c53e52610c29961) +++ sources/storage/StorageGlobals.cpp (.../StorageGlobals.cpp) (revision 5a4a26f106ba03759e3a89b19690fa678f8a3aca) @@ -13,10 +13,15 @@ * */ // Qt +#include #include // 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 +65,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 +96,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 +110,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 QCoreApplication::applicationDirPath() + (gEnableManufacturing ? "/scripts/" : "/scripts/"); + #else + return "/home/denali/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 +137,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 @@ -156,6 +176,10 @@ const char *Brightness_Set = "brightness_set.sh"; const char *Brightness_Get = "brightness_get.sh"; + // Brightness + const char *RootSSHAccess_Set = "rootsshaccess_set.sh"; + const char *RootSSHAccess_Get = "rootsshaccess_get.sh"; + // Bluetooth const char *Bluetooth_Paired_Reset = "bluetooth_paired_clear.sh"; const char *Bluetooth_Paired_Query = "bluetooth_paired_query.sh";