#! /bin/sh

set -e

. /usr/share/debconf/confmodule

if [ "configure" = "$1" ] && [ -z "$2" ]; then 
    cat > /etc/network/interfaces <<EOF
auto lo
iface lo inet loopback
EOF
    
fi

if [ ! -f /config-done ]; then
	oem-config-prepare --quiet
	touch /config-done
fi

# Ew
if [ -f /etc/X11/Xwrapper.config ]; then
    sed -i -e 's/allowed_users=.*/allowed_users=anybody/' /etc/X11/Xwrapper.config
fi

# Double ew. Hack to work around unionfs bug/feature.
if [ ! -L /squashmnt ]; then
	ln -s / /squashmnt
fi

#DEBHELPER#
