浏览代码

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 11 年之前
父节点
当前提交
596c09c459
共有 2 个文件被更改,包括 5 次插入1 次删除
  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.
   * Change dpkg-maintscript-helper to handle symlinks and pathnames ending in
     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 ]
   * 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
 
 	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"
 }