Merge lp:~jelmer/ubuntu/precise/etckeeper/tutorial-bzr into lp:ubuntu/precise/etckeeper

Proposed by Jelmer Vernooij
Status: Merged
Merged at revision: 40
Proposed branch: lp:~jelmer/ubuntu/precise/etckeeper/tutorial-bzr
Merge into: lp:ubuntu/precise/etckeeper
Diff against target: 149 lines (+33/-36)
2 files modified
README (+27/-36)
debian/changelog (+6/-0)
To merge this branch: bzr merge lp:~jelmer/ubuntu/precise/etckeeper/tutorial-bzr
Reviewer Review Type Date Requested Status
Colin Watson Approve
Review via email: mp+99165@code.launchpad.net

Description of the change

Change the tutorial to use bzr - which is the default VCS for etckeeper in Ubuntu.

To post a comment you must log in.
Revision history for this message
Colin Watson (cjwatson) wrote :

"You can clone the repository using bzr BRANCH"

Are the all-caps there deliberate?

41. By Jelmer Vernooij

Fix accidental uppercasing of branch command. Thanks, Colin.

Revision history for this message
Jelmer Vernooij (jelmer) wrote :

On Mon, Mar 26, 2012 at 01:33:20PM -0000, Colin Watson wrote:
> "You can clone the repository using bzr BRANCH"
>
> Are the all-caps there deliberate?
They weren't, thanks for catching that.

I've pushed a fix to Launchpad.

Cheers,

Jelmer

Revision history for this message
Colin Watson (cjwatson) wrote :

Thanks, looks good to me now.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'README'
--- README 2011-11-25 20:03:36 +0000
+++ README 2012-03-26 14:09:17 +0000
@@ -78,10 +78,10 @@
7878
79A quick walkthrough of using etckeeper.79A quick walkthrough of using etckeeper.
8080
81Note that the default VCS is git, and this tutorial assumes you're using81Note that the default VCS is bzr, and this tutorial assumes you're using
82it. Using other VCSes should be broadly similar. 82it. Using other VCSes should be broadly similar.
8383
84The `etckeeper init` command initialises an /etc/.git/ repository. 84The `etckeeper init` command initialises an /etc/.bzr/ repository.
85If you installed etckeeper from a package, this was probably automatically85If you installed etckeeper from a package, this was probably automatically
86performed during the package installation. If not, your first step is to86performed during the package installation. If not, your first step is to
87run it by hand:87run it by hand:
@@ -89,50 +89,49 @@
89 etckeeper init89 etckeeper init
9090
91The `etckeeper init` command is careful to never overwrite existing files91The `etckeeper init` command is careful to never overwrite existing files
92or directories in /etc. It will create a `.gitignore` if one doesn't92or directories in /etc. It will create a `.bzrignore` if one doesn't
93already exist (or update content inside a "managed by etckeeper" comment93already exist (or update content inside a "managed by etckeeper" comment
94block), sets up pre-commit hooks if they don't already exist, and so on. It94block), sets up pre-commit hooks if they don't already exist, and so on. It
95does *not* commit any files, but does `git add` all interesting files for95does *not* commit any files, but does `bzr add` all interesting files for
96an initial commit later.96an initial commit later.
9797
98Now you might want to run `git status` to check that it includes all98Now you might want to run `bzr status` to check that it includes all
99the right files, and none of the wrong files. And you can edit the99the right files, and none of the wrong files. And you can edit the
100`.gitignore` and so forth. Once you're ready, it's time to commit:100`.bzrignore` and so forth. Once you're ready, it's time to commit:
101101
102 cd /etc102 cd /etc
103 git status103 bzr status
104 git commit -m "initial checkin"104 bzr commit -m "initial checkin"
105 git gc # pack git repo to save a lot of space
106105
107After this first commit, you can use regular git commands to handle106After this first commit, you can use regular bzr commands to handle
108further changes:107further changes:
109108
110 passwd someuser109 passwd someuser
111 git status110 bzr status
112 git commit -a -m "changed a password"111 bzr commit -m "changed a password"
113112
114Rinse, lather, repeat. You might find that some files are changed by113Rinse, lather, repeat. You might find that some files are changed by
115daemons and shouldn't be tracked by git. These can be removed from git:114daemons and shouldn't be tracked by bzr. These can be removed from bzr:
116115
117 git rm --cached printcap # modified by CUPS116 bzr rm printcap # modified by CUPS
118 echo printcap >> .gitignore117 echo printcap >> .bzrignore
119 git commit -a -m "don't track printcap" 118 bzr commit -m "don't track printcap"
120119
121etckeeper hooks into apt (and similar systems) so changes to interesting120etckeeper hooks into apt (and similar systems) so changes to interesting
122files in /etc caused by installing or upgrading packages will automatically121files in /etc caused by installing or upgrading packages will automatically
123be committed. Here "interesting" means files that are not ignored by122be committed. Here "interesting" means files that are not ignored by
124`.gitignore`.123`.bzrignore`.
125124
126You can use any git commands you like, but do keep in mind that, if you125You can use any bzr commands you like, but do keep in mind that, if you
127check out a different branch or an old version, git is operating directly126check out a different branch or an old version, bzr is operating directly
128on your system's /etc. If you do decide to check out a branch or tag,127on your system's /etc. If you do decide to check out a branch or tag,
129make sure you run "etckeeper init" again, to get any metadata changes:128make sure you run "etckeeper init" again, to get any metadata changes:
130129
131 git checkout april_first_joke_etc130 bzr revert april_first_joke_etc
132 etckeeper init131 etckeeper init
133132
134Often it's better to clone /etc to elsewhere and do potentially dangerous133Often it's better to clone /etc to elsewhere and do potentially dangerous
135stuff in a staging directory. You can clone the repository using git clone,134stuff in a staging directory. You can clone the repository using bzr branch,
136but be careful that the directory it's cloned into starts out mode 700, to135but be careful that the directory it's cloned into starts out mode 700, to
137prevent anyone else from seeing files like shadow, before `etckeeper init`136prevent anyone else from seeing files like shadow, before `etckeeper init`
138fixes their permissions:137fixes their permissions:
@@ -140,30 +139,27 @@
140 mkdir /my/workdir139 mkdir /my/workdir
141 cd /my/workdir140 cd /my/workdir
142 chmod 700 .141 chmod 700 .
143 git clone /etc142 bzr branch /etc
144 cd etc143 cd etc
145 etckeeper init -d .144 etckeeper init -d .
146 chmod 755 ..145 chmod 755 ..
147146
148Another common reason to clone the repository is to make a backup to a147Another common reason to clone the repository is to make a backup to a
149server. When using git push to create a new remote clone, make sure the new148server. When using bzr push to create a new remote clone, make sure the new
150remote clone is mode 700! (And, obviously, only push over a secure149remote clone is mode 700! (And, obviously, only push over a secure
151transport like ssh, and only to a server you trust.)150transport like ssh, and only to a server you trust.)
152151
153 ssh server 'mkdir /etc-clone; cd /etc-clone; chmod 700 .; git init --bare'152 ssh server 'bzr init --no-tree /etc-clone; chmod -R 700 /etc-clone'
154 git remote add backup ssh://server/etc-clone153 bzr push bzr+ssh://server/etc-clone
155 git push backup --all
156154
157If you have several machine's using etckeeper, you can start with a155If you have several machine's using etckeeper, you can start with a
158etckeeper repository on one machine, then add another machine's etckeeper156etckeeper repository on one machine, then add another machine's etckeeper
159repository as a git remote. Then you can diff against it, examine its157repository. Then you can diff against it, examine its
160history, merge with it, and so on. It would probably not, however, be wise158history, merge with it, and so on. It would probably not, however, be wise
161to "git checkout" the other machine's branch! (And if you do, make sure to159to "bzr checkout" the other machine's branch! (And if you do, make sure to
162run "etckeeper init" to update file permissions.)160run "etckeeper init" to update file permissions.)
163 161
164 root@kodama:/etc>git remote add dodo ssh://dodo/etc162 root@kodama:/etc>bzr diff -rbranch:bzr+ssh://dodo/etc | head
165 root@kodama:/etc>git fetch dodo
166 root@kodama:/etc>git diff dodo/master group |head
167 diff --git a/group b/group163 diff --git a/group b/group
168 index 0242b84..b5e4384 100644164 index 0242b84..b5e4384 100644
169 --- a/group165 --- a/group
@@ -175,11 +171,6 @@
175 -lp:x:7:cupsys171 -lp:x:7:cupsys
176 +lp:x:7:172 +lp:x:7:
177173
178Incidentially, this also means I have a backup of dodo's /etc on kodama.
179So if kodama is compromised, that data could be used to attack dodo
180too. On the other hand, if dodo's disk dies, I can restore it from this
181handy hackup.
182
183Of course, it's also possible to pull changes from a server onto client174Of course, it's also possible to pull changes from a server onto client
184machines, to deploy changes to /etc. Once /etc is under version control, the175machines, to deploy changes to /etc. Once /etc is under version control, the
185sky's the limit..176sky's the limit..
186177
=== modified file 'debian/changelog'
--- debian/changelog 2012-02-06 07:49:28 +0000
+++ debian/changelog 2012-03-26 14:09:17 +0000
@@ -1,3 +1,9 @@
1etckeeper (0.61ubuntu2) UNRELEASED; urgency=low
2
3 * Update tutorial to use bzr. LP: #945453
4
5 -- Jelmer Vernooij <jelmer@debian.org> Sat, 24 Mar 2012 12:34:30 +0100
6
1etckeeper (0.61ubuntu1) precise; urgency=low7etckeeper (0.61ubuntu1) precise; urgency=low
28
3 [Chuck Short]9 [Chuck Short]

Subscribers

People subscribed via source and target branches