Linux – How to make a variable symlink ? (or something similar)

filesystemslinuxrhelsymlink

How can I make a variable symlink that would point to a different location according to the current user? Is it possible? Should I use something else instead? A mount point? How?

Here is the problem in case you come across a different solution:

Here at work we are a team developing on Unix with SVN. We all use the same development machine (remotely). So we have checkouts in different places (not /home but a specific dir mounted on another disk, let's say /svn/[userlogin]/).

We use scripts and tools. Some special tools have a complex configuration and project file that includes the path of the source files. This is error prone and we lose a lot of time because of bad config or 'projects' that need to be recreated all the time. I would like to share this complex configuration and the project files across all developers.

But for such files to be shared while working on different checkouts, I must either:

  • correct on-the-fly the paths stored in config/project to adapt them to the current user
  • make a "magic" fixed path that symlink/mount/point points to a different place according to the user (so same project file but pointing to different source)

Before that we used clearcase, which was mounting a view of the same path for everyone (let's say /vob), each developer seeing his or her own view. That was convenient.

How can I do a similar thing? Can you think of another solution? Thanks.

— Edit —

I was thinking of Eclipse IDE. I want to share some workspace settings, the project and the run/debug configurations. Eclipse (+plugin) settings consist of 50+ small files, so editing them is out of question.

With clearcase it was easy thanks to the fixed "/vob" path which, for each terminal, was automatically pointing to the "view" we choose.

I would like something similar. I want a /svn/mysource which, for each terminal, point to the user current checkout, which is in a user-dependent path.

Best Answer

For those people viewing this more recently, I've written a small FUSE filesystem called HomeFS that forwards calls to a directory relative to the calling users' home directories.

That is, if you have a user Tyler and a user Sarah with a HomeFS mountpoint at /usr/share/bigsoft/config and a relative directory of .config/bigsoft, when Tyler does ls /usr/share/bigsoft he will see the contents of /home/tyler/.config/bigsoft and Sarah will see the contents of /home/sarah/.config/bigsoft.

Primarily, this is to work around proprietary software which insists its variable files be in some 'install directory', like how some Windows software tends to work.

Related Question