This file is indexed.

postinst is in italc-client 1:2.0.2+dfsg1-4.

This file is a maintainer script. It is executed when installing (*inst) or removing (*rm) the package.

The actual contents of the file can be viewed below.

  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
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
#!/bin/sh

# postinst script for italc-client
#
# see: dh_installdeb(1)

# summary of how this script can be called:
#        * <postinst> `configure' <most-recently-configured-version>
#        * <old-postinst> `abort-upgrade' <new version>
#        * <conflictor's-postinst> `abort-remove' `in-favour' <package>
#          <new-version>
#        * <postinst> `abort-remove'
#        * <deconfigured's-postinst> `abort-deconfigure' `in-favour'
#          <failed-install-package> <version> `removing'
#          <conflicting-package> <version>
# for details, see http://www.debian.org/doc/debian-policy/ or
# the debian-policy package

set -e

# Source debconf library.
. /usr/share/debconf/confmodule

case "$1" in
	configure)
		# italc_auth_helper needs to be installed setuid root
		if ! dpkg-statoverride --list /usr/bin/italc_auth_helper >/dev/null; then
			dpkg-statoverride --add --update root root 4755 /usr/bin/italc_auth_helper
		fi

		# fetch debconf-variables for italc-client
		db_get italc-client/create-keypairs && italc_create_keypairs=$RET
		db_get italc-client/key-access-for-groups && italc_key_access_for_groups=$RET
		db_get italc-client/create-groups-for-roles && italc_create_groups_for_roles=$RET
		db_get italc-client/use-existing-groups-for-roles && italc_use_existing_groups_for_roles=$RET

		# users of iTALC client

		db_get italc-client/del-last-group-student
		del_last_group="$RET"
		if [ "$del_last_group" = "true" ]; then
			db_get italc-client/last-group-student
			last_group=$(echo $RET | cut -d" " -f1)

			# try to remove the formerly used group for this role, on failure, ignore it
			getent group $last_group 1>/dev/null && delgroup "$last_group" || \
			    echo "Removing Posix group »$last_group« for role »student« failed."

		fi

		db_get italc-client/group-italc-student
		# for sanity: we take everything as a group name until we fine a blank...
		student_group=$(echo $RET | cut -d" " -f1)

		if ! getent group "$student_group" 1>/dev/null; then
			if echo "$student_group" | egrep '^[[:digit:]]{1,5}$' 1>/dev/null; then
				student_group=""
			fi
		fi

		if [ "$italc_create_groups_for_roles" = "true" ]; then
			if echo "$student_group" | egrep '^[[:digit:]]{1,5}$' 1>/dev/null; then
				echo "Specified group for role »student« is a gidNumber, not creating any group." 1>&2
			elif ! getent group $student_group >/dev/null; then
				echo "Creating $student_group group." 1>&2
				addgroup --system $student_group
			else
				echo "Group »$student_group« already exists." 1>&2
			fi
		fi

		# users of iTALC master

		if [ "$italc_create_keypairs" = "true" ]; then

			# reset the configuration file...
			if [ -f /etc/xdg/iTALC\ Solutions/iTALC.conf ]; then
				sed -i /etc/xdg/iTALC\ Solutions/iTALC.conf \
				    -e 's/^LogonGroups=.*/LogonGroups="ITALC_GROUP_ADMIN,ITALC_GROUP_SUPPORTER,ITALC_GROUP_TEACHER,ITALC_GROUP_STUDENT"/'
			fi

			for role in admin supporter teacher; do

				db_get italc-client/del-last-group-$role
				del_last_group="$RET"
				if [ "$del_last_group" = "true" ]; then
					db_get italc-client/last-group-$role
					last_group=$(echo $RET | cut -d" " -f1)

					# try to remove the formerly used group for this role, on failure, ignore it
					getent group $last_group 1>/dev/null && delgroup "$last_group" || \
					    echo "Removing Posix group »$last_group« for role »$role« failed."

				fi

				db_get italc-client/group-italc-$role
				# for sanity: we take everything as a group name until we fine a blank...
				group=$(echo $RET | cut -d" " -f1)

				if ! getent group "$group" 1>/dev/null; then
					if echo "$group" | egrep '^[[:digit:]]{1,5}$' 1>/dev/null; then
						group=""
					fi
				fi

				if [ "$italc_create_keypairs" = "true" ]; then
					# the imc command tries to start its Qt GUI if $DISPLAY is set...
					if [ ! -z ${DISPLAY+x} ]; then
						remembered_DISPLAY=$DISPLAY
					fi
					unset DISPLAY
					if ! test -f "/etc/italc/keys/public/$role/key" -a -f "/etc/italc/keys/private/$role/key"; then
						echo -n "Creating iTALC public/private key pair for iTALC role »$role« ... "
						imc -role $role -createkeypair >/dev/null 2>/dev/null
						chmod -Rf a-w,o-rx "/etc/italc/keys/public/$role"
						chmod -Rf a-w,o-rx "/etc/italc/keys/private/$role"
						echo "done."
					else
						echo "iTALC public/private key for iTALC role »$role« already exists."
					fi
					if [ ! -z "${remembered_DISPLAY+x}" ]; then
						DISPLAY=$remembered_DISPLAY
					fi
				fi

				if [ "$italc_create_groups_for_roles" = "true" ] && [ "x$group" != "x" ]; then
					if echo "$group" | egrep '^[[:digit:]]{1,5}$' 1>/dev/null; then
						echo "Specified group for role »$role« is a gidNumber, not creating any group." 1>&2
					elif ! getent group $group >/dev/null; then
						echo "Creating $group group." 1>&2
						addgroup --system $group
					else
						echo "Group »$group« already exists." 1>&2
					fi
				fi

				# role dependent manipulation of iTALC.conf
				if [ -f /etc/xdg/iTALC\ Solutions/iTALC.conf ]; then
					ROLE=$(echo $role | tr [a-z] [A-Z])
					sed -i /etc/xdg/iTALC\ Solutions/iTALC.conf \
					    -e "s/ITALC_GROUP_$ROLE/$group/"
				fi

				if [ "$italc_key_access_for_groups" = "true" ]; then
					if [ -f /etc/italc/keys/private/$role/key ]; then
						chmod -Rf a-w,o-rx "/etc/italc/keys/private/$role"
						if [ "x$group" != "x" ]; then
							chown -Rf :$group "/etc/italc/keys/private/$role"
						else
							chown -Rf :root "/etc/italc/keys/private/$role"
						fi
					fi

					if [ -f /etc/italc/keys/public/$role/key ]; then
						chmod -Rf a-w,o-rx "/etc/italc/keys/public/$role"
						if [ "x$student_group" != "x" ]; then
							chown -Rf :$student_group "/etc/italc/keys/public/$role"
						else
							chown -Rf :root "/etc/italc/keys/public/$role"
						fi
					fi
				fi

			done

			# manipulate role-independent things iTALC.conf
			if [ -f /etc/xdg/iTALC\ Solutions/iTALC.conf ]; then
				ROLE=$(echo $role | tr [a-z] [A-Z])
				sed -i /etc/xdg/iTALC\ Solutions/iTALC.conf \
				    -e "/^#debconf#.*/d" \
				    -e "s/ITALC_GROUP_STUDENT/$student_group/"
			fi

			# Set permissions for /etc/italc/keys/public/.
			# The permissions and group ownership found for this directory
			# are essential for the iTALC Client startup (via the wrapper
			# script in /usr/bin/ica).
			if [ "$italc_key_access_for_groups" = "true" ]; then
				if [ "x$student_group" != "x" ]; then
					chown -Rf :$student_group "/etc/italc/keys/public"
				else
					chown -Rf :root "/etc/italc/keys/public"
				fi
				chmod 0750 "/etc/italc/keys/public"
			fi

		fi

		db_get italc-client/autostart-on-login
		if [ "$RET" = "true" ] && [ ! -e /etc/xdg/autostart/italc-client-autostart.desktop ]; then
			echo "Setting up system-wide XDG autostart for iTALC client."
			ln -sf /usr/share/applications/italc-client-autostart.desktop /etc/xdg/autostart/italc-client-autostart.desktop
		elif [ "$RET" = "false" ] && [ -L /etc/xdg/autostart/italc-client-autostart.desktop ]; then
			echo "Disabling system-wide XDG autostart for iTALC client."
			rm -f /etc/xdg/autostart/italc-client-autostart.desktop
		fi
		;;

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

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

# dh_installdeb will replace this with shell code automatically
# generated by other debhelper scripts.



exit 0