#!/bin/sh ################################################################################ # TmsSetup Sets up a Tms System Controller # T.Barnaby, BEAM Ltd, 2007-02-22 ################################################################################ # # # This scripts sets up a TMS System Controller for operation after a bare metal # install. # fileReplace <filename> <searchParameter> <replaceParamter> fileReplace() { if grep "$2" $1 > /dev/null 2>&1 then res=`sed -e "s'$2'$3'" $1` echo "$res" > $1 else echo "$3" >> $1 fi } fileReplaceIfNotSet() { if ! grep "$3" $1 > /dev/null 2>&1 then res=`sed -e "s'$2'$3'" $1` echo "$res" > $1 fi } install=0 if [ "$1" == "-install" ]; then install=1 fi # Enable syslog from remote systems sed -e "s/^SYSLOGD_OPTIONS=.*$/SYSLOGD_OPTIONS=\"-r -m 0\"/" /etc/sysconfig/syslog > /tmp/syslog mv /tmp/syslog /etc/sysconfig/syslog if [ $install != "1" ]; then service syslog restart fi # Setup freedesktop menu item cp tms.menu /etc/xdg/menus/applications-merged/tms.menu # Setup Network cp ifcfg-eth1 /etc/sysconfig/network-scripts if [ $install != "1" ]; then ifdown eth1; ifup eth1 fi # Sets up hosts cp hosts /etc/hosts # Sets up DNS #cp resolv.conf /etc/resolv.conf #cp tmsnet.rev tmsnet.zone /var/named #cp named /etc/sysconfig/named #cp named.conf /etc/named.conf #chkconfig named on #service named restart # Sets up DHCP if ! grep "BEAM" /etc/dhcpd.conf > /dev/null 2>&1; then cp dhcpd.conf /etc/dhcpd.conf fi chkconfig dhcpd on if [ $install != "1" ]; then service dhcpd restart fi # Sets up TFTP for boot chkconfig tftp on if [ $install != "1" ]; then service xinetd restart fi # Sets up nfs if ! grep "^/usr/tms " /etc/exports > /dev/null 2>&1 then echo "/usr/tms *.tmsnet(async,ro)" >> /etc/exports fi if ! grep "^/usr/tms/rootfs " /etc/exports > /dev/null 2>&1 then echo "/usr/tms/rootfs *.tmsnet(async,rw,no_root_squash)" >> /etc/exports fi if ! grep "^/usr/tms/rootfs-1 " /etc/exports > /dev/null 2>&1 then echo "/usr/tms/rootfs-1 *.tmsnet(async,rw,no_root_squash)" >> /etc/exports fi if ! grep "^/usr/tms/rootfs-2 " /etc/exports > /dev/null 2>&1 then echo "/usr/tms/rootfs-2 *.tmsnet(async,rw,no_root_squash)" >> /etc/exports fi if ! grep "^/usr/tms/rootfs-3 " /etc/exports > /dev/null 2>&1 then echo "/usr/tms/rootfs-3 *.tmsnet(async,rw,no_root_squash)" >> /etc/exports fi if ! grep "^/usr/tms/rootfs-4 " /etc/exports > /dev/null 2>&1 then echo "/usr/tms/rootfs-4 *.tmsnet(async,rw,no_root_squash)" >> /etc/exports fi if ! grep "^/data " /etc/exports > /dev/null 2>&1 then echo "/data *.tmsnet(async,rw,no_root_squash)" >> /etc/exports fi chkconfig nfs on if [ $install != "1" ]; then service nfs restart fi # Enable and Disable some services chkconfig time-stream on chkconfig ntpd on chkconfig ypbind off chkconfig yum-updatesd off chkconfig bluetooth off # Setup boapns if ! grep "^boapns" /etc/services > /dev/null 2>&1 then echo "boapns 12000/tcp # BEAM BOAP Name Server" >> /etc/services echo "boapns 12000/udp # BEAM BOAP Name Server" >> /etc/services fi chkconfig boapns on if [ $install != "1" ]; then service boapns restart fi # Setup TmsServer chkconfig tmsServer on if [ $install != "1" ]; then service tmsServer restart fi chkconfig tmsWeb on if [ $install != "1" ]; then service tmsWeb restart fi # Setup yum for f in `ls /etc/yum.repos.d`; do sed -e "s/^enabled=.*$/enabled=0/" /etc/yum.repos.d/$f > /tmp/$f mv /tmp/$f /etc/yum.repos.d/$f done cp tms.repo /etc/yum.repos.d # Setup for GUI boot fileReplace /etc/inittab "^id:.:initdefault:" "id:5:initdefault:" echo 'DESKTOP="KDE"' > /etc/sysconfig/desktop # Add standard user if ! grep -q "^tms:" /etc/passwd; then useradd -p '$1$KJHkHb.f$CCPRPaaEi3ozOCvsBkUoP/' tms fi # Setup file system sharing if ! grep "^#BEAM" /etc/samba/smb.conf > /dev/null 2>&1; then sed -e "s/workgroup.*=.*$/workgroup = TMS/" /etc/samba/smb.conf > /tmp/smb.conf cp /tmp/smb.conf /etc/samba/smb.conf cat "smb.conf" >> /etc/samba/smb.conf #smbpasswd -a tms fi exit 0