Skip to content

Instantly share code, notes, and snippets.

@maxrp
Last active December 18, 2015 07:19
Show Gist options
  • Save maxrp/5745687 to your computer and use it in GitHub Desktop.
Save maxrp/5745687 to your computer and use it in GitHub Desktop.
#!/usr/bin/bash
# enable job control
set -m
TOR_PKGS=(tor-browser-gnu-linux-x86_64-2.3.25-8-dev-en-US.tar.gz{,.asc})
TOR_MIRROR='https://www.torproject.org/dist/torbrowser/linux/'
# never hurts to double check this
TOR_SIGNING_KEY='416F061063FEE659'
WORKDIR=$(mktemp -d)
GPGOPTS="--homedir ${WORKDIR} --keyserver hkps://hkps.pool.sks-keyservers.net --no-tty --batch"
GPGVOPTS="--homedir ${WORKDIR} -q --keyring ${WORKDIR}/pubring.gpg ${TOR_PKGS[1]}"
cd "${WORKDIR}"
# Fetch the signing key while downloading the package and signature
gpg2 ${GPGOPTS} --recv-keys ${TOR_SIGNING_KEY} &
for pkg in "${TOR_PKGS[@]}"; do
wget "${TOR_MIRROR}${pkg}"
done;
# verify the package and launch it on success
if gpgv2 ${GPGVOPTS}
then
tar xf "${TOR_PKGS[0]}"
# launch vidalia+firefox
${WORKDIR}/tor-browser_en-US/start-tor-browser
else
echo "********************************************************************"
echo "*************PACKAGE VERIFICATION FAILED, ABORTING!*****************"
echo "********************************************************************"
fi;
function cleanup(){
echo "Exitted, cleaning up: rm -rf ${WORKDIR}";
rm -rf ${WORKDIR};
}
trap cleanup EXIT SIGINT
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment