S99ldomreconfig

From Peter Pap's Technowiki
Revision as of 05:45, 1 June 2011 by Ppapa (talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
#!/bin/sh

AWK=/usr/bin/awk
CAT=/usr/bin/cat
CATMAN=/usr/bin/catman
CHGRP=/usr/bin/chgrp
CHMOD=/usr/bin/chmod
CHOWN=/usr/bin/chown
CHROOT=/usr/sbin/chroot
CP=/usr/bin/cp
DATE=/usr/bin/date
ECHO=/usr/bin/echo
FIND=/usr/bin/find
GREP=/usr/bin/grep
LN=/usr/bin/ln
MKDIR=/usr/bin/mkdir
MOUNT=/usr/sbin/mount
MV=/usr/bin/mv
PATCHADD=/usr/sbin/patchadd
PROJADD=/usr/sbin/projadd
RM=/usr/bin/rm
ROUTE=/usr/sbin/route
SED=/usr/bin/sed
SORT=/usr/bin/sort
SVCCFG=/usr/sbin/svccfg
TOUCH=/usr/bin/touch
UNAME=/sbin/uname
USERADD=/usr/sbin/useradd
export AWK CAT CATMAN CHGRP CHMOD CHOWN CHROOT CP DATE ECHO FIND GREP LN MKDIR MOUNT MV PATCHADD PROJADD RM ROUTE SED SORT SVCCFG TOUCH UNAME USERADD

$ECHO "==> solaris10-finish starting" `date`

$ECHO "==> Adding /etc/hosts entries"
        $CP /etc/inet/hosts /etc/inet/hosts.orig
        $GREP -v loghost /etc/inet/hosts > /etc/inet/hosts.tmp
        $GREP loghost /etc/inet/hosts | $AWK ' { print $1"\t"$2" "$2".mydomain.com.au" } ' >> /etc/inet/hosts.tmp
        $MV /etc/inet/hosts.tmp /etc/inet/hosts
        $CAT << EOF >> /etc/hosts
192.168.1.10 loghost
192.168.1.11 ntp
EOF

$ECHO "==> Adjusting sendmail setup for MyDomain"

        $CP -p /etc/mail/sendmail.cf /etc/mail/sendmail.cf.orig
        $SED -e 's/#Dj$w.Foo.COM/Dj$w.mydomain.com.au/' < /etc/mail/sendmail.cf > /tmp/sendmail.cf
        $MV /tmp/sendmail.cf /etc/mail/sendmail.cf
        $SED -e 's/^DS/DSmailhost.$m/' < /etc/mail/sendmail.cf > /tmp/sendmail.cf
        $MV /tmp/sendmail.cf /etc/mail/sendmail.cf
        $CAT << EOF > /tmp/sed.cmd
/C{E}root/a\\
C{M}`$UNAME -n`.mydomain.com.au\\
\\
# Domain I wish to masquerade as\\
DMmydomain.com.au
EOF
        $SED -f /tmp/sed.cmd /etc/mail/sendmail.cf > /tmp/sendmail.cf
        $MV /tmp/sendmail.cf /etc/mail/sendmail.cf
        $CHMOD 444 /etc/mail/sendmail.cf

$ECHO "==> Creating man windex pages"
        $MOUNT -F proc /proc /proc
        $CATMAN -w -M /usr/share/man
        $CATMAN -w -M /usr/openwin/man
        $CATMAN -w -M /usr/dt/man
        $CATMAN -w -M /usr/dt/share/man
        $SORT -u -o /usr/share/man/windex /usr/share/man/windex


$ECHO "==> solaris10-post finished" `date`
$ECHO "==> cleaning Up"

        $RM /etc/rc3.d/S99ldomreconfig