summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorgrufo2017-07-14 19:32:19 +0200
committergrufo2017-07-14 19:32:19 +0200
commitd5068263a0e7de0ae2b630ffafc0a4231a40e0a9 (patch)
treea96a2f80fce57c6727cb9904979fd2e3e3f9c7cd
parent960519bae0f581f161d7f7e59e609a2e25903370 (diff)
downloadaur-d5068263a0e7de0ae2b630ffafc0a4231a40e0a9.tar.gz
tor-browser.sh: code review
-rw-r--r--.SRCINFO2
-rw-r--r--PKGBUILD2
-rwxr-xr-xtor-browser.sh15
3 files changed, 10 insertions, 9 deletions
diff --git a/.SRCINFO b/.SRCINFO
index a643af8cddf4..1a312684169d 100644
--- a/.SRCINFO
+++ b/.SRCINFO
@@ -36,7 +36,7 @@ pkgbase = tor-browser-vi
validpgpkeys = EF6E286DDA85EA2A4BA7DE684E2C6E8793298290
md5sums = 9178c9325979377f7ec57569b15fcb61
md5sums = 494afbfa60fb4ce21840244cc3f7208c
- md5sums = 0c4a3227b4598356e321713e1d54869e
+ md5sums = 9ba504d97e5841d80e0d1388d3e18951
source_i686 = https://dist.torproject.org/torbrowser/7.0.2/tor-browser-linux32-7.0.2_vi.tar.xz
source_i686 = https://dist.torproject.org/torbrowser/7.0.2/tor-browser-linux32-7.0.2_vi.tar.xz.asc
md5sums_i686 = SKIP
diff --git a/PKGBUILD b/PKGBUILD
index c7c9fe9c76f1..3ea3f19c45ba 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -50,7 +50,7 @@ source=("${_pkgname}.desktop"
md5sums=('9178c9325979377f7ec57569b15fcb61'
'494afbfa60fb4ce21840244cc3f7208c'
- '0c4a3227b4598356e321713e1d54869e')
+ '9ba504d97e5841d80e0d1388d3e18951')
md5sums_i686=('SKIP'
'SKIP')
md5sums_x86_64=('SKIP'
diff --git a/tor-browser.sh b/tor-browser.sh
index e321daaf0560..0f557ddfb42d 100755
--- a/tor-browser.sh
+++ b/tor-browser.sh
@@ -78,19 +78,18 @@ _refresh_local_() {
_aur_update_() {
- local DO_UPDATE=0
-
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.'
+ echo 'Unable to retrieve the PKGBUILD. Abort.' 1>&2
rm -rf "${TMP_PKGBUILD}"
exit 1
fi
@@ -101,11 +100,11 @@ _aur_update_() {
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 (${AUR_VERSION})..."
- local DO_UPDATE=1
+ 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...'
- local DO_UPDATE=1
+ DO_UPDATE=1
else
echo "Everything is up to date (current version: ${_TB_VERSION_})."
fi
@@ -125,7 +124,8 @@ Usage: ${0##*/} [option]
Options:
-h|--help Show this help message and exit
-u|--update Search in AUR for a new release and install it
- -f|--refresh Force refresh of the copy in your home directory
+ -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.
@@ -140,6 +140,7 @@ for arg; do
-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