140066 【备份还原】还原系统后无法创建同名用户
This commit is contained in:
parent
b96d705d96
commit
76137966f5
|
@ -199,6 +199,13 @@ int MyBackupManager::goRestore(const BackupWrapper& backupWrapper)
|
|||
connect(worker, &Worker::progress, this, [&](int rate) {
|
||||
emit this->progress(int(BackupState::WORKING), rate);
|
||||
});
|
||||
connect(worker, &Worker::otherSignal, this, [&](int type) {
|
||||
// 结束ukui-session-tools的锁定,以便后面的用户登出操作
|
||||
if (Worker::OtherSignal::UKUI_SESSION_LOCK_END == type) {
|
||||
this->uninhibit();
|
||||
emit this->sendRestoreResult(true);
|
||||
}
|
||||
});
|
||||
connect(worker, &Worker::workResult, this, [&] (bool result) {
|
||||
emit this->sendRestoreResult(result);
|
||||
this->finished();
|
||||
|
|
|
@ -96,6 +96,7 @@ void RsyncPathToDirProcess::rsync_finished(int exitCode, QProcess::ExitStatus)
|
|||
emit finished(true);
|
||||
} else {
|
||||
qDebug() << "RsyncPathToDirProcess::rsync_finished unblock mode";
|
||||
emit progress(100);
|
||||
m_syncProcess->start("sync");
|
||||
if (!m_syncProcess->waitForStarted()) {
|
||||
qDebug() << "sync start failed";
|
||||
|
|
|
@ -119,6 +119,7 @@ bool SystemRestoreProxy::restoreEfi()
|
|||
if (!Utils::isDirEmpty(efiPath)) {
|
||||
// 1、修复源数据
|
||||
repairEfi();
|
||||
sync();
|
||||
|
||||
// 2、重新rw读写挂载
|
||||
remountEfi();
|
||||
|
@ -371,18 +372,27 @@ void SystemRestoreProxy::restoreSystem()
|
|||
break;
|
||||
}
|
||||
if (FACTORY_BACKUP_UUID == m_curUuid && m_backupWrapper.m_type == BackupType::RESTORE_SYSTEM) {
|
||||
emit this->otherSignal(UKUI_SESSION_LOCK_END);
|
||||
Utils::wait(5);
|
||||
|
||||
// 出厂还原有的机器上删除/home/xxx有残留,故在此再强制删除一下,sudo rm -rf命令一遍还删除不了(报错:无法删除/home/xx/.config:目录非空,应该是删除后又自动生成了),多删除几次还不是非常干净,^_^
|
||||
removeHome(QString(Utils::getSysRootPath() + "/home").replace("//", "/"));
|
||||
removeHome(QString(Utils::getSysRootPath() + "/data/home").replace("//", "/"));
|
||||
}
|
||||
QProcess::execute("sync");
|
||||
Utils::wait(5);
|
||||
|
||||
emit this->workResult(result);
|
||||
Utils::wait(2);
|
||||
QProcess::execute("sync");
|
||||
Utils::wait(2);
|
||||
emit this->workResult(result);
|
||||
} else {
|
||||
QProcess::execute("sync");
|
||||
Utils::wait(5);
|
||||
emit this->workResult(result);
|
||||
Utils::wait(3);
|
||||
}
|
||||
|
||||
reboot(RB_AUTOBOOT);
|
||||
} else {
|
||||
emit this->workResult(result);
|
||||
}
|
||||
emit this->workResult(result);
|
||||
});
|
||||
|
||||
m_p->start(args, false);
|
||||
|
|
|
@ -11,6 +11,10 @@
|
|||
class Worker : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
enum OtherSignal{
|
||||
UKUI_SESSION_LOCK_END,
|
||||
};
|
||||
public:
|
||||
explicit Worker();
|
||||
virtual ~Worker();
|
||||
|
@ -24,6 +28,8 @@ signals:
|
|||
void workResult(bool result);
|
||||
// 任务取消
|
||||
void cancel();
|
||||
// 其它信号
|
||||
void otherSignal(int type);
|
||||
|
||||
public slots:
|
||||
// 环境检测
|
||||
|
|
|
@ -478,7 +478,7 @@ bool Utils::generateExcludePathsFile()
|
|||
// 系统安装后有的会将/data/home /data/root挂载到的/home /root上,实际文件是存放在/data/home /data/root下面,为了统一标准保留/home /root排除/data/home /data/root
|
||||
QStringList excludes;
|
||||
Utils::excludeFstabBindPath(excludes);
|
||||
// Utils::excludeSomeHomePath(excludes);
|
||||
Utils::excludeSomeHomePath(excludes);
|
||||
Utils::excludeCustomizePath(excludes);
|
||||
for (const QString& item : excludes) {
|
||||
in << item << END_LINE;
|
||||
|
|
|
@ -963,6 +963,9 @@ void SystemRestore::initLastWidget()
|
|||
labelError2->setVisible(false);
|
||||
retry->setVisible(false);
|
||||
homePage->setVisible(false);
|
||||
|
||||
Utils::wait(2);
|
||||
QProcess::execute("ukui-session-tools --logout");
|
||||
} else {
|
||||
resultLogo->setThemeIconSchema("dialog-error", ":/symbos/dialog-error");
|
||||
resultLogo->setVisible(true);
|
||||
|
|
Loading…
Reference in New Issue