Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 21 Dec 1999 16:51:24 +0100 (CET)
From:      Luigi Rizzo <luigi@info.iet.unipi.it>
To:        MIHIRA Sanpei Yoshiro <sanpei@sanpei.org>
Cc:        freebsd-current@FreeBSD.ORG
Subject:   Re: [diskless] /etc/rc.diskless1 in 3-stable is better than in 4-current
Message-ID:  <199912211551.QAA16496@info.iet.unipi.it>
In-Reply-To: <199912211216.VAA11579@lavender.yy.cs.keio.ac.jp> from MIHIRA Sanpei Yoshiro at "Dec 21, 1999 09:16:39 pm"

next in thread | previous in thread | raw e-mail | index | archive | help
> [/etc/rc.diskless1 was broken]
...
>   From CVS log of src/etc/rc.diskless1, I think someone forgot to
> commit newer and sophisticated code in 4-current and only committed
> in 3-stable by Luigi.

it is not something i forgot --
the problem is, i don't have the resources to run a 4.0 machine,
and so i cannot test these things. As a consequence, i probably
committed the -stable version near to a release (with appropriate
permissions) to fix the problems there, but i could not do the
job for 4.0 due to lack of resources.

>   I think we need to update 4-current:src/etc/rc.diskless1.
>   May I create patch for rc.diskless1?

i suggest that you try and find a committer which can do appropriate
tests.
BTW -- i attach to this msg a small script (/etc/diskless/clone_root,
whatever it should go e.g. /usr/share/example/diskless/) that i
routinely use to create/populate a shared readonly diskless root.
This ought to be committed at some point,maybe with appropriate cleanup.

	cheers
	luigi

-----------------------------------+-------------------------------------
  Luigi RIZZO, luigi@iet.unipi.it  . Dip. di Ing. dell'Informazione
  http://www.iet.unipi.it/~luigi/  . Universita` di Pisa
  TEL/FAX: +39-050-568.533/522     . via Diotisalvi 2, 56126 PISA (Italy)
  Mobile   +39-347-0373137
-----------------------------------+-------------------------------------

#!/bin/sh
#
# clone root filesystem for diskless root stuff
#
# usage
#	clone_root all		to do a full copy (e.g. bin, sbin...)
#	clone_root var		to recreate /var (including devices)
#	clone_root		to repopulate /etc
#	clone_root pwd		to copy pw related files

# Architecture:

# init_diskless_root():
# The shared readonly root $DEST is first initialized with a copy of
# the server's root
# 
# update():
# creates mountpoints and updates stuff in /conf

# VARIABLES:
#	some manual init is needed here.
# DEST	the diskless_root dir (goes into /etc/bootptab and /etc/exports
#	on the server)
DEST=/diskless_root
PRINTERS="lp"

# you should not touch these vars:
# DIRS		mountpoints (empty dirs)

DIRS="c cdrom compat home mnt mnt1 proc usr var sd1 sd1/usr wd0e wd2 wd2/usr"
PWFILES="master.passwd passwd spwd.db pwd.db"

init_diskless_root() {
	echo "Cleaning old diskless root ($DEST)"
	cd /
	rm -rf ${DEST} && echo "Old diskless root removed."
	echo "Creating $DEST..."
	mkdir -p $DEST && echo "New diskless root created."
	echo "Now copy original tree from /..."
	(cd / ; tar clf - . ) | (cd $DEST; tar xvf - )
	(cd / ; find -x dev | cpio -o -H newc ) | \
		(cd $DEST; cpio -i -H newc -d )
}

update() {
	(cd / ; tar clf - conf ) | (cd $DEST; tar xvf - )
	(cd $DEST ; rm -rf tmp var dev )
	(cd $DEST ; mkdir tmp var dev )
	(cd $DEST/dev ; cp /dev/MAKEDEV . )
	(cd $DEST/dev ; /dev/MAKEDEV all snd1 bktr0 )
	(cd $DEST/dev ; ln -s /dev/sysmouse mouse )
	echo "Fixup permissions on various objects..."
	chmod 555 $DEST/sbin/init
	echo "Create mount points..."
	for i in $DIRS
	do
	    rm -r -f ${DEST}/$i
	    mkdir -p ${DEST}/$i && chown root:wheel ${DEST}/$i && echo -n " $i"
	done
	echo "."
	(cd /etc ; tar cvf - ${PWFILES} ) | (cd ${DEST}/etc ; tar xf - )
	cp /sys/compile/DISKLESS/kernel $DEST/kernel
	echo "."
}


# this simply updates per-machine files in /etc/diskless/machine
# We need to create a few fundamental files in /etc:
#	rc
#	fstab
# These are taken from /etc/diskless/
#

case $1 in
	all)
		init_diskless_root
		update ;;
	update)
		update ;;
	*)	# copy conf and pwfiles
		(cd / ; tar clf - conf ) | (cd $DEST; tar xvf - )
		(cd /etc ; tar cvf - ${PWFILES} ) | (cd ${DEST}/etc ; tar xf - )
		;;
esac
exit 0
### end of file ###


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-current" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199912211551.QAA16496>