forum/etckeeper uses git despite VCS="hg" when a /etc/.git directory existsetckeeperhttp://etckeeper.branchable.com/forum/etckeeper_uses_git_despite_VCS__61____34__hg__34___when_a___47__etc__47__.git_directory_exists/etckeeperikiwiki2022-01-11T11:56:28Zcomment 1http://etckeeper.branchable.com/forum/etckeeper_uses_git_despite_VCS__61____34__hg__34___when_a___47__etc__47__.git_directory_exists/comment_1_167ca2ab91c1e4b969ba58f532528a82/joey2022-01-07T15:14:16Z2022-01-07T15:09:03Z
<p>We can see why right in /usr/bin/etckeeper:</p>
<pre><code>if [ -d ".git" ]; then
VCS=git
elif [ -d ".hg" ]; then
VCS=hg
elif [ -d "_darcs" ]; then
VCS=darcs
elif [ -d ".bzr" ]; then
VCS=bzr
fi
</code></pre>
<p>So the VCS config is only used to control what <code>etckeeper init</code> does.</p>
<p>See also this todo item about it, with more discussion:
<span class="createlink"><a href="http://etckeeper.branchable.com/ikiwiki.cgi?do=create&from=forum%2Fetckeeper_uses_git_despite_VCS__61____34__hg__34___when_a___47__etc__47__.git_directory_exists%2Fcomment_1_167ca2ab91c1e4b969ba58f532528a82&page=todo%2Fdoc%2Ftodo%2FGive_preference_to_etckeeper.conf_over_existing_repository_for_defining__60__strong__62___36__60__%2Fstrong__62__VCS" rel="nofollow">?</a>strong>VCS</span></p>
comment 2http://etckeeper.branchable.com/forum/etckeeper_uses_git_despite_VCS__61____34__hg__34___when_a___47__etc__47__.git_directory_exists/comment_2_d1d40ba983bdf52502c53c13f8f73919/Abdull2022-01-11T11:56:28Z2022-01-11T11:56:28Z
<p>Thank your for the info, I found your mentioned TODO at <em><a href="http://etckeeper.branchable.com/todo/Give_preference_to_etckeeper.conf_over_existing_repository_for_defining___36__VCS/">Give preference to etckeeper.conf over existing repository for defining $VCS</a></em>.</p>
<p>I was able to accomplish my scenario (one personal git repository with <del>cherry-picked</del> selected configuration files in one repository AND using etckeeper as well) with the following workaround setup:</p>
<ul>
<li>Set up my personal git repository at the root filesystem location <code>/</code>.</li>
<li>Configure etckeeper to use mercurial/hg.</li>
</ul>
<p>I noticed that (at least in Debian 11.2 bullseye) <code>apt install etckeeper</code> automatically runs <code>etckeeper init</code>, thereby setting up a <strong>git</strong>-based etckeeper according to the <a href="https://git.joeyh.name/index.cgi/etckeeper.git/tree/etckeeper.conf?h=debian&id=e2efb7797cfc0a6b366a9db01d37f685ccf04e22">default <code>etckeeper.conf</code> file</a> - but I want <strong>hg</strong>. I looked around, but there doesn't currently seem to be a way (e.g. <em>debconf</em>) to configure etckeeper at <em>pre-installation time</em> to use hg other than <a href="https://git.joeyh.name/index.cgi/etckeeper.git/tree/debian/postinst?h=debian&id=e2efb7797cfc0a6b366a9db01d37f685ccf04e22#n80">having an appropriate <code>/etc/etckeeper/etckeeper.conf</code> file in place before running <code>apt install etckeeper</code></a>. Or is there? Thanks for your help!</p>