rc revision 7459
1179187Sjb#!/bin/sh
2179187Sjb#	$Id: rc,v 1.56 1995/03/26 18:18:58 wpaul Exp $
3179187Sjb#	From: @(#)rc	5.27 (Berkeley) 6/5/91
4179187Sjb
5179187Sjb# System startup script run by init on autoboot
6179187Sjb# or after single-user.
7179187Sjb# Output and error are redirected to console by init,
8179187Sjb# and the console is the controlling terminal.
9179187Sjb
10179187Sjbstty status '^T'
11179187Sjb
12179187Sjb# Set shell to ignore SIGINT (2), but not children;
13179187Sjb# shell catches SIGQUIT (3) and returns to single user after fsck.
14179187Sjbtrap : 2
15179187Sjbtrap : 3	# shouldn't be needed
16179187Sjb
17179187SjbHOME=/; export HOME
18179187SjbPATH=/sbin:/bin:/usr/sbin:/usr/bin
19179187Sjbexport PATH
20179187Sjb
21179187Sjbswapon -a
22179187Sjb
23179187Sjbif [ $1x = autobootx ]
24179187Sjbthen
25179187Sjb	echo Automatic reboot in progress...
26179187Sjb	fsck -p
27179187Sjb	case $? in
28179187Sjb	0)
29179187Sjb		;;
30179187Sjb	2)
31179187Sjb		exit 1
32179187Sjb		;;
33179187Sjb	4)
34179187Sjb		reboot
35179187Sjb		echo "reboot failed... help!"
36179187Sjb		exit 1
37179187Sjb		;;
38179187Sjb	8)
39		echo "Automatic file system check failed... help!"
40		exit 1
41		;;
42	12)
43		echo "Reboot interrupted"
44		exit 1
45		;;
46	130)
47		# interrupt before catcher installed
48		exit 1
49		;;
50	*)
51		echo "Unknown error in reboot"
52		exit 1
53		;;
54	esac
55else
56	echo Skipping disk checks ...
57fi
58
59trap "echo 'Reboot interrupted'; exit 1" 3
60
61# root must be read/write both for NFS diskless and for VFS LKMs before
62# proceeding any further.
63mount -u -o rw /
64
65umount -a >/dev/null 2>&1
66mount -a -t nonfs
67
68# If the machine runs wall CMOS clock (compatible with MSDOS),
69# activate following line by creating empty file /etc/wall_cmos_clock
70# If this file not exist, following line does nothing (assumed
71# the machine runs UTC CMOS clock). See adjkerntz(8) for details.
72adjkerntz -i
73
74# If there is a global system configuration file, suck it in.
75if [ -f /etc/sysconfig ]; then
76	. /etc/sysconfig
77fi
78
79# configure serial devices
80if [ -f /etc/rc.serial ]; then
81	. /etc/rc.serial
82fi
83
84# start up the network
85if [ -f /etc/netstart ]; then
86	. /etc/netstart
87fi
88
89# Do system maintainance functions.
90if [ -f /etc/rc.maint ]; then
91	. /etc/rc.maint
92fi
93
94# Now start up miscellaneous daemons that don't belong anywhere else
95#
96echo -n standard daemons:
97echo -n ' cron';		cron
98if [ "X${xtend}" != X"NO" -a -x /usr/libexec/xtend ]; then
99 	echo -n ' xtend';   /usr/libexec/xtend
100fi
101echo -n ' printer';             lpd
102echo '.'
103
104mount -a -t nfs >/dev/null 2>&1 &	# XXX shouldn't need background
105
106# Make shared lib searching a little faster.  Leave /usr/lib first if you
107# add your own entries or you may come to grief.
108if [ -x /sbin/ldconfig ]; then
109	_LDC=/usr/lib
110	if [ -d /usr/X11R6/lib ]; then _LDC="${_LDC} /usr/X11R6/lib" ; fi
111	if [ -d /usr/X386/lib ]; then _LDC="${_LDC} /usr/X386/lib" ; fi
112	if [ -d /usr/local/lib ]; then _LDC="${_LDC} /usr/local/lib" ; fi
113	if [ -d /usr/gnu/lib ]; then _LDC="${_LDC} /usr/gnu/lib" ; fi
114	echo 'setting ldconfig path:' ${_LDC}
115	ldconfig ${_LDC}
116fi
117
118######################### Start Of Syscons Section #######################
119
120kbdadjust=NO
121[ "X${keymap}" != X"NO" -o "X${keyrate}" != X"NO" ] && kbdadjust=YES
122vidadjust=NO
123[ "X${scrnmap}" != X"NO" -o "X${font8x16}" != X"NO" -o \
124	"X${font8x14}" != X"NO" -o "X${font8x8}" != X"NO" -o \
125	"X${blanktime}" != X"NO" ] && vidadjust=YES
126
127[ "X${kbdadjust}" != X"NO" -o "X${vidadjust}" != X"NO" -o \
128	"X${saver}" != X"NO" ] && echo "starting syscons:"
129
130[ "X${kbdadjust}" != X"NO" ] && echo -n " kbdcontrol:"
131
132# keymap
133if [ "X${keymap}" != X"NO" ]; then
134	echo -n " keymap"
135	kbdcontrol -l ${keymap}
136fi
137
138# keyrate
139if [ "X${keyrate}" != X"NO" ]; then
140	echo -n " keyrate"
141	kbdcontrol -r ${keyrate}
142fi
143
144[ "X${kbdadjust}" != X"NO" ] && echo
145[ "X${vidadjust}" != X"NO" ] && echo -n " vidcontrol:"
146
147# screen mapping
148if [ "X${scrnmap}" != X"NO" ]; then
149	echo -n " screen_map"
150	vidcontrol -l ${scrnmap}
151fi
152
153# font 8x16
154if [ "X${font8x16}" != X"NO" ]; then
155	echo -n " font8x16"
156	vidcontrol -f 8x16 ${font8x16}
157fi
158
159# font 8x14
160if [ "X${font8x14}" != X"NO" ]; then
161	echo -n " font8x14"
162	vidcontrol -f 8x14 ${font8x14}
163fi
164
165# font 8x8
166if [ "X${font8x8}" != X"NO" ]; then
167	echo -n " font8x8"
168	vidcontrol -f 8x8 ${font8x8}
169fi
170
171# blank time
172if [ "X${blanktime}" != X"NO" ]; then
173	echo -n " blank_time"
174	vidcontrol -t ${blanktime}
175fi
176
177[ "X${vidadjust}" != X"NO" ] && echo "."
178
179# screen saver
180if [ "X${saver}" != X"NO" ] ; then
181	echo -n "screensaver: "
182	modstat | grep _saver || modload -u -o /tmp/saver_mod -e \
183				 saver_init -q /lkm/${saver}_saver_mod.o
184fi
185
186######################### End Of Syscons Section #######################
187
188# Start the SCO binary emulation if requested.
189if [ "X${ibcs2}" = X"YES" ]; then
190	echo "Enabling ibcs2 emulation."
191	ibcs2
192fi
193
194# Do traditional (but rather obsolete) rc.local file if it exists.
195if [ -f /etc/rc.local ]; then
196	sh /etc/rc.local
197fi
198
199date
200exit 0
201