Skip to content

Commit

Permalink
arc: temp workaround part 1
Browse files Browse the repository at this point in the history
Signed-off-by: AuxXxilium <[email protected]>
  • Loading branch information
AuxXxilium committed Aug 26, 2024
1 parent 82e403e commit 4542fd4
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 41 deletions.
5 changes: 4 additions & 1 deletion files/initrd/opt/arc/arc-functions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,11 @@ function addonSelection() {
writeConfigKey "addons.\"${ADDON}\"" "" "${USER_CONFIG_FILE}"
done
ADDONSINFO="$(readConfigEntriesArray "addons" "${USER_CONFIG_FILE}")"
if [ "${PRODUCTVER}" == "7.2" ]; then
ADDONSINFO+="\n\n\Z1Warning: \ZnDSM 7.2.2 isn't supported by all Addons!"
fi
dialog --backtitle "$(backtitle)" --title "DSM Addons" \
--msgbox "DSM Addons selected:\n${ADDONSINFO}" 0 0
--msgbox "DSM Addons selected:\n${ADDONSINFO}" 8 50
}

###############################################################################
Expand Down
92 changes: 52 additions & 40 deletions files/initrd/opt/arc/arc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,7 @@ function arcVersion() {
resp=$(cat ${TMP_PATH}/resp)
[ -z "${resp}" ] && return 1
if [ "${PRODUCTVER}" != "${resp}" ]; then
[ "${PRODUCTVER}" == "7.2.2" ] && PRODUCTVER="7.2"
PRODUCTVER="${resp}"
writeConfigKey "productver" "${PRODUCTVER}" "${USER_CONFIG_FILE}"
# Delete old files
Expand Down Expand Up @@ -643,57 +644,66 @@ function make() {
[ -d "${UNTAR_PAT_PATH}" ] && rm -rf "${UNTAR_PAT_PATH}"
mkdir -p "${UNTAR_PAT_PATH}"
if [ "${OFFLINE}" == "false" ]; then
# Get PAT Data
dialog --backtitle "$(backtitle)" --colors --title "Arc Build" \
--infobox "Get PAT Data from Syno..." 3 40
idx=0
while [ ${idx} -le 3 ]; do # Loop 3 times, if successful, break
local URL="https://www.synology.com/api/support/findDownloadInfo?lang=en-us&product=${MODEL/+/%2B}&major=${PRODUCTVER%%.*}&minor=${PRODUCTVER##*.}"
if [ "${ARCNIC}" == "auto" ]; then
PAT_DATA="$(curl -skL -m 10 "${URL}")"
else
PAT_DATA="$(curl --interface ${ARCNIC} -skL -m 10 "${URL}")"
fi
if [ "$(echo ${PAT_DATA} | jq -r '.success' 2>/dev/null)" == "true" ]; then
if echo ${PAT_DATA} | jq -r '.info.system.detail[0].items[0].files[0].label_ext' 2>/dev/null | grep -q 'pat'; then
PAT_URL=$(echo ${PAT_DATA} | jq -r '.info.system.detail[0].items[0].files[0].url')
PAT_HASH=$(echo ${PAT_DATA} | jq -r '.info.system.detail[0].items[0].files[0].checksum')
PAT_URL=${PAT_URL%%\?*}
if [ -n "${PAT_URL}" ] && [ -n "${PAT_HASH}" ]; then
if echo "${PAT_URL}" | grep -q "https://"; then
VALID=true
break
fi
fi
fi
fi
sleep 3
idx=$((${idx} + 1))
done
if [ "${VALID}" == "false" ]; then
if [ "${PRODUCTVER}" == "7.2.1" ]; then
# Get PAT Data
dialog --backtitle "$(backtitle)" --colors --title "Arc Build" \
--infobox "Get PAT Data from Local File..." 3 40
PAT_URL="$(readConfigKey "${MODEL}.${PRODUCTVER}.url" "${D_FILE}")"
PAT_HASH="$(readConfigKey "${MODEL}.${PRODUCTVER}.hash" "${D_FILE}")"
else
[ "${PRODUCTVER}" == "7.2.2" ] && PRODUCTVER="7.2"
# Get PAT Data
dialog --backtitle "$(backtitle)" --colors --title "Arc Build" \
--infobox "Get PAT Data from Github..." 3 40
--infobox "Get PAT Data from Syno..." 3 40
idx=0
while [ ${idx} -le 3 ]; do # Loop 3 times, if successful, break
URL="https://raw.githubusercontent.com/AuxXxilium/arc-dsm/main/dsm/${MODEL/+/%2B}/${PRODUCTVER}/pat_url"
HASH="https://raw.githubusercontent.com/AuxXxilium/arc-dsm/main/dsm/${MODEL/+/%2B}/${PRODUCTVER}/pat_hash"
local URL="https://www.synology.com/api/support/findDownloadInfo?lang=en-us&product=${MODEL/+/%2B}&major=${PRODUCTVER%%.*}&minor=${PRODUCTVER##*.}"
if [ "${ARCNIC}" == "auto" ]; then
PAT_URL="$(curl -skL -m 10 "${URL}")"
PAT_HASH="$(curl -skL -m 10 "${HASH}")"
PAT_DATA="$(curl -skL -m 10 "${URL}")"
else
PAT_URL="$(curl --interface ${ARCNIC} -m 10 -skL "${URL}")"
PAT_HASH="$(curl --interface ${ARCNIC} -m 10 -skL "$HASH")"
PAT_DATA="$(curl --interface ${ARCNIC} -skL -m 10 "${URL}")"
fi
PAT_URL=${PAT_URL%%\?*}
if [ -n "${PAT_URL}" ] && [ -n "${PAT_HASH}" ]; then
if echo "${PAT_URL}" | grep -q "https://"; then
VALID="true"
break
if [ "$(echo ${PAT_DATA} | jq -r '.success' 2>/dev/null)" == "true" ]; then
if echo ${PAT_DATA} | jq -r '.info.system.detail[0].items[0].files[0].label_ext' 2>/dev/null | grep -q 'pat'; then
PAT_URL=$(echo ${PAT_DATA} | jq -r '.info.system.detail[0].items[0].files[0].url')
PAT_HASH=$(echo ${PAT_DATA} | jq -r '.info.system.detail[0].items[0].files[0].checksum')
PAT_URL=${PAT_URL%%\?*}
if [ -n "${PAT_URL}" ] && [ -n "${PAT_HASH}" ]; then
if echo "${PAT_URL}" | grep -q "https://"; then
VALID=true
break
fi
fi
fi
fi
sleep 3
idx=$((${idx} + 1))
done
if [ "${VALID}" == "false" ]; then
dialog --backtitle "$(backtitle)" --colors --title "Arc Build" \
--infobox "Get PAT Data from Github..." 3 40
idx=0
while [ ${idx} -le 3 ]; do # Loop 3 times, if successful, break
URL="https://raw.githubusercontent.com/AuxXxilium/arc-dsm/main/dsm/${MODEL/+/%2B}/${PRODUCTVER}/pat_url"
HASH="https://raw.githubusercontent.com/AuxXxilium/arc-dsm/main/dsm/${MODEL/+/%2B}/${PRODUCTVER}/pat_hash"
if [ "${ARCNIC}" == "auto" ]; then
PAT_URL="$(curl -skL -m 10 "${URL}")"
PAT_HASH="$(curl -skL -m 10 "${HASH}")"
else
PAT_URL="$(curl --interface ${ARCNIC} -m 10 -skL "${URL}")"
PAT_HASH="$(curl --interface ${ARCNIC} -m 10 -skL "$HASH")"
fi
PAT_URL=${PAT_URL%%\?*}
if [ -n "${PAT_URL}" ] && [ -n "${PAT_HASH}" ]; then
if echo "${PAT_URL}" | grep -q "https://"; then
VALID="true"
break
fi
fi
sleep 3
idx=$((${idx} + 1))
done
fi
fi
if [ "${AUTOMATED}" == "false" ] && [ "${VALID}" == "false" ]; then
MSG="Failed to get PAT Data.\n"
Expand Down Expand Up @@ -912,6 +922,8 @@ if [ "${AUTOMATED}" == "true" ]; then
make
fi
else
dialog --backtitle "$(backtitle)" --title "Arc Warning" \
--msgbox "WARN: Be aware of using DSM 7.2.2 is not stable,\nall Addons and Patches are written for 7.2.1." 7 70
[ "${BUILDDONE}" == "true" ] && NEXT="3" || NEXT="1"
while true; do
echo "= \"\Z4========== Main ==========\Zn \" " >"${TMP_PATH}/menu"
Expand Down
1 change: 1 addition & 0 deletions files/initrd/opt/arc/include/consts.sh
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ S_FILE="${MODEL_CONFIG_PATH}/serials.yml"
S_FILE_ARC="${MODEL_CONFIG_PATH}/arc_serials.yml"
S_FILE_ENC="${MODEL_CONFIG_PATH}/arc_serials.enc"
P_FILE="${MODEL_CONFIG_PATH}/platforms.yml"
D_FILE="${MODEL_CONFIG_PATH}/data.yml"

EXTRACTOR_PATH="${PART3_PATH}/extractor"
EXTRACTOR_BIN="syno_extract_system_patch"

0 comments on commit 4542fd4

Please sign in to comment.