fix downloadExts

This commit is contained in:
Ing 2024-04-18 05:48:33 +08:00
parent 56b54f26f9
commit bcf61311f5
2 changed files with 24 additions and 24 deletions

View File

@ -263,13 +263,13 @@ else
fi fi
# Executes DSM kernel via KEXEC # Executes DSM kernel via KEXEC
KEXECARGS=""
KVER=$(readModelKey "${MODEL}" "productvers.[${PRODUCTVER}].kver") KVER=$(readModelKey "${MODEL}" "productvers.[${PRODUCTVER}].kver")
if [ "${KVER:0:1}" = "3" -a ${EFI} -eq 1 ]; then if [ "${KVER:0:1}" = "3" -a ${EFI} -eq 1 ]; then
echo -e "\033[1;33m$(TEXT "Warning, running kexec with --noefi param, strange things will happen!!")\033[0m" echo -e "\033[1;33m$(TEXT "Warning, running kexec with --noefi param, strange things will happen!!")\033[0m"
kexec --noefi -l "${MOD_ZIMAGE_FILE}" --initrd "${MOD_RDGZ_FILE}" --command-line="${CMDLINE_LINE}" >"${LOG_FILE}" 2>&1 || dieLog KEXECARGS="--noefi"
else
kexec -l "${MOD_ZIMAGE_FILE}" --initrd "${MOD_RDGZ_FILE}" --command-line="${CMDLINE_LINE}" >"${LOG_FILE}" 2>&1 || dieLog
fi fi
kexec ${KEXECARGS} -l "${MOD_ZIMAGE_FILE}" --initrd "${MOD_RDGZ_FILE}" --command-line="${CMDLINE_LINE}" >"${LOG_FILE}" 2>&1 || dieLog
echo -e "\033[1;37m$(TEXT "Booting ...")\033[0m" echo -e "\033[1;37m$(TEXT "Booting ...")\033[0m"
for T in $(w 2>/dev/null | grep -v "TTY" | awk -F' ' '{print $2}'); do for T in $(w 2>/dev/null | grep -v "TTY" | awk -F' ' '{print $2}'); do
echo -e "\n\033[1;43m$(TEXT "[This interface will not be operational. Please wait a few minutes.\nFind DSM via http://find.synology.com/ or Synology Assistant and connect.]")\033[0m\n" >"/dev/${T}" 2>/dev/null || true echo -e "\n\033[1;43m$(TEXT "[This interface will not be operational. Please wait a few minutes.\nFind DSM via http://find.synology.com/ or Synology Assistant and connect.]")\033[0m\n" >"/dev/${T}" 2>/dev/null || true

View File

@ -2686,7 +2686,7 @@ function downloadExts() {
else else
MSG="" MSG=""
MSG+="Latest: ${TAG}\n\n" MSG+="Latest: ${TAG}\n\n"
MSG+="$(curl -skL --connect-timeout 10 "${PROXY}${3}/releases/tag/${TAG}" | pup 'div[data-test-selector="body-content"]' | html2text -utf8)\n\n" MSG+="$(curl -skL --connect-timeout 10 "${PROXY}${3}/releases/tag/${TAG}" | pup 'div[data-test-selector="body-content"]' | html2text --ignore-links --ignore-images)\n\n"
MSG+="$(TEXT "Do you want to update?")" MSG+="$(TEXT "Do you want to update?")"
if [ "${5}" = "-1" ]; then if [ "${5}" = "-1" ]; then
echo "${T} - ${MSG}" echo "${T} - ${MSG}"
@ -2699,35 +2699,35 @@ function downloadExts() {
--infobox "$(echo -e "${MSG}")" 0 0 --infobox "$(echo -e "${MSG}")" 0 0
fi fi
fi fi
if [ "${5}" = "-1" ]; then function __download() {
(
rm -f ${TMP_PATH}/${4}*.zip rm -f ${TMP_PATH}/${4}*.zip
touch "${TMP_PATH}/${4}-${TAG}.zip.downloading" touch "${TMP_PATH}/${4}-${TAG}.zip.downloading"
STATUS=$(curl -kL --connect-timeout 10 -w "%{http_code}" "${PROXY}${3}/releases/download/${TAG}/${4}-${TAG}.zip" -o "${TMP_PATH}/${4}-${TAG}.zip") STATUS=$(curl -kL --connect-timeout 10 -w "%{http_code}" "${PROXY}${3}/releases/download/${TAG}/${4}-${TAG}.zip" -o "${TMP_PATH}/${4}-${TAG}.zip")
RET=$? RET=$?
rm -f "${TMP_PATH}/${4}-${TAG}.zip.downloading" rm -f "${TMP_PATH}/${4}-${TAG}.zip.downloading"
) 2>&1
else
(
rm -f ${TMP_PATH}/${4}*.zip
touch "${TMP_PATH}/${4}-${TAG}.zip.downloading"
STATUS=$(curl -kL --connect-timeout 10 -w "%{http_code}" "${PROXY}${3}/releases/download/${TAG}/${4}-${TAG}.zip" -o "${TMP_PATH}/${4}-${TAG}.zip")
RET=$?
rm -f "${TMP_PATH}/${4}-${TAG}.zip.downloading"
) 2>&1 | DIALOG --title "${T}" \
--progressbox "$(TEXT "Downloading ...")" 20 100
fi
if [ ${RET} -ne 0 -o ${STATUS:-0} -ne 200 ]; then if [ ${RET} -ne 0 -o ${STATUS:-0} -ne 200 ]; then
rm -f "${TMP_PATH}/${4}-${TAG}.zip" rm -f "${TMP_PATH}/${4}-${TAG}.zip"
MSG="$(printf "$(TEXT "Error downloading new version.\nError: %d:%d\n(Please via https://curl.se/libcurl/c/libcurl-errors.html check error description.)")" "${RET}" "${STATUS}")" MSG="$(printf "$(TEXT "Error downloading new version.\nError: %d:%d\n(Please via https://curl.se/libcurl/c/libcurl-errors.html check error description.)")" "${RET}" "${STATUS}")"
echo -e "${MSG}" > "${LOG_FILE}"
fi
return 0
}
rm -f "${LOG_FILE}"
if [ "${5}" = "-1" ]; then if [ "${5}" = "-1" ]; then
echo "${T} - ${MSG}" __download $@ 2>&1
else
__download $@ 2>&1 | DIALOG --title "${T}" \
--progressbox "$(TEXT "Downloading ...")" 20 100
fi
if [ -f "${LOG_FILE}" ]; then
if [ "${5}" = "-1" ]; then
echo "${T} - $(cat "${LOG_FILE}")"
elif [ "${5}" = "0" ]; then elif [ "${5}" = "0" ]; then
DIALOG --title "${T}" \ DIALOG --title "${T}" \
--msgbox "${MSG}" 0 0 --msgbox "$(cat "${LOG_FILE}")" 0 0
else else
DIALOG --title "${T}" \ DIALOG --title "${T}" \
--infobox "${MSG}" 0 0 --infobox "$(cat "${LOG_FILE}")" 0 0
fi fi
return 1 return 1
fi fi