Subversion Repositories configs

Rev

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