[Pkg-sysvinit-devel] Handling of non-conffiles
Roger Leigh
rleigh at codelibre.net
Wed Jan 11 20:04:54 UTC 2012
On Wed, Jan 11, 2012 at 04:26:43PM +0000, Roger Leigh wrote:
> One problem mentioned in a few bugreports is the handling of
> updates to /etc/default/rcS. Because it's not a conffile, we
> don't provide updates to it. While there are good reasons for
> this approach, I was thinking of ways of improving the situation.
>
> While we don't want to lose any user customisation of this file,
> would it make sense to update the file to the latest version if
> it hasn't been modified? We can do this quite simply: take the
> sha1sum of the file, and compare it with a list of sha1sums of
> all the previous packaged versions of this file; if it matches,
> then it's not been modified, and so should be safe to upgrade.
> This would therefore mean all but the tiny minority of users
> who modify the file would then always have the current version
> and package defaults, and hence wouldn't be using the version
> from back when they originally installed their system.
This is a suggested solution. Any comments?
diff --git a/debian/initscripts.postinst b/debian/initscripts.postinst
index 37682bc..60b5444 100755
--- a/debian/initscripts.postinst
+++ b/debian/initscripts.postinst
@@ -121,6 +121,48 @@ then
fi
#
+# If rcS file has not been modified from a previous default, update it
+# to the latest version. Note that the list was generated from the
+# git repository using the following shell commands:
+#
+# for file in debian/src/initscripts/share/default.rcS debian/initscripts/share/default.rcS; do
+# git log --format="%H" -- "$file" | while read commit; do
+# filehash="$(git ls-tree "$commit" "$file" | cut -d ' ' -f 3 | cut -f 1)"
+# if [ -n "$filehash" ]; then
+# git show "$filehash" | sha1sum
+# fi
+# done
+# done | cut -d ' ' -f 1 | sort | uniq
+#
+# This list should not include the current sha1sum, or else it will
+# try to update the unchanged file on future upgrades. This is listed
+# separately as a no-op.
+#
+rcShash="$(sha1sum /etc/default/rcS | cut -d ' ' -f 1)"
+case "$rcShash" in
+ 093a44fc4d3bf71a9e0db72d77725d9e7b8a6e50 | \
+ 1015bb356f45a1827dbb950cd683fa8457dfbde9 | \
+ 1aeb1b2ec69e4e04dc18e7f40b43846e3f059536 | \
+ 4236f10374de5a4f3b08e658526b5b7877ccb65e | \
+ 594595e22dbb6ceaf7c27118d793b372ee47d266 | \
+ 5c14126591302229891be0f2c2a19f64359d71ff | \
+ 67d92e4240a1e19f341228910b912f34fa763e4e | \
+ 8f438a9b327e87930bcbc0d3ed05f5771e326b04 | \
+ 9ef7a3897c1962418241b014e843148a015bf478 | \
+ c432715638e2456135203fed86b58587d6409d29 | \
+ d09dce2de70c56d4b738bcf32e2eabc6fde23aa7 | \
+ dec43dd15916fc8ac249cf6872cbc4a3a9b8b9ad)
+ echo "Installing new version of config file /etc/default/rcS ... (not modified by user)"
+ cp -p /usr/share/initscripts/default.rcS /etc/default/rcS
+ ;;
+ 3ead47692317baed2c3777cd9698553508718ecc)
+ echo "Not installing new version of config file /etc/default/rcS (already at latest version)"
+ ;;
+ *)
+ echo "Not installing new version of config file /etc/default/rcS (modified by user)"
+esac
+
+#
# In 2.86.ds1-7 the "single" script was moved.
# We have to remove the old links _before_ we install new ones.
#
--
.''`. Roger Leigh
: :' : Debian GNU/Linux http://people.debian.org/~rleigh/
`. `' Printing on GNU/Linux? http://gutenprint.sourceforge.net/
`- GPG Public Key: 0x25BFB848 Please GPG sign your mail.
More information about the Pkg-sysvinit-devel
mailing list