Etckeeper: Difference between revisions

recipe
m Text replacement - "<(\/?)source" to "<$1syntaxhighlight"
Tags: Mobile edit Mobile web edit
 
(2 intermediate revisions by one other user not shown)
Line 3: Line 3:


== TLDR ==
== TLDR ==
<source lang="bash">
<syntaxhighlight lang="bash">
sudo su -
sudo su -
apt-get install etckeeper
apt-get install etckeeper
Line 9: Line 9:
# change VCS to 'git' by commenting out bzr; and uncomment git
# change VCS to 'git' by commenting out bzr; and uncomment git
vim etckeeper/etckeeper.conf
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
etckeeper init
</source>
# commit your files
etckeeper commit
# now everything should just happen automagically anytime something in etc changes
</syntaxhighlight>


== Extending etckeeper ==
== Extending etckeeper ==
Line 20: Line 26:


<code>vi /etc/etckeeper/commit.d/20mirror-outside-files</code>
<code>vi /etc/etckeeper/commit.d/20mirror-outside-files</code>
<source lang="bash">
<syntaxhighlight lang="bash">
#!/bin/sh
#!/bin/sh
set -e
set -e
Line 65: Line 71:
## Special case handled above
## Special case handled above
## mirror_dir "/home/greg/bin"
## mirror_dir "/home/greg/bin"
</source>
</syntaxhighlight>
 
== 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:
 
<syntaxhighlight lang="bash">
git ls-files fail2ban | grep py
</syntaxhighlight>
 
and compare to actual directory contents <code>ls -al /etc/fail2ban</code>
 
<syntaxhighlight lang="bash">
 
# What files am I intentionally ignoring with .gitignore?
 
git ls-files --other --ignored --exclude-standard
 
# same as
 
git status --ignored
 
</syntaxhighlight>


[[Category:System Administration]]
[[Category:System Administration]]