Merge lp:~jelmer/ubuntu/raring/etckeeper/merge-debian into lp:ubuntu/raring/etckeeper

Proposed by Jelmer Vernooij
Status: Rejected
Rejected by: Martin Pitt
Proposed branch: lp:~jelmer/ubuntu/raring/etckeeper/merge-debian
Merge into: lp:ubuntu/raring/etckeeper
Diff against target: 592 lines (+257/-61)
16 files modified
Makefile (+3/-0)
README (+44/-37)
debian/changelog (+42/-0)
debian/control (+2/-2)
debian/copyright (+1/-1)
debian/po/pt_BR.po (+59/-0)
etckeeper (+17/-7)
etckeeper.8 (+3/-2)
etckeeper.conf (+3/-3)
etckeeper.spec (+1/-1)
init.d/50vcs-ignore (+1/-1)
unclean.d/50test (+2/-2)
uninit.d/01prompt (+1/-1)
uninit.d/50vcs-uninit (+32/-2)
update-ignore.d/01update-ignore (+8/-2)
zypper-etckeeper.py (+38/-0)
To merge this branch: bzr merge lp:~jelmer/ubuntu/raring/etckeeper/merge-debian
Reviewer Review Type Date Requested Status
Didier Roche-Tolomelli Approve
Ubuntu Sponsors Pending
Ubuntu branches Pending
Review via email: mp+141431@code.launchpad.net

Description of the change

Merge the latest upstream version of etckeeper.

This also reverts (by not reapplying) the Ubuntu-specific change of the default VCS to Bazaar.

I've cherry-picked a patch from upstream to make it cope better with changes to the VCS setting. This fixes an issue originally introduced in dapper, when we first switched from git to bzr.

To post a comment you must log in.
Revision history for this message
Didier Roche-Tolomelli (didrocks) wrote :

This looks good :) Not sure about the bzr -> git change back, but I trust your knowledge and your ubuntu friendlyness here :)

review: Approve
Revision history for this message
Didier Roche-Tolomelli (didrocks) wrote :

ah, it seems Colin actually already released 0.64ubuntu1

Unmerged revisions

45. By Jelmer Vernooij

releasing version 0.64ubuntu1

44. By Jelmer Vernooij

Drop hostname dependency.

43. By Jelmer Vernooij

Cherry-pick support for detecting the VCS in use from upstream.
(git commits e5742f7ae353f9a675e13fc0b951daeeff82bdae and
9f613899512e2091d2699c7f64b60c0dbdad71a2). LP: #909558

42. By Jelmer Vernooij

* Merge from Debian. Remaining changes:
 - etckeeper.spec: Change version to match Ubuntu version
 - commit.d/50vcs-commit: Avoid failure in initial commit if etckeeper
   is not installed from a tty (like early during installation)
 - debian/control: Added dependency on hostname.
 - etckeeper: Ensure that LANG is set, default to UTF8, necessary for
   bzr to function properly in non-interactive shells (eg, cron); user's
   local LANG will override if set.
* Drop patch to default to bzr as VCS, switching back to upstream default of
  git.
* Added support for openSUSE's zypper package manager.
  Thanks, Catalin Iacob
* Add Brazilian Portuguese debconf translation.
  Closes: #685771 Thanks, Adriano Rafael Gomes
* bzr: Improve detection of unclean repos, to work when there are shelved
  changes.
* uninit: Now preserves parts of the gitignore and similar files that
  are outside the managed by etckeeper block. Closes: #673996
  Thanks, David De La Harpe Golden (Squared Financial)
* Autocommit git staged files. Closes: #662614

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'Makefile'
2--- Makefile 2011-11-25 20:03:36 +0000
3+++ Makefile 2012-12-28 17:58:21 +0000
4@@ -36,6 +36,9 @@
5 $(INSTALL_DATA) yum-etckeeper.py $(DESTDIR)$(prefix)/lib/yum-plugins/etckeeper.py
6 $(INSTALL_DATA) yum-etckeeper.conf $(DESTDIR)$(etcdir)/yum/pluginconf.d/etckeeper.conf
7 endif
8+ifeq ($(HIGHLEVEL_PACKAGE_MANAGER),zypper)
9+ $(INSTALL_DATA) zypper-etckeeper.py $(DESTDIR)$(prefix)/lib/zypp/plugins/commit/zypper-etckeeper.py
10+endif
11 -./etckeeper-bzr/__init__.py install --root=$(DESTDIR) ${PYTHON_INSTALL_OPTS} || echo "** bzr support not installed"
12 echo "** installation successful"
13
14
15=== modified file 'README'
16--- README 2012-03-26 14:04:59 +0000
17+++ README 2012-12-28 17:58:21 +0000
18@@ -54,15 +54,15 @@
19 Most VCS, including git, mercurial and bazaar have only limited tracking of
20 file metadata, being able to track the executable bit, but not other
21 permissions or owner info. (darcs doesn't even track executable bits.) So
22-file metadata storage is stored separately. Among other chores, `etckeeper
23-init` sets up a `pre-commit` hook that stores metadata about file owners
24-and permissions into a `/etc/.metadata` file. This metadata is stored in
25+file metadata is stored separately. Among other chores, `etckeeper init`
26+sets up a `pre-commit` hook that stores metadata about file owners and
27+permissions into a `/etc/.etckeeper` file. This metadata is stored in
28 version control along with everything else, and can be applied if the repo
29 should need to be checked back out.
30
31 git and mercurial cannot track empty directories, but they can be
32 significant sometimes in /etc. So the `pre-commit` hook also stores
33-information that can be used to recreate the empty directories in a
34+information that can be used to recreate the empty directories in the
35 `/etc/.etckeeper` file.
36
37 Most VCS don't support several special files that you _probably_ won't have
38@@ -78,10 +78,10 @@
39
40 A quick walkthrough of using etckeeper.
41
42-Note that the default VCS is bzr, and this tutorial assumes you're using
43+Note that the default VCS is git, and this tutorial assumes you're using
44 it. Using other VCSes should be broadly similar.
45
46-The `etckeeper init` command initialises an /etc/.bzr/ repository.
47+The `etckeeper init` command initialises an /etc/.git/ repository.
48 If you installed etckeeper from a package, this was probably automatically
49 performed during the package installation. If not, your first step is to
50 run it by hand:
51@@ -89,77 +89,81 @@
52 etckeeper init
53
54 The `etckeeper init` command is careful to never overwrite existing files
55-or directories in /etc. It will create a `.bzrignore` if one doesn't
56+or directories in /etc. It will create a `.gitignore` if one doesn't
57 already exist (or update content inside a "managed by etckeeper" comment
58 block), sets up pre-commit hooks if they don't already exist, and so on. It
59-does *not* commit any files, but does `bzr add` all interesting files for
60+does *not* commit any files, but does `git add` all interesting files for
61 an initial commit later.
62
63-Now you might want to run `bzr status` to check that it includes all
64+Now you might want to run `git status` to check that it includes all
65 the right files, and none of the wrong files. And you can edit the
66-`.bzrignore` and so forth. Once you're ready, it's time to commit:
67+`.gitignore` and so forth. Once you're ready, it's time to commit:
68
69 cd /etc
70- bzr status
71- bzr commit -m "initial checkin"
72+ git status
73+ git commit -m "initial checkin"
74+ git gc # pack git repo to save a lot of space
75
76-After this first commit, you can use regular bzr commands to handle
77+After this first commit, you can use regular git commands to handle
78 further changes:
79
80 passwd someuser
81- bzr status
82- bzr commit -m "changed a password"
83+ git status
84+ git commit -a -m "changed a password"
85
86 Rinse, lather, repeat. You might find that some files are changed by
87-daemons and shouldn't be tracked by bzr. These can be removed from bzr:
88+daemons and shouldn't be tracked by git. These can be removed from git:
89
90- bzr rm printcap # modified by CUPS
91- echo printcap >> .bzrignore
92- bzr commit -m "don't track printcap"
93+ git rm --cached printcap # modified by CUPS
94+ echo printcap >> .gitignore
95+ git commit -a -m "don't track printcap"
96
97 etckeeper hooks into apt (and similar systems) so changes to interesting
98 files in /etc caused by installing or upgrading packages will automatically
99 be committed. Here "interesting" means files that are not ignored by
100-`.bzrignore`.
101+`.gitignore`.
102
103-You can use any bzr commands you like, but do keep in mind that, if you
104-check out a different branch or an old version, bzr is operating directly
105+You can use any git commands you like, but do keep in mind that, if you
106+check out a different branch or an old version, git is operating directly
107 on your system's /etc. If you do decide to check out a branch or tag,
108 make sure you run "etckeeper init" again, to get any metadata changes:
109
110- bzr revert april_first_joke_etc
111+ git checkout april_first_joke_etc
112 etckeeper init
113
114 Often it's better to clone /etc to elsewhere and do potentially dangerous
115-stuff in a staging directory. You can clone the repository using bzr branch,
116+stuff in a staging directory. You can clone the repository using git clone,
117 but be careful that the directory it's cloned into starts out mode 700, to
118-prevent anyone else from seeing files like shadow, before `etckeeper init`
119+prevent anyone else from seeing files like `shadow`, before `etckeeper init`
120 fixes their permissions:
121
122 mkdir /my/workdir
123 cd /my/workdir
124 chmod 700 .
125- bzr branch /etc
126+ git clone /etc
127 cd etc
128 etckeeper init -d .
129 chmod 755 ..
130
131 Another common reason to clone the repository is to make a backup to a
132-server. When using bzr push to create a new remote clone, make sure the new
133-remote clone is mode 700! (And, obviously, only push over a secure
134+server. When using `git push` to create a new remote clone, make sure the
135+new remote clone is mode 700! (And, obviously, only push over a secure
136 transport like ssh, and only to a server you trust.)
137
138- ssh server 'bzr init --no-tree /etc-clone; chmod -R 700 /etc-clone'
139- bzr push bzr+ssh://server/etc-clone
140+ ssh server 'mkdir /etc-clone; cd /etc-clone; chmod 700 .; git init --bare'
141+ git remote add backup ssh://server/etc-clone
142+ git push backup --all
143
144 If you have several machine's using etckeeper, you can start with a
145 etckeeper repository on one machine, then add another machine's etckeeper
146-repository. Then you can diff against it, examine its
147+repository as a git remote. Then you can diff against it, examine its
148 history, merge with it, and so on. It would probably not, however, be wise
149-to "bzr checkout" the other machine's branch! (And if you do, make sure to
150+to "git checkout" the other machine's branch! (And if you do, make sure to
151 run "etckeeper init" to update file permissions.)
152
153- root@kodama:/etc>bzr diff -rbranch:bzr+ssh://dodo/etc | head
154+ root@kodama:/etc>git remote add dodo ssh://dodo/etc
155+ root@kodama:/etc>git fetch dodo
156+ root@kodama:/etc>git diff dodo/master group |head
157 diff --git a/group b/group
158 index 0242b84..b5e4384 100644
159 --- a/group
160@@ -171,6 +175,11 @@
161 -lp:x:7:cupsys
162 +lp:x:7:
163
164+Incidentially, this also means I have a backup of dodo's /etc on kodama.
165+So if kodama is compromised, that data could be used to attack dodo
166+too. On the other hand, if dodo's disk dies, I can restore it from this
167+handy hackup.
168+
169 Of course, it's also possible to pull changes from a server onto client
170 machines, to deploy changes to /etc. Once /etc is under version control, the
171 sky's the limit..
172@@ -195,7 +204,7 @@
173 git commit -m "run git gc after each apt run"
174
175 Here's how to disable the automatic commits after each apt run, while still
176-letting it git add new files and git rm removed ones:
177+letting it git add new files:
178
179 chmod -x /etc/etckeeper/commit.d/50vcs-commit
180
181@@ -246,14 +255,12 @@
182 * http://www.jukie.net/~bart/blog/20070312134706
183 * http://bryan-murdock.blogspot.com/2007/07/put-etc-under-revision-control-with-git.html
184
185-[isisetup][2] has some of the same aims as etckeeper, however, unlike it,
186+isisetup had some of the same aims as etckeeper, however, unlike it,
187 etckeeper does not aim to be a git porcelain with its own set of commands
188 for manipulating the /etc repository. Instead, etckeeper provides a simple
189 setup procedure and hooks for setting up an /etc repository, and then gets
190 out of your way; you manage the repository using regular VCS commands.
191
192- [2]: http://www.isisetup.ch/
193-
194
195 ## license
196
197
198=== modified file 'debian/changelog'
199--- debian/changelog 2012-03-26 15:10:42 +0000
200+++ debian/changelog 2012-12-28 17:58:21 +0000
201@@ -1,3 +1,45 @@
202+etckeeper (0.64ubuntu1) raring; urgency=low
203+
204+ * Merge from Debian. Remaining changes:
205+ - etckeeper.spec: Change version to match Ubuntu version
206+ - commit.d/50vcs-commit: Avoid failure in initial commit if etckeeper
207+ is not installed from a tty (like early during installation)
208+ - etckeeper: Ensure that LANG is set, default to UTF8, necessary for
209+ bzr to function properly in non-interactive shells (eg, cron); user's
210+ local LANG will override if set.
211+ * Drop patch to default to bzr as VCS, switching back to upstream default of
212+ git.
213+ * Cherry-pick support for detecting the VCS in use from upstream.
214+ (git commits e5742f7ae353f9a675e13fc0b951daeeff82bdae and
215+ 9f613899512e2091d2699c7f64b60c0dbdad71a2). LP: #909558
216+
217+ -- Jelmer Vernooij <jelmer@ubuntu.com> Sat, 08 Dec 2012 03:03:39 +0100
218+
219+etckeeper (0.64) unstable; urgency=low
220+
221+ * Added support for openSUSE's zypper package manager.
222+ Thanks, Catalin Iacob
223+ * Add Brazilian Portuguese debconf translation.
224+ Closes: #685771 Thanks, Adriano Rafael Gomes
225+
226+ -- Joey Hess <joeyh@debian.org> Sat, 25 Aug 2012 11:53:08 -0400
227+
228+etckeeper (0.63) unstable; urgency=low
229+
230+ * bzr: Improve detection of unclean repos, to work when there are shelved
231+ changes.
232+ * uninit: Now preserves parts of the gitignore and similar files that
233+ are outside the managed by etckeeper block. Closes: #673996
234+ Thanks, David De La Harpe Golden (Squared Financial)
235+
236+ -- Joey Hess <joeyh@debian.org> Sat, 02 Jun 2012 18:22:37 -0400
237+
238+etckeeper (0.62) unstable; urgency=low
239+
240+ * Autocommit git staged files. Closes: #662614
241+
242+ -- Joey Hess <joeyh@debian.org> Mon, 05 Mar 2012 10:41:46 -0400
243+
244 etckeeper (0.61ubuntu2) precise; urgency=low
245
246 * Update tutorial to use bzr. LP: #945453
247
248=== modified file 'debian/control'
249--- debian/control 2012-01-06 19:42:39 +0000
250+++ debian/control 2012-12-28 17:58:21 +0000
251@@ -4,7 +4,7 @@
252 Build-Depends: debhelper (>= 7), dpkg-dev (>= 1.9.0), bzr (>= 1.5~), python
253 Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com>
254 XSBC-Original-Maintainer: Joey Hess <joeyh@debian.org>
255-Standards-Version: 3.9.2
256+Standards-Version: 3.9.3
257 XS-Python-Version: all
258 Vcs-Git: git://git.kitenet.net/etckeeper
259 Homepage: http://kitenet.net/~joey/code/etckeeper/
260@@ -12,7 +12,7 @@
261 Package: etckeeper
262 Architecture: all
263 Section: admin
264-Depends: bzr (>= 1.5~) | git (>= 1:1.7) | mercurial | darcs, hostname, ${misc:Depends}
265+Depends: git (>= 1:1.7) | mercurial | bzr (>= 1.5~) | darcs, ${misc:Depends}
266 Recommends: cron
267 Suggests: sudo (>= 1.7.4p4)
268 Conflicts: bzr (<< 1.5~)
269
270=== modified file 'debian/copyright'
271--- debian/copyright 2011-02-06 00:00:55 +0000
272+++ debian/copyright 2012-12-28 17:58:21 +0000
273@@ -1,4 +1,4 @@
274-Format: http://dep.debian.net/deps/dep5/
275+Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
276
277 Files: *
278 Copyright: © 2007-2011 Joey Hess <joey@kitenet.net>
279
280=== added file 'debian/po/pt_BR.po'
281--- debian/po/pt_BR.po 1970-01-01 00:00:00 +0000
282+++ debian/po/pt_BR.po 2012-12-28 17:58:21 +0000
283@@ -0,0 +1,59 @@
284+# Debconf translations for etckeeper.
285+# Copyright (C) 2012 THE etckeeper'S COPYRIGHT HOLDER
286+# This file is distributed under the same license as the etckeeper package.
287+# Adriano Rafael Gomes <adrianorg@gmail.com>, 2012.
288+#
289+msgid ""
290+msgstr ""
291+"Project-Id-Version: etckeeper 0.63\n"
292+"Report-Msgid-Bugs-To: etckeeper@packages.debian.org\n"
293+"POT-Creation-Date: 2009-05-06 14:41-0400\n"
294+"PO-Revision-Date: 2012-08-21 11:15-0300\n"
295+"Last-Translator: Adriano Rafael Gomes <adrianorg@gmail.com>\n"
296+"Language-Team: Brazilian Portuguese <debian-l10n-portuguese@lists.debian."
297+"org>\n"
298+"Language: pt_BR\n"
299+"MIME-Version: 1.0\n"
300+"Content-Type: text/plain; charset=UTF-8\n"
301+"Content-Transfer-Encoding: 8bit\n"
302+
303+#. Type: error
304+#. Description
305+#: ../templates:2001
306+msgid "Commit failed"
307+msgstr "Envio falhou"
308+
309+#. Type: error
310+#. Description
311+#: ../templates:2001
312+msgid "An attempt to commit /etc changes to ${VCS} failed."
313+msgstr "Uma tentativa de enviar alterações feitas em /etc para ${VCS} falhou."
314+
315+#. Type: error
316+#. Description
317+#: ../templates:2001
318+msgid ""
319+"You may manually resolve the issues with the uncommitted changes before "
320+"continuing."
321+msgstr ""
322+"Você pode resolver manualmente os problemas com as alterações não enviadas "
323+"antes de continuar."
324+
325+#. Type: boolean
326+#. Description
327+#: ../templates:3001
328+msgid "Remove etckeeper ${VCS} repository and associated files?"
329+msgstr "Remover o repositório ${VCS} do etckeeper e os arquivos associados?"
330+
331+#. Type: boolean
332+#. Description
333+#: ../templates:3001
334+msgid ""
335+"Etckeeper is being purged from the system, and was used to store /etc in a "
336+"${VCS} repository. If you choose to remove the repository, this will DESTROY "
337+"all history etckeeper has recorded for /etc."
338+msgstr ""
339+"O etckeeper está sendo expurgado do sistema, e foi usado para armazenar o "
340+"diretório /etc em um repositório ${VCS}. Se você escolher remover o "
341+"repositório, isso DESTRUIRÁ todo o histórico que o etckeeper gravou para o "
342+"diretório /etc."
343
344=== modified file 'etckeeper'
345--- etckeeper 2012-02-06 07:49:28 +0000
346+++ etckeeper 2012-12-28 17:58:21 +0000
347@@ -16,12 +16,6 @@
348 . $conf
349 fi
350
351-if [ -z "$VCS" ]; then
352- echo "Please configure a VCS in $conf" >&2
353- exit 1
354-fi
355-export VCS
356-
357 program_directory="${0%/*}"
358 if [ -n "$program_directory" ]; then
359 PATH="$PATH:$program_directory"
360@@ -61,7 +55,7 @@
361 if [ -z "$1" ]; then
362 usage
363 elif [ "x$1" = "x-h" ] || [ "x$1" = "x--help" ]; then
364- man etceeper || echo "Usage: etckeeper command [-d directory]" >&2
365+ man etckeeper || echo "Usage: etckeeper command [-d directory]" >&2
366 exit 0
367 fi
368 command="$1"
369@@ -94,6 +88,22 @@
370 cd "$ETCKEEPER_DIR"
371 export ETCKEEPER_DIR
372
373+if [ -d ".git" ]; then
374+ VCS=git
375+elif [ -d ".hg" ]; then
376+ VCS=hg
377+elif [ -d "_darcs" ]; then
378+ VCS=darcs
379+elif [ -d ".bzr" ]; then
380+ VCS=bzr
381+fi
382+
383+if [ -z "$VCS" ]; then
384+ echo "Please configure a VCS in $conf" >&2
385+ exit 1
386+fi
387+export VCS
388+
389 lsscripts() {
390 perl -e '
391 $dir=shift;
392
393=== modified file 'etckeeper.8'
394--- etckeeper.8 2010-07-16 15:14:05 +0000
395+++ etckeeper.8 2012-12-28 17:58:21 +0000
396@@ -41,10 +41,11 @@
397 .B unclean
398 This returns true if the directory contains uncommitted changes.
399 .TP
400-.B update-ignore
401+.B update-ignore [-a]
402 This updates the VCS ignore file. Content outside a "managed by etckeeper"
403 block is not touched. This is generally run when upgrading to a new version
404-of etckeeper.
405+of etckeeper. (The -a switch will add a "managed by etckeeper" block if
406+one is not present.)
407 .TP
408 .B vcs subcommand [options ...]
409 You can use this to run any subcommand of the VCS that etckeeper is
410
411=== modified file 'etckeeper.conf'
412--- etckeeper.conf 2011-06-21 17:14:20 +0000
413+++ etckeeper.conf 2012-12-28 17:58:21 +0000
414@@ -1,7 +1,7 @@
415 # The VCS to use.
416 #VCS="hg"
417-#VCS="git"
418-VCS="bzr"
419+VCS="git"
420+#VCS="bzr"
421 #VCS="darcs"
422
423 # Options passed to git commit when run by etckeeper.
424@@ -30,7 +30,7 @@
425 #AVOID_COMMIT_BEFORE_INSTALL=1
426
427 # The high-level package manager that's being used.
428-# (apt, pacman-g2, yum etc)
429+# (apt, pacman-g2, yum, zypper etc)
430 HIGHLEVEL_PACKAGE_MANAGER=apt
431
432 # The low-level package manager that's being used.
433
434=== modified file 'etckeeper.spec'
435--- etckeeper.spec 2012-03-26 15:10:42 +0000
436+++ etckeeper.spec 2012-12-28 17:58:21 +0000
437@@ -1,5 +1,5 @@
438 Name: etckeeper
439-Version: 0.61ubuntu2
440+Version: 0.64ubuntu1
441 Release: 4%{?dist}
442 Summary: store /etc in git, mercurial, bzr or darcs
443
444
445=== modified file 'init.d/50vcs-ignore'
446--- init.d/50vcs-ignore 2009-02-14 01:21:22 +0000
447+++ init.d/50vcs-ignore 2012-12-28 17:58:21 +0000
448@@ -1,4 +1,4 @@
449 #!/bin/sh
450 set -e
451
452-etckeeper update-ignore || true
453+etckeeper update-ignore -a || true
454
455=== modified file 'unclean.d/50test'
456--- unclean.d/50test 2009-02-12 17:13:23 +0000
457+++ unclean.d/50test 2012-12-28 17:58:21 +0000
458@@ -2,11 +2,11 @@
459 set -e
460
461 if [ "$VCS" = git ]; then
462- [ -d .git ] && [ -n "`git ls-files --modified --deleted --others --exclude-standard`" ]
463+ [ -d .git ] && [ -n "`git status --porcelain`" ]
464 elif [ "$VCS" = hg ]; then
465 [ -d .hg ] && ! hg status 2>&1 | wc -l | grep -q "^0$"
466 elif [ "$VCS" = bzr ]; then
467- [ -d .bzr ] && ! bzr status 2>/dev/null | wc -l | grep -q "^0$"
468+ [ -d .bzr ] && ! bzr version-info --custom --template="{clean}\n" | grep -q "^1$"
469 elif [ "$VCS" = darcs ]; then
470 [ -d _darcs ] && darcs whatsnew -l >/dev/null
471 fi
472
473=== modified file 'uninit.d/01prompt'
474--- uninit.d/01prompt 2009-05-06 14:52:30 +0000
475+++ uninit.d/01prompt 2012-12-28 17:58:21 +0000
476@@ -3,7 +3,7 @@
477
478 if [ "$1" != "-f" ]; then
479 echo "** Warning: This will DESTROY all recorded history for $ETCKEEPER_DIR,"
480- echo "** including the $VCS repository and ignore file."
481+ echo "** including the $VCS repository."
482 echo ""
483 printf "Are you sure you want to do this? [yN] "
484 read answer
485
486=== modified file 'uninit.d/50vcs-uninit'
487--- uninit.d/50vcs-uninit 2009-09-26 15:58:15 +0000
488+++ uninit.d/50vcs-uninit 2012-12-28 17:58:21 +0000
489@@ -18,7 +18,37 @@
490 managed_by_etckeeper="managed by etckeeper"
491
492 if ! grep -q "$managed_by_etckeeper" "$file"; then
493- echo "etckeeper: "$file" does not contain \"$managed_by_etckeeper\" comment; not removing"
494+ exit 0
495 else
496- rm -f $file
497+ realfile="$file"
498+ if [ -n "`type -p tempfile`" ]; then
499+ tempfile="tempfile"
500+ elif [ -n "`type -p mktemp`" ]; then
501+ tempfile="mktemp"
502+ else
503+ echo "etckeeper warning: can't find tempfile or mktemp" >&2
504+ exit 1
505+ fi
506+ file=$($tempfile)
507+ otherentries=
508+ skipping=
509+ while read line; do
510+ if echo "$line" | grep -q "$managed_by_etckeeper"; then
511+ if [ ! "$skipping" ]; then
512+ skipping=1
513+ else
514+ skipping=
515+ fi
516+ elif [ ! "$skipping" ]; then
517+ echo "$line" >> "$file"
518+ otherentries=1
519+ fi
520+ done <"$realfile"
521+
522+ if [ "$otherentries" ]; then
523+ mv -f "$file" "$realfile"
524+ else
525+ rm -f "$file"
526+ rm -f "$realfile"
527+ fi
528 fi
529
530=== modified file 'update-ignore.d/01update-ignore'
531--- update-ignore.d/01update-ignore 2012-01-06 19:23:42 +0000
532+++ update-ignore.d/01update-ignore 2012-12-28 17:58:21 +0000
533@@ -160,8 +160,14 @@
534
535 if [ -e "$file" ]; then
536 if ! grep -q "$managed_by_etckeeper" "$file"; then
537- echo "etckeeper: "$file" does not contain \"$managed_by_etckeeper\" comment; not updating"
538- exit 1
539+ if [ "$1" != "-a" ]; then
540+ echo "etckeeper: "$file" does not contain \"$managed_by_etckeeper\" comment; not updating"
541+ exit 1
542+ else
543+ echo "etckeeper: "$file" exists but does not contain \"$managed_by_etckeeper\" comment; updating"
544+ writefile
545+ exit 0
546+ fi
547 fi
548 realfile="$file"
549 if [ -n "`type -p tempfile`" ]; then
550
551=== added file 'zypper-etckeeper.py'
552--- zypper-etckeeper.py 1970-01-01 00:00:00 +0000
553+++ zypper-etckeeper.py 2012-12-28 17:58:21 +0000
554@@ -0,0 +1,38 @@
555+#!/usr/bin/env python
556+
557+import errno
558+import subprocess
559+import zypp_plugin
560+
561+
562+def _call_etckeeper(install_arg):
563+ # zypper interprets the plugin's stdout as described in
564+ # http://doc.opensuse.org/projects/libzypp/HEAD/zypp-plugins.html so it's
565+ # important that we don't write anything to it. We therefore redirect
566+ # etckeeper's stdout to the plugin's stderr. Since zypper writes the
567+ # stderr of plugins to its log file, etckeeper's stdout will go there as
568+ # well.
569+
570+ subprocess.call(['etckeeper', install_arg], stdout=2)
571+
572+
573+class EtckeeperPlugin(zypp_plugin.Plugin):
574+ def PLUGINBEGIN(self, headers, body):
575+ _call_etckeeper('pre-install')
576+ self.ack()
577+
578+ def PLUGINEND(self, headers, body):
579+ try:
580+ _call_etckeeper('post-install')
581+ except OSError as e:
582+ # if etckeeper was just removed, executing it will fail with
583+ # ENOENT
584+ if e.errno != errno.ENOENT:
585+ # reraise so that we don't hide other errors than etckeeper
586+ # not existing
587+ raise
588+ self.ack()
589+
590+
591+plugin = EtckeeperPlugin()
592+plugin.main()

Subscribers

People subscribed via source and target branches