Index: sources/device/DeviceController.cpp =================================================================== diff -u -r8d5fe7d63e3d86e9d89d5f824347d34479e4e9ec -rd8c73c14f41d548e3ffecdb6948e6b7bb54523f2 --- sources/device/DeviceController.cpp (.../DeviceController.cpp) (revision 8d5fe7d63e3d86e9d89d5f824347d34479e4e9ec) +++ sources/device/DeviceController.cpp (.../DeviceController.cpp) (revision d8c73c14f41d548e3ffecdb6948e6b7bb54523f2) @@ -645,31 +645,41 @@ */ void DeviceController::onProcessCryptSetupExitCode(int vExitCode, QProcess::ExitStatus vStatus) { + const int ERR_CRYPTSETUP_MOUNT_ISMOUNT=134; // is used in crypt_setup.sh do not modify + // The Exit code in this script is not used. // any other checking is done by UI Software at the moment this script is called. // The only thing matters is the pared device info in text and it will be empty string if error happens. MDeviceCryptSetupResponse model; - QByteArray deviceInfo = _processCryptSetup.readAll(); + QByteArray deviceInfo; if ( vStatus ) vExitCode = Device::DeviceError::eDevice_Scripts_Error_Status; else deviceInfo = _processCryptSetup.readAll(); model.fromByteArray( deviceInfo, &vExitCode ); // DEBUG: qDebug() << model._data.mEchoInfo; emit didAttributeResponse(model.data()); LOG_APPED_UI(model.data().mMessage); - if ( _deviceCryptSetupRequest._data.mCommand == "mount" ) emit didCryptSetupMount(model._data.mAccepted); + bool isSetup = _deviceCryptSetupRequest._data.mCommand == "setup"; + bool isMount = _deviceCryptSetupRequest._data.mCommand == "mount"; + bool isMounted = isMount && ( + vExitCode == ERR_CRYPTSETUP_MOUNT_ISMOUNT || // is already mounted + vExitCode == 0 // successful mount + ); + bool isUpdate = gEnableUpdating && isMounted; + if ( isMount ) emit didCryptSetupMount(model._data.mAccepted); + QString msg = ""; int err = 0 ; //TODO The Settings shall be the Singleton SettingsController and modify the MSettings like the others. Storage::Settings settings; // moving the configuration files if the encrypted partition creation was successful. - if ( ! model._data.mAccepted ) goto lErr; - if ( gEnableUpdating ) goto lMove; - if ( _deviceCryptSetupRequest._data.mCommand != "setup" ) goto lOut; + if ( isUpdate ) goto lMove; // if it is gEnableUpdating, bypass the mAccepted for already mounted. + if ( ! model._data.mAccepted ) goto lErr ; // any other case goto error + if ( ! isSetup ) goto lOut ; // if not setup do NOT continue to move configurations lMove: - err = settings.configurationsMove(&msg); + err = settings.configurationsMove(&msg, isUpdate); if ( err ) { model._data.mAccepted = false ; model._data.mReason = err ; @@ -935,7 +945,7 @@ // any other checking is done by UI Software at the moment this script is called. // The only thing matters is the paired device info in text and it will be empty string if error happens. MDeviceFactoryResetResponse model; - QByteArray deviceInfo = _processFactoryReset.readAll(); + QByteArray deviceInfo; if ( vStatus ) vExitCode = Device::DeviceError::eDevice_Scripts_Error_Status; else deviceInfo = _processFactoryReset.readAll(); model.fromByteArray( deviceInfo, &vExitCode ); @@ -984,7 +994,7 @@ // any other checking is done by UI Software at the moment this script is called. // The only thing matters is the paired device info in text and it will be empty string if error happens. MDeviceDecommissionResponse model; - QByteArray deviceInfo = _processDecommission.readAll(); + QByteArray deviceInfo; if ( vStatus ) vExitCode = Device::DeviceError::eDevice_Scripts_Error_Status; else deviceInfo = _processDecommission.readAll(); model.fromByteArray( deviceInfo, &vExitCode ); @@ -1042,7 +1052,7 @@ void DeviceController::onProcessUSBMountExitCode(int vExitCode, QProcess::ExitStatus vStatus) { MDeviceUSBMountResponse model; - QByteArray deviceInfo = _processUSBMount.readAll(); + QByteArray deviceInfo; if ( vStatus ) vExitCode = Device::DeviceError::eDevice_Scripts_Error_Status; else deviceInfo = _processUSBMount.readAll(); model.fromByteArray( deviceInfo, &vExitCode ); Index: sources/gui/qml/pages/settings/SettingsStack.qml =================================================================== diff -u -r8d5fe7d63e3d86e9d89d5f824347d34479e4e9ec -rd8c73c14f41d548e3ffecdb6948e6b7bb54523f2 --- sources/gui/qml/pages/settings/SettingsStack.qml (.../SettingsStack.qml) (revision 8d5fe7d63e3d86e9d89d5f824347d34479e4e9ec) +++ sources/gui/qml/pages/settings/SettingsStack.qml (.../SettingsStack.qml) (revision d8c73c14f41d548e3ffecdb6948e6b7bb54523f2) @@ -52,18 +52,22 @@ readonly property bool visibleCalibration : false readonly property bool visibleInformation : true - readonly property bool visibleVolumeBrightness : true + readonly property bool visibleVolumeBrightness : ! onlyUpdating // same as service password, on application execution in updating, on mount files will be moved. readonly property bool visibleWiFi : true readonly property bool visibleBluetooth : true readonly property bool visibleExportLogs : true - readonly property bool visibleServicePassword : normalMode && ! loggedIn + // during the update we cannot enable the servce menu since the current set password is in ~denali folder + // not the ~root which is the working folder during update. + //TODO in case is required we need to copy from denali to root for the update and copy back again, + // if works it is a better approach better. + readonly property bool visibleServicePassword : ( normalMode && ! loggedIn ) // || ( onlyUpdating && ! loggedIn ) readonly property bool visibleDGCleaning : normalMode readonly property bool visibleRoInput : normalMode readonly property bool visibleRootSSHAccess : loggedIn readonly property bool visibleFactoryReset : loggedIn readonly property bool visibleDecommission : loggedIn - readonly property bool visibleSetDateTime : loggedIn + readonly property bool visibleSetDateTime : loggedIn || onlyUpdating readonly property bool visibleDeviceConfiguration : onlyManufacturing && loggedIn readonly property bool visibleDeviceRegistration : onlyManufacturing && loggedIn Index: sources/storage/Settings.cpp =================================================================== diff -u -r8d5fe7d63e3d86e9d89d5f824347d34479e4e9ec -rd8c73c14f41d548e3ffecdb6948e6b7bb54523f2 --- sources/storage/Settings.cpp (.../Settings.cpp) (revision 8d5fe7d63e3d86e9d89d5f824347d34479e4e9ec) +++ sources/storage/Settings.cpp (.../Settings.cpp) (revision d8c73c14f41d548e3ffecdb6948e6b7bb54523f2) @@ -223,19 +223,26 @@ * \param vMessage * \return */ -int Settings::configurationsMove(QString *vMessage) +int Settings::configurationsMove(QString *vMessage, bool vIsUpdate) { int err = Settings_Error::eError_None ; - Location_Enum loc = Location_Enum ::eInit; - QString src = Settings::location(Location_Enum ::eInit ) ; - QString dst = Settings::location(Location_Enum ::eSecured ) ; + Location_Enum loc = Location_Enum ::eInit ; + QString src = Settings::location(Location_Enum ::eInit ); + QString dst = Settings::location(Location_Enum ::eSecured ); QString msg = ""; - if ( ! Settings ::configurationsPOST(loc )) { err = Settings_Error::eError_Remove; msg = errorMessage(err ); LOG_DEBUG(msg); goto lOut; } - if ( ! FileHandler ::makeFolder ( dst )) { err = Settings_Error::eError_Copy ; msg = errorMessage(err ); LOG_DEBUG(msg); goto lOut; } + QStringList lstExclude; + if ( vIsUpdate ) { + lstExclude << QFileInfo( src + Storage::Settings_Category_SettingsSystem ).absolutePath(); + } + + if ( ! Settings ::configurationsPOST(loc )) { err = Settings_Error::eError_Remove; msg = errorMessage(err ); LOG_DEBUG(msg); goto lOut; } + if ( ! FileHandler ::makeFolder ( dst )) { err = Settings_Error::eError_Copy ; msg = errorMessage(err ); LOG_DEBUG(msg); goto lOut; } for( QString dir : FileHandler::subFolders(src)) { QString sub = src + dir; - if ( FileHandler ::copyFolder (sub, dst )) { err = Settings_Error::eError_MkDir ; msg = errorMessage(err, dir); LOG_DEBUG(msg); goto lOut; } - if ( FileHandler ::removeFolder (sub )) { err = Settings_Error::eError_POST ; msg = errorMessage(err, dir); LOG_DEBUG(msg); goto lOut; } + if ( ! lstExclude.contains( sub ) ) { + if ( FileHandler ::copyFolder (sub, dst )) { err = Settings_Error::eError_MkDir ; msg = errorMessage(err, dir); LOG_DEBUG(msg); goto lOut; } + } + if ( FileHandler ::removeFolder (sub )) { err = Settings_Error::eError_POST ; msg = errorMessage(err, dir); LOG_DEBUG(msg); goto lOut; } } Storage::Settings_Secured(); Index: sources/storage/Settings.h =================================================================== diff -u -r80b5e8f1ebb90c03c37d90d90cd2da3bd95d6803 -rd8c73c14f41d548e3ffecdb6948e6b7bb54523f2 --- sources/storage/Settings.h (.../Settings.h) (revision 80b5e8f1ebb90c03c37d90d90cd2da3bd95d6803) +++ sources/storage/Settings.h (.../Settings.h) (revision d8c73c14f41d548e3ffecdb6948e6b7bb54523f2) @@ -128,7 +128,7 @@ int read (); int save (const QString &vCategory, const QString &vGroup, const QString &vKey, const QString &vValue); - int configurationsMove ( QString *vMessage = nullptr); + int configurationsMove (QString *vMessage = nullptr, bool vIsUpdate = false); int configurationsPOST (Location_Enum vLoc = Location_Enum::eSecured) { Q_UNUSED(vLoc); return true; } static QString category(Category_Enum vCategory) {