From 1781df38505531b5072c7b34c22d8207bac81ef7 Mon Sep 17 00:00:00 2001 From: zhaominyong Date: Fri, 29 Jul 2022 10:55:16 +0800 Subject: [PATCH] =?UTF-8?q?=E8=87=AA=E5=8A=A8=E5=A4=87=E4=BB=BD=E7=82=B9?= =?UTF-8?q?=E7=9A=84grub=E8=BF=98=E5=8E=9F=E8=AE=B0=E5=BD=95=E6=97=A5?= =?UTF-8?q?=E5=BF=97=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backup-daemon/data/backup-auto-efi | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/backup-daemon/data/backup-auto-efi b/backup-daemon/data/backup-auto-efi index 094e67a..f044612 100755 --- a/backup-daemon/data/backup-auto-efi +++ b/backup-daemon/data/backup-auto-efi @@ -961,6 +961,7 @@ getLastUsefulBackupPointUuid() { currentType=true lastUsefulBackupPointUuid="" foundComment=0 #是否发现了要修改的comment + lastbackupname="" #如果不定义IFS,则echo $line会去掉前后空格,导致写到文件中去时没有格式 IFS_old=$IFS @@ -969,6 +970,10 @@ getLastUsefulBackupPointUuid() { #去除了前后空格 xxx=$(echo "$line" | sed "s/^[ \t]*//g" | sed "s/[ \t]*$//g") #echo "xxx: $xxx" + + if [[ "$xxx" =~ "" ]]; then + lastbackupname=$xxx + fi if [[ "$xxx" =~ "" ]]; then currentUuid=$xxx @@ -1009,6 +1014,8 @@ getLastUsefulBackupPointUuid() { lastUsefulBackupPointUuid=$(echo $lastUsefulBackupPointUuid | sed 's:::' | tr -d "\n") lastUsefulBackupPointUuid=$(echo $lastUsefulBackupPointUuid | sed 's:.*::' | tr -d "\n") #echo "lastUsefulBackupPointUuid=$lastUsefulBackupPointUuid" + lastbackupname=$(echo $lastbackupname | sed 's:::' | tr -d "\n") + lastbackupname=$(echo $lastbackupname | sed 's:.*::' | tr -d "\n") } #see backup-auto/autobackup.cpp @@ -1029,7 +1036,7 @@ restoreAuto() { #还原 fi #写日志文件 local m_time=$(date "+%y-%m-%d %H:%M:%S" | tr -d "\n") - writeLogFile "${m_time},${uuid},4,grub系统还原" #grub时只有一键还原,没有增量还原 + writeLogFile "${m_time},${uuid},4,grub系统还原,,,${lastbackupname}" #grub时只有一键还原,没有增量还原 restoreDir="${m_mountPath}${BACKUP}/snapshots/$uuid"