#! /bin/sh
#
#************** Copyright (c) 2002 Trimble Navigation Limited **********
# $Id: fireball,v 1.29 2003/07/23 23:11:42 rvenkat Exp $
# $Source: /home/CVS/fireballTop/fireballFS/root/etc/init.d/fireball,v $
#------------------------------------------------------------
#
# Fireball Devices	Verify presence of Fireball devices
#
#
# Erase system lock files when the system starts up.
#

PATH=/sbin:/bin:/usr/sbin:/usr/bin


#echo "Clearing lock files..."

rm -f /etc/network/ifstate
rm -f /var/run/*.pid
rm -f /var/lock/subsys/*
rm -f /var/lock/*
rm -f /var/gps/tmp/*

# Lockfile (pid file) for dhcpc.  This gets left
# behind if using a dhcp server, and the system crashes.  Would prevent
# being able to start dhcp system after the crash.
# The file in /etc/dhcpc is the default location.  We are using the
# alternate location in /etc/sysconfig/dhcpc
rm -f /etc/sysconfig/dhcpc/*.pid

if [ ! -f "/var/run/utmp" ];
then
    echo "Creating utmp"
    touch /var/run/utmp
fi

#echo "Setting permissions on misc devices"
chown 0:5000 /dev/misc/gps_data
chown 0:5000 /dev/misc/power
chown 0:5000 /dev/misc/led

if [ ! -e /dev/rtai_shm ];
then
#      echo "NFS: Creating device nodes"
      /bin/mknod /dev/rtai_shm c 10 254
fi

if [ ! -e /dev/console ];
then
#  echo "Creating device console"
  mknod /dev/console c 5 1
fi

if [ ! -e /dev/rtc ]
then
#    echo  "Creating rtc link"
    ln -s /dev/misc/rtc /dev/rtc
fi

# Set up the default system name and assign that to the hostname.  This
# has to be done early in the boot process, so that subsystems like
# syslogd can have a hostname to use.  Hostname could be overridden
# later by, for instance, reading a value in /etc/sysconfig/network, or
# by a process like DHCP reading a hostname from the DHCP server.  None
# of that is implemented at this time.
