-
-
Notifications
You must be signed in to change notification settings - Fork 117
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cannot set/change user binary dir on Linux #365
Comments
Hi, I believe tinytex is only calling
You can check the value of the option using Which is the value set ? I believe you can change this value quiet easily using This should change the behavior to the
So afterall it is a Hope it helps |
Hi @cderv, thanks a lot for the detailed response!
> tinytex::tlmgr(c("option", "sys_bin"))
tlmgr option sys_bin
Destination for symlinks for binaries (sys_bin): /home/salim/bin
Awesome, that worked! I've proposed a new FAQ item in yihui/yihui.org#171 about this as well as yihui/yihui.org#172 :) |
Yes, on Linux, the I can definitely set it to |
@yihui Yes, I agree that it's too early to change the default. It's a recurring issue on Ubuntu and I don't know what their immediate plans are. Since Ubuntu uses systemd and systemd is a freedesktop.org project adhering to the XDG Base Directory Specification (easily verified by running We could think about introducing an additional param |
…erwise still use ~/bin (#365)
Okay, I just made a change so that Alternatively, I could check if diff --git a/R/install.R b/R/install.R
index 4d6ac31..65a2f49 100644
--- a/R/install.R
+++ b/R/install.R
@@ -411,7 +411,9 @@ install_prebuilt = function(
# post-install configurations
post_install_config = function(add_path, extra_packages, repo, hash = FALSE) {
if (os_index == 2) {
- if (!dir_exists(bin_dir <- '~/.local/bin')) dir.create(bin_dir <- '~/bin', FALSE, TRUE)
+ bin_dir = '~/.local/bin'
+ if (!path.expand(bin_dir) %in% env_paths()) bin_dir = '~/bin'
+ dir.create(bin_dir, FALSE, TRUE)
tlmgr(c('option', 'sys_bin', bin_dir))
}
# fix fonts.conf: https://github.com/yihui/tinytex/issues/313
@@ -430,6 +432,11 @@ post_install_config = function(add_path, extra_packages, repo, hash = FALSE) {
}
}
+# get paths on the PATH variable
+env_paths = function() {
+ unlist(strsplit(Sys.getenv('PATH'), .Platform$path.sep, fixed = TRUE))
+}
+
download_installer = function(file, version) {
url = if (version != '') sprintf(
'https://github.com/yihui/tinytex-releases/releases/download/v%s/%s', version, file
diff --git a/tools/install-bin-unix.sh b/tools/install-bin-unix.sh
index b0a3393..f2bf897 100755
--- a/tools/install-bin-unix.sh
+++ b/tools/install-bin-unix.sh
@@ -60,10 +60,13 @@ fi
cd $TEXDIR/bin/*/
+# if ~/.local/bin is on PATH, use it as sys_bin; otherwise use ~/bin
BINDIR="$HOME/.local/bin"
-if [ ! -d $BINDIR]; then
+if [[ "$PATH" =~ (^|:)"${BINDIR}"(:|$) ]]; then
+else
BINDIR="$HOME/bin"
fi
+mkdir -p $BINDIR
[ $OSNAME != "Darwin" ] && ./tlmgr option sys_bin $BINDIR
./tlmgr postaction install script xetex # GH issue #313 |
FWIW I would need to recheck but I think |
Okay, if that's the case, my current fix should work, and the alternative fix could be problematic (would need to check for the existence of the dir or create the dir). |
Great, much appreciated! |
I just installed tinytex for the first time on a Linux system (Ubuntu 20.04). First of all: Great project, thank you!
Now to my problem: While it's possible to customize the tinytex installation path (aka tinytex "root") via
tinytex::install_tinytex()
'sdir
param, there doesn't seem to exist any means to set/customize the user bin folder where tinytex places the symlinks after successful installation. Instead of the default~/bin
I'd like to use~/.local/bin
(which is the default defined in the XDG Base Directory Specification).This wouldn't be that much of a problem if I could just manually move the symlinks and forget about it. But tinytex regenerates the
~/bin
dir with all symlinks everytimetinytex::tlmgr_install()
is executed. Is there any environment variable I could set to avoid this? Or anything else I've missed?By filing an issue to this repo, I promise that
xfun::session_info('tinytex')
. I have upgraded all my packages to their latest versions (e.g., R, RStudio, and R packages), and also tried the development version:remotes::install_github('yihui/tinytex')
.I understand that my issue may be closed if I don't fulfill my promises.
The text was updated successfully, but these errors were encountered: