! In T338#5679, @Patrick wrote:
…
So when ~/bin
exists, then $HOME/bin
is automatically added to PATH
. No mention of ~/opt
though.
~/opt
would never be added to $PATH
. ~/bin
would create the binary link to package located in ~/opt
or an XDG
desktop file would be created in the appropriate place.
More importantly… Let’s assume - what I am not convinced of yet - ~/bin
[or supposedly even ~/opt
] is a standard…
When using /usr/bin
, /usr/local/bin
, ~/bin
[or supposedly even ~/opt
] etc… One is supposed to drop binaries/scripts there - not folders. For example, ~/bin/some-script
would be correct. And ~/bin/some-folder/some-script
would be incorrect.
You are correct about /usr/bin
, /usr/local/bin
and ~/bin
being the place to drop binaries. ~/opt
is a spot for pre-compiled
binary 'packages'
and its related files; same as /opt
. You would not drop the tor-browser-en-US
package in any type of bin
directory. You will notice packages such as Google Chrome
get installed in main /opt
directory (not home user directory).
I conclude, that ~/bin/tor-browser_en-US/start-tor-browser.desktop
[or ~/opt/tor-browser_en-US/start-tor-browser.desktop
] would still not be standards conform? Because there is a sub folder (tor-browser_en-US
). What do you think?
This is also correct, as you suggested, creating a .desktop
file in ~/bin/tor-browser_en-US/start-tor-browser.desktop
or ~/opt/tor-browser_en-US/start-tor-browser.desktop
is the incorrect location for them to go. Since Tor browser
is considered a private user application, then any links to it should be within the users home directory. Therefore the .desktop
file should then be located in ~/.local/share/applications/
, or the path of where the .desktop
files is located would need to be added to XDG_DATA_DIRS
ENV
variable (I think this would be a bad option to add to XDG_DATA_DIRS
for only one file).
Now, that solves the issue of placing the .desktop
file in the standards base location, but leaves the issue of being able to make sure its in the path to be able to start it from the command line. That’s where the ~/bin
directory comes into play. We would ensure it’s in the uses path and either create a wrapper or softlink to to start Tor browser
. Again, `~/bin’ is a DE-facto standard location to place private user binaries, and you already mentioned Debian 8 supports this.
Starting start-tor-browser.desktop
from command line would also fail, because of the sub folder (not included in PATH
). (And additionally, start-tor-browser.desktop
has an upstream bug(?): You need to cd
into the folder, before you can run ./start-tor-browser.desktop
.
This would be the best solution IMO:
The main tor-browser_en-US
private package should either be located in ~/.tor-browser_en-US
, or within a parent hidden directory like ~/.tb|tor|tor-browser/tor-browser_en-US
(to allow old versions, or additional locales) . This keeps the main user directory clean and is an acceptable directory to put such a package according to the Filesystem Hierarchy Standard
. The other acceptable location could be the ~/opt
directory. My preference though would be in a hidden subdirectory such as ~/.tb/tor-browser_en-US
directory.
The desktop application file should then be located in ~/.local/share/applications/start-tor-browser.desktop
which is the XDG_DATA_DIR
. This would then make the Tor browser
application available on the start menu
. The XDG user data directories are used to store user data.
Further a wrapper or soft-link can be provided within the ~/bin
directory to directly start Tor browser
from the command line, or if Tor browser
is able to be activated from Dbus
the gapplications