mirror of
https://github.com/RROrg/rr.git
synced 2025-06-21 05:51:05 +08:00
更新重启到 BIOS 为 UEFI,优化获取型号和版本的错误处理逻辑
This commit is contained in:
parent
4119344e60
commit
9c636e8390
@ -145,7 +145,8 @@ def getmodels(platforms=None):
|
||||
models.sort(key=lambda k: (k["arch"], k["name"]))
|
||||
|
||||
except Exception as e:
|
||||
click.echo(f"Error: {e}")
|
||||
# click.echo(f"Error: {e}")
|
||||
pass
|
||||
|
||||
print(json.dumps(models, indent=4))
|
||||
|
||||
@ -190,7 +191,8 @@ def getmodelsbykb(platforms=None):
|
||||
continue
|
||||
models.append({"name": d[0].split("<br")[0], "arch": d[5].lower()})
|
||||
except Exception as e:
|
||||
click.echo(f"Error: {e}")
|
||||
# click.echo(f"Error: {e}")
|
||||
pass
|
||||
|
||||
models.sort(key=lambda x: (x["arch"], x["name"]))
|
||||
print(json.dumps(models, indent=4))
|
||||
@ -272,7 +274,8 @@ def getpats4mv(model, version):
|
||||
'sum': S['files'][0]['checksum']
|
||||
}
|
||||
except Exception as e:
|
||||
click.echo(f"Error: {e}")
|
||||
# click.echo(f"Error: {e}")
|
||||
pass
|
||||
|
||||
pats = {k: pats[k] for k in sorted(pats.keys(), reverse=True)}
|
||||
print(json.dumps(pats, indent=4))
|
||||
@ -321,7 +324,8 @@ def getpats(models=None):
|
||||
pats[model] = {}
|
||||
pats[model][__fullversion(ver)] = item.attrs['href']
|
||||
except Exception as e:
|
||||
click.echo(f"Error: {e}")
|
||||
# click.echo(f"Error: {e}")
|
||||
pass
|
||||
|
||||
print(json.dumps(pats, indent=4))
|
||||
|
||||
|
@ -397,7 +397,7 @@ function checkBIOS_VT_d() {
|
||||
# Rebooting
|
||||
# 1 - mode
|
||||
function rebootTo() {
|
||||
local MODES="config recovery junior bios memtest"
|
||||
local MODES="config recovery junior uefi memtest"
|
||||
if [ -z "${1}" ] || ! echo "${MODES}" | grep -wq "${1}"; then exit 1; fi
|
||||
# echo "Rebooting to ${1} mode"
|
||||
GRUBPATH="$(dirname "$(find "${PART1_PATH}/" -name grub.cfg 2>/dev/null | head -1)")"
|
||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -126,7 +126,7 @@ function modelMenu() {
|
||||
PS="$(readConfigEntriesArray "platforms" "${WORK_PATH}/platforms.yml" | sort)"
|
||||
MJ="$(python3 ${WORK_PATH}/include/functions.py getmodels -p "${PS[*]}")"
|
||||
|
||||
if [ "${MJ:-[]}" = "[]" ]; then
|
||||
if [ "${MJ:-"[]"}" = "[]" ]; then
|
||||
DIALOG --title "$(TEXT "Model")" \
|
||||
--msgbox "$(TEXT "Unable to connect to Synology website, Please check the network and try again, or use 'Parse Pat'!")" 0 0
|
||||
return 1
|
||||
@ -257,7 +257,7 @@ function productversMenu() {
|
||||
--infobox "$(TEXT "Get pat data ...")" 0 0
|
||||
fi
|
||||
PJ="$(python3 ${WORK_PATH}/include/functions.py getpats4mv -m "${MODEL}" -v "${selver}")"
|
||||
if [ "${PJ:-{}}" = "{}" ]; then
|
||||
if [ "${PJ:-"{}"}" = "{}" ]; then
|
||||
if [ -z "${1}" ]; then
|
||||
MSG="$(TEXT "Unable to connect to Synology website, Please check the network and try again, or use 'Parse Pat'!")"
|
||||
DIALOG --title "$(TEXT "Addons")" \
|
||||
@ -4125,9 +4125,9 @@ else
|
||||
echo "x \"$(TEXT "Reboot to RR")\""
|
||||
echo "y \"$(TEXT "Reboot to Recovery")\""
|
||||
echo "z \"$(TEXT "Reboot to Junior")\""
|
||||
#if efibootmgr | grep -q "^Boot0000"; then
|
||||
echo "b \"$(TEXT "Reboot to BIOS")\""
|
||||
#fi
|
||||
if [ -d "/sys/firmware/efi" ]; then
|
||||
echo "b \"$(TEXT "Reboot to UEFI")\""
|
||||
fi
|
||||
echo "s \"$(TEXT "Back to shell")\""
|
||||
echo "e \"$(TEXT "Exit")\""
|
||||
} >"${TMP_PATH}/menu"
|
||||
@ -4168,10 +4168,8 @@ else
|
||||
;;
|
||||
b)
|
||||
DIALOG --title "$(TEXT "Main menu")" \
|
||||
--infobox "$(TEXT "Reboot to BIOS")" 0 0
|
||||
#efibootmgr -n 0000 >/dev/null 2>&1
|
||||
#reboot
|
||||
rebootTo bios
|
||||
--infobox "$(TEXT "Reboot to UEFI")" 0 0
|
||||
rebootTo uefi
|
||||
exit 0
|
||||
;;
|
||||
s)
|
||||
|
Loading…
x
Reference in New Issue
Block a user