Made things a little more boot-cd friendly (specifically readonly /usr).

Also /etc/rc automatically determines where /usr should come from based
on where the ramdisk was copied from.
This commit is contained in:
Ben Gras 2005-05-03 08:56:01 +00:00
parent b49e963b5e
commit 4c80170111
4 changed files with 29 additions and 12 deletions

View File

@ -1,6 +1,6 @@
ETC=/etc
USRETC=/usr/etc
ETC=/etc/
USRETC=/usr/etc/
FILES1=fstab group hostname.file inet.conf motd mtab passwd profile protocols rc services termcap ttytab utmp
FILES2=shadow
FILES3=daily dhcptags.conf rc
@ -12,10 +12,10 @@ clean::
install::
@echo "Installing /etc and /usr/etc.."
mkdir -p $(ETC)
for f in $(FILES1); do if [ -f $(ETC)/$$f ]; then echo $$f exists; else cp $$f $(ETC); fi; done
for f in $(FILES1); do if [ -f $(ETC)/$$f ]; then echo $$f exists; else cp $$f $(ETC); chmod 755 $(ETC)/$$f; fi; done
for f in $(FILES2); do if [ -f $(ETC)/$$f ]; then echo $$f exists; else cp $$f $(ETC); chmod 600 $(ETC)/$$f; fi; done
for f in $(FILES3); do if [ -f $(USRETC)/$$f ]; then echo $$f exists; else cp usr/$$f $(USRETC); chmod 755 $(USRETC)/$$f; fi; done
@echo "Making hierarchy.."
./mtree.sh mtree/minix.tree
for f in $(FILES3); do if [ -f $(USRETC)/$$f ]; then echo $$f exists; else cp usr/$$f $(USRETC); chmod 755 $(USRETC)/$$f; fi; done
cd /dev && /usr/src/commands/scripts/MAKEDEV.sh std
(cd ast && tar cf - . ) | (cd /usr/ast && tar xf - )
(cd ast && tar cf - .* ) | (cd /usr/ast && tar xf - )

View File

@ -1 +1 @@
noname
minix

27
etc/rc
View File

@ -50,6 +50,21 @@ start)
# Any swapspace on a device?
test "$swap" : '/dev/' && mount -s $swap
# Are we booting from CD?
bootcd="`/bin/sysenv bootcd`"
ramname="`/bin/sysenv ramname`"
# If booting from CD, /usr has to be mounted readonly.
# Also, $usr won't be specified correctly in the
# fstab (the CD could be anywhere), so we decide
# where it is.
if [ "$bootcd" = 1 ]
then
usr_roflag="-r"
usr="/dev/${ramname}p2"
echo "Setting /usr to mount readonly from cd: $ramname -> $usr"
fi
# Mount the /usr partition unless this is a single floppy Minix.
if [ ! -d /usr/bin ]
then
@ -62,7 +77,7 @@ start)
echo "usr=/dev/$usr" >/tmp/usr'
. /tmp/usr
fi
mount $usr /usr || {
mount $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."
@ -96,10 +111,12 @@ Mount $usr /usr failed -- Single user."
# Any swapspace on a file?
test -n "$swap" -a ! "$swap" : '/dev/' && mount -s $swap
case "`printroot -r`" in
/dev/ram)
# Remove boot-only things to make space.
rm -rf /boot /minix
case "`printroot -r`":$bootcd in
/dev/ram:)
# Remove boot-only things to make space,
# unless booting from CD, in which case we need them.
rm -rf /boot
esac
# Things should be alright now.

View File

@ -20,7 +20,7 @@ then
set -- `ls -lT $timestamp`
test "$6 $7 $9" = "$(date '+%b %d %Y')" && exit
fi
>$timestamp
>$timestamp 2>/dev/null # Makes for errors when booting from CD
# Remove three day old files from various tmp dirs.
cleantmp -3 /tmp /usr/tmp /usr/preserve /usr/spool/lpd /usr/spool/at/past