# $Copyright:	$
# Copyright (c) 1984, 1985, 1986, 1987, 1988, 1989, 1990 
# Sequent Computer Systems, Inc.   All rights reserved.
#  
# This software is furnished under a license and may be used
# only in accordance with the terms of that license and with the
# inclusion of the above copyright notice.   This software may not
# be provided or otherwise made available to, or used by, any
# other person.  No title to or ownership of the software is
# hereby transferred.
#ident	"$Header: sysetup 1.10 90/08/10 $@(#)initpkg:init.d/sysetup	1.4"

#   This file contains system setup requirements for the system.
  
#   First, the ps_data file is always removed so that the ps command
#   will be forced to read the /unix file, since it may have been
#   created recently.

set `who -r`
if [ $9 != "S" ]
then
	exit
fi

#   recreate /etc/ps_data in the background while the boot continues
#   NOTE: the -a flag does not require a controlling tty

rm -f /etc/ps_data
/bin/ps -a </dev/null >/dev/null 2>&1 &

#  If there are trademark files, print them.

if [ -d /etc/tm ]
then
	cat /etc/tm/* 2> /dev/null
fi

#  Put the version string of the OS in the motd file.

/etc/dmesg | /usr/bin/egrep DYNIX | /bin/sed -n '$p' >/tmp/t1
/bin/grep -v "^DYNIX" /etc/motd >>/tmp/t1
/bin/cat /tmp/t1 > /etc/motd
/bin/rm /tmp/t1

#  Clean up the pseudo tty's, in case any processes died and left them
#  with improper modes and owners when we last went down.

for major in 52 53
do
	i=0
	while [ $i -lt 256 ]
	do
		dir=`ttydevname $major $i`
		dir=`dirname $dir`
		if [ -d $dir ]
		then
			chown root $dir/*
			chmod 666 $dir/*
		fi
		i=`expr $i + 64`
	done
done

# Copy our bootfile to the place where SSM expects it if that
# place exists and we have a file to copy

if [ -d /usr/ssw -a -f /boot ]
then
	cp /boot /usr/ssw
fi
