postinst is in cobbler 2.2.2-0ubuntu33.
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  | #!/bin/sh -e
. /usr/share/debconf/confmodule
db_version 2.0
if ([ "$1" = "configure" ] && [ -z "$2" ]) || [ "$1" = "reconfigure" ] || [ -n "$DEBCONF_RECONFIGURE" ]; then
	# Set cobbler's password
	db_get cobbler/password || true
	password="$RET"
	hash=$(printf "cobbler:Cobbler:$password" | md5sum | awk '{print $1}')
	[ -e /etc/cobbler/users.digest ] || install -o root -g root -m 0600 /dev/null /etc/cobbler/users.digest
	htpasswd -D /etc/cobbler/users.digest "cobbler" || true
	printf "cobbler:Cobbler:$hash\n" >> /etc/cobbler/users.digest
	hash=$(printf "$password" | openssl passwd -1 -stdin)
	sed -i "s%^default_password_crypted:.*%default_password_crypted: \"$hash\"%" /etc/cobbler/settings
	db_get cobbler/server_and_next_server || true
	ipaddr="$RET"
	db_set cobbler/server_and_next_server "$ipaddr"
	if grep -qs "^next_server: *..*..*..*$" /etc/cobbler/settings; then
		sed -i "s/^next_server: *..*..*..*$/next_server: $ipaddr/" /etc/cobbler/settings
	fi
	if grep -qs "^server: *..*..*..*$" /etc/cobbler/settings; then
		sed -i "s/^server: *..*..*..*$/server: $ipaddr/" /etc/cobbler/settings
	fi
	# Enable required apache modules
	a2enmod proxy_http
	a2enmod wsgi
	# Install cobbler files and web config for API
	ln -sf /usr/share/cobbler/webroot/cobbler /var/www/cobbler
	ln -sf /etc/cobbler/cobbler.conf /etc/apache2/conf.d/cobbler.conf
	# Need to restart apache to pickup web configs
	if [ -x /usr/sbin/invoke-rc.d ]; then
		invoke-rc.d apache2 restart || true
	else
		/etc/init.d/apache2 restart || true
	fi
	
fi
db_stop
# Automatically added by dh_installinit
if [ -e "/etc/init/cobbler.conf" ]; then
	invoke-rc.d cobbler start || exit $?
fi
# End automatically added section
# Automatically added by dh_installinit
update-rc.d -f cobbler remove >/dev/null || exit $?
# End automatically added section
# Automatically added by dh_python2:
if which pycompile >/dev/null 2>&1; then
	pycompile -p cobbler /usr/share/cobbler -V 2.7
fi
# End automatically added section
exit 0
 |