-
Notifications
You must be signed in to change notification settings - Fork 83
/
sync_binaries.sh
executable file
·84 lines (71 loc) · 2.92 KB
/
sync_binaries.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
#!/usr/bin/env bash
# Make sure S3Location is set
if [ -z "$S3Location" ]
then
echo "\$S3Location must be set. Please set the S3Location"
exit
fi
declare -a OS_VALUE=("darwin" "linux")
declare -a ARCH_VALUE=("386" "amd64" "arm" "arm64")
cd ../btfs-binary-releases
# Delete existing files
echo "=== Deleting existing files ==="
rm -rf ./darwin/386/*
rm -rf ./darwin/amd64/*
rm -rf ./linux/386/*
rm -rf ./linux/amd64/*
rm -rf ./linux/arm/*
rm -rf ./linux/arm64/*
rm -rf ./windows/386/*
rm -rf ./windows/amd64/*
echo "=== Completed deleting existing files ==="
# Get the version for fs-repo-migrations
curl -fsSL -O https://github.com/TRON-US/btfs-distributions/raw/master/fs-repo-migrations/versions
if [ $? -eq 0 ]
then
VERSION=$(cat versions | sort -V | tail -n 1)
rm -f versions
else
echo "Download of fs-repo-migrations version file failed, confirm your internet connection to GitHub is working and rerun this script."
exit 1
fi
# Download files for macOS and Linux
for OS in ${OS_VALUE[@]}; do
for ARCH in ${ARCH_VALUE[@]}; do
if [[ ${OS} = "darwin" && ( ${ARCH} = "arm64" || ${ARCH} = "arm" ) ]]; then continue; fi
echo "=== Performing dload for "$OS" "$ARCH" ==="
cd "$OS"/"$ARCH"
wget -q distributions.btfs.io/"$S3Location"/"$OS"/"$ARCH"/btfs-"$OS"-"$ARCH".tar.gz
gunzip btfs-"$OS"-"$ARCH".tar.gz
tar -xf btfs-"$OS"-"$ARCH".tar
wget -q distributions.btfs.io/"$S3Location"/"$OS"/"$ARCH"/update-"$OS"-"$ARCH".tar.gz
tar -xzf update-"$OS"-"$ARCH".tar.gz
rm update-"$OS"-"$ARCH".tar.gz
URL="https://github.com/TRON-US/btfs-distributions/raw/master/fs-repo-migrations/${VERSION}/fs-repo-migrations_${VERSION}_${OS}-${ARCH}.tar.gz"
wget -q "$URL"
tar -xzf fs-repo-migrations_${VERSION}_${OS}-${ARCH}.tar.gz
mv fs-repo-migrations/fs-repo-migrations fs-repo-migrations-${OS}-${ARCH}
rm -f fs-repo-migrations_${VERSION}_${OS}-${ARCH}.tar.gz
rm -rf fs-repo-migrations
cd ../..
done
done
# Download files for Windows
OS="windows"
for ARCH in ${ARCH_VALUE[@]}; do
if [[ ${ARCH} = "arm64" || ${ARCH} = "arm" ]]; then continue; fi
echo "=== Performing dload for windows "$ARCH" ==="
cd windows/"$ARCH"
wget -q distributions.btfs.io/"$S3Location"/windows/"$ARCH"/btfs-windows-"$ARCH".zip
unzip -q btfs-windows-"$ARCH".zip
wget -q distributions.btfs.io/"$S3Location"/windows/"$ARCH"/update-windows-"$ARCH".zip
unzip -q update-windows-"$ARCH".zip
rm update-windows-"$ARCH".zip
URL="https://github.com/TRON-US/btfs-distributions/raw/master/fs-repo-migrations/${VERSION}/fs-repo-migrations_${VERSION}_${OS}-${ARCH}.zip"
wget -q "$URL"
unzip -q fs-repo-migrations_${VERSION}_${OS}-${ARCH}.zip
mv fs-repo-migrations/fs-repo-migrations.exe fs-repo-migrations-${OS}-${ARCH}.exe
rm -f fs-repo-migrations_${VERSION}_${OS}-${ARCH}.zip
rm -rf fs-repo-migrations
cd ../..
done