hw9a0出厂还原时多加2层提示

This commit is contained in:
zhaominyong 2022-02-21 17:43:19 +08:00
parent da8f318c1c
commit f4366ecb7d
1 changed files with 63 additions and 0 deletions

View File

@ -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