#include #include #include "mymountproxy.h" #include "../common/utils.h" MyMountProxy::MyMountProxy(QObject* parent) : QObject(parent) { m_processMount = new MountBackupProcess(this); } MountResult MyMountProxy::mountBackupPartition() { QString backupPartitionUuid = Utils::getBackupPartitionUuid(); if (backupPartitionUuid.isEmpty()) { qCritical("can't open /etc/.bootinfo or can't get RECOVERY_DEV_UUID"); return MountResult::CANNOT_GET_BACKUPUUID; } QString rootPath = Utils::getSysRootPath(); QString backPath = rootPath + BACKUP_PATH; backPath.replace("//", "/"); Utils::mkpath(backPath); bool res = m_processMount->Do(backupPartitionUuid); if (res) { QString snapshotsPath = rootPath + BACKUP_SNAPSHOTS_PATH; snapshotsPath.replace("//", "/"); Utils::mkpath(snapshotsPath); if (!Utils::generateExcludePathsFile()) { qCritical("mount success, but generate some important file failed!"); return MountResult::GENERATE_IMPORT_FILE_FAIL; } return MountResult::MOUNTED; } return MountResult::NO_MOUNTED; } bool MyMountProxy::umountBackupPartition() { return m_processMount->umountBackupPartition(); }