From e2fec1c28f615557b81f8ed57b5d5b7492bc4164 Mon Sep 17 00:00:00 2001 From: Ing Date: Sat, 11 Jan 2025 15:31:58 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E8=AF=BB=E5=8F=96=E9=99=84?= =?UTF-8?q?=E5=8A=A0=E7=BB=84=E4=BB=B6=E5=8F=82=E6=95=B0=E7=9A=84=E5=8A=9F?= =?UTF-8?q?=E8=83=BD=EF=BC=8C=E4=BC=98=E5=8C=96=20NVMe=20=E6=A3=80?= =?UTF-8?q?=E6=B5=8B=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- files/initrd/opt/rr/include/addons.sh | 16 ++++++++++++++++ files/initrd/opt/rr/include/functions.sh | 2 +- files/initrd/opt/rr/menu.sh | 18 +++++++++++------- 3 files changed, 28 insertions(+), 8 deletions(-) diff --git a/files/initrd/opt/rr/include/addons.sh b/files/initrd/opt/rr/include/addons.sh index 5bae0ac0..5c0131a6 100755 --- a/files/initrd/opt/rr/include/addons.sh +++ b/files/initrd/opt/rr/include/addons.sh @@ -22,6 +22,22 @@ function availableAddons() { done <<<$(find "${ADDONS_PATH}" -maxdepth 1 -type d 2>/dev/null | sort) } +############################################################################### +# Read Addon Key +# 1 - Addon +# 2 - key +function readAddonKey() { + if [ -z "${1}" ] || [ -z "${2}" ]; then + echo "" + return 1 + fi + if [ ! -f "${ADDONS_PATH}/${1}/manifest.yml" ]; then + echo "" + return 1 + fi + readConfigKey "${2}" "${ADDONS_PATH}/${1}/manifest.yml" +} + ############################################################################### # Check if addon exist # 1 - Addon id diff --git a/files/initrd/opt/rr/include/functions.sh b/files/initrd/opt/rr/include/functions.sh index 23d65a6a..847a95cf 100755 --- a/files/initrd/opt/rr/include/functions.sh +++ b/files/initrd/opt/rr/include/functions.sh @@ -217,7 +217,7 @@ function _get_fastest() { done else for I in "$@"; do - speed=$(curl -o /dev/null -s -w '%{time_total}' "${I}") + speed=$(curl -skL -w '%{time_total}' "${I}" -o /dev/null) speed=$(awk "BEGIN {print (${speed:-0.999} * 1000)}") speedlist+="${I} ${speed:-999}\n" # Assign default value 999 if speed is empty done diff --git a/files/initrd/opt/rr/menu.sh b/files/initrd/opt/rr/menu.sh index ac25eda1..1bbb0353 100755 --- a/files/initrd/opt/rr/menu.sh +++ b/files/initrd/opt/rr/menu.sh @@ -142,9 +142,9 @@ function modelMenu() { IGPUPS=(apollolake geminilake) IGPUID="$(lspci -nd ::300 2>/dev/null | grep "8086" | cut -d' ' -f3 | sed 's/://g')" NVMEMS=(DS918+ RS1619xs+ DS419+ DS1019+ DS719+ DS1621xs+) - NVMEPS=(/sys/devices/pci0000:00/0000:*/nvme /sys/devices/pci0000:00/0000:*/*/nvme) + NVMEMD=$(find /sys/devices -type d -name nvme | awk -F'/' '{print NF}' | sort -n | tail -n1) if [ -n "${IGPUID}" ]; then grep -iq "${IGPUID}" ${WORK_PATH}/i915ids && hasiGPU=1 || hasiGPU=2; else hasiGPU=0; fi - if [ $(ls -d ${NVMEPS[0]} 2>/dev/null | wc -l) -gt 0 ]; then hasNVME=1; else [ $(ls -d ${NVMEPS[1]} 2>/dev/null | wc -l) -gt 0 ] && hasNVME=2 || hasNVME=0; fi + if [ ${NVMEMD:-0} -lt 6 ]; then hasNVME=0; elif [ ${NVMEMD:-0} -eq 6 ]; then hasNVME=1; else hasNVME=2; fi [ $(lspci -d ::104 2>/dev/null | wc -l) -gt 0 -o $(lspci -d ::107 2>/dev/null | wc -l) -gt 0 ] && hasHBA=1 || hasHBA=0 while read -r M A; do COMPATIBLE=1 @@ -573,11 +573,15 @@ function addonMenu() { [ $? -ne 0 ] && continue ADDON="$(cat "${TMP_PATH}/resp")" [ -z "${ADDON}" ] && continue - DIALOG --title "$(TEXT "Addons")" \ - --inputbox "$(TEXT "Type a optional params to addon")" 0 70 \ - 2>${TMP_PATH}/resp - [ $? -ne 0 ] && continue - VALUE="$(cat "${TMP_PATH}/resp")" + if [ "$(readAddonKey "${ADDON}" "params")" = "true" ]; then + DIALOG --title "$(TEXT "Addons")" \ + --inputbox "$(TEXT "Type a optional params to addon")" 0 70 \ + 2>${TMP_PATH}/resp + [ $? -ne 0 ] && continue + VALUE="$(cat "${TMP_PATH}/resp")" + else + VALUE="" + fi ADDONS[${ADDON}]="${VALUE}" writeConfigKey "addons.\"${ADDON}\"" "${VALUE}" "${USER_CONFIG_FILE}" touch ${PART1_PATH}/.build