#753986 etckeeper: In absence of git, use other supported VCS to init repo after installation.

#753986#5
Date:
2014-07-06 20:10:08 UTC
From:
To:
The etckeeper package may be installed without git, as long as another
supported VCS (currently bazaar, darcs, mercurial) is or gets
installed.

However, when git is not installed, etckeeper will not initialise the
repo after installation. Instead one sees the output:

"etckeeper init not ran as git is not installed"

This is because, at present, the postinst script sources the config
file /etc/etckeeper/etckeeper.conf, checks whether $VCS is installed
and only runs init and the initial commit if it is.
At this point, though, right after installation, etckeeper.conf is
still just the default config file from the package, which sets
"VCS=git", no matter what's installed on the system.

The package would have to figure out which VCS to use, which should be
easy if there's only one, and set $VCS accordingly in etckeeper.conf
before using it.
Maybe this could be solved with debconf, but I'm not familiar enough
with that to supply a patch. Might look into it, though.

Perhaps, one could even avoid bothering the user with any questions in
case there's more than one VCS installed, by hardcoding a preference
list. As pointed out in Debian Bug #611882 it is easy enough to
uninit, manually reconfigure and init again.

#753986#10
Date:
2014-07-07 16:39:18 UTC
From:
To:
Gabriel Niebler wrote:

This is problimatic because the VCS used would then be essentially
non-deteministic.

Instead, I think etckeeper should continue defaulting to git, and its
apt hook should notice if git got installed and it has not been initted,
and automatically init it then.

#753986#15
Date:
2014-07-08 17:59:36 UTC
From:
To:
Hello Joey,
thank you for your reply.

I don't think it would be.
My suggestion is to iterate over a preference list of supported VCSs and to use
the first one found on the system at install time, e.g. if  git is installed, use git.
Otherwise, if mercurial is installed, use hg. Otherwise...
The outcome is completely deterministic for any installed combination of VCSs.

One can argue about the order of the list, of course. git should be first. I like mercurial,
so I put it second. YMMV.

That doesn't seem to fix the issue, it only gets rid of the output that says the
repo wasn't initialised (which the user ought to know in any case).

The above procedure would still default to git, because it's first on the list, but
still does something useful if git is simply not there.

It would have to be done in postinst and I can try my hand at implementing it.

#753986#20
Date:
2014-09-14 20:52:52 UTC
From:
To:
I've forked etckeeper on github, implemented a fix for this issue in
the postinst script, committed and created a pull request:
https://github.com/joeyh/etckeeper/pull/19

Feel free to merge and then close this bug.

#753986#27
Date:
2014-12-22 21:02:04 UTC
From:
To:
"Use first vcs from $LIST" *is* nondeterministic. It means that people
who happen to have bzr installed from ancient days of yore when anything
used bzr will get a etckeeper using bzr if they apt-get install
etckeeper. And then on a second system that didn't have that cruft
installed, they'll get an etckeeper using git.

I have no interest in supporting that clusterfuck, and frankly the
prospect makes me itch to remove all !git support from etckeeper. It's
bad enough that distributions like ubuntu have overrideen the default in
the past.

So, wontfix.