#!/bin/bash

fcopy -M /etc/resolv.conf /etc/hosts.equiv /etc/defaultrouter
fcopy -M /etc/inet/ntp.conf /etc/inet/inetd.conf
fcopy -M /etc/sendmail.cw /etc/sendmail.cf 
fcopy -m root,sys,6555 /usr/lib/sendmail
fcopy -M /etc/auto_home /etc/auto_master
fcopy -M /etc/nsswitch.conf
fcopy -M /etc/rc3.d/S79catman /etc/rc3.d/S60patch /etc/rc3.d/S99reboot
fcopy -m root,sys,744 /etc/init.d/screenblank /etc/init.d/ctl-amd /etc/init.d/lprng
fcopy -M /usr/share/lib/terminfo/l/linux
fcopy -m root,sys,640 /var/adm/MvLogs.table

cd $target && tar -xpf /fai/files/DEFAULT.tar

[ -n "$YPSERVER" ] && echo $YPSERVER >> $target/var/yp/binding/$YPDOMAIN/ypservers

find $target/etc -name "???volmgt" | xargs rm -f 

# install additional software packages
[ "$addpackages" ] && cd /fai/files/packages && pkgadd -R $target -d /fai/files/packages -n -a /fai/files/packages/nocheck "$addpackages"

# set resolution to RES1280 or RES1152
co=`constype`
echo "framebuffertype: $co"
case $co in
    SUNWffb) fbexe=/usr/sbin/ffbconfig ;;
    SUNWm64*) fbexe="/usr/sbin/m64config -depth 24" ;;
    SUNWcg6) fbexe=/usr/bin/echo ;;
#    SUNWCm64|SUNWm64x|TSIpgxw) fbexe=pgxconfig ;;
    *) fbexe=/usr/bin/echo
esac

if ifclass RES1280; then
    res="-file system -res 1280 nocheck"
else
    res="-file system -res 1152x900x76 nocheck"
fi
cat > $target/etc/rc3.d/S90resolution <<EOF
#! /bin/sh
echo "setting resolution $fbexe $res"
$fbexe $res
rm \$0
EOF
cat $target/etc/rc3.d/S90resolution >/var/tmp/S90

# remove dir /var/news to install a link with cfagent
ifclass CS_KOELN && rmdir $target/var/news
