1
|
1
|
#!/bin/bash
|
2
|
2
|
|
|
3
|
+if [ $# -eq 0 ]; then
|
|
4
|
+ echo "Usage: ./tba-fetch-deps.sh --\$MODE"
|
|
5
|
+ echo " modes:"
|
|
6
|
+ echo " --nightly Downloads the needed assets from the nightlies build server. Use when local version matches nightly build server version."
|
|
7
|
+ echo " --tbb PATH Harvest most recently built assets from PATH assuming it points to a tor-browser-build dir. Use when local version does NOT match nightly build server version."
|
|
8
|
+ exit -1
|
|
9
|
+fi
|
|
10
|
+
|
|
11
|
+TBB_BUILD_06="https://tb-build-06.torproject.org/~tb-builder/tor-browser-build/out"
|
|
12
|
+
|
|
13
|
+if [[ $1 == "--tbb" && -z $2 ]]; then
|
|
14
|
+ echo "--tbb needs path to tor-browser-build dir"
|
|
15
|
+ exit -1
|
|
16
|
+fi
|
|
17
|
+TBB_PATH=$2
|
|
18
|
+
|
3
|
19
|
cd "$(dirname $(realpath "$0"))/.."
|
4
|
20
|
|
5
|
21
|
if [ -z "$TOR_BROWSER_BUILD" ]; then
|
6
|
22
|
TOR_BROWSER_BUILD=../../../../tor-browser-build
|
7
|
23
|
fi
|
8
|
24
|
|
9
|
|
-tor_expert_bundle_aar="$(ls -1td "$TOR_BROWSER_BUILD/out/tor-expert-bundle-aar/"tor-expert-bundle-aar-* | head -1)"
|
10
|
|
-if [ -z "tor_expert_bundle_aar" ]; then
|
|
25
|
+echo "Fetching tor-expert-bundle.aar..."
|
|
26
|
+
|
|
27
|
+if [[ $1 == "--tbb" ]]; then
|
|
28
|
+ tor_expert_bundle_aar="$(ls -1td "$TOR_BROWSER_BUILD/out/tor-expert-bundle-aar/"tor-expert-bundle-aar-* | head -1)"
|
|
29
|
+ cp "$tor_expert_bundle_aar"/* app/
|
|
30
|
+else
|
|
31
|
+ tor_expert_bundle_aar_dirname="$(curl -s $TBB_BUILD_06/tor-expert-bundle-aar/ | sed -nE 's/.*href=\"(tor-expert-bundle-aar-[0-9a-z\.\-]*).*/\1/p')"
|
|
32
|
+ curl -o app/tor-expert-bundle.aar $TBB_BUILD_06/tor-expert-bundle-aar/$tor_expert_bundle_aar_dirname/tor-expert-bundle.aar
|
|
33
|
+fi
|
|
34
|
+
|
|
35
|
+if [ -z app/tor_expert_bundle.aar ]; then
|
11
|
36
|
echo "Cannot find Tor Expert Bundle arr artifacts!"
|
12
|
37
|
exit 2
|
13
|
38
|
fi
|
|
39
|
+echo ""
|
14
|
40
|
|
15
|
|
-cp "$tor_expert_bundle_aar"/* app/
|
|
41
|
+echo "Fetching noscript..."
|
16
|
42
|
|
17
|
|
-noscript="$(find "$TOR_BROWSER_BUILD/out/browser" -name 'noscript*.xpi' -print | sort | tail -1)"
|
18
|
43
|
mkdir -p "app/src/main/assets/extensions"
|
19
|
|
-if [ -f "$noscript" ]; then
|
20
|
|
- cp "$noscript" "app/src/main/assets/extensions/{73a6fe31-595d-460b-a920-fcc0f8843232}.xpi"
|
|
44
|
+
|
|
45
|
+if [[ $1 == "--tbb" ]]; then
|
|
46
|
+ noscript="$(find "$TOR_BROWSER_BUILD/out/browser" -name 'noscript*.xpi' -print | sort | tail -1)"
|
|
47
|
+ cp "$noscript" "app/src/main/assets/extensions/{73a6fe31-595d-460b-a920-fcc0f8843232}.xpi"
|
|
48
|
+else
|
|
49
|
+ noscript_fname="$(curl -s $TBB_BUILD_06/browser/ | sed -nE 's/.*href=\"(noscript-[0-9a-z\.\-]*).*/\1/p')"
|
|
50
|
+ curl -o "app/src/main/assets/extensions/{73a6fe31-595d-460b-a920-fcc0f8843232}.xpi" $TBB_BUILD_06/browser/$noscript_fname
|
21
|
51
|
fi
|
|
52
|
+echo ""
|
22
|
53
|
|
23
|
54
|
if [ -z "$GRADLE_MAVEN_REPOSITORIES" ]; then
|
24
|
55
|
GRADLE_MAVEN_REPOSITORIES="$HOME/.m2/repository"
|
... |
... |
@@ -47,7 +78,18 @@ if [ "$os" = "unsupported" ] || [ "$arch" = "unsupported" ]; then |
47
|
78
|
exit 2
|
48
|
79
|
fi
|
49
|
80
|
|
50
|
|
-app_services="$(ls -1t "$TOR_BROWSER_BUILD/out/application-services/"application-services*.tar.zst | head -1)"
|
|
81
|
+echo "Fetching application-services..."
|
|
82
|
+
|
|
83
|
+if [[ $1 == "--tbb" ]]; then
|
|
84
|
+ app_services="$(ls -1t "$TOR_BROWSER_BUILD/out/application-services/"application-services*.tar.zst | head -1)"
|
|
85
|
+ tar -C /tmp -xf "$app_services"
|
|
86
|
+else
|
|
87
|
+ app_services_fname="$(curl -s $TBB_BUILD_06/application-services/ | sed -nE 's/.*href=\"(application-services-[0-9a-z\.\-]*).*/\1/p')"
|
|
88
|
+ app_services=/tmp/$app_services_fname
|
|
89
|
+ curl -o $app_services $TBB_BUILD_06/application-services/$app_services_fname
|
|
90
|
+ tar -C /tmp -xf "$app_services"
|
|
91
|
+ rm "$app_services"
|
|
92
|
+fi
|
51
|
93
|
mkdir -p "$GRADLE_MAVEN_REPOSITORIES/org/mozilla"
|
52
|
94
|
if [ -f "$app_services" ]; then
|
53
|
95
|
tar -C /tmp -xf "$app_services"
|