Update graphics/cimg to version 1.7.5,3
[dports.git] / graphics / sane-backends / pkg-deinstall
1 #!/bin/sh
2
3 user=saned
4 group=saned
5
6 ask() {
7     local question default answer
8
9     question=$1
10     default=$2
11     if [ -z "${PACKAGE_BUILDING}" ]; then
12         read -p "${question} [${default}]? " answer
13     fi
14     if [ x${answer} = x ]; then
15         answer=${default}
16     fi
17     echo ${answer}
18 }
19
20 yesno() {
21     local dflt question answer
22
23     question=$1
24     dflt=$2
25     while :; do
26         answer=$(ask "${question}" "${dflt}")
27         case "${answer}" in
28         [Yy]*)          return 0;;
29         [Nn]*)          return 1;;
30         esac
31         echo "Please answer yes or no."
32     done
33 }
34
35 delete_account() {
36     local u g home
37
38     u=$1
39     g=$2
40     if yesno "Do you want me to remove group \"${g}\"" y; then
41         pw groupdel -n ${g}
42         echo "Done."
43     fi
44     if yesno "Do you want me to remove user \"${u}\"" y; then
45         eval home=~${u}
46         pw userdel -n ${u}
47         echo "Done."
48     fi
49 }
50
51 if [ x"$2" = xDEINSTALL ]; then
52     if [ ! -n "$BATCH" ]; then
53         if /bin/ps -axc | /usr/bin/grep -q saned; then
54             if yesno "There are some SANE processes running.  Shall I kill them" y; then
55                 ${PKG_PREFIX}/etc/rc.d/saned stop
56                 sleep 2
57             else
58                 echo "OK ... I hope you know what you are doing."
59             fi
60         fi
61
62     fi
63 fi