From 9748a6536efa12a6792baafc0076992480043041 Mon Sep 17 00:00:00 2001 From: Ben Gras Date: Tue, 3 May 2005 15:41:02 +0000 Subject: [PATCH] Fixed an mtree bugs that caused permissions and ownerships for / to be wrong. Made the install process quieter when install already done. rc and daily now is more readonly-/usr aware (for cd). --- etc/Makefile | 14 ++++++++------ etc/mtree.sh | 2 +- etc/rc | 4 ++-- etc/usr/daily | 7 ++++++- etc/usr/rc | 7 ++++++- 5 files changed, 23 insertions(+), 11 deletions(-) diff --git a/etc/Makefile b/etc/Makefile index b0c62d4c7..40121d92f 100644 --- a/etc/Makefile +++ b/etc/Makefile @@ -12,10 +12,12 @@ 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); 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 $(FILES1); do if [ -f $(ETC)/$$f ]; then :; else cp $$f $(ETC)/$$f; chmod 755 $(ETC)/$$f; fi; done + @for f in $(FILES2); do if [ -f $(ETC)/$$f ]; then :; else cp $$f $(ETC)/$$f; chmod 600 $(ETC)/$$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 - ) + sh mtree.sh mtree/minix.tree + @for f in $(FILES3); do if [ -f $(USRETC)/$$f ]; then :; else cp usr/$$f $(USRETC); chmod 755 $(USRETC)/$$f; fi; done + @echo "Making devices.." + cd /dev && sh /usr/src/commands/scripts/MAKEDEV.sh std 2>/dev/null + @echo "Making user homedirs.." + for u in bin ast; do (cd ast && tar cf - .[a-z]* ) | (cd ~$u && tar xf - ); done diff --git a/etc/mtree.sh b/etc/mtree.sh index 786b2b503..cdc9df951 100755 --- a/etc/mtree.sh +++ b/etc/mtree.sh @@ -1,4 +1,4 @@ #!/bin/sh cat $1 | while read line -do awk '{ print "mkdir -p "$4" || exit 1; chmod "$1" "$4" || exit 1; chown "$2" "$4" || exit 1; chgrp "$3" "$4" || exit 1" }' | sh || exit 1 +do echo $line | awk '{ print "mkdir -p "$4" || exit 1; chmod "$1" "$4" || exit 1; chown "$2" "$4" || exit 1; chgrp "$3" "$4" || exit 1" }' | sh || exit 1 done diff --git a/etc/rc b/etc/rc index 83a943172..b3c5e56f2 100755 --- a/etc/rc +++ b/etc/rc @@ -52,7 +52,6 @@ start) # 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 @@ -60,8 +59,9 @@ start) # where it is. if [ "$bootcd" = 1 ] then + ramname="`/bin/sysenv ramimagedev_n`" usr_roflag="-r" - usr="/dev/${ramname}p2" + usr="/dev/c0`echo $ramname | sed 's/.*\(d.\).*/\1/'`p2" echo "Setting /usr to mount readonly from cd: $ramname -> $usr" fi diff --git a/etc/usr/daily b/etc/usr/daily index 225f7a1db..6552aa535 100755 --- a/etc/usr/daily +++ b/etc/usr/daily @@ -2,6 +2,11 @@ # # daily - daily cleanup of the system. +# Doesn't make sense when running from CD +if [ -f /CD ] +then exit +fi + case "$#:$1" in 1:cron|1:boot) caller=$1 @@ -20,7 +25,7 @@ then set -- `ls -lT $timestamp` test "$6 $7 $9" = "$(date '+%b %d %Y')" && exit fi ->$timestamp 2>/dev/null # Makes for errors when booting from CD +>$timestamp # Remove three day old files from various tmp dirs. cleantmp -3 /tmp /usr/tmp /usr/preserve /usr/spool/lpd /usr/spool/at/past diff --git a/etc/usr/rc b/etc/usr/rc index d7e0a6c39..097f8f30e 100644 --- a/etc/usr/rc +++ b/etc/usr/rc @@ -45,7 +45,12 @@ start) echo -n "Starting daemons:" daemonize update - daemonize cron + + # Ugly error message when starting cron from CD. + # (and cron unnecessary then so..) + if [ ! -f /CD ] + then daemonize cron + fi if [ "$net" ] then -- 2.44.0