File: hal.preinst

package info (click to toggle)
hal 0.5.8.1-9etch1
  • links: PTS, VCS
  • area: main
  • in suites: etch
  • size: 2,060 kB
  • ctags: 2
  • sloc: sh: 152; makefile: 27
file content (56 lines) | stat: -rw-r--r-- 1,621 bytes parent folder | download | duplicates (2)
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
51
52
53
54
55
56
#!/bin/sh

set -e

rm_conffile() {
  CONFFILE="$1"
  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
 fi
}

case "$1" in
install|upgrade)
    if dpkg --compare-versions "$2" le "0.5.2-1"; then
        rm_conffile "/etc/hal/fdi/preferences.fdi"
        rm_conffile "/etc/dev.d/block/hal-unmount.dev"
    fi
    if dpkg --compare-versions "$2" le "0.5.6-2"; then
        rm_conffile "/etc/udev/scripts/device-removable.sh" 
    fi
    if dpkg --compare-versions "$2" le "0.5.6-4"; then
        rm_conffile "/etc/hal/fdi/preferences.fdi"
    fi
    if dpkg --compare-versions "$2" le "0.5.7-2"; then
        rm_conffile "/etc/udev/rules.d/90-hal.rules"
    fi
    if dpkg --compare-versions "$2" le "0.5.7.1-1"; then
       deluser --quiet --system hal > /dev/null || true
    fi
esac


if [ "$1" = "upgrade" ]; then
  if [ -x /etc/dbus-1/event.d/20hal ]; then
    /etc/dbus-1/event.d/20hal stop
  else 
    # Really old version of hal have the dbus init script in another location
    # Fallback to manual..
    start-stop-daemon --quiet --stop --oknodo --exec /usr/sbin/hald
  fi
fi

if [ -f /etc/dbus-1/event.d/hal ]; then
	mv /etc/dbus-1/event.d/hal /etc/dbus-1/event.d/20hal
fi

#DEBHELPER#