File: ecryptfs-utils.prerm

package info (click to toggle)
ecryptfs-utils 111-6
  • links: PTS
  • area: main
  • in suites: bookworm
  • size: 3,528 kB
  • sloc: ansic: 18,280; sh: 7,043; makefile: 350; python: 41
file content (34 lines) | stat: -rw-r--r-- 1,083 bytes parent folder | download | duplicates (4)
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
#!/bin/sh -e

if [ "$1" = remove ]; then
	# We should do some checking to prevent removal of ecryptfs if in use
	# Check active mounts
	if out=`mount | grep "\Wtype\Wecryptfs\W"`; then
		echo "WARNING: Should not remove ecryptfs-utils, as it appears to be in use:" 1>&2
		echo "$out" 1>&2
	fi
	if out=`grep "\Wecryptfs\W" /proc/mounts`; then
		echo "WARNING: Should not remove ecryptfs-utils, as it appears to be in use:" 1>&2
		echo "$out" 1>&2
	fi
	# Check fstab
	if out=`grep "\Wecryptfs\W" /etc/fstab`; then
		echo "WARNING: Should not remove ecryptfs-utils, as it appears to be in use:" 1>&2
		echo "$out" 1>&2
	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 "WARNING: Should not remove ecryptfs-utils, as it appears to be in use:" 1>&2
			echo "       [/home/$i/.ecryptfs]" 1>&2
		fi
	done
	pam-auth-update --package --remove ecryptfs-utils
fi

#DEBHELPER#

exit 0