mountvirtfs 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. #!/bin/sh
  2. ########################################################################
  3. # Begin mountvirtfs
  4. #
  5. # Description : Mount proc, sysfs, and run
  6. #
  7. # Authors : Gerard Beekmans - gerard@linuxfromscratch.org
  8. # DJ Lucas - dj@linuxfromscratch.org
  9. # Update : Bruce Dubbs - bdubbs@linuxfromscratch.org
  10. #
  11. # Version : LFS 7.0
  12. #
  13. ########################################################################
  14. ### BEGIN INIT INFO
  15. # Provides: mountvirtfs
  16. # Required-Start:
  17. # Should-Start:
  18. # Required-Stop:
  19. # Should-Stop:
  20. # Default-Start: S
  21. # Default-Stop:
  22. # Short-Description: Mounts /sys and /proc virtual (kernel) filesystems.
  23. # Mounts /run (tmpfs) and /dev (devtmpfs).
  24. # Description: Mounts /sys and /proc virtual (kernel) filesystems.
  25. # Mounts /run (tmpfs) and /dev (devtmpfs).
  26. # X-LFS-Provided-By: LFS
  27. ### END INIT INFO
  28. . /lib/lsb/init-functions
  29. case "${1}" in
  30. start)
  31. # Make sure /run/var is available before logging any messages
  32. mount -n /run || failed=1
  33. mkdir -p /run/var /run/lock /run/shm
  34. chmod 1777 /run/shm
  35. log_info_msg "Mounting virtual file systems: ${INFO}/run"
  36. if ! mountpoint /proc >/dev/null; then
  37. log_info_msg2 " ${INFO}/proc"
  38. mount -n -o nosuid,noexec,nodev /proc || failed=1
  39. fi
  40. if ! mountpoint /sys >/dev/null; then
  41. log_info_msg2 " ${INFO}/sys"
  42. mount -n -o nosuid,noexec,nodev /sys || failed=1
  43. fi
  44. if ! mountpoint /dev >/dev/null; then
  45. log_info_msg2 " ${INFO}/dev"
  46. mount -n -o mode=0755,nosuid /dev || failed=1
  47. fi
  48. ln -s /run/shm /dev/shm
  49. # Copy the only static device node that Udev >= 155 doesn't
  50. # handle to /dev
  51. cp -a /lib/udev/devices/null /dev
  52. (exit ${failed})
  53. evaluate_retval
  54. exit $failed
  55. ;;
  56. *)
  57. echo "Usage: ${0} {start}"
  58. exit 1
  59. ;;
  60. esac
  61. # End mountvirtfs