Explorar el Código

dpkg-maintscript-helper: Support moving a conffile not being shipped

When the conffile stops being shipped, it might make sense to move it
somewhere else to preserve it. Do not fail if the new conffile does not
exist.

Closes: #767003
Signed-off-by: Guillem Jover <guillem@debian.org>
Mathias Behrle hace 11 años
padre
commit
596c09c459
Se han modificado 2 ficheros con 5 adiciones y 1 borrados
  1. 2 0
      debian/changelog
  2. 3 1
      scripts/dpkg-maintscript-helper.sh

+ 2 - 0
debian/changelog

@@ -94,6 +94,8 @@ dpkg (1.18.0) UNRELEASED; urgency=low
     - Improve available state sorting order strings in dselect panel.
     - Improve available state sorting order strings in dselect panel.
   * Change dpkg-maintscript-helper to handle symlinks and pathnames ending in
   * Change dpkg-maintscript-helper to handle symlinks and pathnames ending in
     slash. For the former error out, for the latter strip it. Closes: #771752
     slash. For the former error out, for the latter strip it. Closes: #771752
+  * Support moving a conffile not being shipped anymore. Closes: #767003
+    Thanks to Mathias Behrle <mathiasb@m9s.biz>.
 
 
   [ Raphaël Hertzog ]
   [ Raphaël Hertzog ]
   * Drop myself from Uploaders.
   * Drop myself from Uploaders.

+ 3 - 1
scripts/dpkg-maintscript-helper.sh

@@ -210,7 +210,9 @@ finish_mv_conffile() {
 	ensure_package_owns_file "$PACKAGE" "$OLDCONFFILE" || return 0
 	ensure_package_owns_file "$PACKAGE" "$OLDCONFFILE" || return 0
 
 
 	echo "Preserving user changes to $NEWCONFFILE (renamed from $OLDCONFFILE)..."
 	echo "Preserving user changes to $NEWCONFFILE (renamed from $OLDCONFFILE)..."
-	mv -f "$NEWCONFFILE" "$NEWCONFFILE.dpkg-new"
+	if [ -e "$NEWCONFFILE" ]; then
+		mv -f "$NEWCONFFILE" "$NEWCONFFILE.dpkg-new"
+	fi
 	mv -f "$OLDCONFFILE" "$NEWCONFFILE"
 	mv -f "$OLDCONFFILE" "$NEWCONFFILE"
 }
 }