yhkylin-backup-tools/backup-daemon/customizesystemrestoreproxy.h

74 lines
1.7 KiB
C
Raw Normal View History

2022-11-01 10:40:05 +08:00
#ifndef CUSTOMIZESYSTEMRESTOREPROXY_H
#define CUSTOMIZESYSTEMRESTOREPROXY_H
#include "workerfactory.h"
#include "myprocess/rsyncpathtodirprocess.h"
#include "parsebackuplist.h"
class CustomizeSystemRestoreProxy : public Worker
{
Q_OBJECT
DECLARE_DYNCREATE(CustomizeSystemRestoreProxy)
public:
// 系统还原的几种场景
enum CustomizeSystemRestoreScene {
SYSTEM_RESTORE, // 系统还原
RESTORE_SYSTEM_WITH_DATA, // 保留用户数据还原
};
explicit CustomizeSystemRestoreProxy();
virtual ~CustomizeSystemRestoreProxy();
public:
// 环境检测
virtual bool checkEnvEx();
// 任务处理
virtual void doWorkEx();
private:
// 将img文件挂载到/backup/imgbackup目录
bool mountImg();
// 以读写方式重新挂载efi分区
void remountEfi();
// 以读写方式重新挂载boot分区
void remountBoot();
// 还原前准备
bool doPrepare();
// 系统还原
void restoreSystem();
/**
* @brief rsync命令参数
* @param scene
* @return rsync的参数信息
*/
QStringList getRsyncArgs(CustomizeSystemRestoreScene scene);
// .user.txt文件路径
QString m_userFile;
// .exclude.user.txt文件路径
QString m_excludeUserFile;
// 备份数据所在的data目录
QString m_backupPath;
// 压缩的img文件全名
QString m_imgFileName;
// 是否还原成功
bool m_bSuccess;
// 当前备份uuid
QString m_curUuid;
// 当前还原源目录
QString m_srcPath;
// 备份进程
RsyncPathToDirProcess *m_p;
// 当前备份节点
ParseBackupList::BackupPoint m_backupPoint;
};
#endif // CUSTOMIZESYSTEMRESTOREPROXY_H