From 5dc0b6e705c3da9438166a1ead5e3c55b04faeb0 Mon Sep 17 00:00:00 2001 From: Fabio Belavenuto Date: Thu, 21 Jul 2022 16:49:04 -0300 Subject: [PATCH] Synoinfo entries unified: Synoinfo entries from model config file are copyed to user config file when the user choose a build. --- README.md | 2 +- TODO | 2 +- files/board/arpl/overlayfs/opt/arpl/menu.sh | 32 ++++++++----------- .../arpl/overlayfs/opt/arpl/ramdisk-patch.sh | 5 +-- 4 files changed, 17 insertions(+), 24 deletions(-) diff --git a/README.md b/README.md index 3df51dba..6adeffa8 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,7 @@ To use this project, download the latest image available and burn it to a USB st The menu system is dynamic and I hope it is intuitive enough that the user can use it without any problems. Its allows you to choose a model, the existing buildnumber for the chosen model, type or randomly create a serial number, add/remove addons, add/remove/view "cmdline" and "synoinfo" entries, choose the LKM version, create the loader, boot, manually edit the configuration file, choose a keymap, update and exit. -Changing addons and synoinfo entries require re-creating the loader, cmdline entries do not. You can view the "cmdline" and "synoinfo" entries defined for the chosen model, with user-defined entries having higher priority. +Changing addons and synoinfo entries require re-creating the loader, cmdline entries do not. There is no need to configure the VID/PID (if using a USB stick) or define the MAC Addresses of the network interfaces. If the user wants to modify the MAC Address of any interface, he must manually add "cmdline" entries in the corresponding menu (set "netif_num" according to "mac1..4" entries). diff --git a/TODO b/TODO index cb873c3d..e0675b7c 100644 --- a/TODO +++ b/TODO @@ -1,7 +1,6 @@ A fazer - Descobrir como é o serial do DS2422+ - Estudar acrescentar modo simples e avançado do menu - - Mudar synoinfo para ler do modelo e preencher no user_config, para usuário poder deletar entradas do modelo Concluidos: - Generalizar código dos addons @@ -27,3 +26,4 @@ Concluidos: - Mudar addons para colocar pacote completo na partição 3 e detectar dinâmicamente durante o boot do júnior - Acertar flag DIRTY ao atualizar módulos, etc - Consertar MAC custom + - Mudar synoinfo para ler do modelo e preencher no user_config, para usuário poder deletar entradas do modelo diff --git a/files/board/arpl/overlayfs/opt/arpl/menu.sh b/files/board/arpl/overlayfs/opt/arpl/menu.sh index e904b1ca..66e7608b 100755 --- a/files/board/arpl/overlayfs/opt/arpl/menu.sh +++ b/files/board/arpl/overlayfs/opt/arpl/menu.sh @@ -104,9 +104,14 @@ function buildMenu() { if [ "${BUILD}" != "${resp}" ]; then BUILD=${resp} writeConfigKey "build" "${BUILD}" "${USER_CONFIG_FILE}" - DIRTY=1 + # Delete synoinfo and reload model/build synoinfo + writeConfigKey "synoinfo" "{}" "${USER_CONFIG_FILE}" + while IFS="=" read KEY VALUE; do + writeConfigKey "synoinfo.${KEY}" "${VALUE}" "${USER_CONFIG_FILE}" + done < <(readModelMap "${MODEL}" "builds.${BUILD}.synoinfo") # Remove old files rm -f "${ORI_ZIMAGE_FILE}" "${ORI_RDGZ_FILE}" "${MOD_ZIMAGE_FILE}" "${MOD_RDGZ_FILE}" + DIRTY=1 fi } @@ -386,8 +391,7 @@ function synoinfoMenu() { if [ "${DT}" != "true" ]; then echo "x \"Set maxdisks manually\"" >> "${TMP_PATH}/menu" fi - echo "s \"Show user synoinfo\"" >> "${TMP_PATH}/menu" - echo "m \"Show model/build synoinfo\"" >> "${TMP_PATH}/menu" + echo "s \"Show synoinfo entries\"" >> "${TMP_PATH}/menu" echo "e \"Exit\"" >> "${TMP_PATH}/menu" # menu loop @@ -397,13 +401,13 @@ function synoinfoMenu() { [ $? -ne 0 ] && return case "`<${TMP_PATH}/resp`" in a) - dialog --backtitle "`backtitle`" --title "User synoinfo" \ - --inputbox "Type a name of synoinfo variable" 0 0 \ + dialog --backtitle "`backtitle`" --title "Synoinfo entries" \ + --inputbox "Type a name of synoinfo entry" 0 0 \ 2>${TMP_PATH}/resp [ $? -ne 0 ] && continue NAME="`sed 's/://g' <"${TMP_PATH}/resp"`" - dialog --backtitle "`backtitle`" --title "User synoinfo" \ - --inputbox "Type a value of '${NAME}' variable" 0 0 "${SYNOINFO[${NAME}]}" \ + dialog --backtitle "`backtitle`" --title "Synoinfo entries" \ + --inputbox "Type a value of '${NAME}' entry" 0 0 "${SYNOINFO[${NAME}]}" \ 2>${TMP_PATH}/resp [ $? -ne 0 ] && continue VALUE="`<"${TMP_PATH}/resp"`" @@ -413,7 +417,7 @@ function synoinfoMenu() { ;; d) if [ ${#SYNOINFO[@]} -eq 0 ]; then - dialog --backtitle "`backtitle`" --msgbox "No user synoinfo to remove" 0 0 + dialog --backtitle "`backtitle`" --msgbox "No synoinfo entries to remove" 0 0 continue fi ITEMS="" @@ -421,7 +425,7 @@ function synoinfoMenu() { ITEMS+="${I} ${SYNOINFO[${I}]} off " done dialog --backtitle "`backtitle`" \ - --checklist "Select synoinfo to remove" 0 0 0 ${ITEMS} \ + --checklist "Select synoinfo entry to remove" 0 0 0 ${ITEMS} \ 2>"${TMP_PATH}/resp" [ $? -ne 0 ] && continue RESP=`<"${TMP_PATH}/resp"` @@ -446,15 +450,7 @@ function synoinfoMenu() { for KEY in ${!SYNOINFO[@]}; do ITEMS+="${KEY}: ${SYNOINFO[$KEY]}\n" done - dialog --backtitle "`backtitle`" --title "User synoinfo" \ - --aspect 18 --msgbox "${ITEMS}" 0 0 - ;; - m) - ITEMS="" - while IFS="=" read KEY VALUE; do - ITEMS+="${KEY}: ${VALUE}\n" - done < <(readModelMap "${MODEL}" "builds.${BUILD}.synoinfo") - dialog --backtitle "`backtitle`" --title "Model/build synoinfo" \ + dialog --backtitle "`backtitle`" --title "Synoinfo entries" \ --aspect 18 --msgbox "${ITEMS}" 0 0 ;; e) return ;; diff --git a/files/board/arpl/overlayfs/opt/arpl/ramdisk-patch.sh b/files/board/arpl/overlayfs/opt/arpl/ramdisk-patch.sh index 86efdbb5..419eb6d2 100755 --- a/files/board/arpl/overlayfs/opt/arpl/ramdisk-patch.sh +++ b/files/board/arpl/overlayfs/opt/arpl/ramdisk-patch.sh @@ -44,10 +44,7 @@ RD_COMPRESSED="`readModelKey "${MODEL}" "builds.${BUILD}.rd-compressed"`" declare -A SYNOINFO declare -A ADDONS -# Read more config -while IFS="=" read KEY VALUE; do - [ -n "${KEY}" ] && SYNOINFO["${KEY}"]="${VALUE}" -done < <(readModelMap "${MODEL}" "builds.${BUILD}.synoinfo") +# Read synoinfo and addons from config while IFS="=" read KEY VALUE; do [ -n "${KEY}" ] && SYNOINFO["${KEY}"]="${VALUE}" done < <(readConfigMap "synoinfo" "${USER_CONFIG_FILE}")