mainstream-format fstab format
. detect both formats in /etc/rc . generate new format in setup . obsoletes /etc/fstab.local: everything can go in /etc/fstab . put shutdown/reboot/halt and a copy of /usr/adm/wtmp (/etc/wtmp) on root FS so that we can do shutdown checks before mounting /usr . new fstab format makes getfsent() and friends work
This commit is contained in:
parent
4311136125
commit
cedeabb357
21 changed files with 200 additions and 182 deletions
|
@ -28,7 +28,7 @@ SUBDIR= aal add_route adduser arp ash at autil awk \
|
||||||
sleep slip sort spell split srccrc ackstrip \
|
sleep slip sort spell split srccrc ackstrip \
|
||||||
stty su sum svclog swifi sync synctree sysenv \
|
stty su sum svclog swifi sync synctree sysenv \
|
||||||
syslogd tail tar tcpd tcpdp tcpstat tee telnet \
|
syslogd tail tar tcpd tcpdp tcpstat tee telnet \
|
||||||
telnetd term termcap tget time tinyhalt touch tr \
|
telnetd term termcap tget time touch tr \
|
||||||
truncate tsort tty udpstat umount uname unexpand \
|
truncate tsort tty udpstat umount uname unexpand \
|
||||||
unstack update uud uue version vol wc \
|
unstack update uud uue version vol wc \
|
||||||
whereis which who write writeisofs fetch \
|
whereis which who write writeisofs fetch \
|
||||||
|
|
|
@ -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 'y':
|
||||||
case 'p':
|
case 'p':
|
||||||
case 'a': automatic ^= 1; break;
|
case 'a': automatic ^= 1; break;
|
||||||
case 'c':
|
case 'c':
|
||||||
|
@ -1571,6 +1572,7 @@ char **argv;
|
||||||
case 'r': repair ^= 1; break;
|
case 'r': repair ^= 1; break;
|
||||||
case 'l': listing ^= 1; break;
|
case 'l': listing ^= 1; break;
|
||||||
case 's': listsuper ^= 1; break;
|
case 's': listsuper ^= 1; break;
|
||||||
|
case 'f': break;
|
||||||
default:
|
default:
|
||||||
printf("%s: unknown flag '%s'\n", prog, arg);
|
printf("%s: unknown flag '%s'\n", prog, arg);
|
||||||
}
|
}
|
||||||
|
@ -1582,7 +1584,7 @@ char **argv;
|
||||||
devgiven = 1;
|
devgiven = 1;
|
||||||
}
|
}
|
||||||
if (!devgiven) {
|
if (!devgiven) {
|
||||||
printf("Usage: fsck [-pacilrsz] file\n");
|
printf("Usage: fsck [-yfpacilrsz] file\n");
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
return(0);
|
return(0);
|
||||||
|
|
|
@ -3,8 +3,12 @@
|
||||||
PROGS= shutdown halt
|
PROGS= shutdown halt
|
||||||
SRCS.shutdown= shutdown.c sh_wall.c log.c
|
SRCS.shutdown= shutdown.c sh_wall.c log.c
|
||||||
SRCS.halt= halt.c log.c
|
SRCS.halt= halt.c log.c
|
||||||
|
BINDIR=/bin
|
||||||
BINMODE= 4754
|
BINMODE= 4754
|
||||||
LINKS+= ${BINDIR}/halt ${BINDIR}/reboot
|
SYMLINKS+= ${BINDIR}/halt ${BINDIR}/reboot
|
||||||
|
SYMLINKS+= ${BINDIR}/halt /usr/bin/halt
|
||||||
|
SYMLINKS+= ${BINDIR}/shutdown /usr/bin/shutdown
|
||||||
|
SYMLINKS+= ${BINDIR}/reboot /usr/bin/reboot
|
||||||
MAN.shutdown=
|
MAN.shutdown=
|
||||||
MAN.halt=
|
MAN.halt=
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,9 @@
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <sys/wait.h>
|
#include <sys/wait.h>
|
||||||
|
|
||||||
void write_log _ARGS(( void ));
|
#include "wtmp.h"
|
||||||
|
|
||||||
|
void write_log _ARGS(( char *fn ));
|
||||||
void usage _ARGS(( void ));
|
void usage _ARGS(( void ));
|
||||||
int main _ARGS(( int argc, char *argv[] ));
|
int main _ARGS(( int argc, char *argv[] ));
|
||||||
|
|
||||||
|
@ -127,7 +129,8 @@ char **argv;
|
||||||
kill(-1, SIGTERM);
|
kill(-1, SIGTERM);
|
||||||
sleep(1);
|
sleep(1);
|
||||||
|
|
||||||
write_log();
|
write_log(STR_WTMP);
|
||||||
|
write_log(STR_ROOT_WTMP);
|
||||||
|
|
||||||
sync();
|
sync();
|
||||||
|
|
||||||
|
|
|
@ -19,9 +19,7 @@
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <sys/utsname.h>
|
#include <sys/utsname.h>
|
||||||
#undef WTMP
|
|
||||||
|
|
||||||
static char WTMP[] = "/usr/adm/wtmp"; /* Record of logins and logouts. */
|
|
||||||
static char SHUT_LOG[] = "/usr/adm/log";
|
static char SHUT_LOG[] = "/usr/adm/log";
|
||||||
|
|
||||||
char who[8];
|
char who[8];
|
||||||
|
@ -29,9 +27,7 @@ extern char *prog;
|
||||||
static char *month[] = { "Jan", "Feb", "Mar", "Apr", "May", "Jun",
|
static char *month[] = { "Jan", "Feb", "Mar", "Apr", "May", "Jun",
|
||||||
"Jul", "Aug", "Sep", "Oct", "Nov", "Dec"};
|
"Jul", "Aug", "Sep", "Oct", "Nov", "Dec"};
|
||||||
|
|
||||||
void write_log _ARGS(( void ));
|
void write_log(char *wtmpfile)
|
||||||
|
|
||||||
void write_log()
|
|
||||||
{
|
{
|
||||||
int fd;
|
int fd;
|
||||||
static struct utmp wtmp;
|
static struct utmp wtmp;
|
||||||
|
@ -52,7 +48,7 @@ void write_log()
|
||||||
strcpy (who,"root");
|
strcpy (who,"root");
|
||||||
else
|
else
|
||||||
strcpy (who,pwd->pw_name);
|
strcpy (who,pwd->pw_name);
|
||||||
fd = open(WTMP,O_APPEND|O_WRONLY,1);
|
fd = open(wtmpfile,O_APPEND|O_WRONLY|O_CREAT,1);
|
||||||
if (fd) {
|
if (fd) {
|
||||||
if (strcmp(prog,"reboot"))
|
if (strcmp(prog,"reboot"))
|
||||||
#ifdef __NBSD_LIBC
|
#ifdef __NBSD_LIBC
|
||||||
|
|
|
@ -36,9 +36,9 @@
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <utmp.h>
|
#include <utmp.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#undef WTMP
|
|
||||||
|
|
||||||
static char WTMP[] = "/usr/adm/wtmp";
|
#include "wtmp.h"
|
||||||
|
|
||||||
static char SHUT_PID[] = "/usr/run/shutdown.pid";
|
static char SHUT_PID[] = "/usr/run/shutdown.pid";
|
||||||
static char NOLOGIN[] = "/etc/nologin";
|
static char NOLOGIN[] = "/etc/nologin";
|
||||||
|
|
||||||
|
@ -387,11 +387,15 @@ void write_pid()
|
||||||
int crash_check()
|
int crash_check()
|
||||||
{
|
{
|
||||||
struct utmp last;
|
struct utmp last;
|
||||||
int fd, crashed;
|
int fd = -1, crashed;
|
||||||
struct stat st;
|
struct stat st;
|
||||||
|
|
||||||
if (stat(WTMP, &st) < 0 || st.st_size == 0) return 0;
|
if (stat(STR_ROOT_WTMP, &st) < 0 || st.st_size == 0) {
|
||||||
if ((fd = open(WTMP, O_RDONLY)) < 0) return 0;
|
if (stat(STR_WTMP, &st) < 0 || st.st_size == 0) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
if ((fd = open(STR_WTMP, O_RDONLY)) < 0) return 0;
|
||||||
|
} else if ((fd = open(STR_ROOT_WTMP, O_RDONLY)) < 0) return 0;
|
||||||
|
|
||||||
crashed = (lseek(fd, - (off_t) sizeof(last), SEEK_END) == -1
|
crashed = (lseek(fd, - (off_t) sizeof(last), SEEK_END) == -1
|
||||||
|| read(fd, (void *) &last, sizeof(last)) != sizeof(last)
|
|| read(fd, (void *) &last, sizeof(last)) != sizeof(last)
|
||||||
|
|
3
commands/reboot/wtmp.h
Normal file
3
commands/reboot/wtmp.h
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
|
||||||
|
static char STR_WTMP[] = "/usr/adm/wtmp";
|
||||||
|
static char STR_ROOT_WTMP[] = "/etc/wtmp";
|
|
@ -469,7 +469,7 @@ mkfs.mfs -B $blocksizebytes /dev/$usr || exit
|
||||||
|
|
||||||
if [ "$nohome" = 0 ]
|
if [ "$nohome" = 0 ]
|
||||||
then
|
then
|
||||||
fshome="home=/dev/$home"
|
fshome="/dev/$home /home mfs rw 0 2"
|
||||||
else fshome=""
|
else fshome=""
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -503,11 +503,8 @@ ln -s /usr/log /mnt/var/log
|
||||||
|
|
||||||
# CD remnants that aren't for the installed system
|
# CD remnants that aren't for the installed system
|
||||||
rm /mnt/etc/issue /mnt/CD /mnt/.* 2>/dev/null
|
rm /mnt/etc/issue /mnt/CD /mnt/.* 2>/dev/null
|
||||||
echo >/mnt/etc/fstab "\
|
echo >/mnt/etc/fstab "/dev/$root / mfs rw 0 1
|
||||||
# Poor man's File System Table.
|
/dev/$usr /usr mfs rw 0 2
|
||||||
|
|
||||||
root=/dev/$root
|
|
||||||
usr=/dev/$usr
|
|
||||||
$fshome"
|
$fshome"
|
||||||
|
|
||||||
# National keyboard map.
|
# National keyboard map.
|
||||||
|
|
|
@ -1,12 +0,0 @@
|
||||||
# Makefile for tinyhalt
|
|
||||||
|
|
||||||
.include <bsd.own.mk>
|
|
||||||
|
|
||||||
PROG= halt
|
|
||||||
SRCS= tinyhalt.c
|
|
||||||
BINDIR= /bin
|
|
||||||
BINMODE= 744
|
|
||||||
LINKS+= ${BINDIR}/halt ${BINDIR}/reboot
|
|
||||||
MAN=
|
|
||||||
|
|
||||||
.include <bsd.prog.mk>
|
|
|
@ -1 +0,0 @@
|
||||||
See commands/reboot/README for more info.
|
|
|
@ -1,42 +0,0 @@
|
||||||
/* tinyhalt 1.0 - small forerunner Author: Kees J. Bot
|
|
||||||
*
|
|
||||||
* Disk space on the root file system is a scarce resource. This little
|
|
||||||
* program sits in /sbin. It normally calls the real halt/reboot, but if
|
|
||||||
* that isn't available then it simply calls reboot(). Can't do any logging
|
|
||||||
* of the event anyhow.
|
|
||||||
*/
|
|
||||||
#define nil 0
|
|
||||||
#include <sys/types.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <string.h>
|
|
||||||
#include <fcntl.h>
|
|
||||||
#include <unistd.h>
|
|
||||||
#include <signal.h>
|
|
||||||
|
|
||||||
int main(int argc, char **argv)
|
|
||||||
{
|
|
||||||
char *prog;
|
|
||||||
char *reboot_code = "delay; boot";
|
|
||||||
|
|
||||||
/* Try to run the real McCoy. */
|
|
||||||
#if __minix_vmd
|
|
||||||
execv("/usr/sbin/halt", argv);
|
|
||||||
#else
|
|
||||||
execv("/usr/bin/halt", argv);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if ((prog = strrchr(*argv,'/')) == nil) prog= argv[0]; else prog++;
|
|
||||||
|
|
||||||
sleep(1); /* Not too fast. */
|
|
||||||
signal(SIGHUP, SIG_IGN);
|
|
||||||
signal(SIGTERM, SIG_IGN);
|
|
||||||
kill(1, SIGTERM);
|
|
||||||
kill(-1, SIGTERM);
|
|
||||||
sleep(1);
|
|
||||||
|
|
||||||
reboot(strcmp(prog, "reboot") == 0 ? RBT_MONITOR : RBT_HALT,
|
|
||||||
reboot_code, strlen(reboot_code));
|
|
||||||
|
|
||||||
write(2, "reboot call failed\n", 19);
|
|
||||||
return 1;
|
|
||||||
}
|
|
|
@ -1,3 +1,13 @@
|
||||||
|
20111109:
|
||||||
|
fstab format change. /etc/rc reads both formats for a while.
|
||||||
|
Please convert your /etc/fstab to the new format though as
|
||||||
|
the system will assume the new format in the future.
|
||||||
|
|
||||||
|
A helper script is in etc/. Example:
|
||||||
|
# sh etc/newfstab.sh /etc/fstab >newfstab
|
||||||
|
(Don't redirect to /etc/fstab directly as the shell will
|
||||||
|
truncate it before it can be read.)
|
||||||
|
|
||||||
20110928:
|
20110928:
|
||||||
Update your /usr/etc/daily and /etc/man.conf if you
|
Update your /usr/etc/daily and /etc/man.conf if you
|
||||||
want to fully enjoy the manpage fixes.
|
want to fully enjoy the manpage fixes.
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
ETC=/etc/
|
ETC=/etc/
|
||||||
USR=/usr/
|
USR=/usr/
|
||||||
USRETC=/usr/etc/
|
USRETC=/usr/etc/
|
||||||
FILES1=fstab group hostname.file inet.conf motd.install mtab passwd profile \
|
FILES1=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 fstab.local
|
rc.subr rc.subr.minix man.conf
|
||||||
|
|
||||||
FILES2=shadow
|
FILES2=shadow
|
||||||
FILES3=daily dhcptags.conf rc
|
FILES3=daily dhcptags.conf rc
|
||||||
|
|
|
@ -1,4 +0,0 @@
|
||||||
# Poor man's File System Table.
|
|
||||||
|
|
||||||
root=/dev/ROOT
|
|
||||||
usr=/dev/USR
|
|
|
@ -1,3 +0,0 @@
|
||||||
# Device Mountpoint FStype
|
|
||||||
# Example:
|
|
||||||
# /dev/ram /mnt mfs
|
|
22
etc/newfstab.sh
Normal file
22
etc/newfstab.sh
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
if [ $# -ne 1 ]
|
||||||
|
then echo "Usage: $0 <minix-style-fstab> >newfstab"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
fstab="$1"
|
||||||
|
. $fstab
|
||||||
|
|
||||||
|
if [ -z "$usr" -o -z "$root" ]
|
||||||
|
then echo "\$root and \$usr not set in $fstab"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "$root / mfs rw 0 2"
|
||||||
|
echo "$usr /usr mfs rw 0 1"
|
||||||
|
if [ -n "$home" ]
|
||||||
|
then echo "$home /home mfs rw 0 1"
|
||||||
|
fi
|
118
etc/rc
118
etc/rc
|
@ -1,10 +1,13 @@
|
||||||
# /etc/rc - System startup script run by init before going multiuser.
|
# /etc/rc - System startup script run by init before going multiuser.
|
||||||
|
|
||||||
|
. /etc/rc.subr.minix
|
||||||
|
|
||||||
exec >/dev/log
|
exec >/dev/log
|
||||||
exec 2>/dev/log
|
exec 2>/dev/log
|
||||||
exec </dev/null
|
exec </dev/null
|
||||||
|
|
||||||
umask 022
|
umask 022
|
||||||
|
FSTAB=/etc/fstab
|
||||||
TERM="${TERM-minix}"
|
TERM="${TERM-minix}"
|
||||||
PATH=/usr/local/bin:/bin:/usr/bin:/usr/sbin:/usr/pkg/bin:/usr/pkg/sbin:/sbin
|
PATH=/usr/local/bin:/bin:/usr/bin:/usr/sbin:/usr/pkg/bin:/usr/pkg/sbin:/sbin
|
||||||
RC_TZ=/etc/rc.timezone
|
RC_TZ=/etc/rc.timezone
|
||||||
|
@ -46,7 +49,42 @@ edit()
|
||||||
shift
|
shift
|
||||||
|
|
||||||
# Assume binaries are always in /usr/sbin
|
# Assume binaries are always in /usr/sbin
|
||||||
service $opt edit /usr/sbin/$service -label $service "$@"
|
service $opt edit /usr/sbin/$service -label $service "$@"
|
||||||
|
}
|
||||||
|
|
||||||
|
# This function parses the deprecated minix shellscript-style
|
||||||
|
# /etc/fstab, and fscks and mounts its filesystems.
|
||||||
|
mountfstab_poorman()
|
||||||
|
{
|
||||||
|
# /etc/fstab lists the root, tmp and usr devices.
|
||||||
|
. $FSTAB
|
||||||
|
|
||||||
|
# Check if the system crashed.
|
||||||
|
if shutdown -C
|
||||||
|
then
|
||||||
|
echo
|
||||||
|
echo "The system was not properly shut down. Checking file systems."
|
||||||
|
fflag=-f
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -n "$fflag" ]
|
||||||
|
then
|
||||||
|
echo "fsck.mfs / - $root"
|
||||||
|
intr fsck.mfs $fsckopts $root
|
||||||
|
echo "fsck.mfs /usr - $usr"
|
||||||
|
intr fsck.mfs $fsckopts $usr
|
||||||
|
if [ ! -z "$home" ]
|
||||||
|
then echo "fsck.mfs /home - $home"
|
||||||
|
intr fsck.mfs $fsckopts $home
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# mount /usr
|
||||||
|
mount $bin_img $usr /usr
|
||||||
|
|
||||||
|
if [ ! -z "$home" ]
|
||||||
|
then mount $bin_img $home /home || echo "WARNING: couldn't mount $home on /home"
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
while getopts 'saf' opt
|
while getopts 'saf' opt
|
||||||
|
@ -54,7 +92,7 @@ do
|
||||||
case $opt in
|
case $opt in
|
||||||
s) sflag=t ;; # Single user
|
s) sflag=t ;; # Single user
|
||||||
a) aflag=t ;; # Ask for /usr
|
a) aflag=t ;; # Ask for /usr
|
||||||
f) fflag=t ;; # Force a full file system check
|
f) fflag=-f ;; # Force a full file system check
|
||||||
*) usage
|
*) usage
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
@ -99,9 +137,6 @@ start)
|
||||||
printroot >/etc/mtab # /etc/mtab keeps track of mounts
|
printroot >/etc/mtab # /etc/mtab keeps track of mounts
|
||||||
>/etc/utmp # /etc/utmp keeps track of logins
|
>/etc/utmp # /etc/utmp keeps track of logins
|
||||||
|
|
||||||
# /etc/fstab lists the root, tmp and usr devices.
|
|
||||||
. /etc/fstab
|
|
||||||
|
|
||||||
# Unmount now defunct ramdisk
|
# Unmount now defunct ramdisk
|
||||||
umount /dev/imgrd > /dev/null || echo "Failed to unmount boot ramdisk"
|
umount /dev/imgrd > /dev/null || echo "Failed to unmount boot ramdisk"
|
||||||
|
|
||||||
|
@ -114,62 +149,19 @@ start)
|
||||||
# Are we booting from CD?
|
# Are we booting from CD?
|
||||||
bootcd="`/bin/sysenv bootcd`"
|
bootcd="`/bin/sysenv bootcd`"
|
||||||
|
|
||||||
# If booting from CD, /usr has to be mounted readonly.
|
# If booting from CD, mounting is a special case.
|
||||||
# Also, $usr won't be specified correctly in the
|
# We know what to do - only /usr is mounted and it's readonly.
|
||||||
# fstab (the CD could be anywhere), so we decide
|
|
||||||
# where it is based on sysenv (set by FS when probing for CD).
|
|
||||||
if [ "$bootcd" = 1 ]
|
if [ "$bootcd" = 1 ]
|
||||||
then
|
then usrdev="$cddev"p2
|
||||||
#imagedev="`/bin/sysenv cdproberoot`"
|
echo "/usr on cd is $usrdev"
|
||||||
#usrdev="`expr $imagedev + 1`"
|
mount -r $usrdev /usr
|
||||||
usr_roflag="-r"
|
else
|
||||||
usr="$cddev"p2
|
# If we're not booting from CD, fsck + mount using /etc/fstab.
|
||||||
echo "Setting /usr on cd is $usr"
|
read <$FSTAB fstabline
|
||||||
fi
|
if [ "$fstabline" = "# Poor man's File System Table." ]
|
||||||
|
then mountfstab_poorman # Old minix /etc/fstab
|
||||||
|
else mountfstab $fflag -o"$fsckopts" $FSTAB
|
||||||
# Mount the /usr partition unless this is a single floppy Minix.
|
fi
|
||||||
if [ ! -d /usr/bin ]
|
|
||||||
then
|
|
||||||
if [ "$aflag" -o "$usr" = unknown ]
|
|
||||||
then
|
|
||||||
# We need to ask what the /usr du jour is.
|
|
||||||
intr sh -c '
|
|
||||||
echo -n "Finish the name of device to mount as /usr: /dev/"
|
|
||||||
read usr
|
|
||||||
echo "usr=/dev/$usr" >/tmp/usr'
|
|
||||||
. /tmp/usr
|
|
||||||
fi
|
|
||||||
|
|
||||||
mount $bin_img $usr_roflag $usr /usr || {
|
|
||||||
echo "\
|
|
||||||
Please try to mount something else as /usr, then hit CTRL-D to continue startup.
|
|
||||||
Mount $usr /usr failed -- Single user."
|
|
||||||
intr sh
|
|
||||||
}
|
|
||||||
rm -f /tmp/usr
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Check if the system crashed.
|
|
||||||
if shutdown -C
|
|
||||||
then
|
|
||||||
echo
|
|
||||||
echo "The system was not properly shut down. Checking file systems."
|
|
||||||
fflag=t
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ "$fflag" ]
|
|
||||||
then
|
|
||||||
umount $usr
|
|
||||||
echo "fsck.mfs / - $root"
|
|
||||||
intr fsck.mfs $fsckopts $root
|
|
||||||
echo "fsck.mfs /usr - $usr"
|
|
||||||
intr fsck.mfs $fsckopts $usr
|
|
||||||
if [ ! -z "$home" ]
|
|
||||||
then echo "fsck.mfs /home - $home"
|
|
||||||
intr fsck.mfs $fsckopts $home
|
|
||||||
fi
|
|
||||||
mount $bin_img $usr /usr
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Edit settings for boot system services
|
# Edit settings for boot system services
|
||||||
|
@ -188,13 +180,9 @@ Mount $usr /usr failed -- Single user."
|
||||||
edit init
|
edit init
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ ! -z "$home" ]
|
|
||||||
then mount $bin_img $home /home || echo "WARNING: couldn't mount $home on /home"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# This file is necessary for above 'shutdown -C' check.
|
# This file is necessary for above 'shutdown -C' check.
|
||||||
# (Silence stderr in case of running from cd.)
|
# (Silence stderr in case of running from cd.)
|
||||||
touch /usr/adm/wtmp 2>/dev/null
|
touch /usr/adm/wtmp /etc/wtmp 2>/dev/null
|
||||||
|
|
||||||
if [ "$sflag" ]
|
if [ "$sflag" ]
|
||||||
then
|
then
|
||||||
|
|
68
etc/rc.subr.minix
Executable file
68
etc/rc.subr.minix
Executable file
|
@ -0,0 +1,68 @@
|
||||||
|
|
||||||
|
mountfstab()
|
||||||
|
{
|
||||||
|
fsck_opts=""
|
||||||
|
fflag=""
|
||||||
|
|
||||||
|
while getopts "fo:" opt
|
||||||
|
do case $opt
|
||||||
|
in f) fflag="-f"
|
||||||
|
;;
|
||||||
|
o) fsck_opts="$OPTARG"
|
||||||
|
;;
|
||||||
|
*) echo "mountfstab: odd"
|
||||||
|
return 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
shift `expr $OPTIND - 1`
|
||||||
|
|
||||||
|
# Make fsck necessary for unclean shutdown
|
||||||
|
msg="The system was not properly shut down. Checking file systems."
|
||||||
|
if shutdown -C
|
||||||
|
then echo "$msg"
|
||||||
|
fflag="-f"
|
||||||
|
fi
|
||||||
|
|
||||||
|
fstabfile="$1"
|
||||||
|
|
||||||
|
if [ ! -f $fstabfile ]
|
||||||
|
then echo "mountfstab: $fstabfile not found"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
cat $fstabfile | sed 's/#.*//' | while read fsline
|
||||||
|
do set "" $fsline
|
||||||
|
shift
|
||||||
|
if [ $# -eq 0 ]; then continue; fi
|
||||||
|
if [ $# -lt 3 ]
|
||||||
|
then echo "$fstabfile: short line"
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
|
||||||
|
# This line's parameters
|
||||||
|
dev="$1"; mp="$2"; fstype="$3"
|
||||||
|
|
||||||
|
# Sanity checks
|
||||||
|
if [ ! -b $dev ]; then echo "$dev missing"; continue; fi
|
||||||
|
if [ ! -d $mp ]; then echo "$mp missing"; continue; fi
|
||||||
|
|
||||||
|
# Do fsck if necessary or requested
|
||||||
|
if [ -n "$fflag" ]
|
||||||
|
then echo "Checking $fstype $dev"
|
||||||
|
if ! fsck.$fstype $fflag $fsck_opts -p $dev
|
||||||
|
then echo "$dev fail"
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Skip the actual mount for /, it's already mounted
|
||||||
|
if [ "$mp" = / ]
|
||||||
|
then continue
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Do actual mount command
|
||||||
|
mount -t $fstype $dev $mp
|
||||||
|
done
|
||||||
|
}
|
25
etc/usr/rc
25
etc/usr/rc
|
@ -2,7 +2,6 @@
|
||||||
|
|
||||||
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,30 +187,6 @@ 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.
|
||||||
|
|
|
@ -17,13 +17,18 @@ case "$#:$1" in
|
||||||
esac
|
esac
|
||||||
|
|
||||||
# Get the device table.
|
# Get the device table.
|
||||||
. /etc/fstab
|
FSTAB=/etc/fstab
|
||||||
|
touch $FSTAB
|
||||||
|
if grep -q "Poor man" $FSTAB
|
||||||
|
then . $FSTAB
|
||||||
|
else root="`awk <$FSTAB '{ if($2=="/") { print $1 } }'`"
|
||||||
|
fi
|
||||||
|
|
||||||
# The real root device may be the RAM disk.
|
# The real root device may be the RAM disk.
|
||||||
realroot=`printroot -r`
|
realroot=`printroot -r`
|
||||||
|
|
||||||
# If it's an initial fstab, pretend root is real root
|
# If it's an initial fstab, pretend root is real root
|
||||||
if [ $root = "/dev/ROOT" ]
|
if [ "$root" = "/dev/ROOT" -o -z "$root" ]
|
||||||
then root=$realroot
|
then root=$realroot
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
|
@ -308,19 +308,22 @@ extrakb=`du -s $RELEASEDIR/usr/install | awk '{ print $1 }'`
|
||||||
find $RELEASEDIR/usr | fgrep -v /install/ | wc -l >$RELEASEDIR/.usrfiles
|
find $RELEASEDIR/usr | fgrep -v /install/ | wc -l >$RELEASEDIR/.usrfiles
|
||||||
find $RELEASEDIR -print -path $RELEASEDIR/usr -prune | wc -l >$RELEASEDIR/.rootfiles
|
find $RELEASEDIR -print -path $RELEASEDIR/usr -prune | wc -l >$RELEASEDIR/.rootfiles
|
||||||
|
|
||||||
|
fstab_marker="# Poor man's File System Table."
|
||||||
echo " * Writing fstab"
|
echo " * Writing fstab"
|
||||||
if [ "$USB" -ne 0 ]
|
if [ "$USB" -ne 0 ]
|
||||||
then
|
then
|
||||||
echo \
|
echo \
|
||||||
'root=/dev/c0d7p0s0
|
"$fstab_marker
|
||||||
|
root=/dev/c0d7p0s0
|
||||||
usr=/dev/c0d7p0s2
|
usr=/dev/c0d7p0s2
|
||||||
' > $RELEASEDIR/etc/fstab
|
" > $RELEASEDIR/etc/fstab
|
||||||
elif [ "$HDEMU" -ne 0 ]
|
elif [ "$HDEMU" -ne 0 ]
|
||||||
then
|
then
|
||||||
echo \
|
echo \
|
||||||
'root=/dev/c0d7p0s0
|
"$fstab_marker
|
||||||
|
root=/dev/c0d7p0s0
|
||||||
usr=/dev/c0d7p0s2
|
usr=/dev/c0d7p0s2
|
||||||
usr_roflag="-r"' > $RELEASEDIR/etc/fstab
|
usr_roflag=\"-r\"" > $RELEASEDIR/etc/fstab
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo " * Mounting $TMPDISKROOT as $RELEASEMNTDIR"
|
echo " * Mounting $TMPDISKROOT as $RELEASEMNTDIR"
|
||||||
|
|
Loading…
Reference in a new issue