#!/bin/sh set -e # Source debconf library. . /usr/share/debconf/confmodule CONFIGFILE="/etc/alternc/local.sh" update_var() { local question local var question="$1" var="$2" db_get "$question" if [ ! -z "$RET" ]; then grep -Eq "^ *$var=" $CONFIGFILE || echo "$var=" >> $CONFIGFILE SED_SCRIPT="$SED_SCRIPT;s\\^ *$var=.*\\$var=\"$RET\"\\" fi } # summary of how this script can be called: # * `configure' # * `abort-upgrade' # * `abort-remove' `in-favour' # # * `abort-deconfigure' `in-favour' # `removing' # # for details, see http://www.debian.org/doc/debian-policy/ or # the debian-policy package # # quoting from the policy: # Any necessary prompting should almost always be confined to the # post-installation script, and should be protected with a conditional # so that unnecessary prompting doesn't happen if a package's # installation fails and the `postinst' is called with `abort-upgrade', # `abort-remove' or `abort-deconfigure'. case "$1" in configure) # Create AlternC Panel user for web server if ! getent group alterncpanel; then addgroup --system --gid 1999 alterncpanel fi if ! getent passwd alterncpanel; then adduser --system --home "/etc/alternc/.alterncpanel" \ --disabled-password --uid 1999 --ingroup alterncpanel alterncpanel fi # ajoute l'user postfix au groupe sasl adduser --quiet postfix sasl # corriger les permissions du chroot mkdir -p /var/spool/postfix/var/run/saslauthd || true dpkg-statoverride --quiet --update --add root sasl 710 /var/spool/postfix/var/run/saslauthd || true # build local.sh if it does not exist if [ ! -f $CONFIGFILE ]; then cat > $CONFIGFILE < $CONFIGFILE.tmp mv -f $CONFIGFILE.tmp $CONFIGFILE if [ -e $CONFIGFILE ]; then # source local.sh variables . $CONFIGFILE fi if grep -q alternc-mergelog /etc/passwd ; then echo "Reusing the alternc-mergelog account as a generic alternc account" # the uid is ugly. we should request allocation from # base-passwd instead usermod --uid 342 --shell /bin/rbash --login alternc alternc-mergelog # this is a separate step otherwise usermod will look for # files to chown in /var/alternc, which takes a long time usermod --home $ALTERNC_LOC alternc fi if [ -d /var/run/alternc-mergelog/.ssh ]; then echo "Cleaning up old alternc-mergelog home" mv /var/run/alternc-mergelog/.ssh $ALTERNC_LOC/.ssh && rmdir /var/run/alternc-mergelog fi if ! grep -q alternc /etc/passwd ; then echo "Creating alternc account" # this uid is ugly. we should request allocation from # base-password instead adduser --quiet --system --uid 342 --home $ALTERNC_LOC --shell /bin/rbash --ingroup adm alternc fi echo "config phpmyadmin" include_str='include("/etc/alternc/phpmyadmin.inc.php")' pma_config=/etc/phpmyadmin/config.inc.php if ! grep -e "$include_str" $pma_config > /dev/null 2>&1; then echo "" >> $pma_config fi if ! grep -q '## ALTERNC START' /etc/sudoers; then # XXX: this is not proper locking if [ -e /etc/sudoers.tmp ]; then echo "sudoers file being edited, aborting" exit 1 else cp /etc/sudoers /etc/sudoers.tmp cat >> /etc/sudoers.tmp <&2 exit 1 ;; esac # dh_installdeb will replace this with shell code automatically # generated by other debhelper scripts. #DEBHELPER# exit 0 # vim: et sw=4