#!/bin/sh # postinst script for glexec # # see: dh_installdeb(1) set -e . /usr/share/debconf/confmodule # 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 GLEXECCONF=/etc/glexec.conf LCMAPSDB=/etc/lcmaps/lcmaps-glexec.db glexec_configure() { # retrieve the configuration parameters from debconf # and build the command-line using positional parameters. # The ordering of the parameters is important, and we must # be careful to prevent shell field splitting, e.g. if # the white list contains spaces. option= framework= endpoints= set -- db_get glexec/logging/destination || true if [ "$RET" = "file" ]; then # set log file parameter db_get glexec/logging/logfile || true set -- "$@" --log-file "$RET" db_get glexec/logging/lcmapslogfile || true set -- "$@" --lcmaps-log-file "$RET" fi db_get glexec/logging/level || true if [ ! -z "$RET" ]; then set -- "$@" --log-level "$RET" fi db_get glexec/whitelist || true if [ ! -z "$RET" ]; then set -- "$@" --white-list "$RET" fi db_get glexec/framework || true case $RET in SCAS) db_get glexec/scas/endpoints || true # don't quote the endpoints now because we actually want field splitting set -- "$@" scas $RET ;; ARGUS) framework=argus db_get glexec/argus/endpoints || true endpoints="$RET"; # don't quote the endpoints now because we actually want field splitting set -- "$@" argus $RET db_get glexec/argus/actionid || true if [ -z "$RET" ]; then db_metaget glexec/argus/actionid default || true db_set glexec/argus/actionid $RET || true fi # insert option at the front of the parameter list set -- --pepc-actionid "$RET" "$@" db_get glexec/argus/resourceid || true if [ -z "$RET" ]; then db_metaget glexec/argus/resourceid default || true db_set glexec/argus/resourceid $RET || true fi set -- --pepc-resourceid "$RET" "$@" ;; *) set -- "$@" local ;; esac # run the configuration script with the accumulated positional parameters glexec-configure -o $GLEXECCONF.dpkg-tmp -d $LCMAPSDB.dpkg-tmp "$@" || true # Install the configuration files using ucf ucf --debconf-ok $GLEXECCONF.dpkg-tmp $GLEXECCONF ucfr glexec $GLEXECCONF rm -f $GLEXECCONF.dpkg-tmp ucf --debconf-ok $LCMAPSDB.dpkg-tmp $LCMAPSDB ucfr glexec $LCMAPSDB rm -f $LCMAPSDB.dpkg-tmp } case "$1" in configure|reconfigure) if ! getent passwd glexec > /dev/null 2>&1 ; then adduser --system --home /usr/sbin --gecos "gLExec system account" --group glexec --no-create-home > /dev/null 2>&1 fi glexec_configure chown root:glexec /etc/glexec.conf /etc/lcmaps/lcmaps-glexec.db chmod 640 /etc/glexec.conf /etc/lcmaps/lcmaps-glexec.db ;; 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