linux shell random 3,Linux 下Shell的学习3-优秀demo详解

1 #!/bin/bash2 #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 -m11

12 if [ -f /etc/sysconfig/network ]; then

13 . /etc/sysconfig/network14 fi

15 if [ -z "$HOSTNAME" -o "$HOSTNAME" = "(none)" ]; then

16 HOSTNAME=localhost17 fi

18

19 if [ ! -e /proc/mounts ]; then

20 mount -n -t proc /proc /proc21 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/usb25 else

26 mount -n -t usbfs /proc/bus/usb /proc/bus/usb27 fi

28

29 #remount /dev/shm to set attributes from fstab #669700

30 mount -n -o remount /dev/shm >/dev/null 2>&1

31

32 . /etc/init.d/functions33

34 PLYMOUTH=

35 [ -x /bin/plymouth ] && PLYMOUTH=yes36

37 # Check SELinux status38 SELINUX_STATE=

39 if [ -e "/selinux/enforce" ] && [ "$(cat /proc/self/attr/current)" != "kernel" ]; then

40 if [ -r "/selinux/enforce" ] ; then

41 SELINUX_STATE=$(cat "/selinux/enforce")42 else

43 # assume enforcing if you can't read it

44 SELINUX_STATE=1

45 fi

46 fi

47

48 if [ -n "$SELINUX_STATE" -a -x /sbin/restorecon ] && __fgrep "/dev" /proc/mounts >/dev/null 2>&1 ; then

49 /sbin/restorecon -R -F /dev 2>/dev/null

50 fi

51

52 disable_selinux() {53 echo $"*** Warning -- SELinux is active"

54 echo $"*** Disabling security enforcement for system recovery."

55 echo $"*** Run 'setenforce 1' to reenable."

56 echo "0" > "/selinux/enforce"

57 }58

59 relabel_selinux() {60 # if /sbin/init is not labeled correctly this process is running inthe61 # wrong context, so a reboot will be required after relabel62 AUTORELABEL=

63 . /etc/selinux/config64 echo "0" > /selinux/enforce65 [ -n "$PLYMOUTH" ] && plymouth --hide-splash66

67 if [ "$AUTORELABEL" = "0" ]; then

68 echo

69 echo $"*** Warning -- SELinux ${SELINUXTYPE} policy relabel is required."

70 echo $"*** /etc/selinux/config indicates you want to manually fix labeling"

71 echo $"*** problems. Dropping you to a shell; the system will reboot"

72 echo $"*** when you leave the shell."

73 start rcS-emergency74

75 else

76 echo

77 echo $"*** Warning -- SELinux ${SELINUXTYPE} policy relabel is required."

78 echo $"*** Relabeling could take a very long time, depending on file"

79 echo $"*** system size and speed of hard drives."

80

81 /sbin/fixfiles -F restore > /dev/null 2>&1

82 fi

83 rm -f /.autorelabel84 echo $"Unmounting file systems"

85 umount -a86 mount -n -o remount,ro /

87 echo $"Automatic reboot in progress."

88 reboot -f89 }90

91 # Print a text banner.92 echo -en $"\t\tWelcome to"

93 read -r system_release < /etc/system-release94 if [[ "$system_release" == *"Red Hat"* ]]; then

95 [ "$BOOTUP" = "color" ] && echo -en "\\033[0;31m"

96 echo -en "Red Hat"

97 [ "$BOOTUP" = "color" ] && echo -en "\\033[0;39m"

98 PRODUCT=$(sed "s/Red Hat \(.*\) release.*/\1/" /etc/system-release)99 echo "$PRODUCT"

100 elif [[ "$system_release" == *Fedora* ]]; then

101 [ "$BOOTUP" = "color" ] && echo -en "\\033[0;34m"

102 echo -en "Fedora"

103 [ "$BOOTUP" = "color" ] && echo -en "\\033[0;39m"

104 PRODUCT=$(sed "s/Fedora \(.*\) \?release.*/\1/" /etc/system-release)105 echo "$PRODUCT"

106 elif [[ "$system_release" =~ "CentOS" ]]; then

107 [ "$BOOTUP" = "color" ] && echo -en "\\033[0;36m"

108 echo -en "CentOS"

109 [ "$BOOTUP" = "color" ] && echo -en "\\033[0;39m"

110 PRODUCT=$(sed "s/CentOS \(.*\) \?release.*/\1/" /etc/system-release)111 echo "$PRODUCT"

112 else

113 PRODUCT=$(sed "s/ release.*//g" /etc/system-release)114 echo "$PRODUCT"

115 fi

116

117 # Only read this once.118 cmdline=$(cat /proc/cmdline)119

120 # Initialize hardware121 if [ -f /proc/sys/kernel/modprobe ]; then

122 if ! strstr "$cmdline" nomodules && [ -f /proc/modules ] ; then

123 sysctl -w kernel.modprobe="/sbin/modprobe" >/dev/null 2>&1

124 else

125 # We used to set this to NULL, but that causes 'failed to exec' messages"126 sysctl -w kernel.modprobe="/bin/true" >/dev/null 2>&1

127 fi

128 fi

129

130 touch /dev/.in_sysinit >/dev/null 2>&1

131

132 # Set default affinity133 if [ -x /bin/taskset ]; then

134 if strstr "$cmdline" default_affinity= ; then

135 for arg in $cmdline ; do

136 if [ "${arg##default_affinity=}" != "${arg}" ]; then

137 /bin/taskset -p ${arg##default_affinity=} 1

138 fi

139 done

140 fi

141 fi

142

143 nashpid=$(pidof nash 2>/dev/null)144 [ -n "$nashpid" ] && kill $nashpid >/dev/null 2>&1

145 unset nashpid146 /sbin/start_udev147

148 # Load other user-defined modules149 for file in /etc/sysconfig/modules/*.modules ; do150 [ -x $file ] && $file151 done152

153 # Load modules (for backward compatibility with VARs)154 if [ -f /etc/rc.modules ]; then155 /etc/rc.modules156 fi157

158 mount -n /dev/pts >/dev/null 2>&1159 [ -n "$SELINUX_STATE" ] && restorecon -F /dev/pts >/dev/null 2>&1160

161 # Configure kernel parameters162 update_boot_stage RCkernelparam163 apply_sysctl164

165 # Set the hostname.166 update_boot_stage RChostname167 action $"Setting hostname ${HOSTNAME}: " hostname ${HOSTNAME}168 [ -n "${NISDOMAIN}" ] && domainname ${NISDOMAIN}169

170 # Sync waiting for storage.171 { rmmod scsi_wait_scan ; modprobe scsi_wait_scan ; rmmod scsi_wait_scan ; } >/dev/null 2>&1172

173 # Device mapper & related initialization174 if ! __fgrep "device-mapper" /proc/devices >/dev/null 2>&1 ; then175 modprobe dm-mod >/dev/null 2>&1176 fi177

178 if [ -f /etc/crypttab ]; then179 init_crypto 0180 fi181

182 if ! strstr "$cmdline" nompath && [ -f /etc/multipath.conf -a \183 -x /sbin/multipath ]; then184 modprobe dm-multipath > /dev/null 2>&1185 /sbin/multipath -v 0186 if [ -x /sbin/kpartx ]; then187 /sbin/dmsetup ls --target multipath --exec "/sbin/kpartx -a -p p" >/dev/null188 fi189 fi190

191 if ! strstr "$cmdline" nodmraid && [ -x /sbin/dmraid ]; then192 modprobe dm-mirror >/dev/null 2>&1193 dmraidsets=$(LC_ALL=C /sbin/dmraid -s -c -i)194 if [ "$?" = "0" ]; then195 for dmname in $dmraidsets; do196 if [[ "$dmname" == isw_* ]] && \197 ! strstr "$cmdline" noiswmd; then198 continue199 fi200 /sbin/dmraid -ay -i --rm_partitions -p "$dmname" >/dev/null 2>&1201 /sbin/kpartx -a -p p "/dev/mapper/$dmname"202 done203 fi204 fi205

206 # Start any MD RAID arrays that haven't been started yet207 [ -r /proc/mdstat -a -r /dev/md/md-device-map ] && /sbin/mdadm -IRs208

209 if [ -x /sbin/lvm ]; then210 action $"Setting up Logical Volume Management:" /sbin/lvm vgchange -a ay --sysinit211 fi212

213 if [ -f /etc/crypttab ]; then214 init_crypto 0215 fi216

217 if [ -f /fastboot ] || strstr "$cmdline" fastboot ; then218 fastboot=yes219 fi220

221 if [ -f /fsckoptions ]; then222 fsckoptions=$(cat /fsckoptions)223 fi224

225 if [ -f /forcefsck ] || strstr "$cmdline" forcefsck ; then226 fsckoptions="-f $fsckoptions"227 elif [ -f /.autofsck ]; then228 [ -f /etc/sysconfig/autofsck ] && . /etc/sysconfig/autofsck229 if [ "$AUTOFSCK_DEF_CHECK" = "yes" ]; then230 AUTOFSCK_OPT="$AUTOFSCK_OPT -f"231 fi232 if [ -n "$AUTOFSCK_SINGLEUSER" ]; then233 [ -n "$PLYMOUTH" ] && plymouth --hide-splash234 echo235 echo $"*** Warning -- the system did not shut down cleanly. "236 echo $"*** Dropping you to a shell; the system will continue"237 echo $"*** when you leave the shell."238 [ -n "$SELINUX_STATE" ] && echo "0" > /selinux/enforce239 start rcS-emergency240 [ -n "$SELINUX_STATE" ] && echo "1" > /selinux/enforce241 [ -n "$PLYMOUTH" ] && plymouth --show-splash242 fi243 fsckoptions="$AUTOFSCK_OPT $fsckoptions"244 fi245

246 if [ "$BOOTUP" = "color" ]; then247 fsckoptions="-C $fsckoptions"248 else249 fsckoptions="-V $fsckoptions"250 fi251

252 READONLY=253 if [ -f /etc/sysconfig/readonly-root ]; then254 . /etc/sysconfig/readonly-root255 fi256 if strstr "$cmdline" readonlyroot ; then257 READONLY=yes258 [ -z "$RW_MOUNT" ] && RW_MOUNT=/var/lib/stateless/writable259 [ -z "$STATE_MOUNT" ] && STATE_MOUNT=/var/lib/stateless/state260 fi261 if strstr "$cmdline" noreadonlyroot ; then262 READONLY=no263 fi264

265 if [ "$READONLY" = "yes" -o "$TEMPORARY_STATE" = "yes" ]; then266

267 mount_empty() {268 if [ -e "$1" ]; then269 echo "$1" | cpio -p -vd "$RW_MOUNT" &>/dev/null270 mount -n --bind "$RW_MOUNT$1" "$1"271 fi272 }273

274 mount_dirs() {275 if [ -e "$1" ]; then276 mkdir -p "$RW_MOUNT$1"277 find "$1" -type d -print0 | cpio -p -0vd "$RW_MOUNT" &>/dev/null278 mount -n --bind "$RW_MOUNT$1" "$1"279 fi280 }281

282 mount_files() {283 if [ -e "$1" ]; then284 cp -a --parents "$1" "$RW_MOUNT"285 mount -n --bind "$RW_MOUNT$1" "$1"286 fi287 }288

289 # Common mount options for scratch space regardless of290 # type of backing store291 mountopts=292

293 # Scan partitions for local scratch storage294 rw_mount_dev=$(blkid -t LABEL="$RW_LABEL" -l -o device)295

296 # First try to mount scratch storage from /etc/fstab, then any297 # partition with the proper label. If either succeeds, be sure298 # to wipe the scratch storage clean. If both fail, then mount299 # scratch storage via tmpfs.300 if mount $mountopts "$RW_MOUNT" > /dev/null 2>&1 ; then301 rm -rf "$RW_MOUNT" > /dev/null 2>&1302 elif [ x$rw_mount_dev != x ] && mount $rw_mount_dev $mountopts "$RW_MOUNT" > /dev/null 2>&1; then303 rm -rf "$RW_MOUNT" > /dev/null 2>&1304 else305 mount -n -t tmpfs $RW_OPTIONS $mountopts none "$RW_MOUNT"306 fi307

308 for file in /etc/rwtab /etc/rwtab.d/* /dev/.initramfs/rwtab ; do309 is_ignored_file "$file" && continue310 [ -f $file ] && cat $file | while read type path ; do311 case "$type" in312 empty)313 mount_empty $path314 ;;315 files)316 mount_files $path317 ;;318 dirs)319 mount_dirs $path320 ;;321 *)322 ;;323 esac324 [ -n "$SELINUX_STATE" -a -e "$path" ] && restorecon -R "$path"325 done326 done327

328 # Use any state passed by initramfs329 [ -d /dev/.initramfs/state ] && cp -a /dev/.initramfs/state/* $RW_MOUNT330

331 # In theory there should be no more than one network interface active332 # this early in the boot process -- the one we're booting from.333 # Use the network address to set the hostname of the client. This334 # must be done even if we have local storage.335 ipaddr=336 if [ "$HOSTNAME" = "localhost" -o "$HOSTNAME" = "localhost.localdomain" ]; then337 ipaddr=$(ip addr show to 0.0.0.0/0 scope global | awk '/[[:space:]]inet / { print gensub("/.*","","g",$2) }')338 for ip in $ipaddr ; do339 HOSTNAME=340 eval $(ipcalc -h $ip 2>/dev/null)341 [ -n "$HOSTNAME" ] && { hostname ${HOSTNAME} ; break; }342 done343 fi344

345 # Clients with read-only root filesystems may be provided with a346 # place where they can place minimal amounts of persistent347 # state. SSH keys or puppet certificates for example.348 #349 # Ideally we'll use puppet to manage the state directory and to350 # create the bind mounts. However, until that's all ready this351 # is sufficient to build a working system.352

353 # First try to mount persistent data from /etc/fstab, then any354 # partition with the proper label, then fallback to NFS355 state_mount_dev=$(blkid -t LABEL="$STATE_LABEL" -l -o device)356 if mount $mountopts $STATE_OPTIONS "$STATE_MOUNT" > /dev/null 2>&1 ; then357 /bin/true358 elif [ x$state_mount_dev != x ] && mount $state_mount_dev $mountopts "$STATE_MOUNT" > /dev/null 2>&1; then359 /bin/true360 elif [ ! -z "$CLIENTSTATE" ]; then361 # No local storage was found. Make a final attempt to find362 # state on an NFS server.363

364 mount -t nfs $CLIENTSTATE/$HOSTNAME $STATE_MOUNT -o rw,nolock365 fi366

367 if [ -w "$STATE_MOUNT" ]; then368

369 mount_state() {370 if [ -e "$1" ]; then371 [ ! -e "$STATE_MOUNT$1" ] && cp -a --parents "$1" "$STATE_MOUNT"372 mount -n --bind "$STATE_MOUNT$1" "$1"373 fi374 }375

376 for file in /etc/statetab /etc/statetab.d/* ; do377 is_ignored_file "$file" && continue378 [ ! -f "$file" ] && continue379

380 if [ -f "$STATE_MOUNT/$file" ] ; then381 mount -n --bind "$STATE_MOUNT/$file" "$file"382 fi383

384 for path in $(grep -v "^#" "$file" 2>/dev/null); do385 mount_state "$path"386 [ -n "$SELINUX_STATE" -a -e "$path" ] && restorecon -R "$path"387 done388 done389

390 if [ -f "$STATE_MOUNT/files" ] ; then391 for path in $(grep -v "^#" "$STATE_MOUNT/files" 2>/dev/null); do392 mount_state "$path"393 [ -n "$SELINUX_STATE" -a -e "$path" ] && restorecon -R "$path"394 done395 fi396 fi397 fi398

399 if [[ " $fsckoptions" != *" -y"* ]]; then400 fsckoptions="-a $fsckoptions"401 fi402

403 _RUN_QUOTACHECK=0404 if [ -f /forcequotacheck ] || strstr "$cmdline" forcequotacheck ; then405 _RUN_QUOTACHECK=1406 fi407 if [ -z "$fastboot" -a "$READONLY" != "yes" ]; then408

409 STRING=$"Checking filesystems"410 echo $STRING411 fsck -T -t noopts=_netdev -A $fsckoptions412 rc=$?413

414 if [ "$rc" -eq "0" ]; then415 success "$STRING"416 echo417 elif [ "$rc" -eq "1" ]; then418 passed "$STRING"419 echo420 elif [ "$rc" -eq "2" -o "$rc" -eq "3" ]; then421 echo $"Unmounting file systems"422 umount -a423 mount -n -o remount,ro /424 echo $"Automatic reboot in progress."425 reboot -f426 fi427

428 # A return of 4 or higher means there were serious problems.429 if [ $rc -gt 1 ]; then430 [ -n "$PLYMOUTH" ] && plymouth --hide-splash431

432 failure "$STRING"433 echo434 echo435 echo $"*** An error occurred during the file system check."436 echo $"*** Dropping you to a shell; the system will reboot"437 echo $"*** when you leave the shell."438

439 str=$"(Repair filesystem)"440 PS1="$str \# # "; export PS1441 [ "$SELINUX_STATE" = "1" ] && disable_selinux442 start rcS-emergency443

444 echo $"Unmounting file systems"445 umount -a446 mount -n -o remount,ro /447 echo $"Automatic reboot in progress."448 reboot -f449 elif [ "$rc" -eq "1" ]; then450 _RUN_QUOTACHECK=1451 fi452 fi453

454 remount_needed() {455 local state oldifs456 [ "$READONLY" = "yes" ] && return 1457 state=$(LC_ALL=C awk '/ \/ / && ($3 !~ /rootfs/) { print $4 }' /proc/mounts)458 oldifs=$IFS459 IFS=","460 for opt in $state ; do461 if [ "$opt" = "rw" ]; then462 IFS=$oldifs463 return 1464 fi465 done466 IFS=$oldifs467 return 0468 }469

470 # Remount the root filesystem read-write.471 update_boot_stage RCmountfs472 if remount_needed ; then473 action $"Remounting root filesystem in read-write mode: " mount -n -o remount,rw /474 fi475

476 # Clean up SELinux labels477 if [ -n "$SELINUX_STATE" ]; then478 restorecon /etc/mtab /etc/ld.so.cache /etc/blkid/blkid.tab /etc/resolv.conf >/dev/null 2>&1479 fi480

481 # If relabeling, relabel mount points.482 if [ -n "$SELINUX_STATE" -a "$READONLY" != "yes" ]; then483 if [ -f /.autorelabel ] || strstr "$cmdline" autorelabel ; then484 restorecon $(awk '!/^#/ && $4 !~ /noauto/ && $2 ~ /^\// { print $2 }' /etc/fstab) >/dev/null 2>&1485 fi486 fi487

488 if [ "$READONLY" != "yes" ] ; then489 # Clear mtab490 (> /etc/mtab) &> /dev/null491

492 # Remove stale backups493 rm -f /etc/mtab~ /etc/mtab~~494

495 # Enter mounted filesystems into /etc/mtab496 mount -f /497 mount -f /proc >/dev/null 2>&1498 mount -f /sys >/dev/null 2>&1499 mount -f /dev/pts >/dev/null 2>&1500 mount -f /dev/shm >/dev/null 2>&1501 mount -f /proc/bus/usb >/dev/null 2>&1502 fi503

504 # Mount all other filesystems (except for NFS and /proc, which is already505 # mounted). Contrary to standard usage,506 # filesystems are NOT unmounted in single user mode.507 # The 'no' applies to all listed filesystem types. See mount(8).508 if [ "$READONLY" != "yes" ] ; then509 action $"Mounting local filesystems: " mount -a -t nonfs,nfs4,smbfs,ncpfs,cifs,gfs,gfs2 -O no_netdev510 else511 action $"Mounting local filesystems: " mount -a -n -t nonfs,nfs4,smbfs,ncpfs,cifs,gfs,gfs2 -O no_netdev512 fi513

514 # Update quotas if necessary515 if [ X"$_RUN_QUOTACHECK" = X1 -a -x /sbin/quotacheck ]; then516 action $"Checking local filesystem quotas: " /sbin/quotacheck -anug517 fi518

519 if [ -x /sbin/quotaon ]; then520 action $"Enabling local filesystem quotas: " /sbin/quotaon -aug521 fi522

523 # Check to see if a full relabel is needed524 if [ -n "$SELINUX_STATE" -a "$READONLY" != "yes" ]; then525 if [ -f /.autorelabel ] || strstr "$cmdline" autorelabel ; then526 relabel_selinux527 fi528 else529 if [ -d /etc/selinux -a "$READONLY" != "yes" ]; then530 [ -f /.autorelabel ] || touch /.autorelabel531 fi532 fi533

534 # Initialize pseudo-random number generator535 if [ -f "/var/lib/random-seed" ]; then536 cat /var/lib/random-seed > /dev/urandom537 else538 [ "$READONLY" != "yes" ] && touch /var/lib/random-seed539 fi540 if [ "$READONLY" != "yes" ]; then541 chmod 600 /var/lib/random-seed542 dd if=/dev/urandom of=/var/lib/random-seed count=1 bs=512 2>/dev/null543 fi544

545 if [ -f /etc/crypttab ]; then546 init_crypto 1547 fi548

549 # Configure machine if necessary.550 if [ -f /.unconfigured ]; then551

552 if [ -x /bin/plymouth ]; then553 /bin/plymouth quit554 fi555

556 if [ -x /usr/bin/system-config-keyboard ]; then557 /usr/bin/system-config-keyboard558 fi559 if [ -x /usr/bin/passwd ]; then560 /usr/bin/passwd root561 fi562 if [ -x /usr/sbin/system-config-network-tui ]; then563 /usr/sbin/system-config-network-tui564 fi565 if [ -x /usr/sbin/timeconfig ]; then566 /usr/sbin/timeconfig567 fi568 if [ -x /usr/sbin/authconfig-tui ]; then569 /usr/sbin/authconfig-tui --nostart570 fi571 if [ -x /usr/sbin/ntsysv ]; then572 /usr/sbin/ntsysv --level 35573 fi574

575 # Reread in network configuration data.576 if [ -f /etc/sysconfig/network ]; then577 . /etc/sysconfig/network578

579 # Reset the hostname.580 action $"Resetting hostname ${HOSTNAME}: " hostname ${HOSTNAME}581 fi582

583 rm -f /.unconfigured584 fi585

586 # Clean out /.587 rm -f /fastboot /fsckoptions /forcefsck /.autofsck /forcequotacheck /halt \588 /poweroff /.suspended &> /dev/null589

590 # Do we need (w|u)tmpx files? We don't set them up, but the sysadmin might...591 _NEED_XFILES=592 [ -f /var/run/utmpx -o -f /var/log/wtmpx ] && _NEED_XFILES=1593

594 # Clean up /var.595 rm -rf /var/lock/cvs/* /var/run/screen/*596 find /var/lock /var/run ! -type d -exec rm -f {} \;597 rm -f /var/lib/rpm/__db* &> /dev/null598 rm -f /var/gdm/.gdmfifo &> /dev/null599

600 [ "$PROMPT" != no ] && plymouth watch-keystroke --command "touch /var/run/confirm" --keys=Ii &601

602 # Clean up utmp/wtmp603 > /var/run/utmp604 touch /var/log/wtmp605 chgrp utmp /var/run/utmp /var/log/wtmp606 chmod 0664 /var/run/utmp /var/log/wtmp607 if [ -n "$_NEED_XFILES" ]; then608 > /var/run/utmpx609 touch /var/log/wtmpx610 chgrp utmp /var/run/utmpx /var/log/wtmpx611 chmod 0664 /var/run/utmpx /var/log/wtmpx612 fi613 [ -n "$SELINUX_STATE" ] && restorecon /var/run/utmp* /var/log/wtmp* >/dev/null 2>&1614

615 # Clean up various /tmp bits616 [ -n "$SELINUX_STATE" ] && restorecon /tmp617 rm -f /tmp/.X*-lock /tmp/.lock.* /tmp/.gdm_socket /tmp/.s.PGSQL.*618 rm -rf /tmp/.X*-unix /tmp/.ICE-unix /tmp/.font-unix /tmp/hsperfdata_* \619 /tmp/kde-* /tmp/ksocket-* /tmp/mc-* /tmp/mcop-* /tmp/orbit-* \620 /tmp/scrollkeeper-* /tmp/ssh-* \621 /dev/.in_sysinit622

623 # Make ICE directory624 mkdir -m 1777 -p /tmp/.ICE-unix >/dev/null 2>&1625 chown root:root /tmp/.ICE-unix626 [ -n "$SELINUX_STATE" ] && restorecon /tmp/.ICE-unix >/dev/null 2>&1627

628 # Start up swapping.629 update_boot_stage RCswap630 action $"Enabling /etc/fstab swaps: " swapon -a -e631 if [ "$AUTOSWAP" = "yes" ]; then632 curswap=$(awk '/^\/dev/ { print $1 }' /proc/swaps | while read x; do get_numeric_dev dec $x ; echo -n " "; done)633 swappartitions=$(blkid -t TYPE=swap -o device)634 if [ x"$swappartitions" != x ]; then635 for partition in $swappartitions ; do636 [ ! -e $partition ] && continue637 majmin=$(get_numeric_dev dec $partition)638 echo $curswap | grep -qw "$majmin" || action $"Enabling local swap partitions: " swapon $partition639 done640 fi641 fi642

643 # Set up binfmt_misc644 /bin/mount -t binfmt_misc none /proc/sys/fs/binfmt_misc > /dev/null 2>&1645

646 # Boot time profiles. Yes, this should be somewhere else.647 if [ -x /usr/sbin/system-config-network-cmd ]; then648 if strstr "$cmdline" netprofile= ; then649 for arg in $cmdline ; do650 if [ "${arg##netprofile=}" != "${arg}" ]; then651 /usr/sbin/system-config-network-cmd --profile ${arg##netprofile=}652 fi653 done654 fi655 fi656

657 # Now that we have all of our basic modules loaded and the kernel going,658 # let's dump the syslog ring somewhere so we can find it later659 [ -f /var/log/dmesg ] && mv -f /var/log/dmesg /var/log/dmesg.old660 dmesg -s 131072 > /var/log/dmesg661

662 # create the crash indicator flag to warn on crashes, offer fsck with timeout663 touch /.autofsck &> /dev/null664

665 [ "$PROMPT" != no ] && plymouth --ignore-keystroke=Ii666 if strstr "$cmdline" confirm ; then667 touch /var/run/confirm668 fi669

670 # Let rhgb know that we're leaving rc.sysinit671 if [ -x /bin/plymouth ]; then672 /bin/plymouth --sysinit673 fi

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值