|
Size: 1279
Comment:
|
Size: 2419
Comment:
|
| Deletions are marked like this. | Additions are marked like this. |
| Line 1: | Line 1: |
| From Davor's email to hcoop-sysadmin: In any case, [[http://kitenet.net/~joey/code/etckeeper/|Etckeeper]] puts /etc under revision control, git |
[[http://kitenet.net/~joey/code/etckeeper/|Etckeeper]] puts /etc under revision control, git |
| Line 6: | Line 4: |
| That means you can cd /etc, and then execute the most useful commands: |
All our machines use EtcKeeper, which should be installed early in the setup process. (Typically among the first packages installed after performing the system installation and first boot). == Installation == |
| Line 10: | Line 10: |
| apt-get install etckeeper etckeeper init cd /etc git commit -am "Initial commit" }}} == Usage == The most useful Git commands we most often use are: {{{ git status (list of files and their Git states) |
|
| Line 18: | Line 31: |
| With etckeeper installed, this issue of authdaemonrc being overriden would simply be a matter of doing 'git diff', spotting the unwanted changes, and doing 'git checkout courier/authdaemonrc' to restore the file to previous state. |
Each time you make a change to a file or set of files and are happy with it, commit your change. |
| Line 23: | Line 33: |
| Note that this is not the only mechanism we have for tracking changes to /etc (we use changetrack as well, and I believe mwolson had something that used Mercurial installed), but I'd aim to make etckeeper a new standard. |
It is tempting to use '''git commit -am "Message ..."''' which commits all files (-a) and provide the commit message on the command line (-m "..."). While that is tolerable practice, listing specific files on the command line and providing a properly formatted Git commit message is preferred over the "bulk" -am switches. |
| Line 27: | Line 35: |
| == Usage == | The -a switch very often commits other changed files that had nothing to do with your commit, such as modified by not committed changes of other admins or files automatically generated/modified by DomTool or system scripts. Those automatically-modified files should be handled in one of the following ways, in order of preference from highest to lowest: |
| Line 29: | Line 37: |
| Each time you make a change, run, for example `git commit -a -m "changed blah blah"`. | * If they change often (such as hosts.deny/hosts.allow), move them to /var/tmp/ and provide a symlink from /etc/, registering only the symlink in Git. * Periodically committing them (just them) with the appropriate commit message (i.e. "Periodic commit of modified files") * Removing them from Git (copy them aside, invoke '''git rm FILE; git commit -am "Remove FILE"''', and copy them back to expected location == Notes == EtcKeeper is better than custom solutions as it also adds apt hooks, so the files are added and commited to git automatically before/after apt-get installs. |
Etckeeper puts /etc under revision control, git by default, which then behaves like a normal git repository.
All our machines use EtcKeeper, which should be installed early in the setup process. (Typically among the first packages installed after performing the system installation and first boot).
1. Installation
apt-get install etckeeper etckeeper init cd /etc git commit -am "Initial commit"
2. Usage
The most useful Git commands we most often use are:
git status (list of files and their Git states) git log (see commit dates & commit msgs) git log -p (see commits with diff included) git add FILE... (add FILE to git) git diff (see any differences since last commit) git commit -am "Commit message" (commit your changes after modification) git checkout FILE (override FILE with version from last commit)
Each time you make a change to a file or set of files and are happy with it, commit your change.
It is tempting to use git commit -am "Message ..." which commits all files (-a) and provide the commit message on the command line (-m "..."). While that is tolerable practice, listing specific files on the command line and providing a properly formatted Git commit message is preferred over the "bulk" -am switches.
The -a switch very often commits other changed files that had nothing to do with your commit, such as modified by not committed changes of other admins or files automatically generated/modified by DomTool or system scripts. Those automatically-modified files should be handled in one of the following ways, in order of preference from highest to lowest:
- If they change often (such as hosts.deny/hosts.allow), move them to /var/tmp/ and provide a symlink from /etc/, registering only the symlink in Git.
- Periodically committing them (just them) with the appropriate commit message (i.e. "Periodic commit of modified files")
Removing them from Git (copy them aside, invoke git rm FILE; git commit -am "Remove FILE", and copy them back to expected location
3. Notes
EtcKeeper is better than custom solutions as it also adds apt hooks, so the files are added and commited to git automatically before/after apt-get installs.
