stopgap local fstab

. /etc/fstab.local to list user-defined filesystems
	. /usr/etc/rc reads it and runs type-specific fsck if necessary
	. also type-specific mount
This commit is contained in:
Ben Gras 2011-11-03 17:08:37 +01:00
parent 0f3423cd75
commit 3fbb50397c
4 changed files with 30 additions and 2 deletions

View file

@ -1557,6 +1557,7 @@ char **argv;
prog = *argv++;
while ((arg = *argv++) != 0)
if (arg[0] == '-' && arg[1] != 0 && arg[2] == 0) switch (arg[1]) {
case 'p':
case 'a': automatic ^= 1; break;
case 'c':
clist = getlist(&argv, "inode");
@ -1581,7 +1582,7 @@ char **argv;
devgiven = 1;
}
if (!devgiven) {
printf("Usage: fsck [-acilrsz] file\n");
printf("Usage: fsck [-pacilrsz] file\n");
exit(1);
}
return(0);

View file

@ -5,7 +5,7 @@ FILES1=fstab group hostname.file inet.conf motd.install mtab passwd profile \
protocols rc services termcap ttytab utmp rc.cd binary_sizes \
binary_sizes.big binary_sizes.xxl syslog.conf rc.daemons.dist \
rs.inet rs.single make.conf system.conf ttys resolv.conf rc.conf \
rc.subr man.conf
rc.subr man.conf fstab.local
FILES2=shadow
FILES3=daily dhcptags.conf rc

3
etc/fstab.local Normal file
View file

@ -0,0 +1,3 @@
# Device Mountpoint FStype
# Example:
# /dev/ram /mnt mfs

View file

@ -2,6 +2,7 @@
RANDOM_FILE=/usr/adm/random.dat
LOCAL_FILE=/usr/etc/rc.local
LOCAL_FSTAB=/etc/fstab.local
case "$#:$1" in
1:start|1:stop|1:down)
@ -188,6 +189,29 @@ start)
# Run the daily cleanup on systems that are not on at night.
test -f /usr/etc/daily && sh /usr/etc/daily boot &
# Mount non-standard filesystems
[ -f $LOCAL_FSTAB ] && cat $LOCAL_FSTAB | grep -v '^#' | while read fsline
do set $fsline
if [ $# -lt 3 ]; then echo "$LOCAL_FSTAB: short line"; continue; fi
# This line's parameters
dev="$1"; mp="$2"; fstype="$3"
# Sanity checks
if mount | fgrep "$dev"; then echo "$dev mounted."; continue; fi
if [ ! -b $dev ]; then echo "$dev missing"; continue; fi
if [ ! -d $mp ]; then echo "$mp missing"; continue; fi
# Do fsck if necessary
if shutdown -C
then echo "Checking $fstype $dev"
if ! fsck.$fstype -p $dev; then echo "$dev fail"; continue; fi
fi
# Do actual mount command
echo "$fstype $dev on $mp:"
mount -t $fstype $dev $mp
done
;;
stop|down)
# Save random data, if /usr is mounted rw.