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:
		
							parent
							
								
									0f3423cd75
								
							
						
					
					
						commit
						3fbb50397c
					
				| @ -1557,6 +1557,7 @@ char **argv; | |||||||
|   prog = *argv++; |   prog = *argv++; | ||||||
|   while ((arg = *argv++) != 0) |   while ((arg = *argv++) != 0) | ||||||
| 	if (arg[0] == '-' && arg[1] != 0 && arg[2] == 0) switch (arg[1]) { | 	if (arg[0] == '-' && arg[1] != 0 && arg[2] == 0) switch (arg[1]) { | ||||||
|  | 		    case 'p': | ||||||
| 		    case 'a':	automatic ^= 1;	break; | 		    case 'a':	automatic ^= 1;	break; | ||||||
| 		    case 'c': | 		    case 'c': | ||||||
| 			clist = getlist(&argv, "inode"); | 			clist = getlist(&argv, "inode"); | ||||||
| @ -1581,7 +1582,7 @@ char **argv; | |||||||
| 		devgiven = 1; | 		devgiven = 1; | ||||||
| 	} | 	} | ||||||
|   if (!devgiven) { |   if (!devgiven) { | ||||||
| 	printf("Usage: fsck [-acilrsz] file\n"); | 	printf("Usage: fsck [-pacilrsz] file\n"); | ||||||
| 	exit(1); | 	exit(1); | ||||||
|   } |   } | ||||||
|   return(0); |   return(0); | ||||||
|  | |||||||
| @ -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 \
 | 	protocols rc services termcap ttytab utmp rc.cd binary_sizes \
 | ||||||
| 	binary_sizes.big binary_sizes.xxl syslog.conf rc.daemons.dist \
 | 	binary_sizes.big binary_sizes.xxl syslog.conf rc.daemons.dist \
 | ||||||
| 	rs.inet rs.single make.conf system.conf ttys resolv.conf rc.conf \
 | 	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 | FILES2=shadow | ||||||
| FILES3=daily dhcptags.conf rc  | FILES3=daily dhcptags.conf rc  | ||||||
|  | |||||||
							
								
								
									
										3
									
								
								etc/fstab.local
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										3
									
								
								etc/fstab.local
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,3 @@ | |||||||
|  | # Device  Mountpoint  FStype  | ||||||
|  | # Example: | ||||||
|  | # /dev/ram	/mnt	mfs | ||||||
							
								
								
									
										24
									
								
								etc/usr/rc
									
									
									
									
									
								
							
							
						
						
									
										24
									
								
								etc/usr/rc
									
									
									
									
									
								
							| @ -2,6 +2,7 @@ | |||||||
| 
 | 
 | ||||||
| RANDOM_FILE=/usr/adm/random.dat | RANDOM_FILE=/usr/adm/random.dat | ||||||
| LOCAL_FILE=/usr/etc/rc.local | LOCAL_FILE=/usr/etc/rc.local | ||||||
|  | LOCAL_FSTAB=/etc/fstab.local | ||||||
| 
 | 
 | ||||||
| case "$#:$1" in | case "$#:$1" in | ||||||
| 1:start|1:stop|1:down) | 1:start|1:stop|1:down) | ||||||
| @ -188,6 +189,29 @@ start) | |||||||
|     # Run the daily cleanup on systems that are not on at night. |     # Run the daily cleanup on systems that are not on at night. | ||||||
|     test -f /usr/etc/daily && sh /usr/etc/daily boot & |     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) | stop|down) | ||||||
|     	# Save random data, if /usr is mounted rw. |     	# Save random data, if /usr is mounted rw. | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 Ben Gras
						Ben Gras