Re: all xterms
On Sun, 31 Oct 1999, Anthony Towns wrote:
> For example, instead of having a symlink to the real
> /usr/bin/foo-1.2 in /etc/alternatives/foo, have an automagically
> generated script that looks something like:
>
> #!/bin/sh
> prog=`basename $1`
> if [ "$HOME" && -e "$HOME/.alternatives/$prog ]; then
> exec $HOME/.alternatives/$prog
> fi
> exec /usr/bin/foo-1.2
Depending on what program should be started with this mechanism (for
example /usr/bin/csh as a fast /bin/csh), this will slow down the
startup process of this binary very much.
> Or have it debconf-ized, and make it look more like:
>
> #!/bin/sh
> . /usr/share/debconf/confmodule.sh
>
> prog=`basename $1`
> if db_get "alternatives/$prog"; then
> exec $RET
> fi
This slows down the startup of the binary much more than the above. I
don't think that this is acceptable for any program.
> (Of course, you'd only want to do this for exectuables. Manpages and
> whatnot would still have to make do with a symlink)
That's not very intuitive, isn't it? So if we want a special handling
for some alternatives (in this case all(?) executables), we can also
make a special handling for _some_ executables using "sensible-*"
wrappers, which evaluate an environment variable. The latter variant
has some advantages:
- It can be activated temporarily (for example in an alias), which
isn't possible using symlinks.
- It slows down the startup of only those programs
(x-terminal-emulator, web-browser, pdf-browser, pager, editor),
which really need it, while all others can use the symlink only way,
which is much faster.
- man pages are still in sync with the executables, because the man
page of sensible-x-terminal-emulator can explain what this script
does.
> OTOH, you could just encourage your users to do something like:
> mkdir ~/bin
> ln -s /usr/bin/rxvt ~/bin/xterm
^^^^^ x-terminal-emulator
> echo 'export PATH=~/bin:$PATH' >>.bashrc
> and be done with it.
This sounds much more acceptable to me than your previous idea. It's
especially the way I normally use. But this also has some (minor)
disadvantages:
- The man pages are not in sync with the executables
- Some scripts set the PATH at the beginning, which may remove ~/bin
from it.
- The above "trick" isn't documented yet. Maybe we should use
~/alternatives instead of ~/bin, document this trick in
update-alternatives(8) and/or the policy and make ~/alternatives the
default prefix of the PATH?
I personally still think, that a sensible-x-terminal-emulator script
would be the easiest (and most intuitive) way to realize this.
Ciao
Roland
--
* roland@spinnaker.de * http://www.spinnaker.de/ *
Reply to: