tree: fix some logic

Signed-off-by: AuxXxilium <info@auxxxilium.tech>
This commit is contained in:
AuxXxilium
2025-01-22 20:42:56 +01:00
parent 1392db0e26
commit c041a9d201
3 changed files with 42 additions and 42 deletions

View File

@@ -78,6 +78,7 @@ function arcModel() {
dialog --backtitle "$(backtitle)" --title "Model" \
--infobox "Reading Models..." 3 25
ARCCONF="$(readConfigKey "${MODEL:-SA6400}.serial" "${S_FILE}")"
ARCMODE="$(readConfigKey "arc.mode" "${USER_CONFIG_FILE}")"
# Loop menu
RESTRICT=1
PS="$(readConfigEntriesArray "platforms" "${P_FILE}" | sort)"
@@ -224,6 +225,7 @@ function arcVersion() {
PLATFORM="$(readConfigKey "platform" "${USER_CONFIG_FILE}")"
DT="$(readConfigKey "platforms.${PLATFORM}.dt" "${P_FILE}")"
PRODUCTVER="$(readConfigKey "productver" "${USER_CONFIG_FILE}")"
ARCMODE="$(readConfigKey "arc.mode" "${USER_CONFIG_FILE}")"
# Get PAT Data from Config
PAT_URL_CONF="$(readConfigKey "paturl" "${USER_CONFIG_FILE}")"
PAT_HASH_CONF="$(readConfigKey "pathash" "${USER_CONFIG_FILE}")"
@@ -401,7 +403,7 @@ function arcPatch() {
PLATFORM="$(readConfigKey "platform" "${USER_CONFIG_FILE}")"
MODEL="$(readConfigKey "model" "${USER_CONFIG_FILE}")"
ARCCONF="$(readConfigKey "${MODEL}.serial" "${S_FILE}")"
ARCMODE="$(readConfigKey "arc.mode" "${USER_CONFIG_FILE}")"
if [ "${ARCMODE}" = "automated" ] && [ "${ARCPATCH}" != "user" ]; then
if [ -n "${ARCCONF}" ]; then
generate_and_write_serial "true"
@@ -463,17 +465,16 @@ function arcSettings() {
PRODUCTVER="$(readConfigKey "productver" "${USER_CONFIG_FILE}")"
PLATFORM="$(readConfigKey "platform" "${USER_CONFIG_FILE}")"
KVER="$(readConfigKey "platforms.${PLATFORM}.productvers.\"${PRODUCTVER}\".kver" "${P_FILE}")"
ARCMODE="$(readConfigKey "arc.mode" "${USER_CONFIG_FILE}")"
PAT_URL="$(readConfigKey "paturl" "${USER_CONFIG_FILE}")"
PAT_HASH="$(readConfigKey "pathash" "${USER_CONFIG_FILE}")"
DT="$(readConfigKey "platforms.${PLATFORM}.dt" "${P_FILE}")"
# Network Config for Loader
if [ "${ARCMODE}" = "config" ]; then
dialog --backtitle "$(backtitle)" --colors --title "Network Config" \
--infobox "Generating Network Config..." 3 40
sleep 2
getnet || return
fi
dialog --backtitle "$(backtitle)" --colors --title "Network Config" \
--infobox "Generating Network Config..." 3 40
sleep 2
getnet || return
if [ "${ONLYPATCH}" = "true" ]; then
writeConfigKey "arc.builddone" "false" "${USER_CONFIG_FILE}"
@@ -703,6 +704,7 @@ function make() {
function arcFinish() {
rm -f "${LOG_FILE}" >/dev/null 2>&1 || true
MODELID="$(readConfigKey "modelid" "${USER_CONFIG_FILE}")"
ARCMODE="$(readConfigKey "arc.mode" "${USER_CONFIG_FILE}")"
if [ -n "${MODELID}" ]; then
writeConfigKey "arc.builddone" "true" "${USER_CONFIG_FILE}"
@@ -729,6 +731,7 @@ function juniorboot() {
BUILDDONE="$(readConfigKey "arc.builddone" "${USER_CONFIG_FILE}")"
MODEL="$(readConfigKey "model" "${USER_CONFIG_FILE}")"
MODELID="$(readConfigKey "modelid" "${USER_CONFIG_FILE}")"
ARCMODE="$(readConfigKey "arc.mode" "${USER_CONFIG_FILE}")"
if [[ "${BUILDDONE}" = "false" && "${ARCMODE}" != "automated" ]] || [ "${MODEL}" != "${MODELID}" ]; then
dialog --backtitle "$(backtitle)" --title "Alert" \
--yesno "Config changed, you need to rebuild the Loader?" 0 0
@@ -749,6 +752,7 @@ function boot() {
BUILDDONE="$(readConfigKey "arc.builddone" "${USER_CONFIG_FILE}")"
MODEL="$(readConfigKey "model" "${USER_CONFIG_FILE}")"
MODELID="$(readConfigKey "modelid" "${USER_CONFIG_FILE}")"
ARCMODE="$(readConfigKey "arc.mode" "${USER_CONFIG_FILE}")"
if [[ "${BUILDDONE}" = "false" && "${ARCMODE}" != "automated" ]] || [ "${MODEL}" != "${MODELID}" ]; then
dialog --backtitle "$(backtitle)" --title "Alert" \
--yesno "Config changed, you need to rebuild the Loader?" 0 0
@@ -766,7 +770,6 @@ function boot() {
###############################################################################
###############################################################################
# Main loop
# Check for Arc Mode
if [ "${ARCMODE}" = "update" ]; then
if [ "${ARCOFFLINE}" != "true" ]; then
updateLoader
@@ -777,7 +780,6 @@ if [ "${ARCMODE}" = "update" ]; then
exec reboot
fi
elif [ "${ARCMODE}" = "automated" ]; then
# Check for Custom Build
if [ "${BUILDDONE}" = "false" ] || [ "${MODEL}" != "${MODELID}" ]; then
arcModel
else
@@ -867,9 +869,7 @@ elif [ "${ARCMODE}" = "config" ]; then
echo "t \"Change User Password \" " >>"${TMP_PATH}/menu"
echo "J \"Reset Network Config \" " >>"${TMP_PATH}/menu"
echo "T \"Disable all scheduled Tasks \" " >>"${TMP_PATH}/menu"
if [ "${PLATFORM}" = "epyc7002" ]; then
echo "M \"Mount DSM Storage Pool \" " >>"${TMP_PATH}/menu"
fi
echo "M \"Mount DSM Storage Pool \" " >>"${TMP_PATH}/menu"
echo "l \"Edit User Config \" " >>"${TMP_PATH}/menu"
echo "s \"Allow Downgrade Version \" " >>"${TMP_PATH}/menu"
echo "O \"Official Driver Priority: \Z4${ODP}\Zn \" " >>"${TMP_PATH}/menu"

View File

@@ -12,12 +12,12 @@ function getnet() {
ETHX=$(ls /sys/class/net/ 2>/dev/null | grep eth)
MODEL=$(readConfigKey "model" "${USER_CONFIG_FILE}")
ARCPATCH=$(readConfigKey "arc.patch" "${USER_CONFIG_FILE}")
ARCPATCH="$(readConfigKey "arc.patch" "${USER_CONFIG_FILE}")"
ARCCONF="$(readConfigKey "${MODEL}.serial" "${S_FILE}")"
ARCMODE="$(readConfigKey "arc.mode" "${USER_CONFIG_FILE}")"
ETHN=$(echo "${ETHX}" | wc -w)
if [ "${ARCPATCH}" != "user" ]; then
generate_and_write_macs "${ARCPATCH}"
else
if [ "${ARCPATCH}" = "user" ]; then
for N in ${ETHX}; do
while true; do
dialog --backtitle "$(backtitle)" --title "Mac Setting" \
@@ -37,6 +37,10 @@ function getnet() {
fi
done
done
elif [ "${ARCPATCH}" != "user" ] && [ -n "${ARCCONF}" ]; then
generate_and_write_macs "${ARCPATCH}"
else
generate_and_write_macs "false"
fi
}
@@ -45,5 +49,5 @@ ETHX=$(ls /sys/class/net/ 2>/dev/null | grep eth)
# Get actual IP
for N in ${ETHX}; do
IPCON="$(getIP "${N}")"
[ -n "${IPCON}" ] && break
[ -n "${IPCON}" ] && break || IPCON="noip"
done

View File

@@ -1,27 +1,25 @@
# Get PortMap for Loader
function getmap() {
function show_dialog() {
dialog --backtitle "$(backtitle)" --title "Sata Portmap" \
--menu "Choose a Portmap for Sata!?\n* Recommended Option" 8 60 0 \
1 "DiskIdxMap: Active Ports ${REMAP1}" \
2 "DiskIdxMap: Max Ports ${REMAP2}" \
3 "SataRemap: Remove empty Ports ${REMAP3}" \
4 "AhciRemap: Remove empty Ports (new) ${REMAP4}" \
5 "Set my own Portmap in Config" \
2>"${TMP_PATH}/resp"
[ $? -ne 0 ] && return 1
resp=$(cat "${TMP_PATH}/resp")
[ -z "${resp}" ] && return 1
}
function set_remap() {
case ${resp} in
1) writeConfigKey "arc.remap" "acports" "${USER_CONFIG_FILE}" ;;
2) writeConfigKey "arc.remap" "maxports" "${USER_CONFIG_FILE}" ;;
3) writeConfigKey "arc.remap" "remap" "${USER_CONFIG_FILE}" ;;
4) writeConfigKey "arc.remap" "ahci" "${USER_CONFIG_FILE}" ;;
5) writeConfigKey "arc.remap" "user" "${USER_CONFIG_FILE}" ;;
esac
function show_and_set_remap() {
dialog --backtitle "$(backtitle)" --title "Sata Portmap" \
--menu "Choose a Portmap for Sata!?\n* Recommended Option" 8 60 0 \
1 "DiskIdxMap: Active Ports ${REMAP1}" \
2 "DiskIdxMap: Max Ports ${REMAP2}" \
3 "SataRemap: Remove empty Ports ${REMAP3}" \
4 "AhciRemap: Remove empty Ports (new) ${REMAP4}" \
5 "Set my own Portmap in Config" \
2>"${TMP_PATH}/resp"
[ $? -ne 0 ] && return 1
resp=$(cat "${TMP_PATH}/resp")
[ -z "${resp}" ] && return 1
case ${resp} in
1) writeConfigKey "arc.remap" "acports" "${USER_CONFIG_FILE}" ;;
2) writeConfigKey "arc.remap" "maxports" "${USER_CONFIG_FILE}" ;;
3) writeConfigKey "arc.remap" "remap" "${USER_CONFIG_FILE}" ;;
4) writeConfigKey "arc.remap" "ahci" "${USER_CONFIG_FILE}" ;;
5) writeConfigKey "arc.remap" "user" "${USER_CONFIG_FILE}" ;;
esac
}
# Sata Disks
@@ -177,9 +175,7 @@ function getmapSelection() {
else
REMAP1="*"
fi
show_dialog
set_remap
show_and_set_remap
else
# Show recommended Option to user
if [ -n "${SATAREMAP}" ] && [ "${EXTERNALCONTROLLER}" = "true" ] && [ "${MACHINE}" = "Native" ]; then