This file is indexed.

postinst is in cobbler-web 2.4.1-0ubuntu2.

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
#!/bin/sh

set -e

# migrate to apache2.4
if dpkg --compare-versions "$2" le-nl 2.4.0-0ubuntu2; then
    mv /etc/apache2/conf.d/cobbler_web.conf /etc/apache2/conf-enabled/
fi

if [ "$1" = "configure" ] ; then
	# Setup apache
	if [ -e /etc/cobbler/cobbler_web.conf -a \
		! -e /etc/apache2/conf-enabled/cobbler_web.conf ]; then
		ln -s /etc/cobbler/cobbler_web.conf /etc/apache2/conf-enabled/cobbler_web.conf
	fi
	chown www-data:www-data /var/lib/cobbler/webui_sessions
	chmod 0700 /var/lib/cobbler/webui_sessions
	chown www-data:www-data /var/lib/cobbler/webui_cache
	chmod 0700 /var/lib/cobbler/webui_sessions

	# migrate from old webroot
	if dpkg --compare-versions "$2" lt-nl 2.4.0~beta2; then
	    rm -f /var/www/cobbler_webui_content
	fi

	ln -sf /var/lib/cobbler/webroot/cobbler_webui_content /var/www/cobbler_webui_content

	# Need to restart apache to pickup web configs
	if [ -f /etc/init.d/apache2 ]; then
		if [ -x /usr/sbin/invoke-rc.d ]; then
			invoke-rc.d apache2 restart || true
		else
			/etc/init.d/apache2 restart || true
		fi
	fi

	# generate a random key
	RAND_SECRET=$(openssl rand -base64 40 | sed 's/\//\\\//g')
	sed -i -e "s/SECRET_KEY = ''/SECRET_KEY = \'$RAND_SECRET\'/" \
		/usr/share/cobbler/web/settings.py
fi