#!/bin/sh # preinst script for debathena-reactivate # # see: dh_installdeb(1) set -e # summary of how this script can be called: # * `install' # * `install' # * `upgrade' # * `abort-upgrade' # for details, see http://www.debian.org/doc/debian-policy/ or # the debian-policy package package=debathena-reactivate 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 } if dpkg-maintscript-helper supports rm_conffile 2> /dev/null; then dpkg-maintscript-helper rm_conffile /etc/athena/sudo-error 2.0.39 -- "$@" dpkg-maintscript-helper rm_conffile /etc/athena/su-error 2.0.39 -- "$@" else # From http://wiki.debian.org/DpkgConffileHandling 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 }")" 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 } case "$1" in install|upgrade) if dpkg --compare-versions "$2" le-nl 2.0.39; then rm_conffile debathena-reactivate "/etc/athena/sudo-error" rm_conffile debathena-reactivate "/etc/athena/su-error" fi esac fi case "$1" in install|upgrade) cleanup_old_diversion /etc/gdm/PreSession/Default cleanup_old_diversion /etc/gdm/PostSession/Default if dpkg --compare-versions "$2" lt-nl 2.0~ && \ [ -w /etc/schroot/schroot.conf ] && \ grep -q '###ATHENA-BEGIN###' /etc/schroot/schroot.conf; then sed -i -e '/###ATHENA-BEGIN###/,/###ATHENA-END###/d' /etc/schroot/schroot.conf fi ;; abort-upgrade) ;; *) echo "preinst called with unknown argument \`$1'" >&2 exit 1 ;; esac # dh_installdeb will replace this with shell code automatically # generated by other debhelper scripts. #DEBHELPER# exit 0