#!/bin/sh
#
# $RCSfile: late_command.sh,v $
# Original Author...: Anthony Awtrey
# Version...........: $Revision: 1.2 $
# Last Modified By..: $Author: aawtrey $
# Last Modified.....: $Date: 2005/04/09 18:15:42 $
#
# Copyright 2005 Anthony Awtrey
#
# Purpose:
# This is the command that is run late in the base-config phase
#

echo "Running base-config/late-command..."

# Add applications we need
DEBCONF_PRIORITY=critical apt-get install --assume-yes kernel-image-2.6-386 acpid hdparm bind9 ipmasq dhcpd vim

# Update hdparm configuration to turn DMA on
/usr/bin/wget -q -O /etc/hdparm.conf http://www.awtrey.com/files/autodebian/hdparm.conf
/etc/init.d/hdparm start

# Update the bind9 configuration
/usr/bin/wget -q -O /etc/bind/db.1.168.192 http://www.awtrey.com/files/autodebian/db.1.168.192
/usr/bin/wget -q -O /etc/bind/db.myhouse.com http://www.awtrey.com/files/autodebian/db.myhouse.com
/usr/bin/wget -q -O /etc/bind/named.conf.local http://www.awtrey.com/files/autodebian/named.conf.local
echo "search myhouse.com" > /etc/resolv.conf
echo "nameserver 127.0.0.1" >> /etc/resolv.conf

# Update the DHCP configuration file
/bin/sed -i 's/^INTERFACES=""$/INTERFACES="eth1"/' /etc/default/dhcp

# Update dhclient configuration file
/bin/sed -i 's/^#supersede domain-name "fugue.com home.vix.com";$/supersede domain-name "home.myhouse.com"/' /etc/dhclient.conf
/bin/sed -i 's/^#prepend domain-name-servers 127.0.0.1;$/prepend domain-name-servers 127.0.0.1;/' /etc/dhclient.conf

# Put the vimrc.local file in place to override stupid vim defaults
/usr/bin/wget -q -O /etc/vim/vimrc.local http://www.awtrey.com/files/autodebian/vimrc.local

# Clean the apt cache to remove the debian packages and get back disk space
apt-get clean

# Remove unwanted apps and libs
apt-get remove --assume-yes --purge nvi

# Finally, reboot to the new kernel...
/sbin/shutdown -r now

# End

