Index: sources/storage/StorageGlobals.cpp =================================================================== diff -u -ra39588d07df5f8723abc79115c974965d0cad1e4 -r8d5fe7d63e3d86e9d89d5f824347d34479e4e9ec --- sources/storage/StorageGlobals.cpp (.../StorageGlobals.cpp) (revision a39588d07df5f8723abc79115c974965d0cad1e4) +++ sources/storage/StorageGlobals.cpp (.../StorageGlobals.cpp) (revision 8d5fe7d63e3d86e9d89d5f824347d34479e4e9ec) @@ -7,16 +7,22 @@ * * \file StorageGlobals.cpp * \author (last) Behrouz NematiPour - * \date (last) 22-Jan-2023 + * \date (last) 18-Jul-2023 * \author (original) Behrouz NematiPour * \date (original) 26-Aug-2020 * */ // Qt +#include #include // Project #include "StorageGlobals.h" + +extern bool gEnableManufacturing ; +extern bool gEnableUpdating ; +extern bool gUseRootHome ; + /*! * \brief Storage * \details The container of the constant global variable withing Storage namespace members. @@ -28,6 +34,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 +68,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 || gEnableUpdating ) ? ( 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 or update 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 +99,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,14 +113,17 @@ #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 + // lockdown script suppose to be the last thing to run, + // and it is the lockdown.sh script which moves the scripts from root to denali home folder, + // therefore in manufacturing or update mode we are still running scripts as root. + return QCoreApplication::applicationDirPath() + ( ( gEnableManufacturing || gEnableUpdating )? "/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 const char *Log_Folder_Base = SDCard_Base_Path_Name; // Base Log Folder @@ -139,7 +157,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"; + }