1

I tend to copy some useful programs to every server I login to. I have loads of configuration files, a statically compiled zsh (in case I need a new version), vim, python, version control binary, etc. I have a script that just checks them out, links all binaries to ~/bin if they're newer than the system-wide versions, and does all the needed setup - I've got the setup I need on any kind of host/distro.

This has worked just fine, while I had the same login on all hosts. Unfortunately now I can't use my standard login at some hosts. How can I modify my environment to work in the same way without recompiling? For example with a normal deployment, I would need to recompile python to make /home/yyy/priv_env/python/lib the main library path, but on all other hosts I need /home/xxx/.... This case can be solved with PYTHONPATH of course, but there are other binaries taking the default path from the compilation stage - like zsh modules. Is there any way to solve this without taking care of many shell variables?

Ideally, I would use a private chroot in the environment which maps to all the needed directories to the places I need. But chroot is not available for non-root users of course.

I also thought about setting up a link in /tmp/${random_preselected_string} to ${HOME}/priv_env and setting all the paths to point at the /tmp/... link. This will work as long as noone creates a file with the same name there. Also with long login sessions, it might be affected by tmp autocleaners.

Have you got any better ideas?

viraptor
  • 1,176

2 Answers2

1

I'd look at ways to specify $HOME as part of the path for the software to evaluate at run time. There's a good chance that'd require patching the code though...

retracile
  • 1,260
0

This won't be much help, but as a general rule the idea behind source builds is they're targetted at the library configuration of your host machine. Portable binaries you've generated via statically linking on another machine are not guaranteed to work, and are not the canonical way of doing things. Generally you should compile your custom binaries on each and every machine you target.

As a fallback I'd set the prefix to /usr/local, but again, I see your dilemma, not having root-access and all.