diff options
author | gordon <gordon@FreeBSD.org> | 2002-06-13 22:14:37 +0000 |
---|---|---|
committer | gordon <gordon@FreeBSD.org> | 2002-06-13 22:14:37 +0000 |
commit | 9c5433cb225f7a4e56e87623ea2e4011179553a5 (patch) | |
tree | 3168589e209abd888b033397e3c46dee6131a116 /etc/rc.d/mountcritremote | |
parent | 50d99cdfecd92f5323a18aa791a5b1cb9d8b7191 (diff) | |
download | FreeBSD-src-9c5433cb225f7a4e56e87623ea2e4011179553a5.zip FreeBSD-src-9c5433cb225f7a4e56e87623ea2e4011179553a5.tar.gz |
Merge in all the changes that Mike Makonnen has been maintaining for a
while. This is only the script pieces, the glue for the build comes next.
Submitted by: Mike Makonnen <makonnen@pacbell.net>
Reviewed by: silence on -current and -hackers
Prodded by: rwatson
Diffstat (limited to 'etc/rc.d/mountcritremote')
-rwxr-xr-x | etc/rc.d/mountcritremote | 82 |
1 files changed, 76 insertions, 6 deletions
diff --git a/etc/rc.d/mountcritremote b/etc/rc.d/mountcritremote index 6479ea1..919fe6d 100755 --- a/etc/rc.d/mountcritremote +++ b/etc/rc.d/mountcritremote @@ -1,19 +1,89 @@ #!/bin/sh # -# $NetBSD: mountcritremote,v 1.2 2000/05/13 08:45:07 lukem Exp $ +# $NetBSD: mountcritremote,v 1.7 2002/04/29 12:29:53 lukem Exp $ +# $FreeBSD$ # # PROVIDE: mountcritremote -# REQUIRE: NETWORK root mountcritlocal +# REQUIRE: NETWORKING root mountcritlocal +# KEYWORD: FreeBSD NetBSD . /etc/rc.subr -# mount critical remote filesystems -# (as specified in $critical_filesystems) -# name="mountcritremote" -start_cmd="mount_critical_filesystems remote" stop_cmd=":" +case `${CMD_OSTYPE}` in + FreeBSD) + start_cmd="mountcritremote_start" + start_precmd="mountcritremote_precmd" + ;; +NetBSD) + start_cmd="mountcritremote_start" + ;; +esac + +# Mount NFS filesystems if present in /etc/fstab +# +# XXX When the vfsload() issues with nfsclient support and related sysctls +# have been resolved, this block can be removed, and the condition that +# skips nfs in the following block (for "other network filesystems") can +# be removed. +# +mountcritremote_precmd() +{ + case "`mount -d -a -t nfs 2> /dev/null`" in + *mount_nfs*) + # Handle absent nfs client support + if ! sysctl vfs.nfs >/dev/null 2>&1 ; then + kldload nfsclient || warn 'nfs mount ' \ + 'requested, but no nfs client in kernel' \ + return 1 + fi + ;; + esac + return 0 +} + +mountcritremote_start() +{ + case `${CMD_OSTYPE}` in + FreeBSD) + # Mount nfs filesystems. + # + echo -n 'Mounting NFS file systems:' + mount -a -t nfs + echo '.' + + # Mount other network filesystems if present in /etc/fstab + for i in ${networkfs_types}; do + fstype=${i%:*} + fsdecr=${i#*:} + + [ "${fstype}" = "nfs" ] && continue + + case "`mount -d -a -t ${fstype}`" in + *mount_${fstype}*) + echo -n "Mounting ${fsdecr} file systems:" + mount -a -t ${fstype} + echo '.' + ;; + esac + done + + # Cleanup /var again just in case it's a network mount + /etc/rc.d/cleanvar start + rm -f /var/run/clean_var /var/spool/lock/clean_var + ;; + NetBSD) + # Mount critical filesystems that may be `remote'. + # (as specified in $critical_filesystems_remote) + # This usually includes /usr. + # + mount_critical_filesystems remote + ;; + esac +} + load_rc_config $name run_rc_command "$1" |