dsm: update

Signed-off-by: AuxXxilium <info@auxxxilium.tech>
This commit is contained in:
AuxXxilium 2023-07-05 17:11:46 +02:00
parent b2a884a7a7
commit 6d5affa482

View File

@ -14,19 +14,22 @@ function getDSM() {
UNTAR_PAT_PATH="${CACHE_PATH}/${MODEL}/${VERSION}" UNTAR_PAT_PATH="${CACHE_PATH}/${MODEL}/${VERSION}"
DESTINATION="${DSMPATH}/${MODEL}/${VERSION}" DESTINATION="${DSMPATH}/${MODEL}/${VERSION}"
DESTINATIONFILES="${FILESPATH}/${MODEL}/${VERSION}" DESTINATIONFILES="${FILESPATH}/${MODEL}/${VERSION}"
SYNOINFO="${DESTINATION}/synoinfo.yml"
PAT_MODEL=$(echo "${MODEL}" | sed -e 's/\./%2E/g' -e 's/+/%2B/g') PAT_MODEL="$(echo "${MODEL}" | sed -e 's/\./%2E/g' -e 's/+/%2B/g')"
PAT_MAJOR=$(echo "${VERSION}" | cut -b 1) PAT_MAJOR="$(echo "${VERSION}" | cut -b 1)"
PAT_MINOR=$(echo "${VERSION}" | cut -b 3) PAT_MINOR="$(echo "${VERSION}" | cut -b 3)"
echo "${MODEL} ${VERSION}" echo "${MODEL} ${VERSION}"
PAT_URL=$(curl -skL "https://www.synology.com/api/support/findDownloadInfo?lang=en-us&product=${PAT_MODEL}&major=${PAT_MAJOR}&minor=${PAT_MINOR}" | jq -r '.info.system.detail[0].items[0].files[0].url') curl -skL "https://www.synology.com/api/support/findDownloadInfo?lang=en-us&product=${PAT_MODEL}&major=${PAT_MAJOR}&minor=${PAT_MINOR}" >"${SYNOINFO}"
HASH=$(curl -skL "https://www.synology.com/api/support/findDownloadInfo?lang=en-us&product=${PAT_MODEL}&major=${PAT_MAJOR}&minor=${PAT_MINOR}" | jq -r '.info.system.detail[0].items[0].files[0].checksum') PAT_URL=$(cat "${SYNOINFO}" | jq -r '.info.system.detail[0].items[0].files[0].url')
HASH=$(cat "${SYNOINFO}" | jq -r '.info.system.detail[0].items[0].files[0].checksum')
echo "${PAT_URL} ${HASH}"
PAT_URL=${PAT_URL%%\?*} PAT_URL=${PAT_URL%%\?*}
OLDURL=$(cat "${DESTINATION}/pat_url") OLDURL="$(cat "${DESTINATION}/pat_url")"
OLDHASH=$(cat "${DESTINATION}/pat_hash") OLDHASH="$(cat "${DESTINATION}/pat_hash")"
if [ "${HASH}" != "${OLDHASH}" ] || [ "${PAT_URL}" != "${OLDURL}" ]; then if [ "${HASH}" != "${OLDHASH}" ] || [ "${PAT_URL}" != "${OLDURL}" ]; then
@ -98,7 +101,7 @@ function getDSM() {
echo "DSM extract Error: ${MODEL}_${BUILD}" echo "DSM extract Error: ${MODEL}_${BUILD}"
fi fi
cd ${HOME} cd ${HOME}
done < ${VERSIONSFILE} done <"${VERSIONSFILE}"
rm -f "${VERSIONSFILE}" rm -f "${VERSIONSFILE}"
} }