#! /bin/sh
# postinst script for rssh

set -e

# Path to the helper program, which we may make setuid.
helper=/usr/lib/rssh/rssh_chroot_helper

if [ "$1" = "configure" ] || [ "$1" = "reconfigure" ] ; then
    . /usr/share/debconf/confmodule
    db_get rssh/chroot_helper_setuid
    setuid="$RET"
    db_stop

    # We don't want to change the setuid status if the sysadmin has overridden
    # it with dpkg-statoverride.
    if dpkg-statoverride --list "$helper" > /dev/null ; then
        status=0
    else
        status=1
    fi
    if [ "$status" != 0 ] ; then
        if [ "$setuid" = "true" ] ; then
            chmod 4755 "$helper"
        else
            chmod 0755 "$helper"
        fi
    fi
fi

#DEBHELPER#

exit 0
