/sbin/rc has hardcoded options for mounting /proc, /sys, /dev and /dev/pts. For mount options it should consult fstab, or the parameters in "/etc/conf.d/rc". I think listing the above filesystems in fstab would be the most flexible solution, and could also eliminate $RC_DEVICE_FS.
true ... might be best to come up with a kind of wrapper that'll check /etc/fstab and if the mount point isnt found, use the default hardcoded options ...
How about mount -n /proc 2>&1 >/dev/null || try mount -n -t proc none /proc and mount -n /sys 2>&1 >/dev/null || mount -n -t sysfs none /sys and so on? I see only one drawback of the above: the user gets no warning if his fstab entry is syntactically incorrect.
ok, added a 'is_in_fstab()' function and updated /sbin/rc to use it ... users can now override /proc /sys /dev /dev/pts ... the only one left would probably be ${svcdir}, but that's a *bit* more complicated so i'll ignore it for now :)
baselayout just arrived. I've noticed that 'is_in_fstab()' doesn't ingore comment lines in fstab.
Created attachment 45370 [details, diff] fix It is a fix to make 'is_in_fstab()' ignore comments. I've also changed the regexp match with a simple string comparison.
Created attachment 45575 [details, diff] get-mount.patch try this please
Good idea. Also I was thinking about the impact of bad fstab files with multiple references to the same mountpoint. How about an extra "exit" like this: awk '$1 ~ "^#" { next } $2 == "'$*'" { print "-t "$3,"-o "$4,$1,$2; exit }' /etc/fstab
i thought of that too but i dont want to just ignore it ... perhaps we could print some errors ... that way boot would still work fine but we'd annoy the user enough to fix their fstab :)
On the other hand. Do we really need to put all this into functions.sh and rc? I mean get_mount_fstab will be called 4 times that is 4 forks to "awk" and 4 times going through the very same fstab file.
My opinion is now that functions.sh will never correctly handle fstab without some complicated code. I've started to rewrite get_mount_fstab() to pure bash code with caching fstab in a shell array. But I've just realized that we should correctly handle LABEL's, UUID's, "\040" to represent the space character in paths. Not to mention error handling. What are the arguments against the solution in comment #2?
updated stable rc-scripts we already have a few pure-bash implementations for parsing /etc/fstab, but we're going to use that in the next baselayout series rather than screw with our versions to be stable