summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorAmin Vakil2019-11-06 17:08:39 +0330
committerAmin Vakil2019-11-06 17:08:39 +0330
commiteeb7058cf12b25bc845eaa7c9d610990de7136fb (patch)
treee0e123cf946b49d548d4ce81373e53009f00c6da
downloadaur-eeb7058cf12b25bc845eaa7c9d610990de7136fb.tar.gz
Initial commit
-rw-r--r--.SRCINFO50
-rw-r--r--PKGBUILD151
-rw-r--r--tor-browser.desktop8
-rw-r--r--tor-browser.install26
-rw-r--r--tor-browser.pngbin0 -> 13576 bytes
-rwxr-xr-xtor-browser.sh196
6 files changed, 431 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO
new file mode 100644
index 000000000000..56587845ffb8
--- /dev/null
+++ b/.SRCINFO
@@ -0,0 +1,50 @@
+pkgbase = tor-browser-behind-tor
+ pkgdesc = Tor Browser Bundle: anonymous browsing using Firefox and Tor (international PKGBUILD)
+ pkgver = 9.0.1
+ pkgrel = 1
+ url = https://www.torproject.org/projects/torbrowser.html
+ install = tor-browser.install
+ arch = i686
+ arch = x86_64
+ license = GPL
+ makedepends = tor
+ depends = mozilla-common
+ depends = libxt
+ depends = startup-notification
+ depends = mime-types
+ depends = dbus-glib
+ depends = alsa-lib
+ depends = desktop-file-utils
+ depends = hicolor-icon-theme
+ depends = libvpx
+ depends = icu
+ depends = libevent
+ depends = nss
+ depends = hunspell
+ depends = sqlite
+ optdepends = zenity: simple dialog boxes
+ optdepends = kdialog: KDE dialog boxes
+ optdepends = gst-plugins-good: H.264 video
+ optdepends = gst-libav: H.264 video
+ optdepends = libpulse: PulseAudio audio driver
+ optdepends = libnotify: Gnome dialog boxes
+ noextract = tor-browser-linux32-9.0.1_en-US.tar.xz
+ noextract = tor-browser-linux64-9.0.1_en-US.tar.xz
+ source = tor-browser.desktop
+ source = tor-browser.png
+ source = tor-browser.sh
+ validpgpkeys = EF6E286DDA85EA2A4BA7DE684E2C6E8793298290
+ sha256sums = 9ee0a4672e2d0835ffb94bcf26e17b56432030496a9cdf019b70c96083c24340
+ sha256sums = bb6b0f27c33d21e0ef6df961e25418327c5e8b01c003bbe18c0a8dae3e16d77d
+ sha256sums = 89118837e6db1d7b089e0067a6430e9a1a8602a64e00b7ea94382abfb0d3e502
+ source_i686 = https://dist.torproject.org/torbrowser/9.0.1/tor-browser-linux32-9.0.1_en-US.tar.xz
+ source_i686 = https://dist.torproject.org/torbrowser/9.0.1/tor-browser-linux32-9.0.1_en-US.tar.xz.asc
+ sha256sums_i686 = b170a91372cea093b28fbc1f14180207a4f82c29c763e8274d8c8410f1bee3ef
+ sha256sums_i686 = SKIP
+ source_x86_64 = https://dist.torproject.org/torbrowser/9.0.1/tor-browser-linux64-9.0.1_en-US.tar.xz
+ source_x86_64 = https://dist.torproject.org/torbrowser/9.0.1/tor-browser-linux64-9.0.1_en-US.tar.xz.asc
+ sha256sums_x86_64 = a5f45b02a59cb84f936b06a64a7bb71cf54c38e7c4f6fb7c0b6d583e82d42a26
+ sha256sums_x86_64 = SKIP
+
+pkgname = tor-browser-behind-tor
+
diff --git a/PKGBUILD b/PKGBUILD
new file mode 100644
index 000000000000..72b002042e8a
--- /dev/null
+++ b/PKGBUILD
@@ -0,0 +1,151 @@
+# Maintainer: Amin Vakil <info AT aminvakil DOT com>
+# Maintainer: grufo <madmurphy333 AT gmail DOT com>
+# Contributor: midgard <arch.midgard AT janmaes DOT com>
+# Contributor: TrialnError <autumn-wind AT web DOT de>
+# Contributor: Yardena Cohen <yardenack AT gmail DOT com>
+# Contributor: Max Roder <maxroder AT web DOT de>
+# Contributor: Sebastian Jug <seb AT stianj DOT ug>
+# Contributor: BrLi
+#
+# Before running makepkg, you must do this (as normal user):
+#
+# gpg --auto-key-locate nodefault,wkd --locate-keys torbrowser@torproject.org
+#
+# If you want to update tor-browser from AUR without AUR helpers you can run in a terminal:
+#
+# tor-browser -u
+
+
+pkgname='tor-browser-behind-tor'
+pkgver='9.0.1'
+pkgrel='1'
+pkgdesc='Tor Browser Bundle: anonymous browsing using Firefox and Tor (international PKGBUILD)'
+url='https://www.torproject.org/projects/torbrowser.html'
+arch=('i686' 'x86_64')
+license=('GPL')
+makedepends=('tor')
+depends=('mozilla-common' 'libxt' 'startup-notification' 'mime-types'
+ 'dbus-glib' 'alsa-lib' 'desktop-file-utils' 'hicolor-icon-theme'
+ 'libvpx' 'icu' 'libevent' 'nss' 'hunspell' 'sqlite')
+optdepends=('zenity: simple dialog boxes'
+ 'kdialog: KDE dialog boxes'
+ 'gst-plugins-good: H.264 video'
+ 'gst-libav: H.264 video'
+ 'libpulse: PulseAudio audio driver'
+ 'libnotify: Gnome dialog boxes')
+install="${pkgname}.install"
+
+_tag_i686='linux32'
+_tag_x86_64='linux64'
+_urlbase="https://dist.torproject.org/torbrowser/${pkgver}"
+_archstr=$([[ "${CARCH}" == 'x86_64' ]] && echo -n "${_tag_x86_64}" || echo -n "${_tag_i686}")
+export all_proxy="socks5h://127.0.0.1:9050"
+_localetor() {
+
+ #
+ # Checking if a `tor-browser` package exists for current locale; a different language can be
+ # chosen by giving a `TORBROWSER_PKGLANG` environment variable to `makepkg`, for instance:
+ #
+ # TORBROWSER_PKGLANG='en-US' makepkg
+ #
+
+ if [[ -n "${TORBROWSER_PKGLANG}" ]]; then
+ echo -n "${TORBROWSER_PKGLANG}"
+ return 0
+ fi
+
+ local _fulllocale="$(locale | grep LANG | cut -d= -f2 | cut -d. -f1 | sed s/_/\-/)"
+ local _shortlocale="$(locale | grep LANG | cut -d= -f2 | cut -d_ -f1)"
+
+ if curl --output /dev/null --silent --head --fail "${_urlbase}/${pkgname}-${_archstr}-${pkgver}_${_fulllocale}.tar.xz"; then
+ echo -n "${_fulllocale}"
+ elif curl --output /dev/null --silent --head --fail "${_urlbase}/${pkgname}-${_archstr}-${pkgver}_${_shortlocale}.tar.xz"; then
+ echo -n "${_shortlocale}"
+ else
+ echo -n 'en-US'
+ fi
+
+}
+
+_language="$(_localetor)"
+
+validpgpkeys=('EF6E286DDA85EA2A4BA7DE684E2C6E8793298290')
+
+# Syntax: _dist_checksum 'linux32'/'linux64'
+_dist_checksum() {
+
+ curl --silent --fail "${_urlbase}/sha256sums-signed-build.txt" | grep "${1}-${pkgver}_${_language}.tar.xz" | cut -d ' ' -f1
+
+}
+source_i686=("${_urlbase}/${pkgname}-${_tag_i686}-${pkgver}_${_language}.tar.xz"{,.asc})
+source_x86_64=("${_urlbase}/${pkgname}-${_tag_x86_64}-${pkgver}_${_language}.tar.xz"{,.asc})
+source=("${pkgname}.desktop"
+ "${pkgname}.png"
+ "${pkgname}.sh")
+
+### IMPORTANT #################################################################
+# No need for `makepkg -g`: the following sha256sums¸don't need to be updated #
+# with each release, everything is done automatically! Leave them like this! #
+###############################################################################
+sha256sums=('9ee0a4672e2d0835ffb94bcf26e17b56432030496a9cdf019b70c96083c24340'
+ 'bb6b0f27c33d21e0ef6df961e25418327c5e8b01c003bbe18c0a8dae3e16d77d'
+ '89118837e6db1d7b089e0067a6430e9a1a8602a64e00b7ea94382abfb0d3e502')
+sha256sums_i686=($(_dist_checksum "${_tag_i686}")
+ 'SKIP')
+sha256sums_x86_64=($(_dist_checksum "${_tag_x86_64}")
+ 'SKIP')
+
+noextract=("${pkgname}-${_tag_i686}-${pkgver}_${_language}.tar.xz"
+ "${pkgname}-${_tag_x86_64}-${pkgver}_${_language}.tar.xz")
+
+prepare() {
+
+ # use colors only if we have them
+ if [[ $(which tput > /dev/null 2>&1 && tput -T "${TERM}" colors || echo -n '0') -ge 8 ]] ; then
+ local _COL_YELLOW_='\e[0;33m'
+ local _COL_LIGHTGREY_='\e[0;37m'
+ local _COL_BRED_='\e[1;31m'
+ local _COL_BBLUE_='\e[1;34m'
+ local _COL_BWHITE_='\e[1;37m'
+ local _COL_DEFAULT_='\e[0m'
+ fi
+
+ msg "Packaging ${pkgname} (language: ${_language})..."
+
+ if [[ -z "${TORBROWSER_PKGLANG}" ]]; then
+ echo -e "\n ${_COL_BBLUE_}->${_COL_DEFAULT_} ${_COL_BRED_}NOTE:${_COL_DEFAULT_} If you want to package ${_COL_BWHITE_}${pkgname}${_COL_DEFAULT_} in a different language, please"
+ echo -e " set a \`${_COL_YELLOW_}TORBROWSER_PKGLANG${_COL_DEFAULT_}\` environment variable before running makepkg.\n"
+ echo ' For instance:'
+ echo -e "\n ${_COL_LIGHTGREY_}TORBROWSER_PKGLANG='en-US' makepkg${_COL_DEFAULT_}\n"
+ fi
+
+ # we search and replace using sed with / as delimiter below so don't allow slashes in these vars.
+ # makepkg already enforces that there're no slashes in ${pkgname}, so we don't check that again here.
+ if [[ ${pkgver} = */* || ${_language} = */* || ${pkgdesc} = */* ]]; then
+ error '${pkgver}, ${_language} and ${pkgdesc} for this package are not allowed to contain /' >&2
+ return 1
+ fi
+
+}
+
+package() {
+
+ cd "${srcdir}"
+
+ sed -i "s/__REPL_LANGUAGE__/${_language}/g" "${pkgname}.desktop"
+
+ sed -i "s/__REPL_NAME__/${pkgname}/g" "${pkgname}.sh"
+ sed -i "s/__REPL_VERSION__/${pkgver}/g" "${pkgname}.sh"
+ sed -i "s/__REPL_RELEASE__/${pkgrel}/g" "${pkgname}.sh"
+ sed -i "s/__REPL_LANGUAGE__/${_language}/g" "${pkgname}.sh"
+ sed -i "s/__REPL_ARCH__/${_archstr}/g" "${pkgname}.sh"
+
+ install -Dm 644 "${pkgname}.desktop" "${pkgdir}/usr/share/applications/${pkgname}.desktop"
+ install -Dm 644 "${pkgname}.png" "${pkgdir}/usr/share/pixmaps/${pkgname}.png"
+ install -Dm 755 "${pkgname}.sh" "${pkgdir}/usr/bin/${pkgname}"
+
+ install -Dm 644 "${pkgname}-${_archstr}-${pkgver}_${_language}.tar.xz" "${pkgdir}/opt/${pkgname}/${pkgname}-${_archstr}-${pkgver}_${_language}.tar.xz"
+
+}
+
+
diff --git a/tor-browser.desktop b/tor-browser.desktop
new file mode 100644
index 000000000000..aca8d1123e6e
--- /dev/null
+++ b/tor-browser.desktop
@@ -0,0 +1,8 @@
+[Desktop Entry]
+Version=1.0
+Type=Application
+Name=Tor Browser (__REPL_LANGUAGE__)
+Exec=/usr/bin/tor-browser
+Icon=tor-browser
+Categories=Network;
+Comment=Anonymous browsing using Firefox and Tor
diff --git a/tor-browser.install b/tor-browser.install
new file mode 100644
index 000000000000..5317164af9b0
--- /dev/null
+++ b/tor-browser.install
@@ -0,0 +1,26 @@
+pkgname='tor-browser'
+
+post_install() {
+ echo
+ echo "==> ${pkgname} will be extracted to ~/.${pkgname}"
+ echo "==> the first time you run ${pkgname} as your normal user!"
+ echo "==> Just start it and have fun."
+ echo
+}
+
+post_upgrade() {
+ echo
+ echo "==> The ${pkgname} copy in your home directory will be upgraded at the"
+ echo "==> first time you run it as your normal user!"
+ echo "==> Just start and have fun."
+ echo
+}
+
+post_remove() {
+ echo
+ echo "==> You have to remove the tor-brower directory in your home"
+ echo "==> directory by hand: As your normal user, do:"
+ echo "==> "
+ echo "==> rm -rf ~/.${pkgname}"
+ echo
+}
diff --git a/tor-browser.png b/tor-browser.png
new file mode 100644
index 000000000000..661641736df3
--- /dev/null
+++ b/tor-browser.png
Binary files differ
diff --git a/tor-browser.sh b/tor-browser.sh
new file mode 100755
index 000000000000..2ca37f23c427
--- /dev/null
+++ b/tor-browser.sh
@@ -0,0 +1,196 @@
+#!/usr/bin/env bash
+
+# Copyright (C) 2009 Benjamin Drung <bdrung at ubuntu dot com>
+# Copyright (C) 2012 Alessio Sergi <al3hex at gmail dot com>
+# Copyright (C) 2017 grufo <madmurphy333 at gmail dot com> (Arch User Repository version)
+# modified 2012 for tor-browser (Max Roder <maxroder at web dot de>)
+# modified 2014 by Yardena Cohen <yardenack at gmail dot com>
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+set -e
+
+
+# CONSTANTS AND VARIABLES
+
+# filled by PKGBUILD
+_TB_PKGNAME_='__REPL_NAME__'
+_TB_VERSION_='__REPL_VERSION__'
+_TB_RELEASE_='__REPL_RELEASE__'
+_TB_LANGUAGE_="__REPL_LANGUAGE__"
+_TB_ARCH_='__REPL_ARCH__'
+
+# other constants and variables
+_TB_HOME_DIR_=~/".${_TB_PKGNAME_}"
+_TB_REFRESH_=0
+
+
+# FUNCTIONS
+
+# syntax: _notify_ "${TITLE}" "${MESSAGE}"
+_notify_() {
+
+ if [ $(which zenity 2>/dev/null) ]; then
+ zenity --info --title "${1}" --text "${2}"
+ elif [ $(which notify-send 2>/dev/null) ]; then
+ notify-send "${1}" "${2}"
+ elif [ $(which kdialog 2>/dev/null) ]; then
+ kdialog --title "${1}" --passivepopup "${2}"
+ else
+ echo -e "${0}: [${1}] ${2}" >&2
+ fi
+
+}
+
+
+# syntax: _compare_ver_ "${INSTALLED_VERSION}" "${LATEST_VERSION}"
+_compare_ver_() {
+
+ [[ "${1}" == "${2}" ]] && return 1 || [[ "${1}" == "`echo -e "${1}\n${2}" | sort -V | head -n1`" ]]
+
+}
+
+
+_refresh_local_() {
+
+ local KEEP_DIR="${_TB_APP_DIR_}/Browser/TorBrowser/Data/Browser"
+ local KEPT_DIR=~/".${_TB_PKGNAME_}-tmpdata"
+ local DIR_IS_KEPT=0
+
+ if [[ -d "${KEEP_DIR}" ]]; then
+ [[ -d "${KEPT_DIR}" ]] && rm -rf "${KEPT_DIR}"
+ mv "${KEEP_DIR}" "${KEPT_DIR}"
+ echo "${0}: Preserving files in ${KEPT_DIR}/." >> "${_TB_LOG_FILE_}"
+ DIR_IS_KEPT=1
+ fi
+
+ echo "${0}: Extracting files to ${_TB_APP_DIR_}." >> "${_TB_LOG_FILE_}"
+ rm -rf "${_TB_APP_DIR_}"/*
+ tar --strip-components=1 -xJf "/opt/${_TB_PKGNAME_}/tor-browser-${_TB_ARCH_}-${_TB_VERSION_}_${_TB_LANGUAGE_}.tar.xz" \
+ -C "${_TB_APP_DIR_}" >> "${_TB_LOG_FILE_}" 2>&1 || _notify_ 'Error' \
+ "The tor-browser archive could not be extracted to your home directory. \
+ \nCheck permissions of ${_TB_APP_DIR_}. \
+ \nThe error log can be found in ${_TB_LOG_FILE_}."
+
+ if [[ ! ${DIR_IS_KEPT} -eq 0 ]]; then
+ rm -rf "${KEEP_DIR}"
+ mv "${KEPT_DIR}" "${KEEP_DIR}"
+ fi
+
+ [[ -f "${_TB_APP_DIR_}/Browser/start-tor-browser" ]] && echo "${_TB_VERSION_}" > "${_TB_VER_FILE_}"
+
+}
+
+
+_aur_update_() {
+
+ if [[ "$(id -u)" == '0' ]]; then
+ echo 'It is not a good idea to do this as root. Abort.' 1>&2
+ exit 1
+ fi
+
+ local DO_UPDATE=0
+ local TMP_PKGBUILD="$(mktemp -d)"
+
+ cd "${TMP_PKGBUILD}"
+
+ if ! { curl --silent --fail "https://aur.archlinux.org/cgit/aur.git/snapshot/${_TB_PKGNAME_}.tar.gz" | tar xz ;} 2>/dev/null; then
+ echo 'Unable to retrieve the PKGBUILD. Abort.' 1>&2
+ rm -rf "${TMP_PKGBUILD}"
+ exit 1
+ fi
+
+ cd "${TMP_PKGBUILD}/${_TB_PKGNAME_}"
+
+ local AUR_VERSION="$(grep 'pkgver' '.SRCINFO' | cut -d = -f2 | sed -e 's/^[[:space:]]*//')"
+ local AUR_RELEASE="$(grep 'pkgrel' '.SRCINFO' | cut -d = -f2 | sed -e 's/^[[:space:]]*//')"
+
+ if _compare_ver_ "${_TB_VERSION_}" "${AUR_VERSION}"; then
+ echo "Found new version (${_TB_VERSION_} -> ${AUR_VERSION})..."
+ DO_UPDATE=1
+ elif [[ "${_TB_VERSION_}" == "${AUR_VERSION}" ]] && [[ "${_TB_RELEASE_}" != "${AUR_RELEASE}" ]] && [[ "${_TB_RELEASE_}" == "`echo -e "${_TB_RELEASE_}\n${AUR_RELEASE}" | sort | head -n1`" ]]; then
+ echo 'Found new PKGBUILD...'
+ DO_UPDATE=1
+ else
+ echo "Everything is up to date (current version: ${_TB_VERSION_})."
+ fi
+
+ [[ ! ${DO_UPDATE} -eq 0 ]] && makepkg -si
+
+ rm -rf "${TMP_PKGBUILD}"
+
+}
+
+
+_usage_() {
+
+ cat <<EOF
+Usage: ${0##*/} [option]
+
+Options:
+ -h|--help Show this help message and exit
+ -u|--update Search in AUR for a new release and install it
+ -r|--refresh Refresh the copy in your home directory and launch tor-browser
+ -e|--erase Erase the copy in your home directory
+ --dir=<directory> The Tor-Browser directory to use
+
+ All unrecognized arguments will be passed to the browser.
+EOF
+
+}
+
+
+# SCRIPT BODY
+
+args=()
+for arg; do
+ case "${arg}" in
+ -h|--help) _usage_; exit 0 ;;
+ -u|--update) _aur_update_; exit 0 ;;
+ -f|--refresh) _TB_REFRESH_=1 ;;
+ -e|--erase) rm -rf "${_TB_HOME_DIR_}"; exit 0 ;;
+ --dir=*) _TB_HOME_DIR_="${arg#*=}" ;;
+ *) args+=("$arg") ;;
+ esac
+done
+
+_TB_VER_FILE_="${_TB_HOME_DIR_}/VERSION"
+_TB_LOG_FILE_="${_TB_HOME_DIR_}/LOG"
+_TB_APP_DIR_="${_TB_HOME_DIR_}/app"
+
+# create directory, if it is missing (e.g. first run)
+[[ ! -d "${_TB_APP_DIR_}" ]] && mkdir -p "${_TB_APP_DIR_}"
+cd "${_TB_HOME_DIR_}"
+
+# create version file if missing
+[[ ! -f "${_TB_VER_FILE_}" ]] && echo 0 > "${_TB_VER_FILE_}"
+
+# get the installed version
+while read _TB_VER_LINE_
+do
+ _TB_INSTALLED_VERSION_="${_TB_VER_LINE_}"
+done < "${_TB_VER_FILE_}"
+
+# start update if old or no tor-browser is installed
+if [[ "${_TB_INSTALLED_VERSION_}" == "${_TB_VERSION_}" ]] && [[ ${_TB_REFRESH_} -eq 0 ]]; then
+ # clear log
+ > "${_TB_LOG_FILE_}"
+else
+ echo "${0}: Your version in ${_TB_HOME_DIR_} is outdated or you do not have installed ${_TB_PKGNAME_} yet." > "${_TB_LOG_FILE_}"
+ _refresh_local_
+fi
+
+# start tor-browser
+"${_TB_APP_DIR_}/Browser/start-tor-browser" "${args[@]}"
+