Skip to content

Commit

Permalink
feat: Country detection
Browse files Browse the repository at this point in the history
  • Loading branch information
kroese authored Dec 5, 2023
1 parent 3808ed6 commit 515ca83
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions src/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ if [ -z "$DL" ]; then
fi

if [ -z "$URL" ]; then
# Select default version based on architecture
if [ "$ARCH" == "amd64" ]; then
URL="$DL/release/7.2.1/69057-1/DSM_VirtualDSM_69057.pat"
else
Expand All @@ -50,7 +49,10 @@ fi

BASE=$(basename "$URL" .pat)

rm -f "$STORAGE"/"$BASE".pat
if [[ "$URL" != "file://${STORAGE}/${BASE}.pat" ]]; then
rm -f "$STORAGE"/"$BASE".pat
fi

rm -f "$STORAGE"/"$BASE".agent
rm -f "$STORAGE"/"$BASE".boot.img
rm -f "$STORAGE"/"$BASE".system.img
Expand Down Expand Up @@ -175,9 +177,17 @@ info "Install: Downloading $(basename "$URL")..."
PAT="/$BASE.pat"
rm -f "$PAT"

{ wget "$URL" -O "$PAT" -q --no-check-certificate --show-progress "$PROGRESS"; rc=$?; } || :
if [[ "$URL" == "file://"* ]]; then

cp "${URL:7}" "$PAT"

else

{ wget "$URL" -O "$PAT" -q --no-check-certificate --show-progress "$PROGRESS"; rc=$?; } || :
(( rc != 0 )) && error "Failed to download $URL, reason: $rc" && exit 69

fi

(( rc != 0 )) && error "Failed to download $URL, reason: $rc" && exit 69
[ ! -f "$PAT" ] && error "Failed to download $URL" && exit 69

SIZE=$(stat -c%s "$PAT")
Expand Down

0 comments on commit 515ca83

Please sign in to comment.