File: postrm

package info (click to toggle)
usbmount 0.0.14.1
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k, lenny
  • size: 84 kB
  • ctags: 2
  • sloc: sh: 228; makefile: 1
file content (54 lines) | stat: -rw-r--r-- 1,720 bytes parent folder | download
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
#!/bin/sh
set -e

# If an upgrade from a version before 0.0.10 is aborted
# and /etc/usbmount.conf has already been moved to
# /etc/usbmount/usbmount.conf, move it back.
if test "$1" = abort-upgrade || test "$1" = abort-install; then
    if test -n "$2" && dpkg --compare-versions "$2" lt 0.0.10; then
	if test -f /etc/usbmount/usbmount.conf 	&& ! test -e /etc/usbmount.conf; then
	    mv /etc/usbmount/usbmount.conf /etc/usbmount.conf
	fi
	if test -d /etc/usbmount; then
	    rmdir /etc/usbmount || :
	fi
    fi
fi

# If the package is removed or installing is aborted, try to remove the
# default mountpoints. Failure to do so is not considered fatal.
if test "$1" = remove || test "$1" = abort-install; then
    rm -f /media/usb 2> /dev/null || :
    for i in 0 1 2 3 4 5 6 7; do
	rmdir /media/usb$i 2> /dev/null || :
    done
fi

# If a fresh package install or upgarde from a version before 0.0.13 is
# aborted and /etc/usbmount/.create_rules_symlink has already been
# created, remove it.
if test "$1" = abort-upgrade || test "$1" = abort-install; then
    if test -z "$2" || dpkg --compare-versions "$2" lt 0.0.13; then
	if test -f  /etc/usbmount/.create_rules_symlink; then
	    rm -f /etc/usbmount/.create_rules_symlink
	fi
	if test "$1" = abort-install && test -z "$2"; then
	    rmdir /etc/usbmount || :
	fi
    fi
fi

# If the package is purged, remove /etc/dev.d/block/usbmount.dev and the
# /etc/udev/rules.d/z60_usbmount.rules symlink if they exist.
if test "$1" = purge; then
    if test -h /etc/udev/rules.d/z60_usbmount.rules; then
	rm -f /etc/udev/rules.d/z60_usbmount.rules
    fi
    if test -f /etc/dev.d/block/usbmount.dev; then
	rm -f /etc/dev.d/block/usbmount.dev
    fi
fi

#DEBHELPER#

exit 0