From 4fb398cec393f30d19c41fe46788ebcc0cdba2a8 Mon Sep 17 00:00:00 2001 From: Ing Date: Fri, 10 May 2024 20:32:07 +0800 Subject: [PATCH] fix update check --- files/initrd/opt/rr/init.sh | 12 ++++++++++++ update-check.sh | 5 +++-- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/files/initrd/opt/rr/init.sh b/files/initrd/opt/rr/init.sh index 00f5ee76..20d96777 100755 --- a/files/initrd/opt/rr/init.sh +++ b/files/initrd/opt/rr/init.sh @@ -64,6 +64,18 @@ initConfigKey "addons.mountloader" "" "${USER_CONFIG_FILE}" initConfigKey "addons.reboottoloader" "" "${USER_CONFIG_FILE}" initConfigKey "modules" "{}" "${USER_CONFIG_FILE}" +# for update +if [ -f "${PART2_PATH}/GRUB_VER" ]; then + PLATFORMTMP="$(_get_conf_kv "PLATFORM" "${PART2_PATH}/GRUB_VER")" + MODELTMP="$(_get_conf_kv "MODEL" "${PART2_PATH}/GRUB_VER")" + [ -z "$(readConfigKey "platform" "${USER_CONFIG_FILE}")" ] && + writeConfigKey "platform" "${PLATFORMTMP,,}" "${USER_CONFIG_FILE}" + [ -z "$(readConfigKey "model" "${USER_CONFIG_FILE}")" ] && + writeConfigKey "model" "$(echo ${MODELTMP} | sed 's/d$/D/; s/rp$/RP/; s/rp+/RP+/')" "${USER_CONFIG_FILE}" + [ -z "$(readConfigKey "modelid" "${USER_CONFIG_FILE}")" ] && + writeConfigKey "modelid" "${MODELTMP}" "${USER_CONFIG_FILE}" +fi + if [ ! "LOCALBUILD" = "${LOADER_DISK}" ]; then _sort_netif "$(readConfigKey "addons.sortnetif" "${USER_CONFIG_FILE}")" diff --git a/update-check.sh b/update-check.sh index d91efe9e..361e5441 100755 --- a/update-check.sh +++ b/update-check.sh @@ -1,6 +1,7 @@ #!/usr/bin/env bash # rr -[ ! "rr" = "$(hostname)" ] && exit 1 +[ "rr" = "$(hostname)" ] && exit 0 # in RR +[ -f "/usr/rr/VERSION" ] && exit 0 # in DSM -exit 0 +exit 1