From 4c80170111122e5f1e85caa09aadfb2f6d2c1afb Mon Sep 17 00:00:00 2001 From: Ben Gras Date: Tue, 3 May 2005 08:56:01 +0000 Subject: [PATCH] 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. --- etc/Makefile | 10 +++++----- etc/hostname.file | 2 +- etc/rc | 27 ++++++++++++++++++++++----- etc/usr/daily | 2 +- 4 files changed, 29 insertions(+), 12 deletions(-) diff --git a/etc/Makefile b/etc/Makefile index 0827df0c0..b0c62d4c7 100644 --- a/etc/Makefile +++ b/etc/Makefile @@ -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 - ) diff --git a/etc/hostname.file b/etc/hostname.file index eaa95e7d0..aa6ca5db6 100755 --- a/etc/hostname.file +++ b/etc/hostname.file @@ -1 +1 @@ -noname +minix diff --git a/etc/rc b/etc/rc index 4c4f8c927..83a943172 100755 --- a/etc/rc +++ b/etc/rc @@ -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. diff --git a/etc/usr/daily b/etc/usr/daily index b0e80e23b..225f7a1db 100755 --- a/etc/usr/daily +++ b/etc/usr/daily @@ -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 -- 2.44.0