summarylogtreecommitdiffstats
path: root/tor-browser-es.sh
diff options
context:
space:
mode:
Diffstat (limited to 'tor-browser-es.sh')
-rwxr-xr-xtor-browser-es.sh39
1 files changed, 21 insertions, 18 deletions
diff --git a/tor-browser-es.sh b/tor-browser-es.sh
index 1080150c7426..288b7561ec2e 100755
--- a/tor-browser-es.sh
+++ b/tor-browser-es.sh
@@ -3,6 +3,7 @@
# 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
@@ -24,10 +25,6 @@ NAME='REPL_NAME'
VERSION='REPL_VERSION'
LANGUAGE="REPL_LANGUAGE"
-DIRECTORY=~/.$NAME
-INSTALL_DIRECTORY=$DIRECTORY/INSTALL
-VERSION_FILE=$DIRECTORY/VERSION
-LOG_FILE=$DIRECTORY/LOG
ARCH=$(getconf LONG_BIT)
notify() {
@@ -48,13 +45,13 @@ notify() {
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 \
+ 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/start-tor-browser.desktop ]] && echo $VERSION > $VERSION_FILE
+ [[ -f $INSTALL_DIRECTORY/Browser/start-tor-browser ]] && echo $VERSION > $VERSION_FILE
}
usage() {
@@ -62,23 +59,29 @@ usage() {
Usage: ${0##*/} [option]
Options:
- -h Show this help message and exit
- -u Force update of the copy in your home directory
- -r <directory> The Tor-Browser directory to use
+ -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.
EOF
}
-while getopts ':hu' opt; do
- case "$opt" in
- h) usage; exit 0 ;;
- u) update=1 ;;
- :) echo "$0: Option '-$OPTARG' requires an argument" >&2
- exit 1 ;;
- *) echo "$0: Invalid option '-$OPTARG'" >&2
- usage; exit 1 ;;
+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"
@@ -102,4 +105,4 @@ else
fi
# start tor-browser
-cd $INSTALL_DIRECTORY && './start-tor-browser.desktop'
+cd $INSTALL_DIRECTORY/Browser && ./start-tor-browser "${args[@]}"