trying to understand the Tor Browser launcher command
- Inicie sesión ou rexístrese para enviar comentarios
In the Tor Browser Launcher Properties the following command is given:
sh -c '"/home/user/Downloads/tor-browser_en-US/Browser/start-tor-browser" --detach || ([ ! -x "/home/user/Downloads/tor-browser_en-US/Browser/start-tor-browser" ] && "$(dirname "$*")"/Browser/start-tor-browser --detach)' dummy %k
I'm guessing that this is for when the /Browser subdirectory is in a nonstandard path/directory location.
Can anyone explain to me how works the clause following the OR ( || operator)? I think this gets used in case /home/user/Downloads/tor-browser_en-US/Browser/start-tor-browser is not possible/not found. But I don't see how this manages to establish the correct alternative path...???
If I type "man sh" it opens manual pages for "dash" rather than "sh" with the -c flag described as:
-c Read commands from the command_string operand instead of from the standard input. Special parameter 0 will be set from the command_name operand and the positional parameters ($1, $2, etc.) set from the remaining argument operands.
I guess the command_string operand is the $PATH/Browser/start-tor-browser
and the remaining argument operands are in this case $1 = "--detach"?
Scanning through the start-tor-browser in an editor I see that the --detach option apparently relates to "Detach from terminal and run Tor Browser in the background."
I can't really see what is meant by "dummy %k".
Please excuse my ignorance and thanks for any suggestions. Although I probably don't need to know all details of how Trisquel works I think its a good idea to try and understand some detail from time to time, as a kind of cross check / sanity check.
Before I discovered torbrowser-launcher, this[1] is what I used to setup Tor Browser after downloading the tarball. Do understand what it does, read the installation script[2].
[1] https://notabug.org/chaosmonk/mozilla-tarball-install
[2] https://notabug.org/chaosmonk/mozilla-tarball-install/src/master/install-from-tarball
Thanks!
On UNIX, 'sh' used to be the Bourne shell. It is now any shell compatible with the Bourne shell. On Trisquel, /bin/sh is by default a link to /bin/dash.
In the shell, as in many programming language, what follows || is not executed if what precedes it succeeded (returned 0, in the Shell). So, the launcher simply executes '/home/user/Downloads/tor-browser_en-US/Browser/start-tor-browser --detach' (your user name is "user"?!). Unless it cannot.
In the latter case, if /home/user/Downloads/tor-browser_en-US/Browser/start-tor-browser is not an executable file ([ ! -x "/home/user/Downloads/tor-browser_en-US/Browser/start-tor-browser" ]), it tries to execute 'start-tor-browser --detach' from a subdirectory "Browser" of a directory you would give as an argument.
Brilliant explanation! Thanks so much.
- Inicie sesión ou rexístrese para enviar comentarios