1
0

mountvirtfs 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  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. if ! mountpoint /run >/dev/null; then
  33. mount -n /run || failed=1
  34. fi
  35. mkdir -p /run/var /run/lock /run/shm
  36. chmod 1777 /run/shm
  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 -n -o nosuid,noexec,nodev /proc || failed=1
  41. fi
  42. if ! mountpoint /sys >/dev/null; then
  43. log_info_msg2 " ${INFO}/sys"
  44. mount -n -o nosuid,noexec,nodev /sys || failed=1
  45. fi
  46. if ! mountpoint /dev >/dev/null; then
  47. log_info_msg2 " ${INFO}/dev"
  48. mount -n -o mode=0755,nosuid /dev || failed=1
  49. fi
  50. # Copy devices that Udev >= 155 doesn't handle to /dev
  51. cp -a /lib/udev/devices/* /dev
  52. ln -sfn /run/shm /dev/shm
  53. (exit ${failed})
  54. evaluate_retval
  55. exit $failed
  56. ;;
  57. *)
  58. echo "Usage: ${0} {start}"
  59. exit 1
  60. ;;
  61. esac
  62. # End mountvirtfs