diff options
author | grufo | 2017-07-14 19:31:32 +0200 |
---|---|---|
committer | grufo | 2017-07-14 19:31:32 +0200 |
commit | ab057dac43840cd1b3401bd2278bc3b3a2ec12e0 (patch) | |
tree | 32affb82a524a33e987d3d6431c1d5b9a5605123 | |
parent | 43f3fc88293868a472e9e813b82a491977d87ae0 (diff) | |
download | aur-ab057dac43840cd1b3401bd2278bc3b3a2ec12e0.tar.gz |
tor-browser.sh: code review
-rw-r--r-- | .SRCINFO | 2 | ||||
-rw-r--r-- | PKGBUILD | 2 | ||||
-rwxr-xr-x | tor-browser.sh | 15 |
3 files changed, 10 insertions, 9 deletions
@@ -36,7 +36,7 @@ pkgbase = tor-browser-en-us 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_en-US.tar.xz source_i686 = https://dist.torproject.org/torbrowser/7.0.2/tor-browser-linux32-7.0.2_en-US.tar.xz.asc md5sums_i686 = SKIP @@ -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 |