arc: rewrite more logic

Signed-off-by: AuxXxilium <info@auxxxilium.tech>
This commit is contained in:
AuxXxilium 2024-09-06 17:31:44 +02:00
parent bd0e53bb7f
commit 97431a6a3b
2 changed files with 21 additions and 14 deletions

View File

@ -517,11 +517,11 @@ function arcPatch() {
[ -z "${resp}" ] && return 1
if [ ${resp} -eq 1 ]; then
# Read Arc Patch from File
SN=$(generateSerial "${MODEL}" "true")
SN=$(generateSerial "${MODEL}" "true" | tr '[:lower:]' '[:upper:]')
writeConfigKey "arc.patch" "true" "${USER_CONFIG_FILE}"
elif [ ${resp} -eq 2 ]; then
# Generate random Serial
SN=$(generateSerial "${MODEL}" "false")
SN=$(generateSerial "${MODEL}" "false" | tr '[:lower:]' '[:upper:]')
writeConfigKey "arc.patch" "false" "${USER_CONFIG_FILE}"
elif [ ${resp} -eq 3 ]; then
while true; do
@ -549,7 +549,7 @@ function arcPatch() {
[ -z "${resp}" ] && return 1
if [ ${resp} -eq 1 ]; then
# Generate random Serial
SN=$(generateSerial "${MODEL}" "false")
SN=$(generateSerial "${MODEL}" "false" | tr '[:lower:]' '[:upper:]')
writeConfigKey "arc.patch" "false" "${USER_CONFIG_FILE}"
elif [ ${resp} -eq 2 ]; then
while true; do
@ -608,16 +608,23 @@ function arcSettings() {
initConfigKey "addons.storagepanel" "" "${USER_CONFIG_FILE}"
addonSelection
[ $? -ne 0 ] && return 1
fi
# Check for CPU Frequency Scaling & Governor
if [ "${CPUFREQ}" == "true" ] && readConfigMap "addons" "${USER_CONFIG_FILE}" | grep -q "cpufreqscaling"; then
initConfigKey "addons.cpufreqscaling" "" "${USER_CONFIG_FILE}"
if [ "${AUTOMATED}" == "false" ] && [ "${CPUFREQ}" == "true" ] && readConfigMap "addons" "${USER_CONFIG_FILE}" | grep -q "cpufreqscaling"; then
dialog --backtitle "$(backtitle)" --colors --title "CPU Frequency Scaling" \
--infobox "Generating Governor Table..." 3 40
governorSelection
[ $? -ne 0 ] && return 1
elif [ "${AUTOMATED}" == "true" ] && [ "${CPUFREQ}" == "true" ] && readConfigMap "addons" "${USER_CONFIG_FILE}" | grep -q "cpufreqscaling"; then
if [ "${PLATFORM}" == "epyc7002" ]; then
writeConfigKey "addons.cpufreqscaling" "schedutil" "${USER_CONFIG_FILE}"
else
writeConfigKey "addons.cpufreqscaling" "ondemand" "${USER_CONFIG_FILE}"
fi
else
deleteConfigKey "addons.cpufreqscaling" "${USER_CONFIG_FILE}"
fi
if [ "${AUTOMATED}" == "false" ]; then
# Check for DT and HBA/Raid Controller
if [ "${PLATFORM}" != "epyc7002" ]; then
if [ "${DT}" == "true" ] && [ "${EXTERNALCONTROLLER}" == "true" ]; then

View File

@ -6,13 +6,13 @@ function getnet() {
NICPORTS="$(readConfigKey "${MODEL}.ports" "${S_FILE}" 2>/dev/null)"
if [ "${ARCPATCH}" == "true" ]; then
ETHN="$(echo ${ETHX} | wc -w)"
MACS=($(generateMacAddress "${MODEL}" "${ETHN}" "true"))
MACS=($(generateMacAddress "${MODEL}" "${ETHN}" "true" | tr '[:lower:]' '[:upper:]'))
for I in $(seq 1 ${ETHN}); do
writeConfigKey "eth$((${I} - 1))" "${MACS[$((${I} - 1))]}" "${USER_CONFIG_FILE}"
done
elif [ "${ARCPATCH}" == "false" ]; then
ETHN="$(echo ${ETHX} | wc -w)"
MACS=($(generateMacAddress "${MODEL}" "${ETHN}" "false"))
MACS=($(generateMacAddress "${MODEL}" "${ETHN}" "false" | tr '[:lower:]' '[:upper:]'))
for I in $(seq 1 ${ETHN}); do
writeConfigKey "eth$((${I} - 1))" "${MACS[$((${I} - 1))]}" "${USER_CONFIG_FILE}"
done
@ -28,7 +28,7 @@ function getnet() {
MAC=$(cat "${TMP_PATH}/resp")
[ -z "${MAC}" ] && MAC="$(readConfigKey "${ETH}" "${USER_CONFIG_FILE}")"
[ -z "${MAC}" ] && MAC="$(cat /sys/class/net/${ETH}/address 2>/dev/null | sed 's/://g' | tr '[:upper:]' '[:lower:]')"
MAC="$(echo "${MAC}" | sed "s/:\|-\| //g" | tr '[:upper:]' '[:lower:]')"
MAC="$(echo "${MAC}" | sed "s/:\|-\| //g" | tr '[:lower:]' '[:upper:]')"
if [ ${#MAC} -eq 12 ]; then
writeConfigKey "${ETH}" "${MAC}" "${USER_CONFIG_FILE}"
break