Index: sources/storage/StorageGlobals.cpp =================================================================== diff -u -rbff1a7d681ce1928f39c79428958a5eb1625080c -r6c6f1f5d466badd9b4fd67be7c907234c342b2a2 --- sources/storage/StorageGlobals.cpp (.../StorageGlobals.cpp) (revision bff1a7d681ce1928f39c79428958a5eb1625080c) +++ sources/storage/StorageGlobals.cpp (.../StorageGlobals.cpp) (revision 6c6f1f5d466badd9b4fd67be7c907234c342b2a2) @@ -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. @@ -28,6 +33,8 @@ /****** TO BE CONSISTENT, ALWAYS INCLUDE '/' AT THE END OF ALL THE FOLDER/DIR/PATH IN HERE ******/ + const char *Standard_tmp = "/tmp/"; + const char *POST_LOG = "post.log"; // this file shall reside in the home folder where the application stored. // USB @@ -60,13 +67,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 +98,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 +112,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 reenable 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 @@ -139,7 +161,30 @@ const char *Brightness_Set = "brightness_set.sh"; const char *Brightness_Get = "brightness_get.sh"; + // Root SSH + 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"; + + // Encrypted Partition - cryptsetup + const char *Crypt_Setup = "crypt_setup.sh"; + + // Factory Reset + const char *Factory_Reset = "factory_reset.sh"; + + // Device Decommissioning + const char *Device_Decommission = "decommission.sh"; + + // Device Lockdown + const char *Device_Lockdown = "lockdown.sh"; + + const char *CloudSyncPath = "/var/configurations/CloudSync/credentials/"; + + // USB unmount/ mount + const char *USB_Unmount = "usb_unmount.sh"; + const char *USB_Mount = "usb_mount.sh"; + }