summarylogtreecommitdiffstats
path: root/oracle-sgdc.install
blob: a283d6ed930beac92d2c3f201cd2a258e270374b (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
50
51
52
53
_SUNRAY_CONF_PATH="/etc/opt/SUNWut/utadmin.conf"
_SUNRAY_LICPOOL_DIR="/var/cache/osgd"

post_install() {
	# Perform the necessary steps for enabling the sharing of Windows client licenses with the Sun Ray Windows Connector.
	
	# Check for the presence of the SunRay conf file.
	if [ -f "${_SUNRAY_CONF_PATH}" ]; then
		# Share licenses with Windows connector.

		#  Parse Sun Ray conf file, and extract the value of admin.srwc.groupname.
		local awk_prog='$1 == "admin.srwc.groupname" {print $3}'
		local admin_groupname=$(awk "${awk_prog}" "${_SUNRAY_CONF_PATH}")

		#  Change the group ownership of the installed tcc to the group obtained above
		chgrp "${admin_groupname}" "/usr/bin/ttatcc"
		if [ $? -ne 0 ]; then
			# We don't want to set GID the binary if we haven't changed the group!
			return
		fi

		# Set the group ID bit in the tcc binary permissions
		chmod g+s "/usr/bin/ttatcc"
		if [ $? -ne 0 ]; then
			echo "Error setting group permissions on ttatcc."
		fi
	else
		# Create the license pool directory used for sharing Windows client licenses between users.
		if [ ! -d "${_SUNRAY_LICPOOL_DIR}" ]; then
			mkdir -p "${_SUNRAY_LICPOOL_DIR}"> /dev/null 2>&1
			if [ $? -ne 0 ]; then
				# Creation failed. Abort.
				return
			fi
		fi

		#  Set it to be world readable, writeable and executable
		chmod 777 "${_SUNRAY_LICPOOL_DIR}"
		if [ $? -ne 0 ]; then
			echo "Error setting permissions on the pool directory."
		fi
	fi
}

post_upgrade() {
	post_install
}

post_remove() {
	rm -rf "${_SUNRAY_LICPOOL_DIR}"
	
	echo "Delete the folder ~/.tarantella if you want to clear your user data."
}