diff options
author | grufo | 2017-11-01 19:29:07 +0000 |
---|---|---|
committer | grufo | 2017-11-01 19:29:07 +0000 |
commit | 8ff0bd3390ca85cf6e30900efc3215b5200a407b (patch) | |
tree | 1f8fe900cb61070ff112f3727b394e2b0234916f | |
parent | 4781a61ba8abdc9320294135c3b13bccf7916a08 (diff) | |
download | aur-8ff0bd3390ca85cf6e30900efc3215b5200a407b.tar.gz |
New release (7.0.8-1)
-rwxr-xr-x | .SRCINFO | 40 | ||||
-rw-r--r--[-rwxr-xr-x] | PKGBUILD | 108 | ||||
-rwxr-xr-x | tor-browser-de.desktop | 9 | ||||
-rwxr-xr-x | tor-browser-de.install | 43 | ||||
-rwxr-xr-x | tor-browser-de.sh | 110 | ||||
-rw-r--r-- | tor-browser.desktop | 8 | ||||
-rw-r--r-- | tor-browser.install | 26 | ||||
-rw-r--r--[-rwxr-xr-x] | tor-browser.png (renamed from tor-browser-de.png) | bin | 13877 -> 13877 bytes | |||
-rwxr-xr-x | tor-browser.sh | 189 |
9 files changed, 305 insertions, 228 deletions
@@ -1,13 +1,11 @@ -# Generated by mksrcinfo v8 -# Sun Oct 22 09:30:50 UTC 2017 pkgbase = tor-browser-de - pkgdesc = Tor Browser Bundle: Anonymes Surfen mit Firefox und Tor - pkgver = 7.0.7 + pkgdesc = Tor Browser Bundle: Anonymous browsing using firefox and tor (de) + pkgver = 7.0.8 pkgrel = 1 url = https://www.torproject.org/projects/torbrowser.html - install = tor-browser-de.install - arch = x86_64 + install = tor-browser.install arch = i686 + arch = x86_64 license = GPL depends = gtk2 depends = mozilla-common @@ -15,7 +13,7 @@ pkgbase = tor-browser-de depends = startup-notification depends = mime-types depends = dbus-glib - depends = libpulse + depends = alsa-lib depends = desktop-file-utils depends = hicolor-icon-theme depends = libvpx @@ -28,21 +26,25 @@ pkgbase = tor-browser-de 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 - source = tor-browser-de.desktop - source = tor-browser-de.png - source = tor-browser-de.sh - md5sums = 5b0844612fcbed11666e3c766072b092 + noextract = tor-browser-linux64-7.0.8_de.tar.xz + noextract = tor-browser-linux32-7.0.8_de.tar.xz + source = tor-browser.desktop + source = tor-browser.png + source = tor-browser.sh + validpgpkeys = EF6E286DDA85EA2A4BA7DE684E2C6E8793298290 + md5sums = 9178c9325979377f7ec57569b15fcb61 md5sums = 494afbfa60fb4ce21840244cc3f7208c - md5sums = bb53b2544e2038943e703c7c6ccf48a1 - source_x86_64 = https://dist.torproject.org/torbrowser/7.0.7/tor-browser-linux64-7.0.7_de.tar.xz - source_x86_64 = https://dist.torproject.org/torbrowser/7.0.7/tor-browser-linux64-7.0.7_de.tar.xz.asc - md5sums_x86_64 = b60cb281d6b4c63703f768f9851286a1 - md5sums_x86_64 = SKIP - source_i686 = https://dist.torproject.org/torbrowser/7.0.7/tor-browser-linux32-7.0.7_de.tar.xz - source_i686 = https://dist.torproject.org/torbrowser/7.0.7/tor-browser-linux32-7.0.7_de.tar.xz.asc - md5sums_i686 = 49b1027aa068b50d4959904277e136c9 + md5sums = 120910366e4094c652fe7c4ee55abbca + source_i686 = https://dist.torproject.org/torbrowser/7.0.8/tor-browser-linux32-7.0.8_de.tar.xz + source_i686 = https://dist.torproject.org/torbrowser/7.0.8/tor-browser-linux32-7.0.8_de.tar.xz.asc md5sums_i686 = SKIP + md5sums_i686 = SKIP + source_x86_64 = https://dist.torproject.org/torbrowser/7.0.8/tor-browser-linux64-7.0.8_de.tar.xz + source_x86_64 = https://dist.torproject.org/torbrowser/7.0.8/tor-browser-linux64-7.0.8_de.tar.xz.asc + md5sums_x86_64 = SKIP + md5sums_x86_64 = SKIP pkgname = tor-browser-de diff --git a/PKGBUILD b/PKGBUILD index 98ef6914a1c9..0e3232c54cf1 100755..100644 --- a/PKGBUILD +++ b/PKGBUILD @@ -1,66 +1,80 @@ -# Maintainer: Constantin Lorenz <Cons27773964 at aol dot com> -# Contributor: Yardena Cohen <yardenack at gmail dot com> +# Maintainer: grufo <madmurphy333 AT gmail 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: Constantin Lorenz <Cons27773964 at aol dot com> -# To port this PKGBUILD to another language of tor-browser you -# have to change $pkgname, $_language, $pkgdesc and $url in PKGBUILD -# AND (!) the first line in the .install file! +# +# Before running makepkg, you must do this: +# +# gpg --keyserver hkp://pgp.mit.edu:11371 --recv-keys D1483FA6C3C07136 +# + +# To port this PKGBUILD to another language of tor-browser you have to +# change ONLY the variable ${_language} below -pkgname='tor-browser-de' -pkgver='7.0.7' _language='de' -pkgrel=1 -pkgdesc='Tor Browser Bundle: Anonymes Surfen mit Firefox und Tor' + +# This PKGBUILD is based on https://aur.archlinux.org/packages/tor-browser/ + +_pkgname='tor-browser' +pkgname="${_pkgname}-${_language,,}" +pkgver='7.0.8' +pkgrel='1' +pkgdesc="Tor Browser Bundle: Anonymous browsing using firefox and tor (${_language})" url='https://www.torproject.org/projects/torbrowser.html' -arch=('x86_64' 'i686') +arch=('i686' 'x86_64') +_idstr32='linux32' +_idstr64='linux64' license=('GPL') depends=('gtk2' 'mozilla-common' 'libxt' 'startup-notification' 'mime-types' - 'dbus-glib' 'libpulse' 'desktop-file-utils' 'hicolor-icon-theme' - 'libvpx' 'icu' 'libevent' 'nss' 'hunspell' 'sqlite') + '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' - 'libnotify: Gnome dialog boxes') -install="${pkgname}.install" + '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" + +_archstr=$([[ "${CARCH}" == 'x86_64' ]] && echo -n "${_idstr64}" || echo -n "${_idstr32}") validpgpkeys=('EF6E286DDA85EA2A4BA7DE684E2C6E8793298290') -source_x86_64=("https://dist.torproject.org/torbrowser/${pkgver}/tor-browser-linux64-${pkgver}_${_language}.tar.xz"{,.asc}) -source_i686=("https://dist.torproject.org/torbrowser/${pkgver}/tor-browser-linux32-${pkgver}_${_language}.tar.xz"{,.asc}) -source+=("${pkgname}.desktop" - "${pkgname}.png" - "${pkgname}.sh") +source_i686=("https://dist.torproject.org/torbrowser/${pkgver}/${_pkgname}-${_idstr32}-${pkgver}_${_language}.tar.xz"{,.asc}) +source_x86_64=("https://dist.torproject.org/torbrowser/${pkgver}/${_pkgname}-${_idstr64}-${pkgver}_${_language}.tar.xz"{,.asc}) +source=("${_pkgname}.desktop" + "${_pkgname}.png" + "${_pkgname}.sh") -md5sums=('5b0844612fcbed11666e3c766072b092' - '494afbfa60fb4ce21840244cc3f7208c' - 'bb53b2544e2038943e703c7c6ccf48a1') -md5sums_x86_64=('b60cb281d6b4c63703f768f9851286a1' - 'SKIP') -md5sums_i686=('49b1027aa068b50d4959904277e136c9' - 'SKIP') +md5sums=('9178c9325979377f7ec57569b15fcb61' + '494afbfa60fb4ce21840244cc3f7208c' + '120910366e4094c652fe7c4ee55abbca') +md5sums_i686=('SKIP' + 'SKIP') +md5sums_x86_64=('SKIP' + 'SKIP') -noextract_x86_64=("tor-browser-linux64-${pkgver}_${_language}.tar.xz") -noextract_i686=("tor-browser-linux32-${pkgver}_${_language}.tar.xz") +noextract=("${_pkgname}-${_idstr64}-${pkgver}_${_language}.tar.xz" + "${_pkgname}-${_idstr32}-${pkgver}_${_language}.tar.xz") package() { - cd "${srcdir}" - sed -i "s/REPL_NAME/${pkgname}/g" ${pkgname}.sh - sed -i "s/REPL_VERSION/${pkgver}/g" ${pkgname}.sh - sed -i "s/REPL_LANGUAGE/${_language}/g" ${pkgname}.sh + sed -i "s/__REPL_LANGUAGE__/${_language}/g" "${_pkgname}.desktop" + sed -i "s/__REPL_NAME__/${pkgname}/g" "${_pkgname}.desktop" - sed -i "s/REPL_NAME/${pkgname}/g" ${pkgname}.desktop - sed -i "s/REPL_LANGUAGE/${_language}/g" ${pkgname}.desktop - sed -i "s/REPL_COMMENT/${pkgdesc}/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}.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}" - if [[ "$CARCH" == 'i686' ]]; then - install -Dm 644 tor-browser-linux32-${pkgver}_${_language}.tar.xz ${pkgdir}/opt/${pkgname}/tor-browser-linux32-${pkgver}_${_language}.tar.xz - else - install -Dm 644 tor-browser-linux64-${pkgver}_${_language}.tar.xz ${pkgdir}/opt/${pkgname}/tor-browser-linux64-${pkgver}_${_language}.tar.xz - fi -} + install -Dm 644 "${_pkgname}-${_archstr}-${pkgver}_${_language}.tar.xz" "${pkgdir}/opt/${pkgname}/${_pkgname}-${_archstr}-${pkgver}_${_language}.tar.xz" +} diff --git a/tor-browser-de.desktop b/tor-browser-de.desktop deleted file mode 100755 index ed885dd5349c..000000000000 --- a/tor-browser-de.desktop +++ /dev/null @@ -1,9 +0,0 @@ -[Desktop Entry] -Version=1.0 -Type=Application -Name=Tor-Browser (REPL_LANGUAGE) -Exec=/usr/bin/REPL_NAME -Icon=/usr/share/pixmaps/REPL_NAME.png -Categories=Network; -Comment=REPL_COMMENT -Name[de_DE]=Tor Browser (de) diff --git a/tor-browser-de.install b/tor-browser-de.install deleted file mode 100755 index 59b97dec6d2d..000000000000 --- a/tor-browser-de.install +++ /dev/null @@ -1,43 +0,0 @@ -pkgname="tor-browser-de" - -pre_install() { - echo - echo "==> If you want to verify the gnupg signature you have to" - echo "==> import the proper public key first (Found on https://www.torproject.org/docs/signing-keys.html.en)." - echo "==> Choose one and use the following command to import it:" - echo "==> " - echo "==> gpg --recv-keys <keyid>" - echo "==> " - echo "==> After that, signature verifying should work." - echo -} - -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 -} - -pre_upgrade() { - # remove old files - rm -rf /opt/$pkgname -} - -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-browser directory in your home" - echo "==> directory by hand: As your normal user, do:" - echo "==> " - echo "==> rm -rf ~/.${pkgname}" - echo -} diff --git a/tor-browser-de.sh b/tor-browser-de.sh deleted file mode 100755 index cd4abf137c1c..000000000000 --- a/tor-browser-de.sh +++ /dev/null @@ -1,110 +0,0 @@ -#!/usr/bin/env bash -# -# Copyright (C) 2009 Benjamin Drung <bdrung at ubuntu dot com> -# Copyright (C) 2012 Alessio Sergi <al3hex at gmail dot com> -# 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 - -# filled by the PKGBUILD -NAME='REPL_NAME' -VERSION='REPL_VERSION' -LANGUAGE="REPL_LANGUAGE" - -ARCH=$(getconf LONG_BIT) - -notify() { - local title="$1" - local message="$2" - - if [ $(which zenity 2>/dev/null) ]; then - zenity --info --title "$title" --text "$message" - elif [ $(which notify-send 2>/dev/null) ]; then - notify-send "$title" "$message" - elif [ $(which kdialog 2>/dev/null) ]; then - kdialog --title "$title" --passivepopup "$message" - else - echo -e "$0: [$title] $message" >&2 - fi -} - -update() { - echo "$0: Extracting files to $INSTALL_DIRECTORY." >> $LOG_FILE - rm -rf $INSTALL_DIRECTORY/* - tar --strip-components=1 -xJf /opt/$NAME/tor-browser-linux${ARCH}-${VERSION}_${LANGUAGE}.tar.xz \ - -C $INSTALL_DIRECTORY >> $LOG_FILE 2>&1 || notify "Error" \ - "The tor-browser archive could not be extracted to your home directory. \ - \nCheck permissions of $INSTALL_DIRECTORY. \ - \nThe error log can be found in $LOG_FILE." - - [[ -f $INSTALL_DIRECTORY/Browser/start-tor-browser ]] && echo $VERSION > $VERSION_FILE -} - -usage() { - cat <<EOF -Usage: ${0##*/} [option] - -Options: - -h|--help Show this help message and exit - -u|--update Force update of the copy in your home directory - --dir=<directory> The Tor-Browser directory to use - - All unrecognized arguments will be passed to the browser, - but arguments with spaces will break, until Tor fixes this bug: - https://trac.torproject.org/projects/tor/ticket/12161 -EOF -} - -DIRECTORY=~/.$NAME -args=() -for arg; do - case "$arg" in - -h|--help) usage; exit 0 ;; - -u|--update) update=1 ;; - --dir=*) DIRECTORY="${arg#*=}" ;; - *) args+=("$arg") ;; - esac -done - -INSTALL_DIRECTORY=$DIRECTORY/INSTALL -VERSION_FILE=$DIRECTORY/VERSION -LOG_FILE=$DIRECTORY/LOG - -# create directory, if it is missing (e.g. first run) -[[ ! -d "$INSTALL_DIRECTORY" ]] && mkdir -p "$INSTALL_DIRECTORY" -cd "$DIRECTORY" - -# create version file if missing -[[ ! -f $VERSION_FILE ]] && echo 0 > $VERSION_FILE - -#get installed version -while read line -do - INSTALLED_VERSION=$line -done < $VERSION_FILE - -# start update if old or no tor-browser is installed -if [[ "$INSTALLED_VERSION" == "$VERSION" ]] && [[ $update != 1 ]]; then - # clear log - > $LOG_FILE -else - echo "$0: Your version in $DIRECTORY is outdated or you do not have installed $NAME yet." > $LOG_FILE - update -fi - -# start tor-browser -cd $INSTALL_DIRECTORY/Browser && ./start-tor-browser --class Tor\ Browser "${args[@]}" diff --git a/tor-browser.desktop b/tor-browser.desktop new file mode 100644 index 000000000000..3728ece546bf --- /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/__REPL_NAME__ +Icon=/usr/share/pixmaps/__REPL_NAME__.png +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-de.png b/tor-browser.png Binary files differindex 39c4ab220c25..39c4ab220c25 100755..100644 --- a/tor-browser-de.png +++ b/tor-browser.png diff --git a/tor-browser.sh b/tor-browser.sh new file mode 100755 index 000000000000..6e14ef0a6794 --- /dev/null +++ b/tor-browser.sh @@ -0,0 +1,189 @@ +#!/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 + + +# 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_VER_FILE_="${_TB_HOME_DIR_}/VERSION" +_TB_LOG_FILE_="${_TB_HOME_DIR_}/LOG" +_TB_APP_DIR_="${_TB_HOME_DIR_}/app" +_TB_REFRESH_=0 + + +# 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 + +} + + +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 + +# 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[@]}" + |