rc revision 7477
1#!/bin/sh
2#	$Id: rc,v 1.58 1995/03/29 03:42:16 jkh Exp $
3#	From: @(#)rc	5.27 (Berkeley) 6/5/91
4
5# System startup script run by init on autoboot
6# or after single-user.
7# Output and error are redirected to console by init,
8# and the console is the controlling terminal.
9
10stty status '^T'
11
12# Set shell to ignore SIGINT (2), but not children;
13# shell catches SIGQUIT (3) and returns to single user after fsck.
14trap : 2
15trap : 3	# shouldn't be needed
16
17HOME=/; export HOME
18PATH=/sbin:/bin:/usr/sbin:/usr/bin
19export PATH
20
21swapon -a
22
23if [ $1x = autobootx ]
24then
25	echo Automatic reboot in progress...
26	fsck -p
27	case $? in
28	0)
29		;;
30	2)
31		exit 1
32		;;
33	4)
34		reboot
35		echo "reboot failed... help!"
36		exit 1
37		;;
38	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# Do system maintainance functions.
85if [ -f /etc/rc.maint ]; then
86	. /etc/rc.maint
87fi
88
89# Start up the network
90if [ -f /etc/netstart ]; then
91	. /etc/netstart
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" \
122	-o "X${keychange}" != X"NO" ] && kbdadjust=YES
123vidadjust=NO
124[ "X${scrnmap}" != X"NO" -o "X${font8x16}" != X"NO" -o \
125	"X${font8x14}" != X"NO" -o "X${font8x8}" != X"NO" -o \
126	"X${blanktime}" != X"NO" ] && vidadjust=YES
127
128[ "X${kbdadjust}" != X"NO" -o "X${vidadjust}" != X"NO" -o \
129	"X${saver}" != X"NO" ] && echo "starting syscons:"
130
131[ "X${kbdadjust}" != X"NO" ] && echo -n " kbdcontrol:"
132
133# keymap
134if [ "X${keymap}" != X"NO" ]; then
135	echo -n " keymap"
136	kbdcontrol -l ${keymap}
137fi
138
139# keyrate
140if [ "X${keyrate}" != X"NO" ]; then
141	echo -n " keyrate"
142	kbdcontrol -r ${keyrate}
143fi
144
145# change function keys
146if [ "X${keychange}" != X"NO" ]; then
147	echo -n " keychange"
148	set - ${keychange}
149	while [ $# -gt 0 ]
150	do
151		kbdcontrol -f "$1" "$2"
152		shift; shift
153	done
154fi
155
156[ "X${kbdadjust}" != X"NO" ] && echo
157[ "X${vidadjust}" != X"NO" ] && echo -n " vidcontrol:"
158
159# screen mapping
160if [ "X${scrnmap}" != X"NO" ]; then
161	echo -n " screen_map"
162	vidcontrol -l ${scrnmap}
163fi
164
165# font 8x16
166if [ "X${font8x16}" != X"NO" ]; then
167	echo -n " font8x16"
168	vidcontrol -f 8x16 ${font8x16}
169fi
170
171# font 8x14
172if [ "X${font8x14}" != X"NO" ]; then
173	echo -n " font8x14"
174	vidcontrol -f 8x14 ${font8x14}
175fi
176
177# font 8x8
178if [ "X${font8x8}" != X"NO" ]; then
179	echo -n " font8x8"
180	vidcontrol -f 8x8 ${font8x8}
181fi
182
183# blank time
184if [ "X${blanktime}" != X"NO" ]; then
185	echo -n " blank_time"
186	vidcontrol -t ${blanktime}
187fi
188
189[ "X${vidadjust}" != X"NO" ] && echo "."
190
191# screen saver
192if [ "X${saver}" != X"NO" ] ; then
193	echo -n "screensaver: "
194	modstat | grep _saver || modload -u -o /tmp/saver_mod -e \
195				 saver_init -q /lkm/${saver}_saver_mod.o
196fi
197
198######################### End Of Syscons Section #######################
199
200# Start the SCO binary emulation if requested.
201if [ "X${ibcs2}" = X"YES" ]; then
202	echo "Enabling ibcs2 emulation."
203	ibcs2
204fi
205
206# Do traditional (but rather obsolete) rc.local file if it exists.
207if [ -f /etc/rc.local ]; then
208	sh /etc/rc.local
209fi
210
211date
212exit 0
213