Index: sources/device/DeviceController.cpp =================================================================== diff -u -r20fd0f6c963bc4dedc81ecb3258a2a4c52295a0f -r4fc7cdc599de191e91296623ec783542b7a3c7b8 --- sources/device/DeviceController.cpp (.../DeviceController.cpp) (revision 20fd0f6c963bc4dedc81ecb3258a2a4c52295a0f) +++ sources/device/DeviceController.cpp (.../DeviceController.cpp) (revision 4fc7cdc599de191e91296623ec783542b7a3c7b8) @@ -693,6 +693,7 @@ // Update UI with a response MDeviceCryptSetupResponse model; + model._data.isExited = false; model._data.mAccepted = false; model._data.mMessage = tr("Encrypted Partition %1 started.").arg(_deviceCryptSetupRequest._data.mCommand); emit didAttributeResponse(model.data()); @@ -711,6 +712,8 @@ // 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; + model._data.isExited = true; // Indicate that request completed + QByteArray deviceInfo; if ( vStatus ) vExitCode = Device::DeviceError::eDevice_Scripts_Error_Status; else deviceInfo = _processCryptSetup.readAll(); Index: sources/device/DeviceModels.h =================================================================== diff -u -r80b5e8f1ebb90c03c37d90d90cd2da3bd95d6803 -r4fc7cdc599de191e91296623ec783542b7a3c7b8 --- sources/device/DeviceModels.h (.../DeviceModels.h) (revision 80b5e8f1ebb90c03c37d90d90cd2da3bd95d6803) +++ sources/device/DeviceModels.h (.../DeviceModels.h) (revision 4fc7cdc599de191e91296623ec783542b7a3c7b8) @@ -237,6 +237,7 @@ class MDeviceCryptSetupResponse : public MDeviceResponseBase { public: struct Data : MDeviceResponseBase::Data { + bool isExited = false; } _data; QVariantList parameters ( ) const override { return { }; } QString infoText ( ) const override { return QString("DeviceCryptSetup"); } Index: sources/device/DeviceView.cpp =================================================================== diff -u -r80b5e8f1ebb90c03c37d90d90cd2da3bd95d6803 -r4fc7cdc599de191e91296623ec783542b7a3c7b8 --- sources/device/DeviceView.cpp (.../DeviceView.cpp) (revision 80b5e8f1ebb90c03c37d90d90cd2da3bd95d6803) +++ sources/device/DeviceView.cpp (.../DeviceView.cpp) (revision 4fc7cdc599de191e91296623ec783542b7a3c7b8) @@ -95,7 +95,8 @@ accepted(vData.mAccepted); reason (vData.mReason ); - cryptSetupEnabled(isCompleteResponse(vData)); + cryptSetupEnabled (vData.isExited && !isCompleteResponse(vData)); + isCryptSetupComplete(vData.isExited ); // has to be the last one response(true); Index: sources/device/DeviceView.h =================================================================== diff -u -r80b5e8f1ebb90c03c37d90d90cd2da3bd95d6803 -r4fc7cdc599de191e91296623ec783542b7a3c7b8 --- sources/device/DeviceView.h (.../DeviceView.h) (revision 80b5e8f1ebb90c03c37d90d90cd2da3bd95d6803) +++ sources/device/DeviceView.h (.../DeviceView.h) (revision 4fc7cdc599de191e91296623ec783542b7a3c7b8) @@ -49,6 +49,7 @@ ATTRIBUTE ( QString , cryptSetup , "", CryptSetup ) PROPERTY ( bool , cryptSetupEnabled , true ) + PROPERTY ( bool , isCryptSetupComplete, false ) ATTRIBUTE ( bool , rootSSHAccess , false, RootSSHAccess ) Index: sources/gui/qml/pages/settings/SettingsManufacturingSetup.qml =================================================================== diff -u -r80b5e8f1ebb90c03c37d90d90cd2da3bd95d6803 -r4fc7cdc599de191e91296623ec783542b7a3c7b8 --- sources/gui/qml/pages/settings/SettingsManufacturingSetup.qml (.../SettingsManufacturingSetup.qml) (revision 80b5e8f1ebb90c03c37d90d90cd2da3bd95d6803) +++ sources/gui/qml/pages/settings/SettingsManufacturingSetup.qml (.../SettingsManufacturingSetup.qml) (revision 4fc7cdc599de191e91296623ec783542b7a3c7b8) @@ -27,7 +27,7 @@ */ UserConfirmation { id: _root message : vDevice.cryptSetupEnabled ? qsTr("Do you want to perform the %1?").arg(title.toLowerCase()) - : qsTr("Please wait ...") + : (vDevice.isCryptSetupComplete ? qsTr("Device Configuration Completed") : qsTr("Please wait ...")) itemIndex : SettingsStack.DeviceConfiguration notificationText: vDevice.status Index: sources/storage/FileHandler.cpp =================================================================== diff -u -r80b5e8f1ebb90c03c37d90d90cd2da3bd95d6803 -r4fc7cdc599de191e91296623ec783542b7a3c7b8 --- sources/storage/FileHandler.cpp (.../FileHandler.cpp) (revision 80b5e8f1ebb90c03c37d90d90cd2da3bd95d6803) +++ sources/storage/FileHandler.cpp (.../FileHandler.cpp) (revision 4fc7cdc599de191e91296623ec783542b7a3c7b8) @@ -319,6 +319,36 @@ } /*! + * \brief FileHandler::isDirSame + * \details Compare the two folder's content + * \param vDir1 - directory path 1 + * \param vDir2 - directory path 2 + * \return true if the two directories are the same, false otherwise + */ +bool FileHandler::isDirSame(const QString &vDir1, const QString &vDir2) +{ + // disabled coco begin validated: This needs user interaction to check the file system + // has been tested manually since currently it is the only place it has been used. + bool isSame = false; + QString cmd = "diff"; + QStringList arguments; + arguments << vDir1 << vDir2; + + QProcess diffProcess; + diffProcess.start(cmd, arguments); + + bool processCompleted = diffProcess.waitForFinished(); + if ( processCompleted ) + { + QString output = diffProcess.readAll(); + isSame = output.isEmpty(); // non empty indicate difference exists + //DEBUG: qDebug()<< output << output.isEmpty(); + } + + return isSame; +} + +/*! * \brief FileHandler::find * \details The function to find files. * It mainly been implemented to find the files are using some amount of total storage in the vPath by percentage, Index: sources/storage/FileHandler.h =================================================================== diff -u -r80b5e8f1ebb90c03c37d90d90cd2da3bd95d6803 -r4fc7cdc599de191e91296623ec783542b7a3c7b8 --- sources/storage/FileHandler.h (.../FileHandler.h) (revision 80b5e8f1ebb90c03c37d90d90cd2da3bd95d6803) +++ sources/storage/FileHandler.h (.../FileHandler.h) (revision 4fc7cdc599de191e91296623ec783542b7a3c7b8) @@ -71,6 +71,7 @@ static bool isMounted (const QString &vPath, bool *vIsReadOnly = nullptr); static bool tmpUsable (); + static bool isDirSame (const QString &vDir1, const QString &vDir2); static QFileInfoList find(const QString &vPath, QStringList vNameFilters, quint8 vRetainPercent); static QFileInfoList find(const QString &vPath, QStringList vNameFilters); Index: sources/storage/Settings.cpp =================================================================== diff -u -rec31f94081864aec8b48a3cfa1e0aea80619714c -r4fc7cdc599de191e91296623ec783542b7a3c7b8 --- sources/storage/Settings.cpp (.../Settings.cpp) (revision ec31f94081864aec8b48a3cfa1e0aea80619714c) +++ sources/storage/Settings.cpp (.../Settings.cpp) (revision 4fc7cdc599de191e91296623ec783542b7a3c7b8) @@ -254,6 +254,7 @@ QString sub = src + dir; 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 ::isDirSame (sub, dst+dir)) { err = Settings_Error::eError_POST ; msg = errorMessage(err, dir); LOG_DEBUG(msg+"_cmp"); goto lOut;} } if ( FileHandler ::removeFolder (sub )) { err = Settings_Error::eError_POST ; msg = errorMessage(err, dir); LOG_DEBUG(msg); goto lOut; } }