X-Git-Url: http://git.osdn.net/view?a=blobdiff_plain;f=docs%2FLFS-BOOK%2Fscripts%2Fapds04.html;fp=docs%2FLFS-BOOK%2Fscripts%2Fapds04.html;h=7d95aba44b862abd983b79e9a29d630dc42ca505;hb=a411e60d0a358bff7a5d6b7ae144b4efd5c2ad1b;hp=38235f749dd2573f834c69037534a60b6652a1b3;hpb=d6bd32b8c5529ebacf0e3459ef10b18e934ac940;p=linuxjf%2FJF.git diff --git a/docs/LFS-BOOK/scripts/apds04.html b/docs/LFS-BOOK/scripts/apds04.html index 38235f7..7d95aba 100644 --- a/docs/LFS-BOOK/scripts/apds04.html +++ b/docs/LFS-BOOK/scripts/apds04.html @@ -4,27 +4,27 @@ - D.4. /etc/rc.d/init.d/consolelog + D.4. /etc/rc.d/init.d/mountvirtfs - +

- D.4. - /etc/rc.d/init.d/consolelog + D.4. + /etc/rc.d/init.d/mountvirtfs

 #!/bin/sh
-# Begin $rc_base/init.d/consolelog
-
 ########################################################################
+# Begin mountvirtfs
 #
-# Description : Set the kernel log level for the console
-#
-# Authors     : Dan Nicholson - dnicholson@linuxfromscratch.org
+# Description : Mount proc, sysfs, and run
 #
-# Version     : 00.00
+# Authors     : Gerard Beekmans - gerard@linuxfromscratch.org
+#               DJ Lucas - dj@linuxfromscratch.org
+# Update      : Bruce Dubbs - bdubbs@linuxfromscratch.org
 #
-# Notes       : /proc must be mounted before this can run
+# Version     : LFS 7.0
 #
 ########################################################################
 
-. /etc/sysconfig/rc
-. ${rc_functions}
+### BEGIN INIT INFO
+# Provides:            mountvirtfs
+# Required-Start:
+# Should-Start:
+# Required-Stop:
+# Should-Stop:
+# Default-Start:       S
+# Default-Stop:
+# Short-Description:   Mounts /sys and /proc virtual (kernel) filesystems.
+#                      Mounts /run (tmpfs) and /dev (devtmpfs).
+# Description:         Mounts /sys and /proc virtual (kernel) filesystems.
+#                      Mounts /run (tmpfs) and /dev (devtmpfs).
+# X-LFS-Provided-By:   LFS
+### END INIT INFO
 
-# set the default loglevel
-LOGLEVEL=7
-if [ -r /etc/sysconfig/console ]; then
-    . /etc/sysconfig/console
-fi
+. /lib/lsb/init-functions
 
 case "${1}" in
-    start)
-        case "$LOGLEVEL" in
-        [1-8])
-            boot_mesg "Setting the console log level to ${LOGLEVEL}..."
-            dmesg -n $LOGLEVEL
-            evaluate_retval
-            ;;
-        *)
-            boot_mesg "Console log level '${LOGLEVEL}' is invalid" ${FAILURE}
-            echo_failure
-            ;;
-        esac
-        ;;
-    status)
-        # Read the current value if possible
-        if [ -r /proc/sys/kernel/printk ]; then
-            read level line < /proc/sys/kernel/printk
-        else
-            boot_mesg "Can't read the current console log level" ${FAILURE}
-            echo_failure
-        fi
+   start)
+      # Make sure /run/var is available before logging any messages
+      if ! mountpoint /run >/dev/null; then
+         mount -n /run || failed=1
+      fi
+
+      mkdir -p /run/var /run/lock /run/shm
+      chmod 1777 /run/shm
+
+      log_info_msg "Mounting virtual file systems: ${INFO}/run" 
+
+      if ! mountpoint /proc >/dev/null; then
+         log_info_msg2 " ${INFO}/proc"
+         mount -n -o nosuid,noexec,nodev /proc || failed=1
+      fi
+
+      if ! mountpoint /sys >/dev/null; then
+         log_info_msg2 " ${INFO}/sys" 
+         mount -n -o nosuid,noexec,nodev /sys || failed=1
+      fi
+
+      if ! mountpoint /dev >/dev/null; then
+         log_info_msg2 " ${INFO}/dev" 
+         mount -n -o mode=0755,nosuid /dev  || failed=1
+      fi
+
+      # Copy devices that Udev >= 155 doesn't handle to /dev
+      cp -a /lib/udev/devices/* /dev
 
-        # Print the value
-        if [ -n "$level" ]; then
-            ${ECHO} -e "${INFO}The current console log level" \
-                "is ${level}${NORMAL}"
-        fi
-        ;;
+      ln -sfn /run/shm /dev/shm
+      
+      (exit ${failed})
+      evaluate_retval
+      exit $failed
+      ;;
 
-    *)
-        echo "Usage: ${0} {start|status}"
-        exit 1
-        ;;
+   *)
+      echo "Usage: ${0} {start}"
+      exit 1
+      ;;
 esac
 
-# End $rc_base/init.d/consolelog
+# End mountvirtfs