Remove obsolete config file diversions
authorChristian Hofstaedtler <ch@grml.org>
Thu, 13 Oct 2011 21:08:54 +0000 (23:08 +0200)
committerChristian Hofstaedtler <ch@grml.org>
Thu, 13 Oct 2011 21:08:54 +0000 (23:08 +0200)
debian/postrm
debian/preinst

index 0527959..55199c8 100755 (executable)
@@ -9,9 +9,6 @@
 set -e
 
 TO_UNDIVERT1="ssh"
-TO_UNDIVERT2="kismet.conf"
-TO_UNDIVERT3="wlan-ng.conf"
-TO_UNDIVERT4="smb.conf"
 
 undivert_gen() {
     DEXT=${3:-original}
@@ -34,15 +31,6 @@ case "$1" in
         for cmd in $TO_UNDIVERT1; do
                 undivert_gen $cmd /etc/init.d
         done
-        for cmd in $TO_UNDIVERT2; do
-                undivert_gen $cmd /etc/kismet
-        done
-        for cmd in $TO_UNDIVERT3; do
-                undivert_gen $cmd /etc/pcmcia
-        done
-        for cmd in $TO_UNDIVERT4; do
-                undivert_gen $cmd /etc/samba
-        done
 
        # make sure the ssh init script even exists if something is failing...
        if ls /etc/init.d/ssh* 1>/dev/null 2>&1 ; then
index 1d31d05..2dd6aa2 100755 (executable)
@@ -10,8 +10,6 @@
 set -e
 
 TO_DIVERT1="ssh"
-TO_DIVERT2="kismet.conf"
-TO_DIVERT3="wlan-ng.conf"
 
 divert_gen() {
     DEXT=${3:-original}
@@ -19,6 +17,12 @@ divert_gen() {
         --divert $2/$1.$DEXT $2/$1 > /dev/null
 }
 
+undivert_gen() {
+    DEXT=${3:-original}
+    dpkg-divert --remove --rename --package grml-etc \
+        --divert $2/$1.$DEXT $2/$1 #> /dev/null
+}
+
 # move files from package grml-etc to grml-etc-core
 # and make sure we do not lose any files...
 rm_conffile() {
@@ -41,23 +45,10 @@ case "$1" in
             divert_gen $cmd /etc/init.d
         done
 
-        for cmd in $TO_DIVERT2; do
-            divert_gen $cmd /etc/kismet
-        done
-
-        for cmd in $TO_DIVERT3; do
-            divert_gen $cmd /etc/pcmcia
-        done
-
-        # did I mention that dpkg-divert sucks?
-        if [ -n "$2" ] ; then
-           if dpkg --compare-versions "${2}" lt 0.8 ; then
-              if dpkg-divert --list | grep -q /etc/init.d/postgresql-8.0 ; then
-                 rm -f /etc/init.d/postgresql-8.0
-                 dpkg-divert --quiet --package grml-etc --remove --rename --divert /etc/init.d/postgresql-8.0.original /etc/init.d/postgresql-8.0
-              fi
-           fi
-        fi
+        # Remove files we no longer ship
+        undivert_gen "kismet.conf" /etc/kismet
+        undivert_gen "wlan-ng.conf" /etc/pcmcia
+        undivert_gen "smb.conf" /etc/samba
 
         # move files from package grml-etc to grml-etc-core
         for file in /etc/zsh/zlogin /etc/zsh/zprofile /etc/zsh/zshenv /etc/zsh/zshrc \
@@ -73,11 +64,6 @@ case "$1" in
            dpkg-divert --quiet --package grml-etc --remove --rename --divert /etc/skel/.zshrc.original /etc/skel/.zshrc
         fi
 
-        if dpkg-divert --list /etc/samba/smb.conf | grep -q 'grml-etc$' ; then
-           [ -f /etc/samba/smb.conf.original ] && rm /etc/samba/smb.conf.original
-           dpkg-divert --quiet --package grml-etc --remove --rename --divert /etc/samba/smb.conf.original /etc/samba/smb.conf
-        fi
-
      ;;
    *)
      echo "preinst called with unknown argument $1" >&2