[1fa2099] | 1 | #!/bin/sh
|
---|
| 2 | ########################################################################
|
---|
| 3 | # Begin mountfs
|
---|
| 4 | #
|
---|
| 5 | # Description : File System Mount Script
|
---|
| 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 |
|
---|
| 15 | ### BEGIN INIT INFO
|
---|
| 16 | # Provides: $local_fs
|
---|
| 17 | # Required-Start: udev checkfs
|
---|
[5e009ae] | 18 | # Should-Start: modules
|
---|
[12e721d] | 19 | # Required-Stop: localnet
|
---|
[1fa2099] | 20 | # Should-Stop:
|
---|
| 21 | # Default-Start: S
|
---|
| 22 | # Default-Stop: 0 6
|
---|
| 23 | # Short-Description: Mounts/unmounts local filesystems defined in /etc/fstab.
|
---|
| 24 | # Description: Remounts root filesystem read/write and mounts all
|
---|
| 25 | # remaining local filesystems defined in /etc/fstab on
|
---|
| 26 | # start. Remounts root filesystem read-only and unmounts
|
---|
| 27 | # remaining filesystems on stop.
|
---|
| 28 | # X-LFS-Provided-By: LFS
|
---|
| 29 | ### END INIT INFO
|
---|
| 30 |
|
---|
| 31 | . /lib/lsb/init-functions
|
---|
| 32 |
|
---|
| 33 | case "${1}" in
|
---|
| 34 | start)
|
---|
| 35 | log_info_msg "Remounting root file system in read-write mode..."
|
---|
| 36 | mount --options remount,rw / >/dev/null
|
---|
| 37 | evaluate_retval
|
---|
| 38 |
|
---|
| 39 | # Remove fsck-related file system watermarks.
|
---|
| 40 | rm -f /fastboot /forcefsck
|
---|
| 41 |
|
---|
| 42 | # Make sure /dev/pts exists
|
---|
| 43 | mkdir -p /dev/pts
|
---|
| 44 |
|
---|
| 45 | # This will mount all filesystems that do not have _netdev in
|
---|
| 46 | # their option list. _netdev denotes a network filesystem.
|
---|
| 47 |
|
---|
| 48 | log_info_msg "Mounting remaining file systems..."
|
---|
[f695e02] | 49 | failed=0
|
---|
| 50 | mount --all --test-opts no_netdev >/dev/null || failed=1
|
---|
[1fa2099] | 51 | evaluate_retval
|
---|
| 52 | exit $failed
|
---|
| 53 | ;;
|
---|
| 54 |
|
---|
| 55 | stop)
|
---|
| 56 | # Don't unmount virtual file systems like /run
|
---|
| 57 | log_info_msg "Unmounting all other currently mounted file systems..."
|
---|
| 58 | # Ensure any loop devies are removed
|
---|
| 59 | losetup -D
|
---|
| 60 | umount --all --detach-loop --read-only \
|
---|
| 61 | --types notmpfs,nosysfs,nodevtmpfs,noproc,nodevpts >/dev/null
|
---|
| 62 | evaluate_retval
|
---|
| 63 |
|
---|
| 64 | # Make sure / is mounted read only (umount bug)
|
---|
| 65 | mount --options remount,ro /
|
---|
| 66 |
|
---|
| 67 | # Make all LVM volume groups unavailable, if appropriate
|
---|
| 68 | # This fails if swap or / are on an LVM partition
|
---|
| 69 | #if [ -x /sbin/vgchange ]; then /sbin/vgchange -an > /dev/null; fi
|
---|
| 70 | ;;
|
---|
| 71 |
|
---|
| 72 | *)
|
---|
| 73 | echo "Usage: ${0} {start|stop}"
|
---|
| 74 | exit 1
|
---|
| 75 | ;;
|
---|
| 76 | esac
|
---|
| 77 |
|
---|
| 78 | # End mountfs
|
---|