Index: sources/storage/StorageGlobals.cpp =================================================================== diff -u -r6210028a421d6259963bf172efbe4f23abfecf2f -rffa637196f8eb64c155cd84ef27f65a87479135e --- sources/storage/StorageGlobals.cpp (.../StorageGlobals.cpp) (revision 6210028a421d6259963bf172efbe4f23abfecf2f) +++ sources/storage/StorageGlobals.cpp (.../StorageGlobals.cpp) (revision ffa637196f8eb64c155cd84ef27f65a87479135e) @@ -7,16 +7,21 @@ * * \file StorageGlobals.cpp * \author (last) Behrouz NematiPour - * \date (last) 13-Oct-2022 + * \date (last) 22-Jan-2023 * \author (original) Behrouz NematiPour * \date (original) 26-Aug-2020 * */ // 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 @@ -117,7 +139,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,7 +178,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"; + }