diff --git a/backup-daemon/data/backup-auto-efi b/backup-daemon/data/backup-auto-efi index 9416104..964d924 100755 --- a/backup-daemon/data/backup-auto-efi +++ b/backup-daemon/data/backup-auto-efi @@ -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 diff --git a/backup-daemon/data/initramfs-tools/scripts/local-bottom/kybackup b/backup-daemon/data/initramfs-tools/scripts/local-bottom/kybackup index 5672ed0..d7cc9c5 100755 --- a/backup-daemon/data/initramfs-tools/scripts/local-bottom/kybackup +++ b/backup-daemon/data/initramfs-tools/scripts/local-bottom/kybackup @@ -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备份操作 diff --git a/backup-daemon/systemrestoreproxy.cpp b/backup-daemon/systemrestoreproxy.cpp index e395272..4836ecd 100755 --- a/backup-daemon/systemrestoreproxy.cpp +++ b/backup-daemon/systemrestoreproxy.cpp @@ -430,7 +430,7 @@ void SystemRestoreProxy::restoreSystem() line += m_curUuid; Utils::syncWriteFile(fileIfSync, line); ::sync(); - Utils::wait(5); + // Utils::wait(5); } Utils::wait(5);