还原工具本身

This commit is contained in:
赵民勇 2023-03-08 15:43:29 +08:00
parent 8fc597cea2
commit f051e1c46d
3 changed files with 24 additions and 3 deletions

View File

@ -7,8 +7,6 @@
#backup-auto --autorestore ${rootpath} /backup
echo $*
# 临时关闭安全,因为有些文件安全保护为只读,造成备份还原无法操作
echo 0 > /sys/kernel/security/kysec/fpro
#xgs备份还原要保留更多的文件或目录:
#kybackup/maindialog.cpp, backup-daemon/mountpoint.cpp, backup-daemon/data/backup-auto-efi
@ -1202,6 +1200,12 @@ mkdir -p ${rootpath}/var/log
echo "参数:" $* >> ${rootpath}/var/log/backup.log
echo "m_isRetainUserData=" $m_isRetainUserData >> ${rootpath}/var/log/backup.log
# 临时关闭安全,因为有些文件安全保护为只读,造成备份还原无法操作
file_protect=$(cat /sys/kernel/security/kysec/fpro)
echo "文件保护状态:"${file_protect} >> ${rootpath}/var/log/backup.log
echo 0 > /sys/kernel/security/kysec/fpro
if [ $backupORrestore = "--autobackup" ]; then
mountBackup
mount >>$PLOGFILE
@ -1244,4 +1248,5 @@ fi
sync
echo ${file_protect} > /sys/kernel/security/kysec/fpro
exit 0

View File

@ -517,6 +517,22 @@ if [ "$NEED_ROLLBACK" = "y" ]; then
reboot -f
fi
if [ "${IS_NORMAL}" == "y" ]; then
if [ -e ${rootmnt}/etc/file_if_sync ]; then
uuid=$(awk -F: '{ if ($1=="rsync_backup_self") print $2}' ${rootmnt}/etc/file_if_sync)
echo "uuid="${uuid}";"
#if [[ ${uuid} =~ ^{[0-9A-Za-z-]*}$ ]]; then
if [ "x"${uuid} != "x" ]; then
mkdir /backup
backup-auto-efi --restorebackupself ${rootmnt} /backup ${uuid}
fi
#echo "sync" > ${rootmnt}/etc/file_if_sync
rm -f ${rootmnt}/etc/file_if_sync
sync
# sleep 3
fi
fi
# 否则
# TODO 执行mount_fstab_efi ${rootmnt} mount备份操作

View File

@ -430,7 +430,7 @@ void SystemRestoreProxy::restoreSystem()
line += m_curUuid;
Utils::syncWriteFile(fileIfSync, line);
::sync();
Utils::wait(5);
// Utils::wait(5);
}
Utils::wait(5);