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