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 );