#!/bin/sh
#
# Automates the steps to create the brt base install image
#

#exits scripts if any step fails
set -e

#shows each step
set -x

env-update

source /etc/profile

#rc-update del sshd default

#rc-update del sysklogd default

#emerge --unmerge sysklogd

#rc-update del net.eth0 default

#rc-update del domainname default

emerge --unmerge vanilla-sources

rm -f /var/lock/brt_sync.lock

rm -f /etc/localtime

rm -f /etc/resolv.conf

#echo > /etc/dnsdomainname
echo -e "# /etc/conf.d/domainname\n\n# When setting up resolv.conf, what should take precedence?\n# If you wish to always override DHCP/whatever, set this to 1.\nOVERRIDE=1\n\n# To have a proper FQDN, you need to setup /etc/hosts and /etc/resolv.conf\n# properly (domain entry in /etc/resolv.conf, and FQDN in /etc/hosts).\n#\nDNSDOMAIN=\"\"\n\n# This only set what /bin/hostname returns.  If you need to setup NIS, meaning\n# what /bin/domainname returns, please see:\n#\n#   http://www.linux-nis.org/nis-howto/HOWTO/\n#\n#NISDOMAIN=\"\"\n" > /etc/conf.d/hostname

#echo > /etc/hostname
echo -e "#/etc/conf.d/hostname\n\n#Set to the hostname of this machine\nHOSTNAME=\"\"\n"  > /etc/conf.d/hostname

#emerge --unmerge grub

cd /usr/portage

rm -rf *

cd /usr/src

rm -rf linux*

cd /etc/ssh

rm -rf ssh_host*

cd /etc/ssl/certs

rm -rf *

cd /opt/stp_exec

rm -rf *

cd /opt/stp

rm -rf *

cd /etc/ssl/private

rm -rf *

cd /root

rm -rf .[a-z]*

rm -rf *

rm -f /etc/fstab

cd /var/tmp

rm -rf *

exit
