#!/bin/bash

## Copyright (C) 2012 - 2025 ENCRYPTED SUPPORT LLC <adrelanos@whonix.org>
## See the file COPYING for copying conditions.

## cp -r /home/user/.cache/tb /home/user/.cache/tb_

set -e
set -o pipefail

mydir="$( cd "$( dirname "$0" )" && pwd )"
cd "$mydir"
cd ../../../

export TBB_VERSIONS_FILE_LINK="file:///home/user/.cache/tb_/RecommendedTBBVersions"
export TBB_REMOTE_FOLDER="file:///home/user/.cache/tb_/RecommendedTBBVersions"

export TBB_SIG_LINK="file:///home/user/.cache/tb_/sha256sums.txt.asc"
export TBB_HASH_LINK="file:///home/user/.cache/tb_/sha256sums.txt"
export TBB_PACKAGE_LINK="file:///home/user/.cache/tb_/tor-browser-linux64-5.0.2_en-US.tar.xz"

## To allow downloads from local file system.
export CURL_FORCE_SSL=" "

## Using --ordinary because curl-prgrs does not work with local files.
if [ -o xtrace ]; then
   bash -x ./usr/bin/update-torbrowser --ordinary "$@"
else
   ./usr/bin/update-torbrowser --ordinary "$@"
fi
