mirror of
https://github.com/AuxXxilium/arv-v-dsm.git
synced 2024-11-23 23:10:58 +07:00
feat: Country detection
* feat: Country detection
This commit is contained in:
parent
c1d3d15d4e
commit
354bd2429b
@ -14,7 +14,8 @@ ARG DEBIAN_FRONTEND noninteractive
|
||||
|
||||
RUN apt-get update && apt-get -y upgrade && \
|
||||
apt-get --no-install-recommends -y install \
|
||||
tini \
|
||||
jq \
|
||||
tini \
|
||||
curl \
|
||||
cpio \
|
||||
wget \
|
||||
|
@ -21,17 +21,37 @@ fi
|
||||
# Display wait message
|
||||
/run/server.sh 5000 install &
|
||||
|
||||
# Download the required files from the Synology website
|
||||
DL="https://global.synologydownload.com/download/DSM"
|
||||
# Detect country
|
||||
COUNTRY=""
|
||||
{ JSON=$(curl -sfk https://ipinfo.io); rc=$?; } || :
|
||||
|
||||
if (( rc == 0 )); then
|
||||
{ COUNTRY=$(echo "$JSON" | jq -r '.country' 2> /dev/null); rc=$?; } || :
|
||||
(( rc != 0 )) || [[ "$COUNTRY" == "null" ]] && COUNTRY=""
|
||||
fi
|
||||
|
||||
if [[ -z "$COUNTRY" ]]; then
|
||||
{ JSON=$(curl -sfk https://api.ipapi.is); rc=$?; } || :
|
||||
if (( rc == 0 )); then
|
||||
{ COUNTRY=$(echo "$JSON" | jq -r '.location.country_code' 2> /dev/null); rc=$?; } || :
|
||||
(( rc != 0 )) || [[ "$COUNTRY" == "null" ]] && COUNTRY=""
|
||||
fi
|
||||
fi
|
||||
|
||||
# Select download mirror based on country
|
||||
if [ "$COUNTRY" == "CN" ]; then
|
||||
DL="https://cndl.synology.cn/download/DSM"
|
||||
else
|
||||
DL="https://global.synologydownload.com/download/DSM"
|
||||
fi
|
||||
|
||||
# Select default version based on architecture
|
||||
if [ -z "$URL" ]; then
|
||||
|
||||
if [ "$ARCH" == "amd64" ]; then
|
||||
URL="$DL/release/7.2.1/69057-1/DSM_VirtualDSM_69057.pat"
|
||||
else
|
||||
URL="$DL/release/7.0.1/42218/DSM_VirtualDSM_42218.pat"
|
||||
fi
|
||||
|
||||
fi
|
||||
|
||||
# Check if output is to interactive TTY
|
||||
@ -83,6 +103,8 @@ if [[ "$TMP" != "$STORAGE/tmp" ]]; then
|
||||
(( MIN_SPACE > SPACE )) && error "Not enough free space for installation in ${STORAGE}, have ${SPACE_GB} GB available but need at least 6 GB." && exit 94
|
||||
fi
|
||||
|
||||
# Download the required files from the Synology website
|
||||
|
||||
RDC="$STORAGE/dsm.rd"
|
||||
|
||||
if [ ! -f "${RDC}" ]; then
|
||||
|
Loading…
Reference in New Issue
Block a user