forked from hean01/iscan
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathiscan.prerm.in
71 lines (51 loc) · 1.56 KB
/
iscan.prerm.in
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#! /bin/sh
# iscan.prerm -- things to do before package removal
# Copyright (C) 2008, 2009 SEIKO EPSON CORPORATION
#
# License: GPLv2+
#DEBHELPER#
STATE_DIR=@DEB_CONFIGURE_LOCALSTATEDIR@/lib/@DEB_SOURCE_PACKAGE@
VERSION=@DEB_VERSION@
SYSCONFDIR=@DEB_CONFIGURE_SYSCONFDIR@
PATH=$PKGLIBDIR:$PATH
# This is a copy of the function of the same name in the postrm script
needs_restore () {
vers=`dpkg-query --show --showformat='${Version}' libsane-extras`
status=`dpkg-query --show --showformat='${Status}' libsane-extras \
| cut -d' ' -f1`
test x"install" = x"$status" -o x"deinstall" = x"$status" \
&& dpkg --compare-versions "$vers" lt 1.0.19.12 >/dev/null 2>&1
}
case "$1" in
remove|upgrade)
if test -f $STATE_DIR/interpreter; then
test -s $STATE_DIR/interpreter || rm $STATE_DIR/interpreter
fi
;;
failed-upgrade|deconfigure)
;;
*)
echo "postinst called with unknown argument \`$1'" >&2
exit 1
;;
esac
case "$1" in
remove)
if test /etc = "$SYSCONFDIR" && test -e /etc/sane.d/epkowa.conf \
&& needs_restore; then
# comment out any modern keywords so that libsane-extra's
# epkowa doesn't choke on them
sed -i '/^$/b; /^[ \t]*#/b; /^[ \t]*usb/b; /^[ \t]*scsi/b;
/^[ \t]*pio/b; s/\(.*\)/#\1/' /etc/sane.d/epkowa.conf
# prevent purging of conf file by making a backup
cp /etc/sane.d/epkowa.conf /etc/sane.d/bak.epkowa.conf
fi
;;
upgrade|failed-upgrade|deconfigure)
;;
*)
echo "postinst called with unknown argument \`$1'" >&2
exit 1
;;
esac
exit 0