@@ -15,12 +15,12 @@ set -e
1515# despite not being linked at the download page
1616
1717if test -z " $2 " ; then
18- echo " Usage: $0 <RESILIO_SYNC_VERSION> <OUTPUT_TARBALL >" >&2
18+ echo " Usage: $0 <RESILIO_SYNC_VERSION> <BUILD >" >&2
1919 exit 1
2020fi
2121
2222RELEASE=" $1 "
23- OUTPUT =" $2 "
23+ BUILD =" $2 "
2424
2525ARCHITECTURE=` uname -r`
2626# Figure out with:
@@ -58,17 +58,16 @@ ARCHITECTURE=`uname -r`
5858# with <ARCH> one of amd64, arm64, armel, i386
5959# <OS_ARCH> is armhf for the linux/arm64/v8 images and armel for the linux/arm/v7 images
6060
61- which dpkg-architecture
61+ which dpkg-architecture > /dev/null
6262
6363OS_ARCH=` dpkg-architecture 2> /dev/null | grep DEB_HOST_ARCH= | cut -f2 -d=`
6464
6565case " $OS_ARCH " in
66- amd64) ARCHITECTURE=' x64 ' ;;
66+ amd64) ARCHITECTURE=' amd64 ' ;;
6767 i386) ARCHITECTURE=' i386' ;;
6868 arm64) ARCHITECTURE=' arm64' ;;
6969 armhf) ARCHITECTURE=' armhf' ;;
70- # In practice I'm disabling the arm version since both v7l and v8 use armhf
71- arm|armel|arm* ) ARCHITECTURE=' arm' ;;
70+ arm|armel|arm* ) ARCHITECTURE=' armel' ;;
7271 # TODO:
7372 * )
7473 echo " Error, architecture: $OS_ARCH " >&2
@@ -77,14 +76,31 @@ case "$OS_ARCH" in
7776esac
7877
7978# See https://www.resilio.com/platforms/desktop/
80- URL=" https://download-cdn.resilio.com/$RELEASE /linux-$ARCHITECTURE /resilio-sync_$ARCHITECTURE .tar.gz"
81- # NOTE: With 2.8.0 the URL format changes (old versions appear to remain in the old URLs).
82- # XXX: Will the new url point to whatever is the latest version?
83- if [ $RELEASE = ' 2.8.0' ]; then
84- URL=" https://download-cdn.resilio.com/stable/linux/$ARCHITECTURE /0/resilio-sync_$ARCHITECTURE .tar.gz"
85- fi
79+ # URL="https://download-cdn.resilio.com/$RELEASE/linux-$ARCHITECTURE/resilio-sync_$ARCHITECTURE.tar.gz"
80+ # NOTES:
81+ # - With 2.8.0 the URL format changed (old versions appear to remain in the old URLs).
82+ # - The new url points to whatever is the current latest version
83+ # - Starting with 2.8.1 I use the deb archives instead
84+ URL=" https://download-cdn.resilio.com/stable/debian/$ARCHITECTURE /0/resilio-sync_$RELEASE .$BUILD -1_$ARCHITECTURE .deb"
85+
86+ OUTPUT=" pkg.deb"
8687
8788echo " Downloading [$URL ]" >&2
8889wget -O " $OUTPUT " " $URL "
8990
9091test -f " $OUTPUT "
92+
93+ # Extract contents mimicking the structure of the tarball (and the older docker
94+ # images'): binary and license only
95+ # Note the binary is the same in the deb and tarball
96+ ar x " $OUTPUT "
97+ tar -C /tmp -xf data.tar.* --strip-components 3 ./usr/bin/rslsync
98+ tar -C /tmp -xf data.tar.* --strip-components 5 ./usr/share/doc/resilio-sync/LICENSE.TXT
99+
100+ # Special case
101+ if [ $RELEASE = " 2.8.0" ]; then
102+ RELEASE=" 2.8"
103+ fi
104+
105+ # Validate version
106+ /tmp/rslsync --help 2>&1 | grep -q " Resilio Sync ${RELEASE} (${BUILD} )"
0 commit comments