|
|
|
|
@@ -1,17 +1,4 @@
|
|
|
|
|
#!/bin/sh
|
|
|
|
|
########################################################################
|
|
|
|
|
# Begin mountfs
|
|
|
|
|
#
|
|
|
|
|
# Description : File System Mount Script
|
|
|
|
|
#
|
|
|
|
|
# Authors : Gerard Beekmans - gerard@linuxfromscratch.org
|
|
|
|
|
# DJ Lucas - dj@linuxfromscratch.org
|
|
|
|
|
# Update : Bruce Dubbs - bdubbs@linuxfromscratch.org
|
|
|
|
|
#
|
|
|
|
|
# Version : LFS 7.0
|
|
|
|
|
#
|
|
|
|
|
########################################################################
|
|
|
|
|
|
|
|
|
|
### BEGIN INIT INFO
|
|
|
|
|
# Provides: $local_fs
|
|
|
|
|
# Required-Start: udev checkfs
|
|
|
|
|
@@ -20,67 +7,59 @@
|
|
|
|
|
# Should-Stop:
|
|
|
|
|
# Default-Start: S
|
|
|
|
|
# Default-Stop: 0 6
|
|
|
|
|
# Short-Description: Mounts/unmounts local filesystems defined in /etc/fstab.
|
|
|
|
|
# Short-Description: Mounts/unmounts local filesystems
|
|
|
|
|
# Description: Remounts root filesystem read/write and mounts all
|
|
|
|
|
# remaining local filesystems defined in /etc/fstab on
|
|
|
|
|
# start. Remounts root filesystem read-only and unmounts
|
|
|
|
|
# remaining local filesystems defined in /etc/fstab or
|
|
|
|
|
# in ZFS. Remounts root filesystem read-only and unmounts
|
|
|
|
|
# remaining filesystems on stop.
|
|
|
|
|
# X-LFS-Provided-By: LFS
|
|
|
|
|
# X-Required: true
|
|
|
|
|
### END INIT INFO
|
|
|
|
|
|
|
|
|
|
. /lib/lsb/init-functions
|
|
|
|
|
|
|
|
|
|
#!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
|
|
|
#
|
|
|
|
|
# needs work!!
|
|
|
|
|
# probably need to split up
|
|
|
|
|
# separate scripts for / and
|
|
|
|
|
# network filesystems
|
|
|
|
|
#
|
|
|
|
|
# Ok, so network filesystems
|
|
|
|
|
# init scripts should be included
|
|
|
|
|
# as part of the package. This
|
|
|
|
|
# script should only be for
|
|
|
|
|
# standard local filesystems
|
|
|
|
|
#
|
|
|
|
|
#!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
|
|
|
|
|
|
|
|
case "$1" in
|
|
|
|
|
start)
|
|
|
|
|
log_init_msg "Remounting root file system in read-write mode"
|
|
|
|
|
mount -o remount,rw / >/dev/null && log_success_msg || log_failure_msg
|
|
|
|
|
log_init_msg "Remounting root file system in read-write mode"
|
|
|
|
|
mount -o remount,rw / >/dev/null && log_success_msg || log_failure_msg
|
|
|
|
|
|
|
|
|
|
# Remove fsck-related file system watermarks.
|
|
|
|
|
rm -f /fastboot /forcefsck
|
|
|
|
|
if [ -f /fastboot ]; then
|
|
|
|
|
log_init_msg "Clearing /fastboot"
|
|
|
|
|
rm /fastboot && log_success_msg || log_failure_msg
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
# Make sure /dev/pts exists
|
|
|
|
|
# mkdir -p /dev/pts
|
|
|
|
|
if [ -f /forcefsck ]; then
|
|
|
|
|
log_init_msg "Clearing /forcefsk"
|
|
|
|
|
rm /forcefsck && log_success_msg || log_failure_msg
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
# This will mount all filesystems that do not have _netdev in
|
|
|
|
|
# their option list. _netdev denotes a network filesystem.
|
|
|
|
|
if [ -x /sbin/zpool ]; then
|
|
|
|
|
if zpool list rpool 2>&1 > /dev/null; then
|
|
|
|
|
log_init_msg "Mounting ZFS file systems"
|
|
|
|
|
zfs mount -a && log_success_msg || log_failure_msg
|
|
|
|
|
fi
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
log_init_msg "Mounting remaining file systems"
|
|
|
|
|
mount -a -O no_netdev >/dev/null && log_success_msg || log_failure_msg
|
|
|
|
|
exit $failed
|
|
|
|
|
;;
|
|
|
|
|
log_init_msg "Mounting remaining file systems"
|
|
|
|
|
mount -a -O no_netdev >/dev/null && log_success_msg || log_failure_msg
|
|
|
|
|
;;
|
|
|
|
|
stop)
|
|
|
|
|
# Don't unmount virtual file systems like /run
|
|
|
|
|
log_init_msg "Unmounting all file systems"
|
|
|
|
|
umount -a -d -r -t notmpfs,nosysfs,nodevtmpfs,noproc,nodevpts >/dev/null && \
|
|
|
|
|
log_success_msg || log_failure_msg
|
|
|
|
|
log_init_msg "Unmounting all file systems"
|
|
|
|
|
umount -a -d -r -t notmpfs,nosysfs,nodevtmpfs,noproc,nodevpts \
|
|
|
|
|
>/dev/null && log_success_msg || log_failure_msg
|
|
|
|
|
|
|
|
|
|
# Make sure / is mounted read only (umount bug)
|
|
|
|
|
mount -o remount,ro /
|
|
|
|
|
if [ -x /sbin/zpool ]; then
|
|
|
|
|
if zpool list rpool 2>&1 > /dev/null; then
|
|
|
|
|
log_init_msg "Unmounting ZFS file systems"
|
|
|
|
|
zfs umount -a && log_success_msg || log_failure_msg
|
|
|
|
|
fi
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
# Make all LVM volume groups unavailable, if appropriate
|
|
|
|
|
# This fails if swap or / are on an LVM partition
|
|
|
|
|
#if [ -x /sbin/vgchange ]; then /sbin/vgchange -an > /dev/null; fi
|
|
|
|
|
;;
|
|
|
|
|
mount -o remount,ro /
|
|
|
|
|
;;
|
|
|
|
|
*)
|
|
|
|
|
echo "Usage: $0 [start|stop]"
|
|
|
|
|
exit 1
|
|
|
|
|
;;
|
|
|
|
|
echo "Usage: $0 [start|stop]"
|
|
|
|
|
exit 1
|
|
|
|
|
;;
|
|
|
|
|
esac
|
|
|
|
|
|
|
|
|
|
exit 0
|
|
|
|
|
|