[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: shouldn't I use update-alternatives for this?



Qingning Huo <qingningh@lanware.co.uk> wrote:
> I suggest dpkg-divert /usr/bin/git, and install a shell script as
> /usr/bin/git, which will invoke either program depending on a certain
> environment variable[1] or a configuration file.  It is possible to achieve
> the following objectives.
> 
> (1) Installing cogito will not change the meaning of /usr/bin/git by
> default;
> 
> (2) System admin can decide a default preference of /usr/bin/git,
> through e.g. /etc/git.rc;
> 
> (3) Each user can choose her/his own preference by e.g. ~/.gitrc;
> 
> (4) cogito on Debian works the same as on other systems.

This sounds like a great suggestion, thank you very much.

In this thought experiment, the cogito package would do this:

    1.  Install its git as /usr/bin/git.scm (or something).

    2.  Divert GNU Interactive Tools' /usr/bin/git to /usr/bin/git.shell
        (or something).

    3.  Install something like this as /usr/bin/git (written in the
        mailer, not tested):
            #!/bin/sh
            GIT=/usr/bin/git.scm
            [ -f /etc/git-selector   ] && source /etc/git-selector
            [ -f $HOME/.git-selector ] && source $HOME/.git-selector
            exec $GIT

    4.  Typical /etc/git-selector, set via debconf on install of cogito:
            #GIT=/usr/bin/git.scm
            GIT=/usr/bin/git.shell

    5.  Typical $HOME/.git-selector, set by user:
            GIT=/usr/bin/git.scm
            #GIT=/usr/bin/git.shell


Wow, this seems like a really nice save -- I especially like objective 4.

I changed the names git.rc and .gitrc, as those might reasonably be
taken by the upstream package(s).

Does this solution seem acceptable to everyone?


-- 
Sebastian Kuzminsky



Reply to: