1
0

mountfs 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. #!/bin/sh
  2. # Begin $RC_BASE/init.d/mountfs
  3. ### BEGIN INIT INFO
  4. # Provides: $local_fs
  5. # Required-Start: udev checkfs
  6. # Should-Start:
  7. # Required-Stop: swap
  8. # Should-Stop:
  9. # Default-Start: S
  10. # Default-Stop: 0 6
  11. # Short-Description: Mounts/unmounts local filesystems defined in /etc/fstab.
  12. # Description: Remounts root filesystem read/write and mounts all
  13. # remaining local filesystems defined in /etc/fstab on
  14. # start. Remounts root filesystem read-only and unmounts
  15. # remaining filesystems on stop.
  16. # X-LFS-Provided-By: LFS
  17. ### END INIT INFO
  18. . /lib/lsb/init-functions
  19. case "${1}" in
  20. start)
  21. message="Remounting root file system in read-write mode..."
  22. mount -n -o remount,rw / >/dev/null
  23. evaluate_retval standard
  24. # Remove fsck-related file system watermarks.
  25. rm -f /fastboot /forcefsck
  26. message="Recording existing mounts in /etc/mtab..."
  27. > /etc/mtab
  28. mount -f / || failed=1
  29. mount -f /proc || failed=1
  30. mount -f /sys || failed=1
  31. mount -f /run || failed=1
  32. (exit ${failed})
  33. evaluate_retval standard
  34. # This will mount all filesystems that do not have _netdev in
  35. # their option list. _netdev denotes a network filesystem.
  36. message="Mounting remaining file systems..."
  37. mount -a -O no_netdev >/dev/null
  38. evaluate_retval standard
  39. ;;
  40. stop)
  41. message="Unmounting all other currently mounted file systems..."
  42. umount -a -d -r >/dev/null
  43. evaluate_retval standard
  44. ;;
  45. *)
  46. echo "Usage: ${0} {start|stop}"
  47. exit 1
  48. ;;
  49. esac
  50. # End $RC_BASE/init.d/mountfs