Dan Gravell
Dan Gravell

Reputation:

File system 'overlays'

Concrete use case: In the Eclipse IDE, new 'plugins' can be added by copying a plugin's file(s) into the $ECLIPSE_HOME/plugins directory. However, I want to keep my original Eclipse installation 'clean' without additional plugins because I want to run this basic installation on its own at times.

What is a way of avoiding having to copy the files (and hence therefore not being able to run a clean version) and instead logically 'overlaying' the contents of another directory so that it appears to be in the directory at runtime?

e.g. something like:

gravelld@gravelld-laptop:~$ ls $ECLIPSE_HOME/plugins/
org.junit_3.8.2.v200706111738
org.junit4_4.3.1
org.junit.source_3.8.2.v200706111738
gravelld@gravelld-laptop:~$ ls myplugins/
org.dangravell.myplugin.jar
gravelld@gravelld-laptop:~$ overlay myplugins/ $ECLIPSE_HOME/plugins
gravelld@gravelld-laptop:~$ ls $ECLIPSE_HOME/plugins/
org.dangravell.myplugin.jar
org.junit_3.8.2.v200706111738
org.junit4_4.3.1
org.junit.source_3.8.2.v200706111738

Another use case may be around patching and so on...

Can something be done with symbolic links or mnt for this?

Thanks!

Upvotes: 1

Views: 4436

Answers (2)

Robᵩ
Robᵩ

Reputation: 168646

You could use an overlay filesystem for this. The three overlay filesystems that I know of in Linux are unionfs, aufs, and minifo.

Unionfs is included in recent Ubuntu kernels.

Upvotes: 4

VonC
VonC

Reputation: 1324997

Have a look at Manage your eclipse environment article, especially the Method 3

Creating a links folder to manage product extensions

If you have product extensions sitting on your file system, like the one we made in Method 1, you can create a few simple files in your Eclipse program directory to notify Eclipse that it needs to check these directories for plug-ins.

First, create a directory inside your Eclipse installation folder (for example, /opt/eclipse) called links. Within this folder, you can create *.link files (for example, emfPlugins.link). Each link file points to a product extension location. Eclipse will scan this links folder on startup and find the plug-ins in each product extension pointed to by a link file.

This is still supported in eclipse3.4 even though the new p2 provisioning system is quite different.


Now that the "'links' directory mechanism" is known, it means the difference between a vanilla eclipse and an eclipse with custom common plugins is just the presence of that 'links' directory.

So, why not have a 'vanilla eclipse distribution' with a symbolic link inside, 'links', pointing to ../links ?

Any user getting that vanilla eclipse would have at first no 'links' directory alongside it, so it will run as a vanilla distribution. But as soon the user creates a links directory or make another symbolic link to a common remote 'links' directory, that same distribution will pick up the common plugins remote directory...

/path/links -> /remote/links/commonPlugins
/eclipse/links -> ../links

Finally, if you create the "/remote/links/commonPlugins" with a given group "aGroup", and protect it with a '750' mask, you have yourself one eclipse setup which will be:

  • vanilla eclipse for any user whom 'id -a' does not include 'aGroup'
  • eclipse with plugins for any user part of "aGroup"

Upvotes: 1

Related Questions