tree: reformate Part 5

Signed-off-by: AuxXxilium <info@auxxxilium.tech>
This commit is contained in:
AuxXxilium 2024-05-10 16:39:13 +02:00
parent df739d364b
commit 8ad6496cfa
6 changed files with 73 additions and 138 deletions

View File

@ -616,9 +616,10 @@ function backupMenu() {
cp -f "${TMP_PATH}/mdX/usr/arc/backup/p1/user-config.yml" "${USER_CONFIG_FILE}"
sleep 2
MODEL="$(readConfigKey "model" "${USER_CONFIG_FILE}")"
MODELID="$(readConfigKey "modelid" "${USER_CONFIG_FILE}")"
PRODUCTVER="$(readConfigKey "productver" "${USER_CONFIG_FILE}")"
if [[ -n "${MODEL}" && -n "${PRODUCTVER}" ]]; then
TEXT="Installation found:\nModel: ${MODEL}\nVersion: ${PRODUCTVER}"
TEXT="Installation found:\nModel: ${MODELID:-${MODEL}}\nVersion: ${PRODUCTVER}"
SN="$(readConfigKey "arc.sn" "${USER_CONFIG_FILE}")"
TEXT+="\nSerial: ${SN}"
ARCPATCH="$(readConfigKey "arc.patch" "${USER_CONFIG_FILE}")"
@ -1074,6 +1075,7 @@ function sysinfo() {
BUILDDONE="$(readConfigKey "arc.builddone" "${USER_CONFIG_FILE}")"
if [ "${CONFDONE}" = "true" ]; then
MODEL="$(readConfigKey "model" "${USER_CONFIG_FILE}")"
MODELID="$(readConfigKey "modelid" "${USER_CONFIG_FILE}")"
PRODUCTVER="$(readConfigKey "productver" "${USER_CONFIG_FILE}")"
PLATFORM="$(readConfigKey "platform" "${USER_CONFIG_FILE}")"
DT="$(readConfigKey "platforms.${PLATFORM}.dt" "${P_FILE}")"
@ -1155,7 +1157,7 @@ function sysinfo() {
TEXT+="\n\Z4>> Loader\Zn"
TEXT+="\n Config | Build: \Zb${CONFDONE} | ${BUILDDONE}\Zn"
TEXT+="\n Config Version: \Zb${CONFIGVER}\Zn"
TEXT+="\n\Z4>> DSM ${PRODUCTVER}: ${MODEL}\Zn"
TEXT+="\n\Z4>> DSM ${PRODUCTVER}: ${MODELID:-${MODEL}}\Zn"
TEXT+="\n Kernel | LKM: \Zb${KVER} | ${LKM}\Zn"
TEXT+="\n Platform | DeviceTree: \Zb${PLATFORM} | ${DT}\Zn"
TEXT+="\n Arc Patch | Kernelload: \Zb${ARCPATCH} | ${KERNELLOAD}\Zn"
@ -1303,6 +1305,7 @@ function fullsysinfo() {
BUILDDONE="$(readConfigKey "arc.builddone" "${USER_CONFIG_FILE}")"
if [ "${CONFDONE}" = "true" ]; then
MODEL="$(readConfigKey "model" "${USER_CONFIG_FILE}")"
MODELID="$(readConfigKey "modelid" "${USER_CONFIG_FILE}")"
PRODUCTVER="$(readConfigKey "productver" "${USER_CONFIG_FILE}")"
PLATFORM="$(readConfigKey "platform" "${USER_CONFIG_FILE}")"
DT="$(readConfigKey "platforms.${PLATFORM}.dt" "${P_FILE}")"
@ -1389,7 +1392,7 @@ function fullsysinfo() {
TEXT+="\nConfig | Build: ${CONFDONE} | ${BUILDDONE}"
TEXT+="\nConfig Version: ${CONFIGVER}"
TEXT+="\n"
TEXT+="\nDSM ${PRODUCTVER}: ${MODEL}"
TEXT+="\nDSM ${PRODUCTVER}: ${MODELID:-${MODEL}}"
TEXT+="\nKernel | LKM: ${KVER} | ${LKM}"
TEXT+="\nPlatform | DeviceTree: ${PLATFORM} | ${DT}"
TEXT+="\nArc Patch | Kernelload: ${ARCPATCH} | ${KERNELLOAD}"

View File

@ -189,12 +189,13 @@ function arcModel() {
else
[ -z "$(grep -w "${M}" "${S_FILE}")" ] && BETA="x" || BETA=""
fi
[ ! grep -w "${A}" "${P_FILE}"] && COMPATIBLE=0
[ ${COMPATIBLE} -eq 1 ] && echo -e "${M} \"\t$(printf "\Zb%-8s\Zn \Zb%-15s\Zn \Zb%-5s\Zn \Zb%-5s\Zn \Zb%-5s\Zn \Zb%-5s\Zn \Zb%-10s\Zn \Zb%-12s\Zn \Zb%-10s\Zn \Zb%-10s\Zn" "${CPU}" "${A}" "${DTS}" "${ARC}" "${IGPUS}" "${HBAS}" "${M_2_CACHE}" "${M_2_STORAGE}" "${USBS}" "${BETA}")\" ">>"${TMP_PATH}/menu"
done <<<$(cat "${TMP_PATH}/modellist")
dialog --backtitle "$(backtitle)" --colors \
--cancel-label "Show all" --help-button --help-label "Exit" \
--extra-button --extra-label "Info" \
--menu "Choose Model for Loader (x = supported / + = need Addons)\n$(printf "\Zb%-16s\Zn \Zb%-8s\Zn \Zb%-15s\Zn \Zb%-5s\Zn \Zb%-5s\Zn \Zb%-5s\Zn \Zb%-5s\Zn \Zb%-10s\Zn \Zb%-12s\Zn \Zb%-10s\Zn \Zb%-10s\Zn" "Model" "CPU" "Platform" "DT" "Arc" "iGPU" "HBA" "M.2 Cache" "M.2 Volume" "USB Mount" "Beta")" 0 120 0 \
--menu "Choose Model for Loader (x = supported / + = need Addons) | Beta Models can have faulty Values.\n$(printf "\Zb%-16s\Zn \Zb%-8s\Zn \Zb%-15s\Zn \Zb%-5s\Zn \Zb%-5s\Zn \Zb%-5s\Zn \Zb%-5s\Zn \Zb%-10s\Zn \Zb%-12s\Zn \Zb%-10s\Zn \Zb%-10s\Zn" "Model" "CPU" "Platform" "DT" "Arc" "iGPU" "HBA" "M.2 Cache" "M.2 Volume" "USB Mount" "Beta")" 0 120 0 \
--file "${TMP_PATH}/menu" 2>"${TMP_PATH}/resp"
RET=$?
case ${RET} in
@ -204,7 +205,7 @@ function arcModel() {
break
;;
1) # cancel-button -> Show all Models
RESTRICT=0
[ ${RESTRICT} -eq 1 ] && RESTRICT=0 || RESTRICT=1
;;
2) # help-button -> Exit
return 0
@ -227,20 +228,22 @@ function arcModel() {
PRODUCTVER=""
PLATFORM="$(grep -w "${resp}" "${TMP_PATH}/modellist" | awk '{print $2}' | head -n 1)"
MODEL="${resp}"
writeConfigKey "model" "${MODEL}" "${USER_CONFIG_FILE}"
writeConfigKey "productver" "" "${USER_CONFIG_FILE}"
writeConfigKey "arc.confdone" "false" "${USER_CONFIG_FILE}"
MODELID="$(echo ${MODEL} | sed 's/d$/D/; s/rp$/RP/; s/rp+/RP+/')"
writeConfigKey "addons" "{}" "${USER_CONFIG_FILE}"
writeConfigKey "arc.builddone" "false" "${USER_CONFIG_FILE}"
writeConfigKey "arc.remap" "" "${USER_CONFIG_FILE}"
writeConfigKey "arc.confdone" "false" "${USER_CONFIG_FILE}"
writeConfigKey "arc.kernel" "official" "${USER_CONFIG_FILE}"
writeConfigKey "arc.paturl" "" "${USER_CONFIG_FILE}"
writeConfigKey "arc.pathash" "" "${USER_CONFIG_FILE}"
writeConfigKey "arc.remap" "" "${USER_CONFIG_FILE}"
writeConfigKey "arc.sn" "" "${USER_CONFIG_FILE}"
writeConfigKey "arc.kernel" "official" "${USER_CONFIG_FILE}"
writeConfigKey "cmdline" "{}" "${USER_CONFIG_FILE}"
writeConfigKey "platform" "${PLATFORM}" "${USER_CONFIG_FILE}"
writeConfigKey "synoinfo" "{}" "${USER_CONFIG_FILE}"
writeConfigKey "model" "${MODEL}" "${USER_CONFIG_FILE}"
writeConfigKey "modelid" "${MODELID}" "${USER_CONFIG_FILE}"
writeConfigKey "modules" "{}" "${USER_CONFIG_FILE}"
writeConfigKey "addons" "{}" "${USER_CONFIG_FILE}"
writeConfigKey "platform" "${PLATFORM}" "${USER_CONFIG_FILE}"
writeConfigKey "productver" "" "${USER_CONFIG_FILE}"
writeConfigKey "synoinfo" "{}" "${USER_CONFIG_FILE}"
if [ "${OFFLINE}" = "false" ]; then
getLogo "${MODEL}"
fi
@ -435,25 +438,17 @@ function arcPatch() {
function arcSettings() {
# Get Network Config for Loader
dialog --backtitle "$(backtitle)" --colors --title "Network Config" \
--infobox "Network Config..." 3 30
--infobox "Loading Network Config..." 3 40
sleep 2
if [ "${CUSTOM}" = "true" ]; then
autogetnet
else
getnet
fi
# Select Portmap for Loader
getmap
if [[ "${DT}" = "false" && $(lspci -d ::106 | wc -l) -gt 0 ]]; then
dialog --backtitle "$(backtitle)" --colors --title "Storage Map" \
--infobox "Storage Map..." 3 30
--infobox "Loading Storage Map..." 3 40
sleep 2
if [ "${CUSTOM}" = "true" ]; then
autogetmapSelection
else
getmapSelection
fi
fi
if [ "${CUSTOM}" = "false" ]; then
# Add Arc Addons
writeConfigKey "addons.cpuinfo" "" "${USER_CONFIG_FILE}"

View File

@ -41,6 +41,7 @@ fi
# Read model/system variables
PLATFORM="$(readConfigKey "platform" "${USER_CONFIG_FILE}")"
MODEL="$(readConfigKey "model" "${USER_CONFIG_FILE}")"
MODELID="$(readConfigKey "modelid" "${USER_CONFIG_FILE}")"
PRODUCTVER="$(readConfigKey "productver" "${USER_CONFIG_FILE}")"
LKM="$(readConfigKey "lkm" "${USER_CONFIG_FILE}")"
MACSYS="$(readConfigKey "arc.macsys" "${USER_CONFIG_FILE}")"
@ -50,7 +51,7 @@ RAM="${RAMTOTAL}GB"
VENDOR="$(dmesg 2>/dev/null | grep -i "DMI:" | sed 's/\[.*\] DMI: //i')"
echo -e "\033[1;37mDSM:\033[0m"
echo -e "Model: \033[1;37m${MODEL}\033[0m"
echo -e "Model: \033[1;37m${MODELID:-${MODEL}}\033[0m"
echo -e "Version: \033[1;37m${PRODUCTVER}\033[0m"
echo -e "LKM: \033[1;37m${LKM}\033[0m"
echo -e "Macsys: \033[1;37m${MACSYS}\033[0m"
@ -86,7 +87,7 @@ KVER="$(readConfigKey "platforms.${PLATFORM}.productvers.[${PRODUCTVER}].kver" "
declare -A CMDLINE
# Build Cmdline
CMDLINE['syno_hw_version']="${MODEL}"
CMDLINE['syno_hw_version']="${MODELID:-${MODEL}}"
[ -z "${VID}" ] && VID="0x46f4" # Sanity check
[ -z "${PID}" ] && PID="0x0001" # Sanity check
CMDLINE['vid']="${VID}"

View File

@ -39,46 +39,6 @@ function getnet() {
dialog --backtitle "$(backtitle)" --title "Mac Setting" --msgbox "Invalid MAC" 0 0
done
fi
# Ask for Macsys
dialog --clear --backtitle "$(backtitle)" \
--nocancel --title "Macsys Setting" \
--menu "Choose an Option\n* Recommended Option" 8 50 0 \
1 "Hardware - Use Hardware Mac for DSM *" \
2 "Custom - Use Custom/Fake Mac for DSM" \
2>"${TMP_PATH}/resp"
resp=$(cat "${TMP_PATH}/resp")
[ -z "${resp}" ] && return 1
if [ ${resp} -eq 1 ]; then
writeConfigKey "arc.macsys" "hardware" "${USER_CONFIG_FILE}"
elif [ ${resp} -eq 2 ]; then
writeConfigKey "arc.macsys" "custom" "${USER_CONFIG_FILE}"
fi
MACSYS="$(readConfigKey "arc.macsys" "${USER_CONFIG_FILE}")"
}
# Get Network Config for Loader
function autogetnet() {
ETHX="$(ls /sys/class/net/ 2>/dev/null | grep eth)" # real network cards list
ARCPATCH="$(readConfigKey "arc.patch" "${USER_CONFIG_FILE}")"
if [ "${ARCPATCH}" = "true" ]; then
ARCMACNUM=1
for ETH in ${ETHX}; do
ARCMAC=""
ARCMAC="$(readConfigKey "${MODEL}.mac${ARCMACNUM}" "${S_FILE}")"
[ -n "${ARCMAC}" ] && writeConfigKey "mac.${ETH}" "${ARCMAC}" "${USER_CONFIG_FILE}"
[ -z "${ARCMAC}" ] && break
ARCMACNUM=$((${ARCMACNUM} + 1))
done
else
ETHN=$(ls /sys/class/net/ 2>/dev/null | grep eth | wc -l)
MACS=$(generateMacAddress "${MODEL}" ${ETHN})
N=1
for ETH in ${ETHX}; do
MAC=$(echo "${MACS}" | cut -d ' ' -f ${N})
writeConfigKey "mac.${ETH}" "${MAC}" "${USER_CONFIG_FILE}"
N=$((${N} + 1))
done
fi
}
# Get Amount of NIC

View File

@ -139,12 +139,12 @@ function getmapSelection() {
SATAPORTMAP="$(awk '{print $1}' "${TMP_PATH}/drivescon")"
SATAREMAP="$(awk '{print $1}' "${TMP_PATH}/remap" | sed 's/.$//')"
EXTERNALCONTROLLER="$(readConfigKey "device.externalcontroller" "${USER_CONFIG_FILE}")"
if [ "${CUSTOM}" = "false" ]; then
# Show recommended Option to user
if [[ -n "${SATAREMAP}" && "${EXTERNALCONTROLLER}" = "true" && "${MACHINE}" = "NATIVE" ]]; then
REMAP2="*"
elif [[ -n "${SATAREMAP}" && "${EXTERNALCONTROLLER}" = "false" ]]; then
REMAP3="*"
REMAP4="*"
else
REMAP1="*"
fi
@ -171,38 +171,7 @@ function getmapSelection() {
elif [ ${resp} -eq 5 ]; then
writeConfigKey "arc.remap" "user" "${USER_CONFIG_FILE}"
fi
# Check Remap for correct config
REMAP="$(readConfigKey "arc.remap" "${USER_CONFIG_FILE}")"
# Write Map to config and show Map to User
if [ "${REMAP}" = "acports" ]; then
writeConfigKey "cmdline.SataPortMap" "${SATAPORTMAP}" "${USER_CONFIG_FILE}"
writeConfigKey "cmdline.DiskIdxMap" "${DISKIDXMAP}" "${USER_CONFIG_FILE}"
deleteConfigKey "cmdline.sata_remap" "${USER_CONFIG_FILE}"
elif [ "${REMAP}" = "maxports" ]; then
writeConfigKey "cmdline.SataPortMap" "${SATAPORTMAPMAX}" "${USER_CONFIG_FILE}"
writeConfigKey "cmdline.DiskIdxMap" "${DISKIDXMAPMAX}" "${USER_CONFIG_FILE}"
deleteConfigKey "cmdline.sata_remap" "${USER_CONFIG_FILE}"
elif [ "${REMAP}" = "remap" ]; then
writeConfigKey "cmdline.sata_remap" "${SATAREMAP}" "${USER_CONFIG_FILE}"
deleteConfigKey "cmdline.DiskIdxMap" "${USER_CONFIG_FILE}"
deleteConfigKey "cmdline.SataPortMap" "${USER_CONFIG_FILE}"
elif [ "${REMAP}" = "ahci" ]; then
writeConfigKey "cmdline.ahci_remap" "${SATAREMAP}" "${USER_CONFIG_FILE}"
deleteConfigKey "cmdline.DiskIdxMap" "${USER_CONFIG_FILE}"
deleteConfigKey "cmdline.SataPortMap" "${USER_CONFIG_FILE}"
elif [ "${REMAP}" = "user" ]; then
deleteConfigKey "cmdline.SataPortMap" "${USER_CONFIG_FILE}"
deleteConfigKey "cmdline.DiskIdxMap" "${USER_CONFIG_FILE}"
deleteConfigKey "cmdline.sata_remap" "${USER_CONFIG_FILE}"
fi
}
function autogetmapSelection() {
# Compute PortMap Options
SATAPORTMAPMAX="$(awk '{print $1}' "${TMP_PATH}/drivesmax")"
SATAPORTMAP="$(awk '{print $1}' "${TMP_PATH}/drivescon")"
SATAREMAP="$(awk '{print $1}' "${TMP_PATH}/remap" | sed 's/.$//')"
EXTERNALCONTROLLER="$(readConfigKey "device.externalcontroller" "${USER_CONFIG_FILE}")"
else
# Show recommended Option to user
if [[ -n "${SATAREMAP}" && "${EXTERNALCONTROLLER}" = "true" && "${MACHINE}" = "NATIVE" ]]; then
writeConfigKey "arc.remap" "maxports" "${USER_CONFIG_FILE}"
@ -211,6 +180,7 @@ function autogetmapSelection() {
else
writeConfigKey "arc.remap" "acports" "${USER_CONFIG_FILE}"
fi
fi
# Check Remap for correct config
REMAP="$(readConfigKey "arc.remap" "${USER_CONFIG_FILE}")"
# Write Map to config and show Map to User
@ -218,22 +188,27 @@ function autogetmapSelection() {
writeConfigKey "cmdline.SataPortMap" "${SATAPORTMAP}" "${USER_CONFIG_FILE}"
writeConfigKey "cmdline.DiskIdxMap" "${DISKIDXMAP}" "${USER_CONFIG_FILE}"
deleteConfigKey "cmdline.sata_remap" "${USER_CONFIG_FILE}"
deleteConfigKey "cmdline.ahci_remap" "${USER_CONFIG_FILE}"
elif [ "${REMAP}" = "maxports" ]; then
writeConfigKey "cmdline.SataPortMap" "${SATAPORTMAPMAX}" "${USER_CONFIG_FILE}"
writeConfigKey "cmdline.DiskIdxMap" "${DISKIDXMAPMAX}" "${USER_CONFIG_FILE}"
deleteConfigKey "cmdline.sata_remap" "${USER_CONFIG_FILE}"
deleteConfigKey "cmdline.ahci_remap" "${USER_CONFIG_FILE}"
elif [ "${REMAP}" = "remap" ]; then
writeConfigKey "cmdline.sata_remap" "${SATAREMAP}" "${USER_CONFIG_FILE}"
deleteConfigKey "cmdline.DiskIdxMap" "${USER_CONFIG_FILE}"
deleteConfigKey "cmdline.SataPortMap" "${USER_CONFIG_FILE}"
deleteConfigKey "cmdline.ahci_remap" "${USER_CONFIG_FILE}"
elif [ "${REMAP}" = "ahci" ]; then
writeConfigKey "cmdline.ahci_remap" "${SATAREMAP}" "${USER_CONFIG_FILE}"
deleteConfigKey "cmdline.DiskIdxMap" "${USER_CONFIG_FILE}"
deleteConfigKey "cmdline.SataPortMap" "${USER_CONFIG_FILE}"
deleteConfigKey "cmdline.sata_remap" "${USER_CONFIG_FILE}"
elif [ "${REMAP}" = "user" ]; then
deleteConfigKey "cmdline.SataPortMap" "${USER_CONFIG_FILE}"
deleteConfigKey "cmdline.DiskIdxMap" "${USER_CONFIG_FILE}"
deleteConfigKey "cmdline.sata_remap" "${USER_CONFIG_FILE}"
deleteConfigKey "cmdline.ahci_remap" "${USER_CONFIG_FILE}"
fi
}

View File

@ -30,6 +30,7 @@ mkdir -p "${RAMDISK_PATH}"
# Read Model Data
PLATFORM="$(readConfigKey "platform" "${USER_CONFIG_FILE}")"
MODEL="$(readConfigKey "model" "${USER_CONFIG_FILE}")"
MODELID="$(readConfigKey "modelid" "${USER_CONFIG_FILE}")"
LKM="$(readConfigKey "lkm" "${USER_CONFIG_FILE}")"
SN="$(readConfigKey "arc.sn" "${USER_CONFIG_FILE}")"
LAYOUT="$(readConfigKey "layout" "${USER_CONFIG_FILE}")"
@ -56,7 +57,6 @@ if [ "${PRODUCTVERDSM}" != "${PRODUCTVER}" ]; then
echo -e "Try to use DSM Version ${PRODUCTVERDSM} for Patch."
writeConfigKey "productver" "${USER_CONFIG_FILE}"
PRODUCTVER="$(readConfigKey "productver" "${USER_CONFIG_FILE}")"
KVER="$(readConfigKey "platforms.${PLATFORM}.productvers.[${PRODUCTVER}].kver" "${P_FILE}")"
PAT_URL=""
PAT_HASH=""
fi
@ -157,6 +157,7 @@ echo "export LOADERVERSION=\"${ARC_VERSION}\"" >>"${RAMDISK_PATH}/addons/addons.
echo "export PLATFORM=\"${PLATFORM}\"" >>"${RAMDISK_PATH}/addons/addons.sh"
echo "export PRODUCTVER=\"${PRODUCTVER}\"" >>"${RAMDISK_PATH}/addons/addons.sh"
echo "export MODEL=\"${MODEL}\"" >>"${RAMDISK_PATH}/addons/addons.sh"
echo "export MODELID=\"${MODELID}\"" >>"${RAMDISK_PATH}/addons/addons.sh"
echo "export MLINK=\"${PAT_URL}\"" >>"${RAMDISK_PATH}/addons/addons.sh"
echo "export MCHECKSUM=\"${PAT_HASH}\"" >>"${RAMDISK_PATH}/addons/addons.sh"
echo "export LAYOUT=\"${LAYOUT}\"" >>"${RAMDISK_PATH}/addons/addons.sh"