# BIT Essential configuration defaults
# This will be sourced in shellscripts
#

# Ensure safe PATH for bit-essential scripts
export PATH="/root/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/X11R6/bin"
# Ensure safe default umask for bit-essential scripts
umask 077


# Path to system configuration scripts used by bit-essential-system-setup
#
CONFSCRIPTS="/usr/share/bit-essential/system-setup.d/"
#
# Space separated list of scripts to execute
# Specify full filename, no path.
#
RUNORDER="apt-sources-list.conf
          apt-disable-debit.conf
          apt-obit.conf
          apt-update.conf
          passwd-root.conf
          passwd-bit-beheer.conf
          run-bitkeys-root.conf
          run-bitkeys-bit-beheer.conf
          etc-aliases.conf
          etc-default-grub.conf
          etc-sudoers.conf
          etc-sshd.conf
          etc-sysctl-arp-ignore.conf
          service-ntp.conf
          service-snmpd.conf"


# Path to file containing BIT account credentials
# Keep this file safe
# 
BITCREDS="/etc/bit-essential/bit-essential-shadow.sh"
chown root:root $BITCREDS
chmod 600 $BITCREDS


# Path to store backups of changed files
#
BACKUPDIR="/var/lib/bit-essential/backups/"


# Should this script run weekly to 'enforce' the setup?
# XXX Not implemented :)
#RUNWEEKLY=yes


####
# Generic functions below
##

function mkbackup {
    file="$1"
    [ -e $file ] || return 0
    safename=$(echo -n "$file" | tr -c "a-zA-Z0-9_-" "_")
    stamp=$(date +"%Y%m%d.%s")
    tgt="$BACKUPDIR/$safename.$stamp"
    cp -a "$file" "$tgt" 
    ret=$?
    echo "mkbackup ($ret)"
    return $ret
}

function testuser {
    user="$1"
    getent=$(getent passwd "$user")
    return $?
}
