Tag Archives: hotwo

backup /etc/ with etckeeper

etckeeper allows the contents of

1
2
/etc be easily stored in Version Control System (VCS) repository.
It hooks into apt to automatically commit changes to <code>/etc

when packages are installed or upgraded.
Placing

1
/etc

under version control is considered an industry best practice,
and the goal of etckeeper

1
 is to make this process as painless as possible.

1
sudo apt-get install etckeeper bzr

edit /etc/etckeeper/etckeeper.conf
# The VCS to use.
#VCS="hg"
#VCS="git"
VCS="bzr"
#VCS="darcs"

cd /etc/
bzr init
bzr nick «$(hostname) /etc repository»
etckeeper commit «first adding of /etc»

Now you have local repository in /etc/.bzr
and can revert your configs if you have made something wrong like rm -rf /etc/apache2 (O_o! UPS!!!!)

How to work with bzr:
look at logs:

1
bzr log --short /etc


look at logs with changed files:

1
<strong>bzr log -v --short /etc</strong>

look at last 20 logs:

1
bzr log --line /etc | head -n 20


look at changes from last commit:

1
bzr status /etc


look at chenges betweet last commit and current state:

1
bzr diff /etc


look at diff between two version of commits:

1
bzr diff -r 8..7 /etc


look at logs in verbose mode:

1
bzr log -p /etc/squid3 | less


revert changes:

1
2
3
bzr revert -r5 /etc/squid3/somefile
bzr revert -r5 /etc/squid3
bzr revert /etc/squid3