postinst is in maas-rack-controller 2.4.0~beta2-6865-gec43e47e6-0ubuntu1.
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 214 215 216 217 218 | #!/bin/sh
set -e
. /usr/share/debconf/confmodule
db_version 2.0
RELEASE=`lsb_release -rs` || RELEASE=""
configure_logging() {
# Give appropriate permissions
if [ ! -f /var/log/maas/rackd.log ]; then
touch /var/log/maas/rackd.log
fi
chown maas:maas /var/log/maas/rackd.log
}
configure_libdir() {
# create var dir
if [ ! -d /var/lib/maas/boot-resources ]; then
mkdir -p /var/lib/maas/boot-resources
fi
# Ensure /var/lib/maas/boot-resources has correct ownership
chown -R maas:maas /var/lib/maas/boot-resources
# If /var/lib/maas/secret exists, ensure ownership and
# permissions are correct
if [ -f /var/lib/maas/secret ]; then
chown maas:maas /var/lib/maas/secret
chmod 0640 /var/lib/maas/secret
fi
if [ -f /var/lib/maas/maas_id ]; then
chown maas:maas /var/lib/maas/maas_id
fi
# Ensure dhcpd related files have the correct permissions
if [ -f /var/lib/maas/dhcpd.conf ]; then
chown root:maas /var/lib/maas/dhcpd.conf
fi
if [ -f /var/lib/maas/dhcpd-interfaces ]; then
chown root:maas /var/lib/maas/dhcpd-interfaces
fi
if [ -f /var/lib/maas/dhcpd6.conf ]; then
chown maas:maas /var/lib/maas/dhcpd6.conf
fi
if [ -f /var/lib/maas/dhcpd6-interfaces ]; then
chown maas:maas /var/lib/maas/dhcpd6-interfaces
fi
if [ -S /var/lib/maas/dhcpd.sock ]; then
chown maas:maas /var/lib/maas/dhcpd.sock
fi
}
extract_cluster_uuid(){
# Extract ClUSTER_UUID setting from config file $1. This will work
# on the old the cluster config file (which is shell).
awk '{ split($1,array,"\"")} END{print array[2] }' "$1"
}
extract_maas_url(){
# Extract the MAAS_URL setting from the config file $1.
grep -Eo "https?://[^ ]+" "$1" | cut -d"\"" -f1
}
configure_cluster_uuid(){
# This will configure a UUID if one has not previously been set.
maas-rack config --init
}
configure_cluster_authbind() {
MAAS_UID="`id -u maas`"
if [ ! -f "/etc/authbind/byuid/$MAAS_UID" ]; then
if [ ! -d "/etc/authbind/byuid" ]; then
mkdir -p /etc/authbind/byuid
chmod 755 /etc/authbind
chmod 755 /etc/authbind/byuid
fi
fi
echo '0.0.0.0/0:68,69' >/etc/authbind/byuid/$MAAS_UID
echo '::/0,68-69' >>/etc/authbind/byuid/$MAAS_UID
chown maas:maas /etc/authbind/byuid/$MAAS_UID
chmod 700 /etc/authbind/byuid/$MAAS_UID
}
configure_maas_url(){
# Get the MAAS URL on configure/reconfigure and write it to the conf files.
db_get maas-rack-controller/maas-url || true
if [ -n "$RET" ]; then
maas-rack config --region-url "$RET"
fi
}
configure_shared_secret() {
db_get maas-rack-controller/shared-secret || true
if [ -n "$RET" ]; then
echo "$RET" | maas-rack install-shared-secret
chown maas:maas /var/lib/maas/secret
chmod 0640 /var/lib/maas/secret
fi
}
upgrade_from_cluster_controller() {
# If we are upgrading from an older (1.7, 1.8) version, then we need
# to obtain the cluster UUID from the old configuration file and set
# it with the new configuration tool.
if [ -f /etc/maas/maas_cluster.conf ]; then
uuid=$(extract_cluster_uuid /etc/maas/maas_cluster.conf)
maas-rack config --uuid "$uuid"
maas_url=$(extract_maas_url /etc/maas/maas_cluster.conf)
maas-rack config --region-url "$maas_url"
db_set maas-rack-controller/maas-url "$maas_url"
mv /etc/maas/maas_cluster.conf /etc/maas/maas_cluster.conf.maas-old
mv /etc/maas/pserv.yaml /etc/maas/pserv.yaml.maas-old
fi
# If we are upgrading from (1.9, 1.10) version, then we need to obtain
# the maas_url and set it to debconf. Otherwise, the config file used
# is exactly the same.
if [ -f /etc/maas/clusterd.conf.1.10 ]; then
mv /etc/maas/clusterd.conf.1.10 /etc/maas/rackd.conf
maas_url=$(extract_maas_url /etc/maas/rackd.conf)
db_set maas-rack-controller/maas-url "$maas_url"
fi
}
# Unconditionally ensure that there is at least an empty configuration
# file. This does *not* overwrite any existing configuration.
maas-rack config
if [ "$1" = "configure" ] && [ -z "$2" ]; then
configure_logging
configure_libdir
configure_maas_url
configure_cluster_uuid
configure_cluster_authbind
maas-rack upgrade-cluster
upgrade_from_cluster_controller
configure_shared_secret
elif [ -n "$DEBCONF_RECONFIGURE" ]; then
configure_maas_url
# Only ask for a shared secret when the region is not installed
# on the same system.
if [ ! -f /usr/sbin/maas-region ]; then
db_input high maas-rack-controller/shared-secret
db_go
fi
configure_shared_secret
elif [ "$1" = "configure" ] && dpkg --compare-versions "$2" gt 0.1+bzr266+dfsg-0ubuntu1; then
configure_logging
configure_libdir
configure_cluster_authbind
maas-rack upgrade-cluster
fi
db_stop
# Automatically added by dh_systemd_enable/11.1.6ubuntu1
if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ] || [ "$1" = "abort-deconfigure" ] || [ "$1" = "abort-remove" ] ; then
# This will only remove masks created by d-s-h on package removal.
deb-systemd-helper unmask 'maas-rackd.service' >/dev/null || true
# was-enabled defaults to true, so new installations run enable.
if deb-systemd-helper --quiet was-enabled 'maas-rackd.service'; then
# Enables the unit on first installation, creates new
# symlinks on upgrades if the unit file has changed.
deb-systemd-helper enable 'maas-rackd.service' >/dev/null || true
else
# Update the statefile to add new symlinks (if any), which need to be
# cleaned up on purge. Also remove old symlinks.
deb-systemd-helper update-state 'maas-rackd.service' >/dev/null || true
fi
fi
# End automatically added section
# Automatically added by dh_systemd_start/11.1.6ubuntu1
if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ] || [ "$1" = "abort-deconfigure" ] || [ "$1" = "abort-remove" ] ; then
if [ -d /run/systemd/system ]; then
systemctl --system daemon-reload >/dev/null || true
deb-systemd-invoke start 'maas-rackd.service' >/dev/null || true
fi
fi
# End automatically added section
# Automatically added by dh_installdeb/11.1.6ubuntu1
dpkg-maintscript-helper rm_conffile /etc/maas/bootresources.yaml 1.7.0~beta1+bzr2781-0ubuntu1 -- "$@"
# End automatically added section
# Automatically added by dh_installdeb/11.1.6ubuntu1
dpkg-maintscript-helper rm_conffile /etc/maas/maas_local_celeryconfig_cluster.py 1.7.0~beta3+bzr3043-0ubuntu1 -- "$@"
# End automatically added section
# Automatically added by dh_installdeb/11.1.6ubuntu1
dpkg-maintscript-helper rm_conffile /etc/init/maas-cluster-celery.conf 1.7.0~beta3+bzr3043-0ubuntu1 -- "$@"
# End automatically added section
# Automatically added by dh_installdeb/11.1.6ubuntu1
dpkg-maintscript-helper rm_conffile /etc/init/maas-pserv.conf 1.7.0~beta3+bzr3043-0ubuntu1 -- "$@"
# End automatically added section
# Automatically added by dh_installdeb/11.1.6ubuntu1
dpkg-maintscript-helper rm_conffile /etc/init/maas-cluster.conf 1.7.0~beta6+bzr3231-0ubuntu1 -- "$@"
# End automatically added section
# Automatically added by dh_installdeb/11.1.6ubuntu1
dpkg-maintscript-helper rm_conffile /etc/init/maas-cluster-register.conf 1.7.0~beta6+bzr3231-0ubuntu1 -- "$@"
# End automatically added section
# Automatically added by dh_installdeb/11.1.6ubuntu1
dpkg-maintscript-helper rm_conffile /etc/maas/maas-cluster-http.conf 1.8.0~alpha1+bzr3522-0ubuntu1 -- "$@"
# End automatically added section
# Automatically added by dh_installdeb/11.1.6ubuntu1
dpkg-maintscript-helper rm_conffile /etc/init/maas-clusterd.conf 2.0.0~alpha1+bzr4635-0ubuntu1 -- "$@"
# End automatically added section
# Automatically added by dh_installdeb/11.1.6ubuntu1
dpkg-maintscript-helper rm_conffile /lib/systemd/system/maas-clusterd.service 2.0.0~alpha1+bzr4635-0ubuntu1 -- "$@"
# End automatically added section
# Automatically added by dh_installinit/11.1.6ubuntu1
if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ] || [ "$1" = "abort-deconfigure" ] || [ "$1" = "abort-remove" ] ; then
if [ -x "/etc/init.d/maas-rackd" ]; then
update-rc.d maas-rackd defaults >/dev/null
invoke-rc.d maas-rackd start || exit 1
fi
fi
# End automatically added section
|