From f4366ecb7dc243b1669e9e1b9fbb7d4e65793d06 Mon Sep 17 00:00:00 2001 From: zhaominyong Date: Mon, 21 Feb 2022 17:43:19 +0800 Subject: [PATCH] =?UTF-8?q?hw9a0=E5=87=BA=E5=8E=82=E8=BF=98=E5=8E=9F?= =?UTF-8?q?=E6=97=B6=E5=A4=9A=E5=8A=A02=E5=B1=82=E6=8F=90=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../scripts/local-bottom/kybackup | 63 +++++++++++++++++++ 1 file changed, 63 insertions(+) diff --git a/backup-daemon/data/initramfs-tools/scripts/local-bottom/kybackup b/backup-daemon/data/initramfs-tools/scripts/local-bottom/kybackup index d10c91f..597864c 100755 --- a/backup-daemon/data/initramfs-tools/scripts/local-bottom/kybackup +++ b/backup-daemon/data/initramfs-tools/scripts/local-bottom/kybackup @@ -115,6 +115,65 @@ loop_wait() #done } +get_is_990_9a0() { + local ret=false + # 匹配 kirin 990 5g, kirin990, kirin 9006c + if egrep -qi 'kirin.?9[09]0' /proc/cpuinfo; then + ret=true + elif egrep -qi 'PANGU' /proc/cpuinfo; then + ret=true + + fi + echo $ret +} +is_990_9a0=$(get_is_990_9a0) + +factory_restore_warnning() +{ + if [ x${is_990_9a0} == x"true" ]; then + local is_sure= + while : + do + if plymouth_is_running; then + myoutput "You are doing factory restoration. Are you sure to continue? [y/n]" "正在准备进行出厂还原操作,是否继续?[y/n]" + is_sure=$(/bin/plymouth watch-keystroke) + echo is_sure=$is_sure + case $is_sure in + y|Y) + break;; + n|N) + # 注意,reboot重启不了,可用reboot -f + reboot -f;; + *) ;; + esac + fi + done + fi +} + +factory_restore_warnning_again() +{ + if [ x${is_990_9a0} == x"true" ]; then + local is_sure= + while : + do + if plymouth_is_running; then + myoutput "Please confirm again whether to restore the system to factory defaults. Are you sure to continue? [y/n]" "请再一次确认是否进行系统出厂还原,是否继续?[y/n]" + is_sure=$(/bin/plymouth watch-keystroke) + echo is_sure=$is_sure + case $is_sure in + y|Y) + break;; + n|N) + # 注意,reboot重启不了,可用reboot -f + reboot -f;; + *) ;; + esac + fi + done + fi +} + restore_warnning() { local is_sure= @@ -328,7 +387,9 @@ if [ "$NEED_BACKUP" = "y" ]; then fi if [ "$NEED_RESTORE" = "y" ]; then + factory_restore_warnning restore_warnning + factory_restore_warnning_again #如果没有${rootmnt}/etc/fstab,则系统坏了,应该能还原,但需要在下一个版本中支持。 if [ ! -e ${rootmnt}/etc/fstab ]; then if [ ! -e /etc/fstab-backup ]; then @@ -396,7 +457,9 @@ fi if [ "$NEED_ROLLBACK" = "y" ]; then + factory_restore_warnning restore_warnning + factory_restore_warnning_again #如果没有${rootmnt}/etc/fstab,则系统坏了,应该能还原,但需要在下一个版本中支持。 if [ ! -e ${rootmnt}/etc/fstab ]; then if [ ! -e /etc/fstab-backup ]; then