#! /bin/sh

FLL_LIVE_USER="knoppix"
test -r /etc/default/distro && . /etc/default/distro


SUDOERS='# sudoers file.
#
# This file MUST be edited with the "visudo" command as root.
#
# See the man page for details on how to write a sudoers file.
#

# Host alias specification

# User alias specification

# Cmnd alias specification

# User privilege specification
root	ALL=(ALL) ALL

# WARNING: This allows the unprivileged $FLL_LIVE_USER user to start commands as root
# WARNING: This is totally insecure and (almost) makes $FLL_LIVE_USER a second root account.
# WARNING: Never allow external access to the $FLL_LIVE_USER user!!!
$FLL_LIVE_USER	ALL=NOPASSWD: ALL'

case "$1" in
    configure)
    if [ -e /etc/sudoers ]; then
    echo "Reconfiguring /etc/sudoers"
    TEMPFILE=$(mktemp)
    rm -f "$TEMPFILE"
    ( grep -i -v "$FLL_LIVE_USER" /etc/sudoers ; \
    grep -i "$FLL_LIVE_USER" <<EOF
$SUDOERS
EOF
    ) > "$TEMPFILE"
    cat "$TEMPFILE" > /etc/sudoers
    rm -f "$TEMPFILE"
    else
    echo "Creating new /etc/sudoers"
    umask 227
    cat >/etc/sudoers <<EOF
$SUDOERS
EOF
    fi
    ;;

    abort-upgrade|abort-remove|abort-deconfigure)

    ;;

    *)
        echo "postinst called with unknown argument \`$1'" >&2
        exit 0
    ;;
esac

# dh_installdeb will replace this with shell code automatically
# generated by other debhelper scripts.

#DEBHELPER#

exit 0
