From 88ce78bbdec78b4b20f13072498ffd0001bbc517 Mon Sep 17 00:00:00 2001 From: AuxXxilium Date: Thu, 27 Jun 2024 18:57:43 +0200 Subject: [PATCH 1/6] arc: remove empty line from sysinfo Signed-off-by: AuxXxilium --- files/initrd/opt/arc/arc-functions.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/files/initrd/opt/arc/arc-functions.sh b/files/initrd/opt/arc/arc-functions.sh index eea3f9432..b6f2a2470 100755 --- a/files/initrd/opt/arc/arc-functions.sh +++ b/files/initrd/opt/arc/arc-functions.sh @@ -1118,7 +1118,6 @@ function sysinfo() { TEXT+="\n\Zb$(lspci -s ${NETBUS} -nnk | awk '{$1=""}1' | awk '{$1=$1};1')\Zn\n" done # Print Config Informations - TEXT+="\n" TEXT+="\n\Z4> Arc: ${ARC_VERSION}\Zn" TEXT+="\n Subversion: \ZbAddons ${ADDONSVERSION} | Configs ${CONFIGSVERSION} | LKM ${LKMVERSION} | Modules ${MODULESVERSION} | Patches ${PATCHESVERSION}\Zn" TEXT+="\n\Z4>> Loader\Zn" From b0405f503077d356c6fdb2ca5ddc0ab08fb20e3d Mon Sep 17 00:00:00 2001 From: AuxXxilium Date: Thu, 27 Jun 2024 19:05:46 +0200 Subject: [PATCH 2/6] tree: fix syntax Signed-off-by: AuxXxilium --- files/initrd/opt/arc/boot.sh | 2 +- files/initrd/opt/arc/include/network.sh | 6 +++--- files/initrd/opt/arc/init.sh | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/files/initrd/opt/arc/boot.sh b/files/initrd/opt/arc/boot.sh index bd5a320c7..2734958f3 100755 --- a/files/initrd/opt/arc/boot.sh +++ b/files/initrd/opt/arc/boot.sh @@ -159,7 +159,7 @@ if [ "${ARCPATCH}" == "true" ]; then NICPORTS="$(readConfigKey "${MODEL}.ports" "${S_FILE}" 2>/dev/null)" [ -z "${NICPORTS}" ] && NICPORTS=1 else - NICPORTS=$(ls /sys/class/net/ 2>/dev/null | grep eth | wc -l) + NICPORTS="$(echo ${ETHX} | wc -w)" fi for ETH in ${ETHX}; do MAC="$(readConfigKey "arc.${ETH}" "${USER_CONFIG_FILE}")" diff --git a/files/initrd/opt/arc/include/network.sh b/files/initrd/opt/arc/include/network.sh index 3a08aa5c6..1e8cbfccc 100755 --- a/files/initrd/opt/arc/include/network.sh +++ b/files/initrd/opt/arc/include/network.sh @@ -1,17 +1,17 @@ # Get Network Config for Loader function getnet() { - ETHX="$(ls /sys/class/net/ 2>/dev/null | grep eth)" # real network cards list + ETHX="$(ls /sys/class/net/ 2>/dev/null | grep eth)" MODEL="$(readConfigKey "model" "${USER_CONFIG_FILE}")" ARCPATCH="$(readConfigKey "arc.patch" "${USER_CONFIG_FILE}")" NICPORTS="$(readConfigKey "${MODEL}.ports" "${S_FILE}" 2>/dev/null)" if [ "${ARCPATCH}" == "true" ]; then - ETHN="${#ETHX}" + ETHN="$(echo ${ETHX} | wc -w)" MACS=($(generateMacAddress "${MODEL}" ${ETHN} true)) for I in $(seq 1 ${ETHN}); do writeConfigKey "arc.eth$((${I} - 1))" "${MACS[$((${I} - 1))]}" "${USER_CONFIG_FILE}" done elif [ "${ARCPATCH}" == "false" ]; then - ETHN=$(ls /sys/class/net/ 2>/dev/null | grep eth | wc -l) + ETHN="$(echo ${ETHX} | wc -w)" MACS=($(generateMacAddress "${MODEL}" ${ETHN} false)) for I in $(seq 1 ${ETHN}); do writeConfigKey "arc.eth$((${I} - 1))" "${MACS[$((${I} - 1))]}" "${USER_CONFIG_FILE}" diff --git a/files/initrd/opt/arc/init.sh b/files/initrd/opt/arc/init.sh index e36ff92b7..4058b80b5 100755 --- a/files/initrd/opt/arc/init.sh +++ b/files/initrd/opt/arc/init.sh @@ -102,7 +102,7 @@ for ETH in ${ETHX}; do [ "${ETH::3}" = "eth" ] && ethtool -s ${ETH} wol g 2>/dev/null || true initConfigKey "arc.${ETH}" "${MACR}" "${USER_CONFIG_FILE}" done -ETHN="${#ETHX}" +ETHN="$(echo ${ETHX} | wc -w)" writeConfigKey "device.nic" "${ETHN}" "${USER_CONFIG_FILE}" # No network devices echo From 74939772bb59719e31b6bea0e2b251bb541778f8 Mon Sep 17 00:00:00 2001 From: AuxXxilium Date: Thu, 27 Jun 2024 19:10:46 +0200 Subject: [PATCH 3/6] arc: fix edit user config Signed-off-by: AuxXxilium --- files/initrd/opt/arc/arc-functions.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/files/initrd/opt/arc/arc-functions.sh b/files/initrd/opt/arc/arc-functions.sh index b6f2a2470..9155eda0f 100755 --- a/files/initrd/opt/arc/arc-functions.sh +++ b/files/initrd/opt/arc/arc-functions.sh @@ -8,7 +8,7 @@ function editUserConfig() { [ $? -ne 0 ] && return 1 mv -f "${TMP_PATH}/userconfig" "${USER_CONFIG_FILE}" ERRORS=$(yq eval "${USER_CONFIG_FILE}" 2>&1) - [ $? -eq 0 ] && continue || break + [ $? -eq 0 ] && break || continue dialog --backtitle "$(backtitle)" --title "Invalid YAML format" --msgbox "${ERRORS}" 0 0 done OLDMODEL="${MODEL}" From 7f5ca9ac43a0111ce14649595ae8c8219efd237c Mon Sep 17 00:00:00 2001 From: AuxXxilium Date: Thu, 27 Jun 2024 19:16:25 +0200 Subject: [PATCH 4/6] arc: rewrite more texts Signed-off-by: AuxXxilium --- files/initrd/opt/arc/arc.sh | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/files/initrd/opt/arc/arc.sh b/files/initrd/opt/arc/arc.sh index b1b98265d..25a475c6f 100755 --- a/files/initrd/opt/arc/arc.sh +++ b/files/initrd/opt/arc/arc.sh @@ -443,7 +443,7 @@ function arcPatch() { fi # At present, the SN rules are not complete, and many SNs are not truly invalid, so not provide tips now. dialog --backtitle "$(backtitle)" --colors --title "DSM SN" \ - --yesno "Serial looks invalid, continue?" 5 50 + --yesno "SN looks invalid, continue?" 5 50 [ $? -eq 0 ] && break done writeConfigKey "arc.patch" "user" "${USER_CONFIG_FILE}" @@ -452,8 +452,8 @@ function arcPatch() { dialog --clear --backtitle "$(backtitle)" \ --nocancel --title "Non Arc Patch Model" \ --menu "Please choose an Option." 8 50 0 \ - 1 "Use random Serial/Mac" \ - 2 "Use my Serial/Mac" \ + 1 "Use random SN/Mac" \ + 2 "Use my SN/Mac" \ 2>"${TMP_PATH}/resp" resp=$(cat ${TMP_PATH}/resp) [ -z "${resp}" ] && return 1 @@ -463,8 +463,8 @@ function arcPatch() { writeConfigKey "arc.patch" "false" "${USER_CONFIG_FILE}" elif [ ${resp} -eq 2 ]; then while true; do - dialog --backtitle "$(backtitle)" --colors --title "Serial" \ - --inputbox "Please enter a Serial Number " 0 0 "" \ + dialog --backtitle "$(backtitle)" --colors --title "DSM SN" \ + --inputbox "Please enter a SN " 7 50 "" \ 2>"${TMP_PATH}/resp" [ $? -ne 0 ] && break 2 SN="$(cat ${TMP_PATH}/resp)" @@ -474,8 +474,8 @@ function arcPatch() { break fi # At present, the SN rules are not complete, and many SNs are not truly invalid, so not provide tips now. - dialog --backtitle "$(backtitle)" --colors --title "Serial" \ - --yesno "Serial looks invalid, continue?" 0 0 + dialog --backtitle "$(backtitle)" --colors --title "DSM SN" \ + --yesno "SN looks invalid, continue?" 5 50 [ $? -eq 0 ] && break done writeConfigKey "arc.patch" "user" "${USER_CONFIG_FILE}" From 2c1bab86020cac253f74e1cf54e9f8f08e519e47 Mon Sep 17 00:00:00 2001 From: AuxXxilium Date: Thu, 27 Jun 2024 19:48:05 +0200 Subject: [PATCH 5/6] boot: rewrite mac related Signed-off-by: AuxXxilium --- files/initrd/opt/arc/boot.sh | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/files/initrd/opt/arc/boot.sh b/files/initrd/opt/arc/boot.sh index 2734958f3..f94468026 100755 --- a/files/initrd/opt/arc/boot.sh +++ b/files/initrd/opt/arc/boot.sh @@ -165,11 +165,9 @@ for ETH in ${ETHX}; do MAC="$(readConfigKey "arc.${ETH}" "${USER_CONFIG_FILE}")" [ -z "${MAC}" ] && MAC="$(cat /sys/class/net/${ETH}/address 2>/dev/null | sed 's/://g' | tr '[:upper:]' '[:lower:]')" ETHN=$((${ETHN} + 1)) - if [ ${ETHN} -le ${NICPORTS} ]; then - CMDLINE['mac${ETHN}']="${MAC}" - fi + [ ${ETHN} -le ${NICPORTS} ] && CMDLINE['mac${ETHN}']="${MAC}" done -CMDLINE['netif_num']="${NICPORTS}" +[ ${ETHN} -le ${NICPORTS} ] && CMDLINE['netif_num']="${ETHN}" || CMDLINE['netif_num']="${NICPORTS}" # Read user network settings while IFS=': ' read -r KEY VALUE; do From 6adb83f253904cd4df00d2b18a474236e5f0e628 Mon Sep 17 00:00:00 2001 From: AuxXxilium Date: Thu, 27 Jun 2024 19:51:45 +0200 Subject: [PATCH 6/6] arc: remove loaded module write Signed-off-by: AuxXxilium --- files/initrd/opt/arc/arc.sh | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/files/initrd/opt/arc/arc.sh b/files/initrd/opt/arc/arc.sh index 25a475c6f..ab2e23c4c 100755 --- a/files/initrd/opt/arc/arc.sh +++ b/files/initrd/opt/arc/arc.sh @@ -373,18 +373,10 @@ function arcVersion() { KVERP="${KVER}" fi writeConfigKey "modules" "{}" "${USER_CONFIG_FILE}" - cp -f "${ARC_PATH}/include/modulelist" "${USER_UP_PATH}/modulelist" - echo -e "\n\n# Arc Modules" >>"${USER_UP_PATH}/modulelist" - KOLIST="" - for I in $(lsmod | awk -F' ' '{print $1}' | grep -v 'Module'); do - KOLIST+="$(getdepends "${PLATFORM}" "${KVERP}" "${I}") ${I} " - done - KOLIST=($(echo ${KOLIST} | tr ' ' '\n' | sort -u)) + # Rewrite modules + writeConfigKey "modules" "{}" "${USER_CONFIG_FILE}" while read -r ID DESC; do writeConfigKey "modules.\"${ID}\"" "" "${USER_CONFIG_FILE}" - for MOD in ${KOLIST[@]}; do - [ "${MOD}" == "${ID}" ] && echo "N ${ID}.ko" >>"${USER_UP_PATH}/modulelist" - done done < <(getAllModules "${PLATFORM}" "${KVERP}") # Check for Only Version if [ "${ONLYVERSION}" == "true" ]; then