Changeset View
Standalone View
etc/rc.initdiskless
Show First 20 Lines • Show All 189 Lines • ▼ Show 20 Lines | handle_remount() { # $1 = mount point | ||||
log "nfspt ${nfspt} mountopts ${mountopts}" | log "nfspt ${nfspt} mountopts ${mountopts}" | ||||
# prepend the nfs root if not present | # prepend the nfs root if not present | ||||
[ `expr "$nfspt" : '\(.\)'` = "/" ] && nfspt="${nfsroot}${nfspt}" | [ `expr "$nfspt" : '\(.\)'` = "/" ] && nfspt="${nfsroot}${nfspt}" | ||||
mount_nfs $mountopts $nfspt $b | mount_nfs $mountopts $nfspt $b | ||||
chkerr $? "mount_nfs $nfspt $b" | chkerr $? "mount_nfs $nfspt $b" | ||||
to_umount="$b ${to_umount}" | to_umount="$b ${to_umount}" | ||||
} | } | ||||
# Create a generic memory disk (using tmpfs) | # Create a generic memory disk | ||||
# | # | ||||
mount_md() { | mount_md() { | ||||
mount -t tmpfs -o size=$(($1 * 512)) tmpfs $2 | /sbin/mdmfs $flags -s $1 ${mfs_type} $2 | ||||
stevek: Would it not be better to do the following in case someone builds a platform that is not using… | |||||
ianAuthorUnsubmitted Not Done Inline ActionsIf that was a thing to worry about, wouldn't every script in etc/rc.d and rc.subr and others all have the :- logic built in to all the variables they use everywhere? It looks like only a few of the scripts do that now. Technically, /etc/defaults/rc.conf is documented as being required. rc.conf(5) says that /etc/rc.conf is included by /etc/defaults/rc.conf (a clever way to ensure required defaults are in place), but the current implementation doesn't actually do it that way. On the other hand, rc.initdiskless doesn't read rc.conf or defaults, so $mfs_type can't even be used here, it'll have to be hard-coded as auto. ian: If that was a thing to worry about, wouldn't every script in etc/rc.d and rc.subr and others… | |||||
stevekUnsubmitted Not Done Inline ActionsThe rc.d scripts often do have defaults (and should, IMO, if they're written correctly), but it's in entries like the following (from etc/rc.d/sshd): : ${sshd_rsa1_enable:="no"} ...although there could be a valid argument for requiring defaults to be in /etc/defaults/rc.conf and not in the rc.d scripts themselves. It would, at least, make things consistent, instead of what we currently have. stevek: The rc.d scripts often do have defaults (and should, IMO, if they're written correctly), but… | |||||
} | } | ||||
ngieUnsubmitted Done Inline ActionsDon't assume rc.conf has been sourced in this script. Doing so breaks being able to call this script standalone, which someone might be doing already, FYI ngie: Don't assume rc.conf has been sourced in this script. Doing so breaks being able to call this… | |||||
ianAuthorUnsubmitted Not Done Inline ActionsI'm going to commit it with ${mfs_type} changed to "auto", but I'm not going to bother to upload a new diff here first. ian: I'm going to commit it with ${mfs_type} changed to "auto", but I'm not going to bother to… | |||||
# Create the memory filesystem if it has not already been created | # Create the memory filesystem if it has not already been created | ||||
# | # | ||||
create_md() { | create_md() { | ||||
[ "x`eval echo \\$md_created_$1`" = "x" ] || return # only once | [ "x`eval echo \\$md_created_$1`" = "x" ] || return # only once | ||||
if [ "x`eval echo \\$md_size_$1`" = "x" ]; then | if [ "x`eval echo \\$md_size_$1`" = "x" ]; then | ||||
md_size=10240 | md_size=10240 | ||||
else | else | ||||
▲ Show 20 Lines • Show All 171 Lines • Show Last 20 Lines |
Would it not be better to do the following in case someone builds a platform that is not using etc/defaults/rc.conf?
/sbin/mdmfs $flags -s $1 ${mfs_type:-auto} $2