summaryrefslogtreecommitdiffstats
path: root/debian/open-infrastructure-root-shell.postinst
blob: 0d83f5fa97b2f300c9283e14e8d4f35b34605405 (plain)
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
#!/bin/sh

set -e

case "${1}" in
	configure)
		. /usr/share/debconf/confmodule

		db_get open-infrastructure-root-shell/setuid-root
		SETUID_ROOT="${RET}" # boolean

		db_stop

		case "${SETUID_ROOT}" in
			true)
				echo -n "Adding setuid bit on /bin/root-shell..."

				# don't stop on errors for robustness reasons
				chown root:root /bin/root-shell || true
				chmod 4755 /bin/root-shell || true

				echo " done."
				;;

			false)
				echo -n "Removing setuid bit on /bin/root-shell..."

				# don't stop on errors for robustness reasons
				chown root:root /bin/root-shell || true
				chmod 0755 /bin/root-shell || true

				echo " done."
				;;
		esac
		;;

	abort-upgrade|abort-remove|abort-deconfigure)

		;;

	*)
		echo "postinst called with unknown argument \`${1}'" >&2
		exit 1
		;;
esac

#DEBHELPER#

exit 0