svn commit: r217165 - in user/nwhitehorn/bsdinstall: . scripts

Nathan Whitehorn nwhitehorn at FreeBSD.org
Sat Jan 8 20:25:14 UTC 2011


Author: nwhitehorn
Date: Sat Jan  8 20:25:13 2011
New Revision: 217165
URL: http://svn.freebsd.org/changeset/base/217165

Log:
  Various improvements for running from read-only media (e.g. install CDs).

Added:
  user/nwhitehorn/bsdinstall/rc.local   (contents, props changed)
  user/nwhitehorn/bsdinstall/testsystem.sh   (contents, props changed)
Modified:
  user/nwhitehorn/bsdinstall/bsdinstall
  user/nwhitehorn/bsdinstall/scripts/hostname

Modified: user/nwhitehorn/bsdinstall/bsdinstall
==============================================================================
--- user/nwhitehorn/bsdinstall/bsdinstall	Sat Jan  8 20:25:00 2011	(r217164)
+++ user/nwhitehorn/bsdinstall/bsdinstall	Sat Jan  8 20:25:13 2011	(r217165)
@@ -4,7 +4,7 @@ DISTRIBUTIONS="kernel.tgz world.tgz dist
 BSDINSTALL_LOG="/tmp/bsdinstall_log"; export BSDINSTALL_LOG
 BSDINSTALL_TMPETC="/tmp/bsdinstall_etc"; export BSDINSTALL_TMPETC
 PATH_FSTAB="$BSDINSTALL_TMPETC/fstab"; export PATH_FSTAB
-BSDINSTALL_DISTDIR="/var/dist"; export BSDINSTALL_DISTDIR
+BSDINSTALL_DISTDIR="/usr/bsdinstall-dist"; export BSDINSTALL_DISTDIR
 BSDINSTALL_CHROOT="/mnt"; export BSDINSTALL_CHROOT
 
 VERB=$1; shift

Added: user/nwhitehorn/bsdinstall/rc.local
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ user/nwhitehorn/bsdinstall/rc.local	Sat Jan  8 20:25:13 2011	(r217165)
@@ -0,0 +1,28 @@
+#!/bin/sh
+
+: ${DIALOG_OK=0}
+: ${DIALOG_CANCEL=1}
+: ${DIALOG_HELP=2}
+: ${DIALOG_EXTRA=3}
+: ${DIALOG_ITEM_HELP=4}
+: ${DIALOG_ESC=255}
+
+TERM=xterm; export TERM # XXX: serial consoles
+
+cdialog --backtitle "FreeBSD Installer" --title "Welcome" --extra-button --extra-label "Shell" --ok-label "Installer" --cancel-label "Live CD" --yesno "Welcome to FreeBSD! Would you like to begin an installation or use the live CD?" 0 0
+
+case $? in
+$DIALOG_OK)	# Installer
+	BSDINSTALL_CONFIGCURRENT=yes; export BSDINSTALL_CONFIGCURRENT
+	bsdinstall
+	reboot
+	;;
+$DIALOG_CANCEL)	# Live CD
+	exit 0
+	;;
+$DIALOG_EXTRA)	# Shell
+	/bin/sh
+	. /etc/rc.local
+	;;
+esac
+

Modified: user/nwhitehorn/bsdinstall/scripts/hostname
==============================================================================
--- user/nwhitehorn/bsdinstall/scripts/hostname	Sat Jan  8 20:25:00 2011	(r217164)
+++ user/nwhitehorn/bsdinstall/scripts/hostname	Sat Jan  8 20:25:13 2011	(r217165)
@@ -13,7 +13,10 @@ HOSTNAME=`cdialog --backtitle 'FreeBSD I
 
 If you are running on a managed network, please ask your network administrator for an appropriate name.' \
 	0 0 $(hostname) 2>&1 1>&3`
-if [ $? -eq $DIALOG_CANCEL ]; then exec $0; fi
+if [ $? -eq $DIALOG_CANCEL ]; then exit 1; fi
 exec 3>&-
 
 echo "hostname=\"$HOSTNAME\"" >> $BSDINSTALL_TMPETC/rc.conf
+if [ ! -z $BSDINSTALL_CONFIGCURRENT ]; then
+	hostname -s "$HOSTNAME"
+fi

Added: user/nwhitehorn/bsdinstall/testsystem.sh
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ user/nwhitehorn/bsdinstall/testsystem.sh	Sat Jan  8 20:25:13 2011	(r217165)
@@ -0,0 +1,47 @@
+#!/bin/sh
+
+# testsystem.sh <scratch directory> <dists directory> <output iso>
+
+mkdir $2
+
+# Kernel package
+cd /usr/src
+mkdir $1
+make installkernel DESTDIR=$1
+cd $1
+tar cvzf $2/kernel.tgz .
+chflags -R noschg .
+rm -rf $1
+
+# Distribution
+cd /usr/src
+mkdir $1
+make distrib-dirs distribution DESTDIR=$1
+cd $1
+tar cvzf $2/distribution.tgz .
+chflags -R noschg .
+rm -rf $1
+
+# World
+cd /usr/src
+mkdir $1
+make installworld DESTDIR=$1
+cd $1
+tar cvzf $2/world.tgz .
+# Keep world around
+
+# Make system
+cd /usr/src
+make installkernel distribution DESTDIR=$1
+mkdir $1/var/dist
+cp $2/kernel.tgz $2/world.tgz $2/distribution.tgz $1/var/dist
+
+# Things for the CD environment
+ln -s /tmp/bsdinstall_etc/resolv.conf $1/etc/resolv.conf
+echo kernel_options=\"-C\" > $1/boot/loader.conf
+echo sendmail_enable=\"NONE\" > $1/etc/rc.conf
+
+# cdialog is not called dialog yet, except here
+ln -s /usr/bin/dialog $1/usr/bin/cdialog
+
+#mkisoimages.sh -b FreeBSD_Install $3 $1


More information about the svn-src-user mailing list