On Sun, Oct 31, 1999 at 10:55:34AM +0100, Roland Rosenfeld wrote:
> On Sun, 31 Oct 1999, Branden Robinson wrote:
> The disadvantage of the alternative concept over some sensible-xterm
> shell script is, that alternatives are static for all users, while
> sensible-xterm could be used on a per-user basis (with
> x-terminal-emulator as the fall back).
Is there any particular reason why the alternatives mechanism couldn't
simply be fixed so users can select their own alternatives?
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
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
Or add a separate indirection, so
	/usr/bin/foo -> /etc/alternatives/bins/foo
	/etc/alternatives/bin/foo is a script that defaults to
		/etc/alternatives/foo
	/etc/alternatives/foo -> /usr/bin/foo-1.2
or similar, so you can still cat /etc/alternatives/foo to look at the
system default.
(Of course, you'd only want to do this for exectuables. Manpages and
whatnot would still have to make do with a symlink)
OTOH, you could just encourage your users to do something like:
	mkdir ~/bin
	ln -s /usr/bin/rxvt ~/bin/xterm
	echo 'export PATH=~/bin:$PATH' >>.bashrc
and be done with it.
Cheers,
aj
-- 
Anthony Towns <aj@humbug.org.au> <http://azure.humbug.org.au/~aj/>
I don't speak for anyone save myself. PGP encrypted mail preferred.
 ``The thing is: trying to be too generic is EVIL. It's stupid, it 
        results in slower code, and it results in more bugs.''
                                        -- Linus Torvalds
Attachment:
pgpb6AeLSNqe8.pgp
Description: PGP signature