#!/bin/sh # postinst script for provision # # see: dh_installdeb(1) set -e # summary of how this script can be called: # * `configure' # * `abort-upgrade' # * `abort-remove' `in-favour' # # * `abort-remove' # * `abort-deconfigure' `in-favour' # `removing' # # for details, see http://www.debian.org/doc/debian-policy/ or # the debian-policy package # Source debconf library. . /usr/share/debconf/confmodule if [ "$DPKG_DEBUG" = "developer" ]; then set -x fi # when changing this, change the regex in the sed replacement below VARLIB="/var/aegir" case "$1" in configure) # add a aegir user if one does not already exist if ! getent passwd aegir >/dev/null ; then echo "adding aegir user..." adduser --quiet --system --no-create-home --group \ --home "$VARLIB" \ --shell '/bin/bash' \ --gecos 'Aegir user,,,' \ aegir fi adduser --quiet aegir www-data if [ -d /etc/sudoers.d ]; then ucf --debconf-ok /usr/share/doc/aegir-cluster-slave2/examples/example.sudoers /etc/sudoers.d/aegir ucfr aegir-provision /etc/sudoers.d/aegir chmod 440 /etc/sudoers.d/aegir else echo "running an older version of sudo" echo "copy content of /usr/share/doc/aegir-provision/examples/example.sudoers into /etc/sudoers for aegir to run properly" fi # fix permissions on installed directories chown aegir:aegir "$VARLIB" "$VARLIB/config" # make sure we have apache configs settled in, for remote headless aegir servers touch $VARLIB/config/apache.conf chown aegir:aegir "$VARLIB/config/apache.conf" ln -sf $VARLIB/config/apache.conf /etc/apache2/conf.d/aegir.conf a2enmod ssl rewrite apache2ctl graceful db_get "aegir/master_ssh_key" SSH_KEY="$RET" if ! [ -z "$SSH_KEY" ]; then if ! grep -q "$SSH_KEY" $VARLIB/.ssh/authorized_keys; then mkdir -p $VARLIB/.ssh echo "$SSH_KEY" >> $VARLIB/.ssh/authorized_keys chown aegir:aegir $VARLIB/.ssh $VARLIB/.ssh/authorized_keys chmod 700 $VARLIB/.ssh chmod 600 $VARLIB/.ssh/authorized_keys fi fi db_get "aegir/master_mountpoint" MOUNT="$RET" if ! [ -z "$MOUNT" ]; then if grep -q "$VARLIB/platforms" /etc/fstab ; then if ! grep -q "$MOUNT.*$VARLIB/platforms" /etc/fstab ; then sed -i.dpkg-orig "/\/var\\/aegir\\/platforms/s#^.*\$#$MOUNT $VARLIB/platforms nfs rw 0 0#" /etc/fstab echo "installed new fstab, original kept in /etc/fstab.dpkg-orig" echo "for the changes to take effect, the $VARLIB/platforms directory need to be remounted" echo "this may require a reboot" fi else cp /etc/fstab /etc/fstab.dpkg-orig echo "$MOUNT $VARLIB/platforms nfs rw 0 0" >> /etc/fstab echo "installed new fstab, original kept in /etc/fstab.dpkg-orig" fi if ! mount | grep -q $VARLIB/platforms; then mount $VARLIB/platforms fi fi ;; abort-upgrade|abort-remove|abort-deconfigure) ;; *) echo "postinst called with unknown argument \`$1'" >&2 exit 1 ;; esac # dh_installdeb will replace this with shell code automatically # generated by other debhelper scripts. #DEBHELPER# exit 0