Subversion Repositories configs

Rev

Rev 9 | Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
4 - 1
#!/bin/bash
2
#
3
# /etc/rc.d/rc.sysinit - run once at boot time
4
#
5
# Taken in part from Miquel van Smoorenburg's bcheckrc.
6
#
7
 
8
HOSTNAME=$(/bin/hostname)
9
 
10
set -m
11
 
12
if [ -f /etc/sysconfig/network ]; then
13
    . /etc/sysconfig/network
14
fi
15
if [ -z "$HOSTNAME" -o "$HOSTNAME" = "(none)" ]; then
16
    HOSTNAME=localhost
17
fi
18
 
19
if [ ! -e /proc/mounts ]; then
20
	mount -n -t proc /proc /proc
21
	mount -n -t sysfs /sys /sys >/dev/null 2>&1
22
fi
23
if [ ! -d /proc/bus/usb ]; then
24
	modprobe usbcore >/dev/null 2>&1 && mount -n -t usbfs /proc/bus/usb /proc/bus/usb
25
else
26
	mount -n -t usbfs /proc/bus/usb /proc/bus/usb
27
fi
28
 
29
#remount /dev/shm to set attributes from fstab #669700
30
mount -n -o remount /dev/shm >/dev/null 2>&1
31
#remount /proc to set attributes from fstab #984003
32
mount -n -o remount /proc >/dev/null 2>&1
33
 
34
. /etc/init.d/functions
35
 
36
PLYMOUTH=
37
[ -x /bin/plymouth ] && PLYMOUTH=yes
38
 
39
# Check SELinux status
40
SELINUX_STATE=
41
if [ -e "/selinux/enforce" ] && [ "$(cat /proc/self/attr/current)" != "kernel" ]; then
42
	if [ -r "/selinux/enforce" ] ; then
43
		SELINUX_STATE=$(cat "/selinux/enforce")
44
	else
45
		# assume enforcing if you can't read it
46
		SELINUX_STATE=1
47
	fi
48
fi
49
 
50
if [ -n "$SELINUX_STATE" -a -x /sbin/restorecon ] && __fgrep " /dev " /proc/mounts >/dev/null 2>&1 ; then
51
	/sbin/restorecon -R -F /dev 2>/dev/null
52
fi
53
 
54
disable_selinux() {
55
	echo $"*** Warning -- SELinux is active"
56
	echo $"*** Disabling security enforcement for system recovery."
57
	echo $"*** Run 'setenforce 1' to reenable."
58
	echo "0" > "/selinux/enforce"
59
}
60
 
61
relabel_selinux() {
62
    # if /sbin/init is not labeled correctly this process is running in the
63
    # wrong context, so a reboot will be required after relabel
64
    AUTORELABEL=
65
    . /etc/selinux/config
66
    echo "0" > /selinux/enforce
67
    [ -n "$PLYMOUTH" ] && plymouth --hide-splash
68
 
69
    if [ "$AUTORELABEL" = "0" ]; then
70
	echo
71
	echo $"*** Warning -- SELinux ${SELINUXTYPE} policy relabel is required. "
72
	echo $"*** /etc/selinux/config indicates you want to manually fix labeling"
73
	echo $"*** problems. Dropping you to a shell; the system will reboot"
74
	echo $"*** when you leave the shell."
75
	start rcS-emergency
76
 
77
    else
78
	echo
79
	echo $"*** Warning -- SELinux ${SELINUXTYPE} policy relabel is required."
80
	echo $"*** Relabeling could take a very long time, depending on file"
81
	echo $"*** system size and speed of hard drives."
82
 
83
	/sbin/fixfiles -F restore > /dev/null 2>&1
84
    fi
85
    rm -f  /.autorelabel
86
    echo $"Unmounting file systems"
87
    umount -a
88
    mount -n -o remount,ro /
89
    echo $"Automatic reboot in progress."
90
    reboot -f
91
}
92
 
93
# Print a text banner.
94
echo -en $"\t\tWelcome to "
95
read -r system_release < /etc/system-release
96
if [[ "$system_release" == *"Red Hat"* ]]; then
97
 [ "$BOOTUP" = "color" ] && echo -en "\\033[0;31m"
98
 echo -en "Red Hat"
99
 [ "$BOOTUP" = "color" ] && echo -en "\\033[0;39m"
100
 PRODUCT=$(sed "s/Red Hat \(.*\) release.*/\1/" /etc/system-release)
101
 echo " $PRODUCT"
102
elif [[ "$system_release" == *Fedora* ]]; then
103
 [ "$BOOTUP" = "color" ] && echo -en "\\033[0;34m"
104
 echo -en "Fedora"
105
 [ "$BOOTUP" = "color" ] && echo -en "\\033[0;39m"
106
 PRODUCT=$(sed "s/Fedora \(.*\) \?release.*/\1/" /etc/system-release)
107
 echo " $PRODUCT"
108
elif [[ "$system_release" =~ "CentOS" ]]; then
109
 [ "$BOOTUP" = "color" ] && echo -en "\\033[0;36m"
110
 echo -en "CentOS"
111
 [ "$BOOTUP" = "color" ] && echo -en "\\033[0;39m"
112
 PRODUCT=$(sed "s/CentOS \(.*\) \?release.*/\1/" /etc/system-release)
113
 echo " $PRODUCT"
114
else
115
 PRODUCT=$(sed "s/ release.*//g" /etc/system-release)
116
 echo "$PRODUCT"
117
fi
118
 
119
# Only read this once.
120
cmdline=$(cat /proc/cmdline)
121
 
122
# Initialize hardware
123
if [ -f /proc/sys/kernel/modprobe ]; then
124
   if ! strstr "$cmdline" nomodules && [ -f /proc/modules ] ; then
125
       sysctl -w kernel.modprobe="/sbin/modprobe" >/dev/null 2>&1
126
   else
127
       # We used to set this to NULL, but that causes 'failed to exec' messages"
128
       sysctl -w kernel.modprobe="/bin/true" >/dev/null 2>&1
129
   fi
130
fi
131
 
132
touch /dev/.in_sysinit >/dev/null 2>&1
133
 
134
# Set default affinity
135
if [ -x /bin/taskset ]; then
136
   if strstr "$cmdline" default_affinity= ; then
137
     for arg in $cmdline ; do
138
         if [ "${arg##default_affinity=}" != "${arg}" ]; then
139
             /bin/taskset -p ${arg##default_affinity=} 1
140
         fi
141
     done
142
   fi
143
fi
144
 
145
nashpid=$(pidof nash 2>/dev/null)
146
[ -n "$nashpid" ] && kill $nashpid >/dev/null 2>&1
147
unset nashpid
148
/sbin/start_udev
149
 
150
# Load other user-defined modules
151
for file in /etc/sysconfig/modules/*.modules ; do
152
  [ -x $file ] && $file
153
done
154
 
155
# Load modules (for backward compatibility with VARs)
156
if [ -f /etc/rc.modules ]; then
157
	/etc/rc.modules
158
fi
159
 
160
mount -n /dev/pts >/dev/null 2>&1
161
[ -n "$SELINUX_STATE" ] && restorecon -F /dev/pts >/dev/null 2>&1
162
 
163
# Configure kernel parameters
164
update_boot_stage RCkernelparam
165
apply_sysctl
166
 
167
# Set the hostname.
168
update_boot_stage RChostname
169
action $"Setting hostname ${HOSTNAME}: " hostname ${HOSTNAME}
170
[ -n "${NISDOMAIN}" ] && domainname ${NISDOMAIN}
171
 
172
# Sync waiting for storage.
173
{ rmmod scsi_wait_scan ; modprobe scsi_wait_scan ; rmmod scsi_wait_scan ; } >/dev/null 2>&1
174
 
175
# Device mapper & related initialization
176
if ! __fgrep "device-mapper" /proc/devices >/dev/null 2>&1 ; then
177
       modprobe dm-mod >/dev/null 2>&1
178
fi
179
 
180
if [ -f /etc/crypttab ]; then
181
    init_crypto 0
182
fi
183
 
184
if ! strstr "$cmdline" nompath && [ -f /etc/multipath.conf -a \
185
		-x /sbin/multipath ]; then
186
	modprobe dm-multipath > /dev/null 2>&1
187
	/sbin/multipath -v 0
188
	if [ -x /sbin/kpartx ]; then
189
		/sbin/dmsetup ls --target multipath --exec "/sbin/kpartx -a -p p" >/dev/null
190
	fi
191
fi
192
 
193
if ! strstr "$cmdline" nodmraid && [ -x /sbin/dmraid ]; then
194
	modprobe dm-mirror >/dev/null 2>&1
195
	dmraidsets=$(LC_ALL=C /sbin/dmraid -s -c -i)
196
	if [ "$?" = "0" ]; then
197
		for dmname in $dmraidsets; do
198
			if [[ "$dmname" == isw_* ]] && \
199
			   ! strstr "$cmdline" noiswmd; then
200
				continue
201
			fi
202
			/sbin/dmraid -ay -i --rm_partitions -p "$dmname" >/dev/null 2>&1
203
			/sbin/kpartx -a -p p "/dev/mapper/$dmname"
204
		done
205
	fi
206
fi
207
 
208
# Start any MD RAID arrays that haven't been started yet
209
[ -r /proc/mdstat -a -r /dev/md/md-device-map ] && /sbin/mdadm -IRs
210
 
211
if [ -x /sbin/lvm ]; then
212
	if [ ! -f /.nolvm ] && ! strstr "$cmdline" nolvm ; then
213
		action $"Setting up Logical Volume Management:" /sbin/lvm vgchange -a ay --sysinit
214
	else
215
		echo $"Logical Volume Management disabled at boot."
216
	fi
217
fi
218
 
219
if [ -f /etc/crypttab ]; then
220
    init_crypto 0
221
fi
222
 
223
if [ -f /fastboot ] || strstr "$cmdline" fastboot ; then
224
	fastboot=yes
225
fi
226
 
227
if [ -f /fsckoptions ]; then
228
	fsckoptions=$(cat /fsckoptions)
229
fi
230
 
231
if [ -f /forcefsck ] || strstr "$cmdline" forcefsck ; then
232
	fsckoptions="-f $fsckoptions"
233
elif [ -f /.autofsck ]; then
234
	[ -f /etc/sysconfig/autofsck ] && . /etc/sysconfig/autofsck
235
	if [ "$AUTOFSCK_DEF_CHECK" = "yes" ]; then
236
		AUTOFSCK_OPT="$AUTOFSCK_OPT -f"
237
	fi
238
	if [ -n "$AUTOFSCK_SINGLEUSER" ]; then
239
		[ -n "$PLYMOUTH" ] && plymouth --hide-splash
240
		echo
241
		echo $"*** Warning -- the system did not shut down cleanly. "
242
		echo $"*** Dropping you to a shell; the system will continue"
243
		echo $"*** when you leave the shell."
244
		[ -n "$SELINUX_STATE" ] && echo "0" > /selinux/enforce
245
		start rcS-emergency
246
		[ -n "$SELINUX_STATE" ] && echo "1" > /selinux/enforce
247
		[ -n "$PLYMOUTH" ] && plymouth --show-splash
248
	fi
249
	fsckoptions="$AUTOFSCK_OPT $fsckoptions"
250
fi
251
 
252
if [ "$BOOTUP" = "color" ]; then
253
	fsckoptions="-C $fsckoptions"
254
else
255
	fsckoptions="-V $fsckoptions"
256
fi
257
 
258
READONLY=
259
if [ -f /etc/sysconfig/readonly-root ]; then
260
	. /etc/sysconfig/readonly-root
261
fi
262
if strstr "$cmdline" readonlyroot ; then
263
	READONLY=yes
264
	[ -z "$RW_MOUNT" ] && RW_MOUNT=/var/lib/stateless/writable
265
	[ -z "$STATE_MOUNT" ] && STATE_MOUNT=/var/lib/stateless/state
266
fi
267
if strstr "$cmdline" noreadonlyroot ; then
268
	READONLY=no
269
fi
270
 
271
if [ "$READONLY" = "yes" -o "$TEMPORARY_STATE" = "yes" ]; then
272
 
273
	mount_empty() {
274
		if [ -e "$1" ]; then
275
			echo "$1" | cpio -p -vd "$RW_MOUNT" &>/dev/null
276
			mount -n --bind "$RW_MOUNT$1" "$1"
277
		fi
278
	}
279
 
280
	mount_dirs() {
281
		if [ -e "$1" ]; then
282
			mkdir -p "$RW_MOUNT$1"
283
			find "$1" -type d -print0 | cpio -p -0vd "$RW_MOUNT" &>/dev/null
284
			mount -n --bind "$RW_MOUNT$1" "$1"
285
		fi
286
	}
287
 
288
	mount_files() {
289
		if [ -e "$1" ]; then
290
			cp -a --parents "$1" "$RW_MOUNT"
291
			mount -n --bind "$RW_MOUNT$1" "$1"
292
		fi
293
	}
294
 
295
	# Common mount options for scratch space regardless of
296
	# type of backing store
297
	mountopts=
298
 
299
	# Scan partitions for local scratch storage
300
	rw_mount_dev=$(blkid -t LABEL="$RW_LABEL" -l -o device)
301
 
302
	# First try to mount scratch storage from /etc/fstab, then any
303
	# partition with the proper label.  If either succeeds, be sure
304
	# to wipe the scratch storage clean.  If both fail, then mount
305
	# scratch storage via tmpfs.
306
	if mount $mountopts "$RW_MOUNT" > /dev/null 2>&1 ; then
307
		rm -rf "$RW_MOUNT" > /dev/null 2>&1
308
	elif [ x$rw_mount_dev != x ] && mount $rw_mount_dev $mountopts "$RW_MOUNT" > /dev/null 2>&1; then
309
		rm -rf "$RW_MOUNT"  > /dev/null 2>&1
310
	else
311
		mount -n -t tmpfs $RW_OPTIONS $mountopts none "$RW_MOUNT"
312
	fi
313
 
314
	for file in /etc/rwtab /etc/rwtab.d/* /dev/.initramfs/rwtab ; do
315
		is_ignored_file "$file" && continue
316
	[ -f $file ] && cat $file | while read type path ; do
317
			case "$type" in
318
				empty)
319
					mount_empty $path
320
					;;
321
				files)
322
					mount_files $path
323
					;;
324
				dirs)
325
					mount_dirs $path
326
					;;
327
				*)
328
					;;
329
			esac
330
			[ -n "$SELINUX_STATE" -a -e "$path" ] && restorecon -R "$path"
331
		done
332
	done
333
 
334
	# Use any state passed by initramfs
335
	[ -d /dev/.initramfs/state ] && cp -a /dev/.initramfs/state/* $RW_MOUNT
336
 
337
	# In theory there should be no more than one network interface active
338
	# this early in the boot process -- the one we're booting from.
339
	# Use the network address to set the hostname of the client.  This
340
	# must be done even if we have local storage.
341
	ipaddr=
342
	if [ "$HOSTNAME" = "localhost" -o "$HOSTNAME" = "localhost.localdomain" ]; then
343
		ipaddr=$(ip addr show to 0.0.0.0/0 scope global | awk '/[[:space:]]inet / { print gensub("/.*","","g",$2) }')
344
		for ip in $ipaddr ; do
345
			HOSTNAME=
346
			eval $(ipcalc -h $ip 2>/dev/null)
347
			[ -n "$HOSTNAME" ] && { hostname ${HOSTNAME} ; break; }
348
		done
349
	fi
350
 
351
	# Clients with read-only root filesystems may be provided with a
352
	# place where they can place minimal amounts of persistent
353
	# state.  SSH keys or puppet certificates for example.
354
	#
355
	# Ideally we'll use puppet to manage the state directory and to
356
	# create the bind mounts.  However, until that's all ready this
357
	# is sufficient to build a working system.
358
 
359
	# First try to mount persistent data from /etc/fstab, then any
360
	# partition with the proper label, then fallback to NFS
361
	state_mount_dev=$(blkid -t LABEL="$STATE_LABEL" -l -o device)
362
	if mount $mountopts $STATE_OPTIONS "$STATE_MOUNT" > /dev/null 2>&1 ; then
363
		/bin/true
364
	elif [ x$state_mount_dev != x ] && mount $state_mount_dev $mountopts "$STATE_MOUNT" > /dev/null 2>&1;  then
365
		/bin/true
366
	elif [ ! -z "$CLIENTSTATE" ]; then
367
		# No local storage was found.  Make a final attempt to find
368
		# state on an NFS server.
369
 
370
		mount -t nfs $CLIENTSTATE/$HOSTNAME $STATE_MOUNT -o rw,nolock
371
	fi
372
 
373
	if [ -w "$STATE_MOUNT" ]; then
374
 
375
		mount_state() {
376
			if [ -e "$1" ]; then
377
				[ ! -e "$STATE_MOUNT$1" ] && cp -a --parents "$1" "$STATE_MOUNT"
378
				mount -n --bind "$STATE_MOUNT$1" "$1"
379
			fi
380
		}
381
 
382
		for file in /etc/statetab /etc/statetab.d/* ; do
383
			is_ignored_file "$file" && continue
384
			[ ! -f "$file" ] && continue
385
 
386
			if [ -f "$STATE_MOUNT/$file" ] ; then
387
				mount -n --bind "$STATE_MOUNT/$file" "$file"
388
			fi
389
 
390
			for path in $(grep -v "^#" "$file" 2>/dev/null); do
391
				mount_state "$path"
392
				[ -n "$SELINUX_STATE" -a -e "$path" ] && restorecon -R "$path"
393
			done
394
		done
395
 
396
		if [ -f "$STATE_MOUNT/files" ] ; then
397
			for path in $(grep -v "^#" "$STATE_MOUNT/files" 2>/dev/null); do
398
				mount_state "$path"
399
				[ -n "$SELINUX_STATE" -a -e "$path" ] && restorecon -R "$path"
400
			done
401
		fi
402
	fi
403
fi
404
 
405
if [[ " $fsckoptions" != *" -y"* ]]; then
406
	fsckoptions="-a $fsckoptions"
407
fi
408
 
409
_RUN_QUOTACHECK=0
410
if [ -f /forcequotacheck ] || strstr "$cmdline" forcequotacheck ; then
411
	_RUN_QUOTACHECK=1
412
fi
413
if [ -z "$fastboot" -a "$READONLY" != "yes" ]; then
414
 
415
        STRING=$"Checking filesystems"
416
	echo $STRING
417
	fsck -T -t noopts=_netdev -A $fsckoptions
418
	rc=$?
419
 
420
	if [ "$rc" -eq "0" ]; then
421
		success "$STRING"
422
		echo
423
	elif [ "$rc" -eq "1" ]; then
424
	        passed "$STRING"
425
		echo
426
	elif [ "$rc" -eq "2" -o "$rc" -eq "3" ]; then
427
		echo $"Unmounting file systems"
428
		umount -a
429
		mount -n -o remount,ro /
430
		echo $"Automatic reboot in progress."
431
		reboot -f
432
        fi
433
 
434
        # A return of 4 or higher means there were serious problems.
435
	if [ $rc -gt 1 ]; then
436
		[ -n "$PLYMOUTH" ] && plymouth --hide-splash
437
 
438
		failure "$STRING"
439
		echo
440
		echo
441
		echo $"*** An error occurred during the file system check."
442
		echo $"*** Dropping you to a shell; the system will reboot"
443
		echo $"*** when you leave the shell."
444
 
445
                str=$"(Repair filesystem)"
446
		PS1="$str \# # "; export PS1
447
		[ "$SELINUX_STATE" = "1" ] && disable_selinux
448
		start rcS-emergency
449
 
450
		echo $"Unmounting file systems"
451
		umount -a
452
		mount -n -o remount,ro /
453
		echo $"Automatic reboot in progress."
454
		reboot -f
455
	elif [ "$rc" -eq "1" ]; then
456
		_RUN_QUOTACHECK=1
457
	fi
458
fi
459
 
460
remount_needed() {
461
  local state oldifs
462
  [ "$READONLY" = "yes" ] && return 1
463
  state=$(LC_ALL=C awk '/ \/ / && ($3 !~ /rootfs/) { print $4 }' /proc/mounts)
464
  oldifs=$IFS
465
  IFS=","
466
  for opt in $state ; do
467
	if [ "$opt" = "rw" ]; then
468
		IFS=$oldifs
469
		return 1
470
	fi
471
  done
472
  IFS=$oldifs
473
  return 0
474
}
475
 
476
# Remount the root filesystem read-write.
477
update_boot_stage RCmountfs
478
if remount_needed ; then
479
  action $"Remounting root filesystem in read-write mode: " mount -n -o remount,rw /
480
fi
481
 
482
# Clean up SELinux labels
483
if [ -n "$SELINUX_STATE" ]; then
484
   restorecon /etc/mtab /etc/ld.so.cache /etc/blkid/blkid.tab /etc/resolv.conf >/dev/null 2>&1
485
fi
486
 
487
# If relabeling, relabel mount points.
488
if [ -n "$SELINUX_STATE" -a "$READONLY" != "yes" ]; then
489
    if [ -f /.autorelabel ] || strstr "$cmdline" autorelabel ; then
490
	restorecon $(awk '!/^#/ && $4 !~ /noauto/ && $2 ~ /^\// { print $2 }' /etc/fstab) >/dev/null 2>&1
491
    fi
492
fi
493
 
494
if [ "$READONLY" != "yes" ] ; then
495
	# Clear mtab
496
	(> /etc/mtab) &> /dev/null
497
 
498
	# Remove stale backups
499
	rm -f /etc/mtab~ /etc/mtab~~
500
 
501
	# Enter mounted filesystems into /etc/mtab
502
	mount -f /
503
	mount -f /proc >/dev/null 2>&1
504
	mount -f /sys >/dev/null 2>&1
505
	mount -f /dev/pts >/dev/null 2>&1
506
	mount -f /dev/shm >/dev/null 2>&1
507
	mount -f /proc/bus/usb >/dev/null 2>&1
508
fi
509
 
510
# Mount all other filesystems (except for NFS and /proc, which is already
511
# mounted). Contrary to standard usage,
512
# filesystems are NOT unmounted in single user mode.
513
# The 'no' applies to all listed filesystem types. See mount(8).
514
if [ "$READONLY" != "yes" ] ; then
515
	action $"Mounting local filesystems: " mount -a -t nonfs,nfs4,smbfs,ncpfs,cifs,gfs,gfs2 -O no_netdev
516
else
517
	action $"Mounting local filesystems: " mount -a -n -t nonfs,nfs4,smbfs,ncpfs,cifs,gfs,gfs2 -O no_netdev
518
fi
519
 
520
# Update quotas if necessary
521
if [ X"$_RUN_QUOTACHECK" = X1 -a -x /sbin/quotacheck ]; then
522
	action $"Checking local filesystem quotas: " /sbin/quotacheck -anug
523
fi
524
 
525
if [ -x /sbin/quotaon ]; then
526
    action $"Enabling local filesystem quotas: " /sbin/quotaon -aug
527
fi
528
 
529
# Check to see if a full relabel is needed
530
if [ -n "$SELINUX_STATE" -a "$READONLY" != "yes" ]; then
531
    if [ -f /.autorelabel ] || strstr "$cmdline" autorelabel ; then
532
	relabel_selinux
533
    fi
534
else
535
    if [ -d /etc/selinux -a "$READONLY" != "yes" ]; then
536
        [ -f /.autorelabel ] || touch /.autorelabel
537
    fi
538
fi
539
 
540
# Initialize pseudo-random number generator
541
if [ -f "/var/lib/random-seed" ]; then
542
	cat /var/lib/random-seed > /dev/urandom
543
else
544
	[ "$READONLY" != "yes" ] && touch /var/lib/random-seed
545
fi
546
if [ "$READONLY" != "yes" ]; then
547
	chmod 600 /var/lib/random-seed
548
	dd if=/dev/urandom of=/var/lib/random-seed count=1 bs=512 2>/dev/null
549
fi
550
 
551
if [ -f /etc/crypttab ]; then
552
    init_crypto 1
553
fi
554
 
555
# Configure machine if necessary.
556
if [ -f /.unconfigured ]; then
557
 
558
    if [ -x /bin/plymouth ]; then
559
        /bin/plymouth quit
560
    fi
561
 
562
    if [ -x /usr/bin/system-config-keyboard ]; then
563
	/usr/bin/system-config-keyboard
564
    fi
565
    if [ -x /usr/bin/passwd ]; then
566
        /usr/bin/passwd root
567
    fi
568
    if [ -x /usr/sbin/system-config-network-tui ]; then
569
	/usr/sbin/system-config-network-tui
570
    fi
571
    if [ -x /usr/sbin/timeconfig ]; then
572
	/usr/sbin/timeconfig
573
    fi
574
    if [ -x /usr/sbin/authconfig-tui ]; then
575
	/usr/sbin/authconfig-tui --nostart
576
    fi
577
    if [ -x /usr/sbin/ntsysv ]; then
578
	/usr/sbin/ntsysv --level 35
579
    fi
580
 
581
    # Reread in network configuration data.
582
    if [ -f /etc/sysconfig/network ]; then
583
	. /etc/sysconfig/network
584
 
585
	# Reset the hostname.
586
	action $"Resetting hostname ${HOSTNAME}: " hostname ${HOSTNAME}
587
    fi
588
 
589
    rm -f /.unconfigured
590
fi
591
 
592
# Clean out /.
593
rm -f /fastboot /fsckoptions /forcefsck /.autofsck /forcequotacheck /halt \
594
	/poweroff /.suspended &> /dev/null
595
 
596
# Do we need (w|u)tmpx files? We don't set them up, but the sysadmin might...
597
_NEED_XFILES=
598
[ -f /var/run/utmpx -o -f /var/log/wtmpx ] && _NEED_XFILES=1
599
 
600
# Clean up /var.
601
rm -rf /var/lock/cvs/* /var/run/screen/*
602
find /var/lock /var/run ! -type d -exec rm -f {} \;
603
rm -f /var/lib/rpm/__db* &> /dev/null
604
rm -f /var/gdm/.gdmfifo &> /dev/null
605
 
606
[ "$PROMPT" != no ] && plymouth watch-keystroke --command "touch /var/run/confirm" --keys=Ii &
607
 
608
# Clean up utmp/wtmp
609
> /var/run/utmp
610
touch /var/log/wtmp
611
chgrp utmp /var/run/utmp /var/log/wtmp
612
chmod 0664 /var/run/utmp /var/log/wtmp
613
if [ -n "$_NEED_XFILES" ]; then
614
  > /var/run/utmpx
615
  touch /var/log/wtmpx
616
  chgrp utmp /var/run/utmpx /var/log/wtmpx
617
  chmod 0664 /var/run/utmpx /var/log/wtmpx
618
fi
619
[ -n "$SELINUX_STATE" ] && restorecon /var/run/utmp* /var/log/wtmp* >/dev/null 2>&1
620
 
621
# Clean up various /tmp bits
622
[ -n "$SELINUX_STATE" ] && restorecon /tmp
623
rm -f /tmp/.X*-lock /tmp/.lock.* /tmp/.gdm_socket /tmp/.s.PGSQL.*
624
rm -rf /tmp/.X*-unix /tmp/.ICE-unix /tmp/.font-unix /tmp/hsperfdata_* \
625
       /tmp/kde-* /tmp/ksocket-* /tmp/mc-* /tmp/mcop-* /tmp/orbit-*  \
626
       /tmp/scrollkeeper-*  /tmp/ssh-* \
627
       /dev/.in_sysinit
628
 
629
# Make ICE directory
630
mkdir -m 1777 -p /tmp/.ICE-unix >/dev/null 2>&1
631
chown root:root /tmp/.ICE-unix
632
[ -n "$SELINUX_STATE" ] && restorecon /tmp/.ICE-unix >/dev/null 2>&1
633
 
634
# Start up swapping.
635
update_boot_stage RCswap
636
action $"Enabling /etc/fstab swaps: " swapon -a -e
637
if [ "$AUTOSWAP" = "yes" ]; then
638
	curswap=$(awk '/^\/dev/ { print $1 }' /proc/swaps | while read x; do get_numeric_dev dec $x ; echo -n " "; done)
639
	swappartitions=$(blkid -t TYPE=swap -o device)
640
	if [ x"$swappartitions" != x ]; then
641
		for partition in $swappartitions ; do
642
			[ ! -e $partition ] && continue
643
			majmin=$(get_numeric_dev dec $partition)
644
			echo $curswap | grep -qw "$majmin" || action $"Enabling local swap partitions: " swapon $partition
645
		done
646
	fi
647
fi
648
 
649
# Set up binfmt_misc
650
/bin/mount -t binfmt_misc none /proc/sys/fs/binfmt_misc > /dev/null 2>&1
651
 
652
# Boot time profiles. Yes, this should be somewhere else.
653
if [ -x /usr/sbin/system-config-network-cmd ]; then
654
  if strstr "$cmdline" netprofile= ; then
655
    for arg in $cmdline ; do
656
        if [ "${arg##netprofile=}" != "${arg}" ]; then
657
	    /usr/sbin/system-config-network-cmd --profile ${arg##netprofile=}
658
        fi
659
    done
660
  fi
661
fi
662
 
663
# Now that we have all of our basic modules loaded and the kernel going,
664
# let's dump the syslog ring somewhere so we can find it later
665
[ -f /var/log/dmesg ] && mv -f /var/log/dmesg /var/log/dmesg.old
666
dmesg -s 131072 > /var/log/dmesg
667
 
668
# create the crash indicator flag to warn on crashes, offer fsck with timeout
669
touch /.autofsck &> /dev/null
670
 
671
[ "$PROMPT" != no ] && plymouth --ignore-keystroke=Ii
672
if strstr "$cmdline" confirm ; then
673
	touch /var/run/confirm
674
fi
675
 
676
# Let rhgb know that we're leaving rc.sysinit
677
if [ -x /bin/plymouth ]; then
678
    /bin/plymouth --sysinit
679
fi
680