147597 【grub还原】使用grub还原未恢复到出厂状态
This commit is contained in:
parent
7ee996d3c4
commit
4510c70e65
|
@ -263,6 +263,7 @@ QStringList CustomizeSystemRestoreProxy::getRsyncArgs(CustomizeSystemRestoreScen
|
||||||
args << "--exclude=/usr/share/rsync";
|
args << "--exclude=/usr/share/rsync";
|
||||||
args << "--exclude=/usr/share/initramfs-tools/hooks/kybackup-hooks";
|
args << "--exclude=/usr/share/initramfs-tools/hooks/kybackup-hooks";
|
||||||
args << "--exclude=/usr/share/initramfs-tools/scripts/local-bottom/kybackup";
|
args << "--exclude=/usr/share/initramfs-tools/scripts/local-bottom/kybackup";
|
||||||
|
args << "--exclude=/data/security-dir";
|
||||||
|
|
||||||
for (const QString& item : excludes) {
|
for (const QString& item : excludes) {
|
||||||
args << QString("--exclude=") + item;
|
args << QString("--exclude=") + item;
|
||||||
|
|
|
@ -545,6 +545,7 @@ generateExcludeFile() {
|
||||||
echo "/swap_file" >>$EXCLUDEFILE
|
echo "/swap_file" >>$EXCLUDEFILE
|
||||||
echo "/var/lib/docker/overlay2" >>$EXCLUDEFILE
|
echo "/var/lib/docker/overlay2" >>$EXCLUDEFILE
|
||||||
echo "/var/log" >>$EXCLUDEFILE
|
echo "/var/log" >>$EXCLUDEFILE
|
||||||
|
echo "/data/security-dir" >>$EXCLUDEFILE
|
||||||
|
|
||||||
#bind挂载的目录不进行备份或还原
|
#bind挂载的目录不进行备份或还原
|
||||||
cat ${rootpath}/etc/fstab | awk '{if($4~/bind/) print $1}' |
|
cat ${rootpath}/etc/fstab | awk '{if($4~/bind/) print $1}' |
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
#backup-auto --autobackup ${rootpath} /backup
|
#backup-auto --autobackup ${rootpath} /backup
|
||||||
#backup-auto --autorestore ${rootpath} /backup
|
#backup-auto --autorestore ${rootpath} /backup
|
||||||
|
|
||||||
|
echo $*
|
||||||
#xgs备份还原要保留更多的文件或目录:
|
#xgs备份还原要保留更多的文件或目录:
|
||||||
#kybackup/maindialog.cpp, backup-daemon/mountpoint.cpp, backup-daemon/data/backup-auto-efi
|
#kybackup/maindialog.cpp, backup-daemon/mountpoint.cpp, backup-daemon/data/backup-auto-efi
|
||||||
XGS=false
|
XGS=false
|
||||||
|
@ -566,6 +567,7 @@ generateExcludeFile() {
|
||||||
echo "/var/lib/docker/overlay2" >>$EXCLUDEFILE
|
echo "/var/lib/docker/overlay2" >>$EXCLUDEFILE
|
||||||
echo "*/backup/snapshots" >>$EXCLUDEFILE
|
echo "*/backup/snapshots" >>$EXCLUDEFILE
|
||||||
echo "/var/log" >>$EXCLUDEFILE
|
echo "/var/log" >>$EXCLUDEFILE
|
||||||
|
echo "/data/security-dir" >>$EXCLUDEFILE
|
||||||
|
|
||||||
#bind挂载的目录不进行备份或还原
|
#bind挂载的目录不进行备份或还原
|
||||||
if [ -z $fstab_path ]; then
|
if [ -z $fstab_path ]; then
|
||||||
|
@ -1075,6 +1077,7 @@ restoreAuto() { #还原
|
||||||
echo "Begin to restore other directories..." >>$PLOGFILE
|
echo "Begin to restore other directories..." >>$PLOGFILE
|
||||||
#保留用户数据还原
|
#保留用户数据还原
|
||||||
if [[ x${m_isRetainUserData} = x"true" ]]; then
|
if [[ x${m_isRetainUserData} = x"true" ]]; then
|
||||||
|
echo "保留用户数据还原" >> ${rootpath}/var/log/backup.log
|
||||||
# 用户数据目录或文件
|
# 用户数据目录或文件
|
||||||
if [ -e "${rootpath}/var/lib/biometric-auth" ]; then
|
if [ -e "${rootpath}/var/lib/biometric-auth" ]; then
|
||||||
excludes="${excludes} --exclude=/var/lib/biometric-auth"
|
excludes="${excludes} --exclude=/var/lib/biometric-auth"
|
||||||
|
@ -1135,6 +1138,7 @@ restoreAuto() { #还原
|
||||||
fi
|
fi
|
||||||
excludes="${excludes} --exclude=/var/log"
|
excludes="${excludes} --exclude=/var/log"
|
||||||
excludes="${excludes} --exclude=*/backup/snapshots"
|
excludes="${excludes} --exclude=*/backup/snapshots"
|
||||||
|
excludes="${excludes} --exclude=/data/security-dir"
|
||||||
#yi jian huan yuan
|
#yi jian huan yuan
|
||||||
if [ ! -e "${restoreDir}/data/data" ]; then
|
if [ ! -e "${restoreDir}/data/data" ]; then
|
||||||
#这两行要一致
|
#这两行要一致
|
||||||
|
@ -1188,6 +1192,8 @@ fi
|
||||||
|
|
||||||
mkdir -p ${rootpath}/var/log
|
mkdir -p ${rootpath}/var/log
|
||||||
|
|
||||||
|
echo "参数:" $* >> ${rootpath}/var/log/backup.log
|
||||||
|
echo "m_isRetainUserData=" $m_isRetainUserData >> ${rootpath}/var/log/backup.log
|
||||||
if [ $backupORrestore = "--autobackup" ]; then
|
if [ $backupORrestore = "--autobackup" ]; then
|
||||||
mountBackup
|
mountBackup
|
||||||
mount >>$PLOGFILE
|
mount >>$PLOGFILE
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
|
echo $*
|
||||||
BACKUP_FLAG=backup
|
BACKUP_FLAG=backup
|
||||||
RESTORE_FLAG=restore
|
RESTORE_FLAG=restore
|
||||||
ROLLBACK_FLAG=rollback-backup
|
ROLLBACK_FLAG=rollback-backup
|
||||||
|
|
|
@ -278,6 +278,7 @@ QStringList SystemRestoreProxy::getRsyncArgs(SystemRestoreScene scene)
|
||||||
args << "--exclude=/usr/share/rsync";
|
args << "--exclude=/usr/share/rsync";
|
||||||
args << "--exclude=/usr/share/initramfs-tools/hooks/kybackup-hooks";
|
args << "--exclude=/usr/share/initramfs-tools/hooks/kybackup-hooks";
|
||||||
args << "--exclude=/usr/share/initramfs-tools/scripts/local-bottom/kybackup";
|
args << "--exclude=/usr/share/initramfs-tools/scripts/local-bottom/kybackup";
|
||||||
|
args << "--exclude=/data/security-dir";
|
||||||
|
|
||||||
// 以前的出厂备份和grub备份没有备份/data,还原时需要判断/data是否存在,如不存在需要屏蔽掉,不然会将主机上的/data删除,造成问题
|
// 以前的出厂备份和grub备份没有备份/data,还原时需要判断/data是否存在,如不存在需要屏蔽掉,不然会将主机上的/data删除,造成问题
|
||||||
// 此为兼容以前备份的老数据而改,等以后老的备份估计不存在了可已去掉
|
// 此为兼容以前备份的老数据而改,等以后老的备份估计不存在了可已去掉
|
||||||
|
|
|
@ -281,6 +281,7 @@ QStringList UDiskSystemRestoreProxy::getRsyncArgs(SystemRestoreScene scene)
|
||||||
args << "--exclude=/usr/share/rsync";
|
args << "--exclude=/usr/share/rsync";
|
||||||
args << "--exclude=/usr/share/initramfs-tools/hooks/kybackup-hooks";
|
args << "--exclude=/usr/share/initramfs-tools/hooks/kybackup-hooks";
|
||||||
args << "--exclude=/usr/share/initramfs-tools/scripts/local-bottom/kybackup";
|
args << "--exclude=/usr/share/initramfs-tools/scripts/local-bottom/kybackup";
|
||||||
|
args << "--exclude=/data/security-dir";
|
||||||
|
|
||||||
// 以前的出厂备份和grub备份没有备份/data,还原时需要判断/data是否存在,如不存在需要屏蔽掉,不然会将主机上的/data删除,造成问题
|
// 以前的出厂备份和grub备份没有备份/data,还原时需要判断/data是否存在,如不存在需要屏蔽掉,不然会将主机上的/data删除,造成问题
|
||||||
// 此为兼容以前备份的老数据而改,等以后老的备份估计不存在了可已去掉
|
// 此为兼容以前备份的老数据而改,等以后老的备份估计不存在了可已去掉
|
||||||
|
|
|
@ -486,6 +486,10 @@ bool Utils::generateExcludePathsFile()
|
||||||
in << "/var/lib/udisks2" << END_LINE;
|
in << "/var/lib/udisks2" << END_LINE;
|
||||||
in << "/var/log" << END_LINE;
|
in << "/var/log" << END_LINE;
|
||||||
in << "*/backup/snapshots" << END_LINE;
|
in << "*/backup/snapshots" << END_LINE;
|
||||||
|
// 跟wps的研发沟通了,安全目录的使用场景,主要是两个场景:
|
||||||
|
// 1、在用户浏览信创加密文档时,解密出来的临时明文文件会放在安全目录,关闭文档后,临时文件被删除。
|
||||||
|
// 2、用户离线授权的某个加密文档的解密私钥也会放在安全目录中。因此跟他讨论,从安全角度来看,最好不要备份还原这个目录。
|
||||||
|
in << "/data/security-dir" << END_LINE;
|
||||||
|
|
||||||
// 系统安装后有的会将/data/home /data/root挂载到的/home /root上,实际文件是存放在/data/home /data/root下面,为了统一标准保留/home /root排除/data/home /data/root
|
// 系统安装后有的会将/data/home /data/root挂载到的/home /root上,实际文件是存放在/data/home /data/root下面,为了统一标准保留/home /root排除/data/home /data/root
|
||||||
QStringList excludes;
|
QStringList excludes;
|
||||||
|
@ -543,6 +547,10 @@ QStringList Utils::getFromExcludePathsFile()
|
||||||
list << "/var/lib/udisks2";
|
list << "/var/lib/udisks2";
|
||||||
list << "/var/log";
|
list << "/var/log";
|
||||||
list << "*/backup/snapshots";
|
list << "*/backup/snapshots";
|
||||||
|
// 跟wps的研发沟通了,安全目录的使用场景,主要是两个场景:
|
||||||
|
// 1、在用户浏览信创加密文档时,解密出来的临时明文文件会放在安全目录,关闭文档后,临时文件被删除。
|
||||||
|
// 2、用户离线授权的某个加密文档的解密私钥也会放在安全目录中。因此跟他讨论,从安全角度来看,最好不要备份还原这个目录。
|
||||||
|
list << "/data/security-dir";
|
||||||
|
|
||||||
// 系统安装后有的会将/data/home /data/root挂载到的/home /root上,实际文件是存放在/data/home /data/root下面
|
// 系统安装后有的会将/data/home /data/root挂载到的/home /root上,实际文件是存放在/data/home /data/root下面
|
||||||
QStringList excludes;
|
QStringList excludes;
|
||||||
|
|
Loading…
Reference in New Issue