Subversion Repositories configs

Rev

Rev 3 | Rev 33 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

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