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
|
#!/bin/sh -e
if [ "$1" = remove ]; then
# We must do some checking to prevent removal of ecryptfs if in use
# Check active mounts
if out=`mount | grep "\Wtype\Wecryptfs\W"`; then
echo "ERROR: Cannot remove ecryptfs-utils, as it appears to be in use:" 1>&2
echo "$out" 1>&2
exit 1
fi
if out=`grep "\Wecryptfs\W" /proc/mounts`; then
echo "ERROR: Cannot remove ecryptfs-utils, as it appears to be in use:" 1>&2
echo "$out" 1>&2
exit 1
fi
# Check fstab
if out=`grep "\Wecryptfs\W" /etc/fstab`; then
echo "ERROR: Cannot remove ecryptfs-utils, as it appears to be in use:" 1>&2
echo "$out" 1>&2
exit 1
fi
# Check home directories
for i in `ls /home`; do
if [ -d "/home/$i/.ecryptfs" ]; then
# If we find a .ecryptfs directory (or link) in a home,
# directory, then someone is using ecryptfs-utils, and
# we should not allow package removal
echo "ERROR: Cannot remove ecryptfs-utils, as it appears to be in use:" 1>&2
echo " [/home/$i/.ecryptfs]" 1>&2
exit 1
fi
done
pam-auth-update --package --remove ecryptfs-utils
fi
#DEBHELPER#
exit 0
|