#!/bin/bash
source /root/envsetup/conf.sh

# hostname
echo "127.0.0.1 ${ETC_HOSTNAME}" >> /etc/hosts
echo ${ETC_HOSTNAME} > /etc/hostname

# DNS
cat > /etc/resolv.conf << EOF
search ubicast.net
nameserver 192.168.40.3
nameserver 192.168.40.2
nameserver 192.168.40.6
EOF

# set ubicast account pwd
if ( ! test -z ${SHELL_UBICAST_PWD} ); then
	echo -e "${SHELL_UBICAST_PWD}\n${SHELL_UBICAST_PWD}" | passwd -q ubicast
fi

# create admin account
useradd -m admin --shell /bin/bash
usermod -aG sudo admin
if ( ! test -z ${SHELL_ADMIN_PWD} ); then
	echo -e "${SHELL_ADMIN_PWD}\n${SHELL_ADMIN_PWD}" | passwd -q admin
fi
