mountvirtfs 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  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 is available before logging any messages
  32. if ! mountpoint /run >/dev/null; then
  33. mount /run || failed=1
  34. fi
  35. mkdir -p /run/lock /run/shm
  36. chmod 1777 /run/shm /run/lock
  37. log_info_msg "Mounting virtual file systems: ${INFO}/run"
  38. if ! mountpoint /proc >/dev/null; then
  39. log_info_msg2 " ${INFO}/proc"
  40. mount -o nosuid,noexec,nodev /proc || failed=1
  41. fi
  42. if ! mountpoint /sys >/dev/null; then
  43. log_info_msg2 " ${INFO}/sys"
  44. mount -o nosuid,noexec,nodev /sys || failed=1
  45. fi
  46. if ! mountpoint /dev >/dev/null; then
  47. log_info_msg2 " ${INFO}/dev"
  48. mount -o mode=0755,nosuid /dev || failed=1
  49. fi
  50. ln -sfn /run/shm /dev/shm
  51. (exit ${failed})
  52. evaluate_retval
  53. exit $failed
  54. ;;
  55. *)
  56. echo "Usage: ${0} {start}"
  57. exit 1
  58. ;;
  59. esac
  60. # End mountvirtfs