postinst is in maas-provision 2.2.2-0ubuntu4.
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 | #!/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 maas-provision/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 maas-provision/server_and_next_server || true
ipaddr="$RET"
db_set maas-provision/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_apparmor
if [ "$1" = "configure" ]; then
APP_PROFILE=/etc/apparmor.d/usr.bin.cobblerd
if [ -f "$APP_PROFILE" ]; then
# Add the local/ include
LOCAL_APP_PROFILE=/etc/apparmor.d/local/usr.bin.cobblerd
test -e "$LOCAL_APP_PROFILE" || {
tmp=`mktemp`
cat <<EOM > "$tmp"
# Site-specific additions and overrides for usr.bin.cobblerd.
# For more details, please see /etc/apparmor.d/local/README.
EOM
mkdir `dirname $LOCAL_APP_PROFILE` 2>/dev/null || true
mv -f "$tmp" "$LOCAL_APP_PROFILE"
chmod 644 "$LOCAL_APP_PROFILE"
}
# Reload the profile, including any abstraction updates
if aa-status --enabled 2>/dev/null; then
apparmor_parser -r -T -W "$APP_PROFILE" || true
fi
fi
fi
# End automatically added section
# 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
exit 0
|