[28273] in Source-Commits
cluster-login-config commit: Convert to dh7 and clean up maintscripts
daemon@ATHENA.MIT.EDU (Jonathan D Reed)
Wed Jun 18 18:16:01 2014
Date: Wed, 18 Jun 2014 18:15:54 -0400
From: Jonathan D Reed <jdreed@MIT.EDU>
Message-Id: <201406182215.s5IMFsGT032124@drugstore.mit.edu>
To: source-commits@MIT.EDU
https://github.com/mit-athena/cluster-login-config/commit/2f3104ca6e6acf9cd5e3237f14124f86f4cf8404
commit 2f3104ca6e6acf9cd5e3237f14124f86f4cf8404
Author: Jonathan Reed <jdreed@mit.edu>
Date: Wed Jun 18 17:48:10 2014 -0400
Convert to dh7 and clean up maintscripts
- Convert rules file to dh7
- Wrap Build-Depends in control file
- Remove c-p-d shell snippets from maintainer scripts
- Remove rm_conffile snippets and switch to dpkg-maintscript-helper (and
Pre-Depend on the right version of dpkg for that)
debian/changelog | 4 +-
debian/control | 6 ++-
debian/debathena-cluster-login-config.displace | 1 +
debian/debathena-cluster-login-config.hide | 3 +
debian/debathena-cluster-login-config.postinst | 82 ++--------------------
debian/debathena-cluster-login-config.postrm | 24 ++-----
debian/debathena-cluster-login-config.preinst | 36 ++--------
debian/debathena-cluster-login-config.prerm | 8 ++
debian/debathena-cluster-login-config.transform | 1 +
debian/debathena-cluster-login-config.undisplace | 8 ++
debian/debathena-cluster-login-config.unhide | 18 +++++
debian/rules | 61 +---------------
12 files changed, 71 insertions(+), 181 deletions(-)
diff --git a/debian/changelog b/debian/changelog
index 4175aa3..4c3aa18 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -4,8 +4,10 @@ debathena-cluster-login-config (1.41) UNRELEASED; urgency=low
ConsoleKit in Trusty) (Trac: #1482)
* This version actually includes the dconf locks described in 1.40
* Depend on debathena-dconf-config
+ * Convert to dh7 and clean up maintainer scripts
+ * Remove stray c-p-d shell code from maintainer scripts
- -- Jonathan Reed <jdreed@mit.edu> Wed, 18 Jun 2014 13:24:55 -0400
+ -- Jonathan Reed <jdreed@mit.edu> Wed, 18 Jun 2014 18:05:34 -0400
debathena-cluster-login-config (1.40) unstable; urgency=low
diff --git a/debian/control b/debian/control
index aeb2041..2bb7818 100644
--- a/debian/control
+++ b/debian/control
@@ -2,11 +2,15 @@ Source: debathena-cluster-login-config
Section: debathena-config/net
Priority: extra
Maintainer: Debathena Project <debathena@mit.edu>
-Build-Depends: cdbs, debhelper, dh-buildinfo, config-package-dev (>= 5.0~), system-services, debathena-gdm-config
+Build-Depends: debhelper (>= 7.0.50~),
+ config-package-dev (>= 5.0~),
+ system-services,
+ debathena-gdm-config,
Standards-Version: 3.9.3
Package: debathena-cluster-login-config
Architecture: all
+Pre-Depends: dpkg (>= 1.15.7.2~)
Depends: ${misc:Depends}, debathena-afs-config, debathena-gdm-config, debathena-kiosk, gconf2, gnome-screensaver, update-notifier-common, debathena-machtype (>= 10.0.2-0debathena1~), python-dbus, grub-common, sudo (>= 1.7.2p1-1~), dconf-cli | dconf-tools, debathena-dconf-config
Provides: ${diverted-files}
Conflicts: ${diverted-files}
diff --git a/debian/debathena-cluster-login-config.displace b/debian/debathena-cluster-login-config.displace
new file mode 100644
index 0000000..10712f3
--- /dev/null
+++ b/debian/debathena-cluster-login-config.displace
@@ -0,0 +1 @@
+/sbin/getty.debathena
diff --git a/debian/debathena-cluster-login-config.hide b/debian/debathena-cluster-login-config.hide
new file mode 100644
index 0000000..c6857c9
--- /dev/null
+++ b/debian/debathena-cluster-login-config.hide
@@ -0,0 +1,3 @@
+# We do not want these sessions visible
+/usr/share/xsessions/gnome-failsafe.desktop
+/usr/share/xsessions/xterm.desktop
diff --git a/debian/debathena-cluster-login-config.postinst b/debian/debathena-cluster-login-config.postinst
index 2d7626c..0300a6d 100644
--- a/debian/debathena-cluster-login-config.postinst
+++ b/debian/debathena-cluster-login-config.postinst
@@ -20,84 +20,22 @@ set -e
#DEBHELPER#
-package=debathena-cluster-login-config
-ours=.debathena
-theirs=.debathena-orig
-
-undivert_unlink_symlink()
-{
- file="$1"
- ourfile="$2"
- theirfile="$3"
- if [ ! -L "$file" ] || \
- [ "$(readlink "$file")" != "$(basename "$ourfile")" -a \
- "$(readlink "$file")" != "$(basename "$theirfile")" ]; then
- echo "*** OMINOUS WARNING ***: $file is not linked to either $(basename "$ourfile") or $(basename "$theirfile")" >&2
- else
- rm -f "$file"
- fi
-}
-
-undivert_unlink_divert()
-{
- file="$1"
- if [ ! -L "$file" ] && [ ! -e "$file" ]; then
- dpkg-divert --remove --rename --package "$package" "$file"
- else
- echo "Not removing diversion of $file by $package" >&2
- fi
-}
-
-undivert_unlink()
-{
- prefix=$1
- suffix=$2
-
- file=$prefix$suffix
- ourfile=$prefix$ours$suffix
- theirfile=$prefix$theirs$suffix
-
- undivert_unlink_symlink "$file" "$ourfile" "$theirfile"
- undivert_unlink_divert "$file" "$package"
-}
-
-cleanup_old_diversion() {
- file="$1"
- if dpkg-divert --list "${file}" | grep -Fxq "diversion of ${file} to ${file}${theirs} by ${package}"; then
- undivert_unlink "$file"
- fi
-}
-
-rm_conffile() {
- local PKGNAME="$1" # Unused
- local CONFFILE="$2"
- if [ -f "$CONFFILE".dpkg-del ]; then
- rm -f "$CONFFILE".dpkg-del
- fi
-}
+# Clean up from old conffiles
+dpkg-maintscript-helper rm_conffile /etc/event.d/ttymsg 1.23 -- "$@"
+dpkg-maintscript-helper rm_conffile /etc/init/ttymsg.conf 1.23 -- "$@"
+dpkg-maintscript-helper rm_conffile \
+ /etc/apt/sources.list.d/debathena-backports.list 1.36 -- "$@"
+dpkg-maintscript-helper rm_conffile \
+ /etc/apt/preferences.d/debathena-libstdcplusplus.pref 1.36 -- "$@"
case "$1" in
configure)
- gdm_version="$(dpkg-query -W -f '${Version}' gdm)"
- if dpkg --compare-versions "$gdm_version" ge '2.25.2~'; then
- cleanup_old_diversion /etc/gdm/gdm.conf.debathena
- cleanup_old_diversion /etc/gdm/gdm.conf-custom.debathena
- fi
-
- if dpkg --compare-versions "$2" lt 1.24~; then
- rm_conffile debathena-cluster-login-config "/etc/event.d/ttymsg"
- rm_conffile debathena-cluster-login-config "/etc/init/ttymsg.conf"
- fi
-
if dpkg --compare-versions "$2" lt '1.36.2~'; then
# Cleanup from previous installs
# /etc/apt/preferences was frobbed due to (LP:508545)
if grep -qxF "Package: libstdc++5" /etc/apt/preferences 2>/dev/null; then
rm /etc/apt/preferences
fi
- # Cleanup conffiles
- rm_conffile debathena-cluster-login-config /etc/apt/sources.list.d/debathena-backports.list
- rm_conffile debathena-cluster-login-config /etc/apt/preferences.d/debathena-libstdcplusplus.pref
fi
if dpkg --compare-versions "$2" lt 1.35.2~; then
@@ -120,12 +58,6 @@ case "$1" in
initctl start "tty$i" >/dev/null 2>&1 || true
done
- # Configure dns-nameservers if they're not there
- if ! egrep -q '^[[:space:]]+dns-nameservers' /etc/network/interfaces; then
- echo ' dns-nameservers 18.70.0.160 18.71.0.151 18.72.0.3' >>/etc/network/interfaces
- /usr/share/update-notifier/notify-reboot-required
- fi
-
# Attempt to initially set the root password.
/usr/sbin/athena-root-password
diff --git a/debian/debathena-cluster-login-config.postrm b/debian/debathena-cluster-login-config.postrm
index dbbab94..ca0f348 100644
--- a/debian/debathena-cluster-login-config.postrm
+++ b/debian/debathena-cluster-login-config.postrm
@@ -18,26 +18,16 @@ set -e
# for details, see http://www.debian.org/doc/debian-policy/ or
# the debian-policy package
-rm_conffile() {
- local PKGNAME="$1" # Unused
- local CONFFILE="$2"
-
- if [ -f "$CONFFILE".dpkg-del ]; then
- mv -f "$CONFFILE".dpkg-del "$CONFFILE"
- fi
-}
+# Clean up from old conffiles
+dpkg-maintscript-helper rm_conffile /etc/event.d/ttymsg 1.23 -- "$@"
+dpkg-maintscript-helper rm_conffile /etc/init/ttymsg.conf 1.23 -- "$@"
+dpkg-maintscript-helper rm_conffile \
+ /etc/apt/sources.list.d/debathena-backports.list 1.36 -- "$@"
+dpkg-maintscript-helper rm_conffile \
+ /etc/apt/preferences.d/debathena-libstdcplusplus.pref 1.36 -- "$@"
case "$1" in
abort-install|abort-upgrade)
- if dpkg --compare-versions "$2" lt 1.24~; then
- rm_conffile debathena-cluster-login-config "/etc/event.d/ttymsg"
- rm_conffile debathena-cluster-login-config "/etc/init/ttymsg.conf"
- fi
-
- if dpkg --compare-versions "$2" lt 1.36.2~; then
- rm_conffile debathena-cluster-login-config /etc/apt/sources.list.d/debathena-backports.list
- rm_conffile debathena-cluster-login-config /etc/apt/preferences.d/debathena-libstdcplusplus.pref
- fi
;;
purge|remove|upgrade|failed-upgrade|disappear)
diff --git a/debian/debathena-cluster-login-config.preinst b/debian/debathena-cluster-login-config.preinst
index 43449e7..e865fbc 100644
--- a/debian/debathena-cluster-login-config.preinst
+++ b/debian/debathena-cluster-login-config.preinst
@@ -13,38 +13,16 @@ set -e
# for details, see http://www.debian.org/doc/debian-policy/ or
# the debian-policy package
-rm_conffile() {
- local PKGNAME="$1"
- local CONFFILE="$2"
-
- [ -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 }")"
- # ' # <-- emacs is confused about quoting
- 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 ..."
- mv -f "$CONFFILE" "$CONFFILE".dpkg-del
- fi
-}
+# Clean up from old conffiles
+dpkg-maintscript-helper rm_conffile /etc/event.d/ttymsg 1.23 -- "$@"
+dpkg-maintscript-helper rm_conffile /etc/init/ttymsg.conf 1.23 -- "$@"
+dpkg-maintscript-helper rm_conffile \
+ /etc/apt/sources.list.d/debathena-backports.list 1.36 -- "$@"
+dpkg-maintscript-helper rm_conffile \
+ /etc/apt/preferences.d/debathena-libstdcplusplus.pref 1.36 -- "$@"
case "$1" in
install|upgrade)
- if dpkg --compare-versions "$2" lt 1.24~; then
- rm_conffile debathena-cluster-login-config "/etc/event.d/ttymsg"
- rm_conffile debathena-cluster-login-config "/etc/init/ttymsg.conf"
- fi
-
- if dpkg --compare-versions "$2" lt 1.36.2~; then
- rm_conffile debathena-cluster-login-config /etc/apt/sources.list.d/debathena-backports.list
- rm_conffile debathena-cluster-login-config /etc/apt/preferences.d/debathena-libstdcplusplus.pref
- fi
-
;;
abort-upgrade)
diff --git a/debian/debathena-cluster-login-config.prerm b/debian/debathena-cluster-login-config.prerm
index 02f428f..e663eb2 100755
--- a/debian/debathena-cluster-login-config.prerm
+++ b/debian/debathena-cluster-login-config.prerm
@@ -21,6 +21,14 @@ set -e
#DEBHELPER#
+# Clean up from old conffiles
+dpkg-maintscript-helper rm_conffile /etc/event.d/ttymsg 1.23 -- "$@"
+dpkg-maintscript-helper rm_conffile /etc/init/ttymsg.conf 1.23 -- "$@"
+dpkg-maintscript-helper rm_conffile \
+ /etc/apt/sources.list.d/debathena-backports.list 1.36 -- "$@"
+dpkg-maintscript-helper rm_conffile \
+ /etc/apt/preferences.d/debathena-libstdcplusplus.pref 1.36 -- "$@"
+
case "$1" in
remove|upgrade|deconfigure)
perl -i'' -ne 's%^### (BEGIN|END) debathena-cluster-login-config\s*$%%m && ($skip = ($1 eq "BEGIN")); print unless $skip;' /etc/sudoers
diff --git a/debian/debathena-cluster-login-config.transform b/debian/debathena-cluster-login-config.transform
new file mode 100644
index 0000000..8974b50
--- /dev/null
+++ b/debian/debathena-cluster-login-config.transform
@@ -0,0 +1 @@
+/etc/pam.d/gdm.debathena.debathena debian/transform_gdm.debathena.debathena
diff --git a/debian/debathena-cluster-login-config.undisplace b/debian/debathena-cluster-login-config.undisplace
new file mode 100644
index 0000000..8d7ba9c
--- /dev/null
+++ b/debian/debathena-cluster-login-config.undisplace
@@ -0,0 +1,8 @@
+# We used to divert this before kexec honored its settings
+/etc/default/kexec.debathena
+# We diverted these for gdm << 2.25.2~, and there may be upgrades
+# from old-gdm to new-gdm.
+/etc/gdm/gdm.conf.debathena.debathena
+/etc/gdm/gdm.conf-custom.debathena.debathena
+# We used to divert this because gdm on lucid was dumb
+/etc/dbus-1/system.d/gdm.conf.debathena
diff --git a/debian/debathena-cluster-login-config.unhide b/debian/debathena-cluster-login-config.unhide
new file mode 100644
index 0000000..331924a
--- /dev/null
+++ b/debian/debathena-cluster-login-config.unhide
@@ -0,0 +1,18 @@
+# We used to divert the tty jobs themselves, rather than getty
+# Former diverted tty jobs for Jaunty and earlier
+/etc/event.d/tty1
+/etc/event.d/tty2
+/etc/event.d/tty3
+/etc/event.d/tty4
+/etc/event.d/tty5
+/etc/event.d/tty6
+# Former diverted tty jobs for Karmic and later
+/etc/init/tty1.conf
+/etc/init/tty2.conf
+/etc/init/tty3.conf
+/etc/init/tty4.conf
+/etc/init/tty5.conf
+/etc/init/tty6.conf
+# We used to remove this in Lucid and earlier to disable
+# user-switching
+/usr/lib/indicator-session/indicator-users-service
diff --git a/debian/rules b/debian/rules
index 298d9e0..9395393 100755
--- a/debian/rules
+++ b/debian/rules
@@ -1,62 +1,7 @@
#!/usr/bin/make -f
-DEB_DIVERT_EXTENSION = .debathena
+%:
+ dh $@ --with config-package
-# We used to divert kexec
-DEB_UNDIVERT_FILES_debathena-cluster-login-config += \
- /etc/default/kexec.debathena \
-# We diverted these for gdm << 2.25.2~, and there may be upgrades
-# from old-gdm to new-gdm.
-DEB_UNDIVERT_FILES_debathena-cluster-login-config += \
- /etc/gdm/gdm.conf.debathena.debathena \
- /etc/gdm/gdm.conf-custom.debathena.debathena
-
-# Remove some sessions we don't want.
-DEB_REMOVE_FILES_debathena-cluster-login-config += \
- /usr/share/xsessions/gnome-failsafe.desktop \
- /usr/share/xsessions/xterm.desktop
-# Transform the already-transformed gdm pam config
-# to prevent root login on console
-DEB_TRANSFORM_FILES_debathena-cluster-login-config += \
- /etc/pam.d/gdm.debathena.debathena
-
-
-# Stop transforming gdm's dbus service
-# (was workaround for Lucid stupidity)
-DEB_UNDIVERT_FILES_debathena-cluster-login-config += \
- /etc/dbus-1/system.d/gdm.conf.debathena
-
-# We used to remove this to disable user switching
-DEB_UNREMOVE_FILES_debathena-cluster-login-config += \
- /usr/lib/indicator-session/indicator-users-service
-
-# Install our fake getty for the VTs
-DEB_DIVERT_FILES_debathena-cluster-login-config += \
- /sbin/getty.debathena
-
-# We used to remove these. /etc/event.d is for Jaunty and earlier
-DEB_UNREMOVE_FILES_debathena-cluster-login-config += \
- /etc/event.d/tty1 \
- /etc/event.d/tty2 \
- /etc/event.d/tty3 \
- /etc/event.d/tty4 \
- /etc/event.d/tty5 \
- /etc/event.d/tty6
-
-# Same as above, but for Karmic and later
-DEB_UNREMOVE_FILES_debathena-cluster-login-config += \
- /etc/init/tty1.conf \
- /etc/init/tty2.conf \
- /etc/init/tty3.conf \
- /etc/init/tty4.conf \
- /etc/init/tty5.conf \
- /etc/init/tty6.conf
-
-include /usr/share/cdbs/1/rules/debhelper.mk
-include /usr/share/cdbs/1/rules/config-package.mk
-
-# dh_gconf needs to get called explicitly to install the
-# .gconf-mandatory and .gconf-defaults files
-install/debathena-cluster-login-config::
+override_dh_gconf:
dh_gconf --priority 90
-