summaryrefslogtreecommitdiff
path: root/debian/wodim.preinst
blob: fd04f70d9d6f17535acfe51a17bf2a0d72e33e38 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#!/bin/sh

# order in descending importance. The loop could be separated, but I have this
# set of checksums now, too lazy for research to separate that again
if [ "$1" = "upgrade" ] ||  [ "$1" = "install" ] ; then
   # first kill old conffiles, then possible dangling symlinks created by that action
   for CONF in /etc/default/wodim /etc/rscsi.conf /etc/default/cdrecord /etc/default/rscsi \
      /etc/cdrecord/cdrecord /etc/cdrecord/rscsi \
      /etc/wodim/wodim /etc/wodim/rscsi
   do
      SUM="$(md5sum $CONF 2>/dev/null | cut -f1 -d\  )"
      # missing, empty, unchanged files
      case "$SUM" in
         00118d4a9c94c41d3ae415638cc055dd |\
         0bcdd41f5d7c6419d524b234701d18f0 |\
         1d2c06f0d52fae533ef0cd58b80d22e4 |\
         3016370f809f8bca713a2eee1ecbeb2d |\
         68e2b3b297d6b5cb0c6beb9136f2d918 |\
         6e3ce0b42b8971f0b10958ab6982b441 |\
         84e0801d1ca1b9d309532385c5864786 |\
         8c3e4a320aafda37f162a12526c0d431 |\
         d41d8cd98f00b204e9800998ecf8427e |\
         e05fdb0a48542ccbff5b28b100d083e3 |\
         e7e6151fe872d56351d04f4c2c3d9722 |\
         eff315991af0911ae8c96b9500c1714f |\
         "")
         rm -f $CONF
         ;;
         *)
         case $CONF in
            *rscsi|*rscsi.conf)
            if ! test -e /etc/netscsid.conf ; then
               cp $CONF /etc/netscsid.conf || true
            fi
            ;;
            *)
            if ! test -e /etc/wodim.conf ; then
               cp $CONF /etc/wodim.conf || true
            fi
            ;;
         esac
         ;;
      esac
   done
   # drop directories but only if empty
   test -d /etc/cdrecord && rmdir /etc/cdrecord 2>/dev/null || true
   test -d /etc/wodim && rmdir /etc/wodim 2>/dev/null || true
fi

#DEBHELPER#