r3689 - glibc-package/branches/multiarch/debian/debhelper.in
Author: aurel32
Date: 2009-07-26 20:44:09 +0000 (Sun, 26 Jul 2009)
New Revision: 3689
Modified:
glibc-package/branches/multiarch/debian/debhelper.in/libc-bin.postinst
glibc-package/branches/multiarch/debian/debhelper.in/libc-bin.preinst
glibc-package/branches/multiarch/debian/debhelper.in/libc.preinst
Log:
Fix "maintainer-script-uses-dpkg-status-directly" lintian error
Modified: glibc-package/branches/multiarch/debian/debhelper.in/libc-bin.postinst
===================================================================
--- glibc-package/branches/multiarch/debian/debhelper.in/libc-bin.postinst 2009-07-26 20:42:37 UTC (rev 3688)
+++ glibc-package/branches/multiarch/debian/debhelper.in/libc-bin.postinst 2009-07-26 20:44:09 UTC (rev 3689)
@@ -4,14 +4,14 @@
# Move a conffile without triggering a dpkg question
mv_conffile() {
- OLDCONFFILE="$1"
- NEWCONFFILE="$2"
+ local OLDCONFFILE="$1"
+ local NEWCONFFILE="$2"
- if [ -e "$OLDCONFFILE" ]; then
- echo "Preserving user changes to $NEWCONFFILE ..."
- mv -f "$NEWCONFFILE" "$NEWCONFFILE".dpkg-new
- mv -f "$OLDCONFFILE" "$NEWCONFFILE"
- fi
+ [ -e "$OLDCONFFILE" ] || return 0
+
+ echo "Preserving user changes to $NEWCONFFILE ..."
+ mv -f "$NEWCONFFILE" "$NEWCONFFILE".dpkg-new
+ mv -f "$OLDCONFFILE" "$NEWCONFFILE"
}
LASTVERSION=2.9-22
Modified: glibc-package/branches/multiarch/debian/debhelper.in/libc-bin.preinst
===================================================================
--- glibc-package/branches/multiarch/debian/debhelper.in/libc-bin.preinst 2009-07-26 20:42:37 UTC (rev 3688)
+++ glibc-package/branches/multiarch/debian/debhelper.in/libc-bin.preinst 2009-07-26 20:44:09 UTC (rev 3689)
@@ -4,14 +4,16 @@
# Prepare to move a conffile without triggering a dpkg question
prep_mv_conffile() {
- CONFFILE="$1"
+ local PKGNAME="$1"
+ local CONFFILE="$2"
- if [ -e "$CONFFILE" ]; then
- md5sum="`md5sum \"$CONFFILE\" | sed -e \"s/ .*//\"`"
- old_md5sum="`sed -n -e \"/^Conffiles:/,/^[^ ]/{\\\\' $CONFFILE'{s/.* //;p}}\" /var/lib/dpkg/status`"
- if [ "$md5sum" = "$old_md5sum" ]; then
- rm -f "$CONFFILE"
- fi
+ [ -e "$CONFFILE" ] || return 0
+
+ local md5sum="$(md5sum $CONFFILE | sed -e 's/ .*//')"
+ local old_md5sum="$(dpkg-query -W -f='${Conffiles}' $PKGNAME | \
+ sed -n -e "\' $CONFFILE ' { s/ obsolete$//; s/.* //; p }")"
+ if [ "$md5sum" = "$old_md5sum" ]; then
+ rm -f "$CONFFILE"
fi
}
@@ -20,9 +22,9 @@
case "$1" in
install|upgrade)
if dpkg --compare-versions "$2" le "$LASTVERSION"; then
- prep_mv_conffile "/etc/bindresvport.blacklist"
- prep_mv_conffile "/etc/gai.conf"
- prep_mv_conffile "/etc/ld.so.conf.d/libc.conf"
+ prep_mv_conffile LIBC "/etc/bindresvport.blacklist"
+ prep_mv_conffile LIBC "/etc/gai.conf"
+ prep_mv_conffile LIBC "/etc/ld.so.conf.d/libc.conf"
fi
esac
Modified: glibc-package/branches/multiarch/debian/debhelper.in/libc.preinst
===================================================================
--- glibc-package/branches/multiarch/debian/debhelper.in/libc.preinst 2009-07-26 20:42:37 UTC (rev 3688)
+++ glibc-package/branches/multiarch/debian/debhelper.in/libc.preinst 2009-07-26 20:44:09 UTC (rev 3689)
@@ -6,19 +6,21 @@
preversion=$2
rm_conffile() {
- CONFFILE="$1"
+ local PKGNAME="$1"
+ local CONFFILE="$2"
- if [ -e "$CONFFILE" ]; then
- md5sum="`md5sum \"$CONFFILE\" | sed -e \"s/ .*//\"`"
- old_md5sum="`sed -n -e \"/^Conffiles:/,/^[^ ]/{\\\\' $CONFFILE'{s/.* //;p}}\" /var/lib/dpkg/status`"
- if [ "$md5sum" != "$old_md5sum" ]; then
- echo "Obsolete conffile $CONFFILE has been modified by you."
- echo "Saving as $CONFFILE.dpkg-bak ..."
- mv -f "$CONFFILE" "$CONFFILE".dpkg-bak
- else
- echo "Removing obsolete conffile $CONFFILE ..."
- rm -f "$CONFFILE"
- fi
+ [ -e "$CONFFILE" ] || return 0
+
+ local md5sum="$(md5sum $CONFFILE | sed -e 's/ .*//')"
+ local old_md5sum="$(dpkg-query -W -f='${Conffiles}' $PKGNAME | \
+ sed -n -e "\' $CONFFILE ' { s/ obsolete$//; s/.* //; p }")"
+ if [ "$md5sum" != "$old_md5sum" ]; then
+ echo "Obsolete conffile $CONFFILE has been modified by you."
+ echo "Saving as $CONFFILE.dpkg-bak ..."
+ mv -f "$CONFFILE" "$CONFFILE".dpkg-bak
+ else
+ echo "Removing obsolete conffile $CONFFILE ..."
+ rm -f "$CONFFILE"
fi
}
@@ -49,7 +51,7 @@
then
# Remove old /etc/init.d/glibc.sh init script
if dpkg --compare-versions "$preversion" le "2.9-22"; then
- rm_conffile "/etc/init.d/glibc.sh"
+ rm_conffile LIBC "/etc/init.d/glibc.sh"
update-rc.d glibc.sh remove >/dev/null
fi
Reply to: