1
|
|
-#!/bin/bash
|
2
|
|
-
|
3
|
|
-# This script allows you to repackage a Tor Browser bundle using an
|
4
|
|
-# obj-x86_64-pc-linux-gnu directory from a local tor-browser.git build.
|
5
|
|
-#
|
6
|
|
-# This script will download the current Tor Browser version (using
|
7
|
|
-# var/torbrowser_version from rbm config, or an optional second argument)
|
8
|
|
-# and repackage it with the specified obj directory.
|
9
|
|
-#
|
10
|
|
-# The new repackaged bundle can be found in the _repackaged directory.
|
11
|
|
-
|
12
|
|
-set -e
|
13
|
|
-
|
14
|
|
-display_usage() {
|
15
|
|
- echo -e "\\nUsage: $0 firefox_obj_path [torbrowser-version]\\n"
|
16
|
|
-}
|
17
|
|
-if [ $# -lt 1 ] || [ $# -gt 2 ]
|
18
|
|
-then
|
19
|
|
- display_usage
|
20
|
|
- exit 1
|
21
|
|
-fi
|
22
|
|
-
|
23
|
|
-DIRNAME="$( cd "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )"
|
24
|
|
-OBJ_PATH=$1
|
25
|
|
-if [ $# -eq 2 ]
|
26
|
|
-then
|
27
|
|
- TOR_VERSION="$2"
|
28
|
|
-else
|
29
|
|
- TOR_VERSION=$("$DIRNAME"/../rbm/rbm showconf tor-browser var/torbrowser_version)
|
30
|
|
-fi
|
31
|
|
-TOR_FILENAME=tor-browser-linux64-${TOR_VERSION}_en-US.tar.xz
|
32
|
|
-TOR_BROWSER_URL=https://dist.torproject.org/torbrowser/"${TOR_VERSION}"/"${TOR_FILENAME}"
|
33
|
|
-TMPDIR="$(mktemp -d)"
|
34
|
|
-
|
35
|
|
-(
|
36
|
|
-cd "$TMPDIR"
|
37
|
|
-wget "$TOR_BROWSER_URL"
|
38
|
|
-wget "$TOR_BROWSER_URL".asc
|
39
|
|
-gpg --no-default-keyring --keyring "$DIRNAME"/../keyring/torbrowser.gpg --verify "${TOR_FILENAME}".asc "${TOR_FILENAME}"
|
40
|
|
-
|
41
|
|
-# From projects/firefox/build: replace firefox binary by the wrapper and strip libraries/binaries
|
42
|
|
-tar xf "${TOR_FILENAME}"
|
43
|
|
-cp -r "${OBJ_PATH}"/dist/firefox .
|
44
|
|
-rm firefox/firefox-bin
|
45
|
|
-mv firefox/firefox firefox/firefox.real
|
46
|
|
-for LIB in firefox/*.so firefox/gtk2/*.so firefox/firefox.real firefox/plugin-container firefox/updater
|
47
|
|
-do
|
48
|
|
- strip "$LIB"
|
49
|
|
-done
|
50
|
|
-
|
51
|
|
-# Overwrite extracted tor-browser with locally built files and move to _repackaged folder
|
52
|
|
-cp -r firefox/* tor-browser_en-US/Browser
|
53
|
|
-rm -rf firefox "${TOR_FILENAME}"
|
54
|
|
-REPACKAGED_DIR="$DIRNAME"/_repackaged/
|
55
|
|
-mkdir -p "$REPACKAGED_DIR"
|
56
|
|
-mv tor-browser_en-US "$REPACKAGED_DIR"/tor-browser-"$(date '+%Y%m%d%H%M%S')"
|
57
|
|
-rm -rf "$TMPDIR"
|
58
|
|
-) |