Open main menu

Changes

1,253 bytes added ,  14:12, 28 August 2018
Adds commentary about hard-linked files
== Intro ==
[https://etckeeper.branchable.com/ Etckeeper] (also at https://github.com/joeyh/etckeeper) is a great tool created by Joey Hess to use your favorite VCS to keep track of what's going on in <code>/etc</code>.
 
== TLDR ==
<source lang="bash">
sudo su -
apt-get install etckeeper
cd /etc/
# change VCS to 'git' by commenting out bzr; and uncomment git
vim etckeeper/etckeeper.conf
# add the contents below to etckeeper/commit.d/20mirror-outside-files
# and make it executable
chmod a+x etckeeper/commit.d/20mirror-outside-files
# create your repo
etckeeper init
# commit your files
etckeeper commit
# now everything should just happen automagically anytime something in etc changes
</source>
== Extending etckeeper ==
## Special case handled above
## mirror_dir "/home/greg/bin"
</source>
 
== Problems with Hard-linked files ==
 
I got this with a recent <code>yum install</code>
 
<pre>
etckeeper warning: hardlinked files could cause problems with git:
./fail2ban/action.d/badips.pyc
./fail2ban/action.d/badips.pyo
./fail2ban/action.d/smtp.pyc
./fail2ban/action.d/smtp.pyo
 
</pre>
 
I looked at the .gitignore in /etc and .pyo and .pyc files are already ignored, so there is no problem. In fact, you can verify that git is NOT tracking these files in etc with the following:
 
<source lang="bash">
git ls-files fail2ban | grep py
</source>
 
and compare to actual directory contents <code>ls -al /etc/fail2ban</code>
 
<source lang="bash">
 
# What files am I intentionally ignoring with .gitignore?
 
git ls-files --other --ignored --exclude-standard
 
# same as
 
git status --ignored
 
</source>
[[Category:Version Control]]
[[Category:DevOps]]
 
[[Category:VCS]]
[[Category:Version Control]]
4,558

edits