Merge branch 'master' of gitlab2.kylin.com:kylinos-src/kylin-backup-tools/kylin-backup-tools

This commit is contained in:
赵民勇 2022-10-08 13:59:50 +08:00
commit 146b8a5695
2 changed files with 55 additions and 23 deletions

View File

@ -594,17 +594,17 @@ generateExcludeFile() {
#echo "/data/*" >>$EXCLUDEFILE #用户可以把数据放到该分区或者目录 #echo "/data/*" >>$EXCLUDEFILE #用户可以把数据放到该分区或者目录
#是否覆盖备份还原工具自身因为grub备份还原使用的工具是initrd.img里面的东西故不存在时可以还原备份还原工具本身(例如工具被删除的场景) #是否覆盖备份还原工具自身因为grub备份还原使用的工具是initrd.img里面的东西故不存在时可以还原备份还原工具本身(例如工具被删除的场景)
if [ $backupOrRestore -eq 1 ]; then #if [ $backupOrRestore -eq 1 ]; then
bFileExists "/usr/bin/backup-daemon" # bFileExists "/usr/bin/backup-daemon"
bFileExists "/usr/bin/kybackup" # bFileExists "/usr/bin/kybackup"
bFileExists "/usr/bin/backup-auto" # bFileExists "/usr/bin/backup-auto"
bFileExists "/usr/bin/mount_fstab_efi" # bFileExists "/usr/bin/mount_fstab_efi"
bFileExists "/usr/bin/backup-auto-efi" # bFileExists "/usr/bin/backup-auto-efi"
bFileExists "/usr/bin/rsync" # bFileExists "/usr/bin/rsync"
bFileExists "/usr/share/rsync" # bFileExists "/usr/share/rsync"
bFileExists "/usr/share/initramfs-tools/hooks/kybackup-hooks" # bFileExists "/usr/share/initramfs-tools/hooks/kybackup-hooks"
bFileExists "/usr/share/initramfs-tools/scripts/local-bottom/kybackup" # bFileExists "/usr/share/initramfs-tools/scripts/local-bottom/kybackup"
fi #fi
# 安全模块会将文件/usr/share/kysec-utils/data/readonly_list中的文件列表限制只读无法修改、备份包含扩展属性时、删除等 # 安全模块会将文件/usr/share/kysec-utils/data/readonly_list中的文件列表限制只读无法修改、备份包含扩展属性时、删除等
# 现在里面仅有/etc/uid_list先暂时排除掉等后续安全模块有其它保护方案后再进一步修改 # 现在里面仅有/etc/uid_list先暂时排除掉等后续安全模块有其它保护方案后再进一步修改
@ -1050,7 +1050,7 @@ restoreAuto() { #还原
fi fi
#0:backup 1:restore #0:backup 1:restore
generateExcludeFile 1 #generateExcludeFile 1
echo "Begin to restore efi directory..." >>$PLOGFILE echo "Begin to restore efi directory..." >>$PLOGFILE
echo "Begin to restore efi directory..." echo "Begin to restore efi directory..."
#额外排除目录或文件 #额外排除目录或文件
@ -1076,13 +1076,27 @@ restoreAuto() { #还原
#保留用户数据还原 #保留用户数据还原
if [[ x${m_isRetainUserData} = x"true" ]]; then if [[ x${m_isRetainUserData} = x"true" ]]; then
# 用户数据目录或文件 # 用户数据目录或文件
bFileExists "/var/lib/biometric-auth" if [ -e "${rootpath}/var/lib/biometric-auth" ]; then
bFileExists "/data/sec_storage_data" excludes="${excludes} --exclude=/var/lib/biometric-auth"
bFileExists "/etc/passwd" fi
bFileExists "/etc/shadow" if [ -e "${rootpath}/data/sec_storage_data" ]; then
bFileExists "/etc/group" excludes="${excludes} --exclude=/data/sec_storage_data"
bFileExists "/etc/gshadow" fi
bFileExists "/etc/sudoers" if [ -e "${rootpath}/etc/passwd" ]; then
excludes="${excludes} --exclude=/etc/passwd"
fi
if [ -e "${rootpath}/etc/shadow" ]; then
excludes="${excludes} --exclude=/etc/shadow"
fi
if [ -e "${rootpath}/etc/group" ]; then
excludes="${excludes} --exclude=/etc/group"
fi
if [ -e "${rootpath}/etc/gshadow" ]; then
excludes="${excludes} --exclude=/etc/gshadow"
fi
if [ -e "${rootpath}/etc/sudoers" ]; then
excludes="${excludes} --exclude=/etc/sudoers"
fi
excludes="${excludes} --exclude=/home --exclude=/root --exclude=/data/home --exclude=/data/root --exclude=/var/lib/AccountsService" excludes="${excludes} --exclude=/home --exclude=/root --exclude=/data/home --exclude=/data/root --exclude=/var/lib/AccountsService"
#如果是990排除/data否则排除/data/usershare #如果是990排除/data否则排除/data/usershare
@ -1093,10 +1107,18 @@ restoreAuto() { #还原
fi fi
#如果是出厂备份的还原,还需要保留语言和时区配置 #如果是出厂备份的还原,还需要保留语言和时区配置
if [[ ${uuid} = "{${factory_uuid}}" && x${is_990_9a0} != x"true" ]]; then if [[ ${uuid} = "{${factory_uuid}}" && x${is_990_9a0} != x"true" ]]; then
bFileExists "/etc/localtime" if [ -e "${rootpath}/etc/localtime" ]; then
bFileExists "/usr/share/zoneinfo" excludes="${excludes} --exclude=/etc/localtime"
bFileExists "/etc/default/locale" fi
bFileExists "/usr/share/i18n" if [ -e "${rootpath}/usr/share/zoneinfo" ]; then
excludes="${excludes} --exclude=/usr/share/zoneinfo"
fi
if [ -e "${rootpath}/etc/default/locale" ]; then
excludes="${excludes} --exclude=/etc/default/locale"
fi
if [ -e "${rootpath}/usr/share/i18n" ]; then
excludes="${excludes} --exclude=/usr/share/i18n"
fi
fi fi
fi fi
# 兼容以前的老备份数据,后面可以尝试去掉此条件的逻辑 # 兼容以前的老备份数据,后面可以尝试去掉此条件的逻辑

10
debian/changelog vendored
View File

@ -1,3 +1,13 @@
yhkylin-backup-tools (4.1.0.0-0k14) v101; urgency=medium
* BUG 号138686 【KVE-2022-0805】银河麒麟桌面操作系统V10_com.kylin.backup Dbus服务删除任意文件夹
* 需求号: 无
* 需求号:无
* 其它改动: 无
* git commitddb38750f603a1f15d910f95cb4be8753b4b5723
-- zhaominyong <zhaominyong@kylinos.cn> Thu, 29 Sep 2022 16:22:45 +0800
yhkylin-backup-tools (4.1.0.0-0k13.2) v101; urgency=medium yhkylin-backup-tools (4.1.0.0-0k13.2) v101; urgency=medium
* BUG 号:无 * BUG 号:无