Index: stable/2.1/release/Makefile =================================================================== --- stable/2.1/release/Makefile (revision 10989) +++ stable/2.1/release/Makefile (revision 10990) @@ -1,572 +1,567 @@ -# $Id: Makefile,v 1.193.2.11 1995/09/20 10:45:14 jkh Exp $ +# $Id: Makefile,v 1.193.2.12 1995/09/21 11:16:28 davidg Exp $ # # How to roll a release: # # make release CHROOTDIR= [ RELEASETAG=something ] # # As far as I know, this will roll everything nicely into the "stage" # directory. I still need to write the two rules to move that into # the "cdrom" and "ftp" directories. # I also need to "make ports" and install those, but I'm not going to do # that on a 14.4 line just yet... # # SET THIS !!! BUILDNAME=2.1.0-950922-SNAP CHROOTDIR=/a/release # If this is a RELEASE, then set RELEASETAG=RELENG_2_1_0 # Things which without too much trouble can be considered variables EXPORT_DISTS= games manpages proflibs dict info EXTRA_DISTS= krb des ${EXPORT_DISTS} ALL_DISTS= bin ${EXTRA_DISTS} # Extra source tarballs; each argument is a pair of source dir and # distribution name. The dist name should not exceed 7 characters # (another "s" for "source" will be prepended). EXTRA_SRC+= usr.sbin/sendmail/cf smailcf #EXTRA_SRC+= usr.sbin/config kconf BOOT1= etc/protocols etc/sysconfig FAQS= MIRROR.SITES # define this to use a vn device instead of the floppy drive VNDEVICE= vn0 # mountpoint for filesystems. MNT= /mnt # other floppy parameters. FDSIZE= 1200 FDLABEL= fd1200 FDINODE= 4300 NEWFSARGS= -c 80 -b 4096 -f 512 -i 4000 -m 0 -t 0 -u 0 \ -o space -T ${FDLABEL} ZIPNSPLIT= gzip --no-name -9 -c | split -b 240640 - # Size of the mfs to put in the kernel we boot. # You want to keep this as small as possible, it costs dearly in RAM. BOOTMFSSIZE= 1075 MFSINODE= 70000 # Things which will get you into trouble if you change them DISTRIBUTIONS= bin ${EXTRA_DISTS} MTREEFILES= ${.CURDIR}/../etc/mtree RD= ${RELEASEDIR}/stage FD= ${RELEASEDIR}/ftp CD= ${RELEASEDIR}/cdrom .if !defined(WHICH_CRUNCH) WHICH_CRUNCH= boot root fixit .endif release: .if !defined(CHROOTDIR) || !defined(BUILDNAME) @echo "To make a release you must set CHROOTDIR and BUILDNAME" && false .endif .if exists(${CHROOTDIR}) chflags -R noschg ${CHROOTDIR}/. rm -rf ${CHROOTDIR} .endif mkdir -p ${CHROOTDIR} cd ${.CURDIR}/../etc ; ${MAKE} distrib-dirs DESTDIR=${CHROOTDIR} cd ${.CURDIR}/../etc ; ${MAKE} distribution DESTDIR=${CHROOTDIR} cd ${.CURDIR}/.. ; ${MAKE} install DESTDIR=${CHROOTDIR} echo "#!/bin/sh" > ${CHROOTDIR}/mk echo "set -ex" >> ${CHROOTDIR}/mk echo "CFLAGS='-O -pipe'" >> ${CHROOTDIR}/mk echo "export CFLAGS" >> ${CHROOTDIR}/mk echo "RELEASEDIR=/R" >> ${CHROOTDIR}/mk echo "export RELEASEDIR" >> ${CHROOTDIR}/mk echo "cd /usr/src" >> ${CHROOTDIR}/mk echo "make world" >> ${CHROOTDIR}/mk echo "cd /usr/src/release" >> ${CHROOTDIR}/mk echo "make obj" >> ${CHROOTDIR}/mk echo "make doRELEASE" >> ${CHROOTDIR}/mk echo "echo Release Finished" >> ${CHROOTDIR}/mk .if !defined(RELEASETAG) cd ${CHROOTDIR}/usr ; cvs co -P src .else cd ${CHROOTDIR}/usr ; cvs co -P -r ${RELEASETAG} src .endif ( cd ${CHROOTDIR}/usr/src/sys/conf && \ cp newvers.sh foo && \ sed "s/^RELEASE=.*/RELEASE=${BUILDNAME}/" foo > newvers.sh; rm foo ) ( cd ${CHROOTDIR}/usr/src/release/sysinstall && \ cp menus.c foo && \ sed "s/RELEASE_NAME/${BUILDNAME}/" foo > menus.c; rm foo ) chmod 755 ${CHROOTDIR}/mk chroot ${CHROOTDIR} /mk # Same as above but for re-rolling the release after simply changing a few # things. rerelease: .if !defined(CHROOTDIR) || !defined(BUILDNAME) @echo "To make a re-release you must set CHROOTDIR and BUILDNAME" && false .endif @if [ ! -d ${CHROOTDIR} ]; then echo "No ${CHROOTDIR} directory to re-release in!"; exit 1; fi echo "#!/bin/sh" > ${CHROOTDIR}/mk echo "set -ex" >> ${CHROOTDIR}/mk echo "CFLAGS='-O -pipe'" >> ${CHROOTDIR}/mk echo "export CFLAGS" >> ${CHROOTDIR}/mk echo "RELEASEDIR=/R" >> ${CHROOTDIR}/mk echo "export RELEASEDIR" >> ${CHROOTDIR}/mk echo "cd /usr/src" >> ${CHROOTDIR}/mk echo "make all install" >> ${CHROOTDIR}/mk echo "cd /usr/src/release/libdisk" >> ${CHROOTDIR}/mk echo "make obj" >> ${CHROOTDIR}/mk echo "make all" >> ${CHROOTDIR}/mk echo "cd /usr/src/release/sysinstall" >> ${CHROOTDIR}/mk echo "make obj" >> ${CHROOTDIR}/mk echo "make all" >> ${CHROOTDIR}/mk echo "cd /usr/src/release" >> ${CHROOTDIR}/mk echo "make obj" >> ${CHROOTDIR}/mk echo "make doRELEASE" >> ${CHROOTDIR}/mk echo "echo Re-Release Finished" >> ${CHROOTDIR}/mk .if !defined(RELEASENOUPDATE) .if !defined(RELEASETAG) cd ${CHROOTDIR}/usr ; cvs update -P -d -q src .else cd ${CHROOTDIR}/usr ; cvs update -P -d -q -r ${RELEASETAG} src .endif .endif ( cd ${CHROOTDIR}/usr/src/sys/conf && \ mv newvers.sh foo && \ sed "s/^RELEASE=.*/RELEASE=${BUILDNAME}/" foo > newvers.sh; rm foo ) chmod 755 ${CHROOTDIR}/mk chroot ${CHROOTDIR} /mk clean: rm -rf root_crunch boot_crunch release.[0-9] release.1[0] # Clean out ${RELEASEDIR} and make the directory structure. release.1: @cd ${.CURDIR} ; $(MAKE) ckRELEASEDIR -mkdir ${RELEASEDIR} chflags -R noschg ${RELEASEDIR}/. rm -rf ${RELEASEDIR}/* mkdir ${RD} mkdir ${RD}/floppies mkdir ${RD}/trees mkdir ${RD}/dists for i in ${ALL_DISTS} ; do \ mkdir ${RD}/trees/$$i ; \ mkdir ${RD}/dists/$$i ; \ mtree -deU -f ${MTREEFILES}/BSD.root.dist \ -p ${RD}/trees/$$i > /dev/null ; \ mtree -deU -f ${MTREEFILES}/BSD.usr.dist \ -p ${RD}/trees/$$i/usr > /dev/null ; \ mtree -deU -f ${MTREEFILES}/BSD.include.dist \ -p ${RD}/trees/$$i/usr/include > /dev/null ; \ mtree -deU -f ${MTREEFILES}/BSD.var.dist \ -p ${RD}/trees/$$i/var > /dev/null ; \ done touch release.1 # Install the system into the various distributions. release.2: @cd ${.CURDIR} ; $(MAKE) ckRELEASEDIR cd ${.CURDIR}/../etc && make distrib-dirs DESTDIR=${RD}/trees/bin cd ${.CURDIR}/.. ; make distribute DISTDIR=${RD}/trees cd ${.CURDIR}/../eBones && ( \ make bootstrap ;\ make obj all help-distribute DISTDIR=${RD}/trees ;\ make kprog \ ) chflags -R noschg ${RD}/trees uudecode ${.CURDIR}/compat20/libgcc.so.261.0.uu install -m 444 -o bin -g bin libgcc.so.261.0 ${RD}/trees/bin/usr/lib touch release.2 # Make and install a couple of kernels we need. release.3: rm -rf ${RD}/kernels mkdir -p ${RD}/kernels @cd ${.CURDIR} && $(MAKE) ckRELEASEDIR cd ${.CURDIR}/../sys/i386/conf && \ sed 's/GENERIC/BOOTMFS/g' GENERIC > BOOTMFS && \ echo "options \"MFS_ROOT=${BOOTMFSSIZE}\"" >> BOOTMFS && \ echo "options MFS" >> BOOTMFS for i in BOOTMFS GENERIC ; do \ cd ${.CURDIR}/../sys/i386/conf && \ config $$i && \ cd ${.CURDIR}/../sys/compile/$$i && \ make depend && \ make kernel && \ cp kernel ${RD}/kernels/$$i ; \ rm -rf ${.CURDIR}/../sys/compile/$$i ; \ done rm -f ${.CURDIR}/../sys/i386/conf/BOOTCDROM cd ${RD}/kernels && kzip GENERIC touch release.3 # Make and install the three crunched binaries which live on the floppies. # You are not supposed to like this :-) release.4: cd ${.CURDIR}/libdisk && make obj && make depend && make all cd ${.CURDIR}/sysinstall && make obj && make depend && make all @cd ${.CURDIR} ; $(MAKE) ckRELEASEDIR rm -rf ${RD}/crunch mkdir -p ${RD}/crunch for j in ${WHICH_CRUNCH} ; do \ rm -rf $${j}_crunch && \ mkdir $${j}_crunch && \ ( cd $${j}_crunch && \ crunchgen ${.CURDIR}/$${j}_crunch.conf && \ ${MAKE} -f $${j}_crunch.mk objs exe NOCRYPT=yes \ "CFLAGS=${CFLAGS} -DCRUNCHED_BINARY") && \ mv $${j}_crunch/$${j}_crunch ${RD}/crunch/$${j} && \ rm -rf $${j}_crunch ; \ done touch release.4 # Fix up the distributions. release.5: @cd ${.CURDIR} ; $(MAKE) ckRELEASEDIR ln -f ${RD}/kernels/GENERIC ${RD}/trees/bin/kernel.GENERIC if [ -d ${RD}/trees/bin/usr/share/man ] ; then \ rm -rf ${RD}/trees/manpages/usr/share/man ;\ mv ${RD}/trees/bin/usr/share/man \ ${RD}/trees/manpages/usr/share/man ;\ fi if [ -d ${RD}/trees/bin/usr/games ] ; then \ rm -rf ${RD}/trees/games/usr/games ;\ mv ${RD}/trees/bin/usr/games \ ${RD}/trees/games/usr/games ;\ fi if [ -d ${RD}/trees/bin/usr/share/games ] ; then \ rm -rf ${RD}/trees/games/usr/share/games ;\ mv ${RD}/trees/bin/usr/share/games \ ${RD}/trees/games/usr/share/games ;\ fi if [ -d ${RD}/trees/bin/var/games ] ; then \ rm -rf ${RD}/trees/games/var/games ;\ mv ${RD}/trees/bin/var/games \ ${RD}/trees/games/var/games ;\ fi if [ -d ${RD}/trees/bin/usr/share/dict ] ; then \ rm -rf ${RD}/trees/dict/usr/share/dict ;\ mv ${RD}/trees/bin/usr/share/dict \ ${RD}/trees/dict/usr/share/dict ;\ fi for i in airport birthtoken flowers na.phone zipcodes ; do \ if [ -f ${RD}/trees/bin/usr/share/misc/$$i ] ; then \ mv ${RD}/trees/bin/usr/share/misc/$$i \ ${RD}/trees/dict/usr/share/misc ; \ fi ; \ done -mv ${RD}/trees/bin/usr/share/info/* \ ${RD}/trees/info/usr/share/info for i in ${RD}/trees/bin/usr/lib/*_p.a ; do \ if [ -f $$i ] ; then \ mv $$i \ ${RD}/trees/proflibs/usr/lib ; \ fi ; \ done cd ${RD}/trees/bin/usr/share/misc && rm -f termcap.db vgrindefs.db -cd ${RD}/trees && \ find ${EXTRA_DISTS} -depth -type d -print | xargs rmdir touch release.5 # Make binary dists, notice that DES dist isn't finished yet. release.6: @cd ${.CURDIR} ; $(MAKE) ckRELEASEDIR rm -rf ${RD}/dists mkdir -p ${RD}/dists mkdir -p ${RD}/info @for i in ${DISTRIBUTIONS} ; \ do \ if [ -d ${RD}/trees/$${i} ] ; then \ cd ${.CURDIR} ; \ $(MAKE) doTARBALL SD=${RD}/trees/$${i} \ TN=$$i TD=$$i ARG="." ; \ echo "$${i} distribution is finished."; \ fi ; \ done touch release.6 # Make source dists, and finish off DES too release.7: @cd ${.CURDIR} ; $(MAKE) ckRELEASEDIR @cd ${.CURDIR} ; $(MAKE) doTARBALL SD=/usr/src \ TD=src TN=sbase ARG="[A-Z]*" @for i in `cd /usr/src ; echo [a-z]*` ; do \ if [ -d /usr/src/$$i -a "$$i" != "CVS" ] ; then \ cd ${.CURDIR} ; \ $(MAKE) doTARBALL SD=/usr/src \ TN=`echo s$$i | tr -d '.' | sed 's/usr/u/'` \ TD=src ARG="$$i" ; \ fi ; \ done .if defined(EXTRA_SRC) @set ${EXTRA_SRC} ; \ while [ $$# -ge 2 ] ; do \ if [ -d /usr/src/$$1 -a "$$1" != "CVS" ] ; then \ cd ${.CURDIR} ; \ $(MAKE) doTARBALL SD=/usr/src \ TN="s$$2" \ TD=src ARG="$$1" ; \ fi ; \ shift ; shift ; \ done .endif ( cd ${RD}/dists/src && \ if [ -f ssecure.aa ] ; then mv ssecure.* ../des ; fi && \ if [ -f sebones.aa ] ; then mv sebones.* ../des ; fi ) @echo "src distribution is finished." mv ${RD}/dists/krb/* ${RD}/dists/des rmdir ${RD}/dists/krb touch release.7 # Complete the bootfd # # Now, just to get this picture down once and for all: # # +------------------------------------------------------------------------+ # |boot.flp | # +-----+-----+------------------------------------------------------------+ # |boot1|boot2|floppy filesystem "bootfd" | # +-----+-----+-+--------------------------------------------------------+-+ # |kernel | # +------------+-----------------------------------------+-+ # |mfs filesystem "mfsfd" | # +-----------------------------------------+ # release.8: write_mfs_in_kernel @cd ${.CURDIR} && $(MAKE) ckRELEASEDIR rm -rf ${RD}/mfsfd mkdir ${RD}/mfsfd cd ${RD}/mfsfd && \ mkdir -p dev mnt stand/help @cd ${.CURDIR} && $(MAKE) installCRUNCH CRUNCH=boot \ DIR=${RD}/mfsfd/stand ZIP=false ( cd ${RD}/trees/bin/dev && \ ls console tty ttyv0 ttyv1 ttyv2 ttyv3 null zero \ *[sw]d* cuaa[01] fd[01] rfd[01] \ cd0a mcd0a scd0a matcd0a rst0 ft0 rwt0 | \ cpio -dump ${RD}/mfsfd/dev ) ( cd ${RD}/mfsfd/dev && rm -f *[sw]d*[bdefgh] ) cd ${RD}/trees/bin && ls ${BOOT1} | cpio -dump ${RD}/mfsfd/stand echo "nameserver 42/tcp name" > ${RD}/mfsfd/stand/etc/services echo "ftp 21/tcp" >> ${RD}/mfsfd/stand/etc/services echo "domain 53/tcp nameserver" >> ${RD}/mfsfd/stand/etc/services echo "domain 53/udp nameserver" >> ${RD}/mfsfd/stand/etc/services tar --exclude CVS -cf - -C ${.CURDIR}/sysinstall help | \ tar xvf - -C ${RD}/mfsfd/stand install -c ${.CURDIR}/../COPYRIGHT ${RD}/mfsfd/stand/help/COPYRIGHT.hlp ( \ a=`expr ${BOOTMFSSIZE} \* 2` && \ echo && \ echo "mfs${BOOTMFSSIZE}:ty=mfs:se#512:nt#1:rm#300:\\" && \ echo " :ns#$$a:nc#1:\\" && \ echo " :pa#$$a:oa#0:ba#4096:fa#512:\\" && \ echo " :pc#$$a:oc#0:bc#4096:fc#512:" && \ echo \ ) >> /etc/disktab cd ${.CURDIR} && ${MAKE} doFS FSSIZE=${BOOTMFSSIZE} \ FSPROTO=${RD}/mfsfd FSLABEL=mfs${BOOTMFSSIZE} \ FSINODE=${MFSINODE} rm -rf ${RD}/bootfd mkdir ${RD}/bootfd cp ${RD}/kernels/BOOTMFS ${RD}/bootfd/kernel ./write_mfs_in_kernel ${RD}/bootfd/kernel fs-image kzip ${RD}/bootfd/kernel mv ${RD}/bootfd/kernel ${RD}/kernels/MFSKERNEL mv ${RD}/bootfd/kernel.kz ${RD}/bootfd/kernel ls -l ${RD}/bootfd/kernel cd ${.CURDIR} && ${MAKE} doFLOPPY FLOPPY=boot touch release.8 # Complete the rootfd directory release.9: @cd ${.CURDIR} && $(MAKE) ckRELEASEDIR rm -rf ${RD}/rootfd mkdir ${RD}/rootfd cd ${RD}/rootfd && \ mkdir stand stand/info @cd ${.CURDIR} && $(MAKE) installCRUNCH CRUNCH=root \ DIR=${RD}/rootfd/stand ZIP=false tar --exclude CVS -cf - -C ${RD} info | tar xvf - -C ${RD}/rootfd/stand mv ${RD}/rootfd/stand/info/krb/* ${RD}/rootfd/stand/info/des rmdir ${RD}/rootfd/stand/info/krb mv ${RD}/rootfd/stand/info/src/ssecure.inf ${RD}/rootfd/stand/info/des mv ${RD}/rootfd/stand/info/src/sebones.inf ${RD}/rootfd/stand/info/des tar -cf - -C ${RD}/trees/bin/dev MAKEDEV | tar xvf - -C ${RD}/rootfd/stand cd ${RD}/rootfd && ( rm -f OK && find . -print && touch OK && echo OK ) | cpio -H newc -oa | gzip -9 -c | dd conv=osync > ${RD}/floppies/root.tmp mv ${RD}/floppies/root.tmp ${RD}/floppies/root.flp touch release.9 # Complete the fixitfd release.10: @cd ${.CURDIR} && $(MAKE) ckRELEASEDIR rm -rf ${RD}/fixitfd mkdir ${RD}/fixitfd cd ${RD}/fixitfd && \ mkdir stand bin sbin etc mnt mnt1 mnt2 mnt3 mnt4 tmp - ln -f ${RD}/kernels/GENERIC.kz ${RD}/fixitfd/kernel @cd ${.CURDIR} && $(MAKE) installCRUNCH CRUNCH=fixit \ DIR=${RD}/fixitfd/stand ZIP=true ( cd ${RD}/trees/bin/dev && \ sh MAKEDEV wd0s5 wd0s6 wd0s7 wd0s8 && \ ls console tty ttyv0 ttyv1 null zero \ *[sw]d* fd[01] rfd[01] | \ cpio -dump ${RD}/fixitfd/dev ) ln -f ${RD}/fixitfd/stand/init ${RD}/fixitfd/sbin - ln -f ${RD}/fixitfd/stand/sh ${RD}/fixitfd/bin cp ${RD}/trees/bin/usr/mdec/fdboot ${RD}/fixitfd/etc/boot1 cp ${RD}/trees/bin/usr/mdec/bootfd ${RD}/fixitfd/etc/boot2 cp ${.CURDIR}/fixit.profile ${RD}/fixitfd/.profile - echo 'echo /etc/rc' > ${RD}/fixitfd/etc/rc - echo 'exit 1' >> ${RD}/fixitfd/etc/rc - touch ${RD}/fixitfd/etc/spwd.db cd ${.CURDIR} && ${MAKE} doFLOPPY FLOPPY=fixit touch release.10 ftp.1: rm -rf ${FD} mkdir ${FD} cd ${RD} && find floppies -print | cpio -dumpl ${FD} cd ${RD}/dists && find . -print | cpio -dumpl ${FD} cd ${RD}/trees/bin/usr/share/FAQ/Text && ln -f ${FAQS} ${FD} # This rule makes ${CHROOTDIR}/R/ftp a suitable anon ftp for testing. ftp.2: -mkdir ${FD}/bin ln -f ${RD}/trees/bin/bin/ls ${FD}/bin/ls cdrom.1: rm -rf ${CD} mkdir ${CD} mkdir ${CD}/filesys cd ${RD} && find floppies dists -print | cpio -dumpl ${CD} ln -f ${RD}/kernels/MFSKERNEL ${CD}/kernel ln -f ${RD}/trees/bin/usr/mdec/fbsdboot.exe ${CD} for i in ${DISTRIBUTIONS} ; \ do \ if [ -d ${RD}/trees/$${i} ] ; then \ ( cd ${RD}/trees/$${i} && \ find . -depth -print | cpio -dumpl ${CD}/filesys ) ; \ fi \ done # Various "subroutine" and other supporting targets. doTARBALL: .if !defined(SD) @echo "SD undefined in doTARBALL" ; exit 1 .endif .if !defined(TD) @echo "TB undefined in doTARBALL" ; exit 1 .endif .if !defined(ARG) @echo "ARG undefined in doTARBALL" ; exit 1 .endif rm -rf ${RD}/dists/${TD}/${TN}* mkdir -p ${RD}/dists/${TD} ( cd ${SD} && \ tn=`echo ${TN} | tr '[A-Z]' '[a-z]' | cut -c1-8` && \ echo rolling ${TD}/$$tn tarball &&\ tar --exclude CVS --exclude obj -cf - ${ARG} | \ ${ZIPNSPLIT} ${RD}/dists/${TD}/$$tn. && \ cd ${RD}/info && \ mkdir -p ${TD} && \ chmod a+x ${.CURDIR}/info.sh && \ ${.CURDIR}/info.sh ${RD}/dists/${TD}/$$tn > ${TD}/$$tn.inf \ ) doRELEASE: release.1 release.2 release.3 release.4 release.5 release.6 \ release.7 release.8 release.9 cd ${.CURDIR} && ${MAKE} cdrom.1 ftp.1 @echo "Release done" floppies: rm -f release.4 release.8 release.9 cd ${.CURDIR} && ${MAKE} doRELEASE boot.flp: rm -f release.4 release.8 cd ${.CURDIR} && ${MAKE} release.4 release.8 WHICH_CRUNCH=boot root.flp: rm -f release.4 release.9 cd ${.CURDIR} && ${MAKE} release.4 release.9 WHICH_CRUNCH=root fixit.flp: rm -f release.4 release.10 cd ${.CURDIR} && ${MAKE} release.4 release.10 WHICH_CRUNCH=fixit write_mfs_in_kernel: ${.CURDIR}/write_mfs_in_kernel.c ${CC} ${CFLAGS} -o write_mfs_in_kernel ${.CURDIR}/write_mfs_in_kernel.c ckRELEASEDIR: .if !defined(RELEASEDIR) @echo "To make a release RELEASEDIR must be defined" && false .endif doFLOPPY: .if !defined(FLOPPY) @echo "FLOPPY undefined in doFLOPPY" ; exit 1 .endif rm -f ${RD}/floppies/${FLOPPY}.flp cd ${.CURDIR} && ${MAKE} doFS FSSIZE=${FDSIZE} \ FSPROTO=${RD}/${FLOPPY}fd \ FSLABEL=${FDLABEL} FSINODE=${FDINODE} mv fs-image ${RD}/floppies/${FLOPPY}.flp doFS: .if !defined(FSSIZE) @echo "FSSIZE undefined in doFS" ; exit 1 .endif .if !defined(FSPROTO) @echo "FSPROTO undefined in doFS" ; exit 1 .endif .if !defined(FSINODE) @echo "FSINODE undefined in doFS" ; exit 1 .endif rm -f fs-image if [ ! -b /dev/${VNDEVICE} -o ! -c /dev/r${VNDEVICE} ] ; then \ cd /dev && sh MAKEDEV ${VNDEVICE} ; fi @umount /dev/${VNDEVICE} 2>/dev/null || true @umount ${MNT} 2>/dev/null || true @vnconfig -u /dev/r${VNDEVICE} 2>/dev/null || true dd of=fs-image if=/dev/zero count=${FSSIZE} bs=1k 2>/dev/null vnconfig -c /dev/r${VNDEVICE} fs-image .if defined(FSLABEL) disklabel -w -r -B \ -b ${RD}/trees/bin/usr/mdec/fdboot \ -s ${RD}/trees/bin/usr/mdec/bootfd \ /dev/r${VNDEVICE} ${FSLABEL} .endif newfs -u 0 -t 0 -i ${FSINODE} -m 0 -T ${FSLABEL} /dev/r${VNDEVICE} mount /dev/${VNDEVICE} ${MNT} cd ${FSPROTO} && find . -print | cpio -dump ${MNT} df -i /mnt umount ${MNT} fsck /dev/r${VNDEVICE} < /dev/null installCRUNCH: .if !defined(CRUNCH) @echo "CRUNCH undefined in installCRUNCH" ; exit 1 .endif .if !defined(DIR) @echo "DIR undefined in installCRUNCH" ; exit 1 .endif .if !defined(ZIP) @echo "ZIP undefined in installCRUNCH" ; exit 1 .endif if ${ZIP} ; then \ gzip -9 < ${RD}/crunch/${CRUNCH} > ${DIR}/${CRUNCH}_crunch ; \ else \ ln -f ${RD}/crunch/${CRUNCH} ${DIR}/${CRUNCH}_crunch ; \ fi chmod 555 ${DIR}/${CRUNCH}_crunch for i in `crunchgen -l ${.CURDIR}/${CRUNCH}_crunch.conf` ; do \ ln -f ${DIR}/${CRUNCH}_crunch ${DIR}/$$i ; \ done .include Index: stable/2.1/release/boot_crunch.conf =================================================================== --- stable/2.1/release/boot_crunch.conf (revision 10989) +++ stable/2.1/release/boot_crunch.conf (revision 10990) @@ -1,15 +1,15 @@ -# $Id: boot_crunch.conf,v 1.20 1995/06/11 19:29:27 rgrimes Exp $ +# $Id: boot_crunch.conf,v 1.20.2.1 1995/09/23 22:31:50 jkh Exp $ srcdirs /usr/src/bin /usr/src/sbin /usr/src/release /usr/src/usr.bin srcdirs /usr/src/gnu/usr.bin /usr/src/usr.sbin /usr/src/sbin/i386 progs sh find progs ft ppp progs sysinstall newfs gzip cpio bad144 fsck ifconfig route slattach -progs ee mount_nfs +progs mount_nfs ln gzip gunzip ln gzip zcat ln sh -sh libs -ll -ledit -lutil -lkvm libs -ldialog -lncurses -lmytinfo -L/usr/src/release/libdisk/obj -ldisk Index: stable/2.1/release/fixit_crunch.conf =================================================================== --- stable/2.1/release/fixit_crunch.conf (revision 10989) +++ stable/2.1/release/fixit_crunch.conf (revision 10990) @@ -1,47 +1,40 @@ -# $Id: fixit_crunch.conf,v 1.2 1995/04/12 08:00:24 phk Exp $ +# $Id: fixit_crunch.conf,v 1.3 1995/04/20 06:48:31 phk Exp $ # first, we list the source dirs that our programs reside in. These are # searched in order listed to find the dir containing each program. srcdirs /usr/src/bin /usr/src/sbin /usr/src/usr.bin /usr/src/usr.sbin srcdirs /usr/src/gnu/usr.bin /usr/src/usr.bin/vi srcdirs /usr/src/sbin/i386 # second, we list all the programs we want to include in our crunched binary. # The order doesn't matter. Any program that needs hard links to it gets an # `ln' directive. # /bin stuff progs cat chmod chroot cp date dd df echo ed expr hostname kill ln ls mkdir -progs mt mv pwd rcp rm rmdir sh sleep stty sync test +progs mt mv pwd rcp rm rmdir sleep stty sync test ln test [ -ln sh -sh # init invokes the shell this way # /sbin stuff -progs bad144 badsect chown clri disklabel dump dmesg fdisk fsck ifconfig init +progs badsect chown clri disklabel dump dmesg fdisk init progs mknod mount newfs ping reboot restore swapon umount progs mount_msdos mount_cd9660 mount_nfs ln dump rdump ln restore rrestore # /usr/bin stuff progs ftp rsh sed telnet rlogin common find ln common vi ln common view ln common ex - -# gnu stuff - -progs cpio gzip -ln gzip gunzip -ln gzip gzcat # finally, we specify the libraries to link in with our binary libs -lcrypt -ltelnet -lutil -ll libs -lcurses -ltermcap -ledit -lkvm Index: stable/2.1/release/root_crunch.conf =================================================================== --- stable/2.1/release/root_crunch.conf (revision 10989) +++ stable/2.1/release/root_crunch.conf (revision 10990) @@ -1,35 +1,35 @@ -# $Id: root_crunch.conf,v 1.4.2.2 1995/06/01 05:54:37 jkh Exp $ +# $Id: root_crunch.conf,v 1.5 1995/06/11 19:29:29 rgrimes Exp $ # first, we list the source dirs that our programs reside in. These are # searched in order listed to find the dir containing each program. srcdirs /usr/src/gnu/usr.bin srcdirs /usr/src/bin /usr/src/sbin /usr/src/sbin/i386 /usr/src/usr.bin srcdirs /usr/src/usr.sbin # second, we list all the programs we want to include in our crunched binary. # The order doesn't matter. Any program that needs hard links to it gets an # `ln' directive. # /bin stuff -progs ls cat df pwd chmod cksum cp date dd echo ed expr grep hostname kill ln +progs ls cat df ee pwd chmod cksum cp date dd echo ed expr grep hostname kill ln progs mkdir mt mv pwd rcp rm rmdir sleep stty sync test ft ln test [ # /sbin stuff progs badsect basename chown clri disklabel dmesg dump dmesg fdisk ft progs getopt init mknod mount mount_cd9660 mount_msdos mount_nfs progs ping reboot restore swapon umount ln dump rdump ln restore rrestore ln reboot halt # /usr/bin stuff progs tar ftp rsh sed telnet rlogin # finally, we specify the libraries to link in with our binary libs -lcrypt -ltelnet -lutil -ll -ledit libs -lgnuregex -lreadline -lcurses -ltermcap -lkvm Index: stable/2.1/release/sysinstall/decode.c =================================================================== --- stable/2.1/release/sysinstall/decode.c (revision 10989) +++ stable/2.1/release/sysinstall/decode.c (revision 10990) @@ -1,157 +1,153 @@ /* * The new sysinstall program. * * This is probably the last program in the `sysinstall' line - the next * generation being essentially a complete rewrite. * - * $Id: decode.c,v 1.6 1995/06/11 19:29:44 rgrimes Exp $ + * $Id: decode.c,v 1.6.2.1 1995/09/23 22:03:05 jkh Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer, * verbatim and that no modifications are made prior to this * point in the file. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * This product includes software developed by Jordan Hubbard * for the FreeBSD Project. * 4. The name of Jordan Hubbard or the FreeBSD project may not be used to * endorse or promote products derived from this software without specific * prior written permission. * * THIS SOFTWARE IS PROVIDED BY JORDAN HUBBARD ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL JORDAN HUBBARD OR HIS PETS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, LIFE OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * */ #include "sysinstall.h" DMenuItem * decode(DMenu *menu, char *name) { DMenuItem *tmp; for (tmp = menu->items; tmp->title; tmp++) if (!strcmp(name, tmp->title)) break; if (!tmp->title) return NULL; return tmp; } Boolean dispatch(DMenuItem *tmp, char *name) { Boolean failed = FALSE; switch (tmp->type) { /* We want to simply display a file */ case DMENU_DISPLAY_FILE: systemDisplayFile((char *)tmp->ptr); break; /* It's a sub-menu; recurse on it */ case DMENU_SUBMENU: (void)dmenuOpenSimple((DMenu *)tmp->ptr); break; /* Execute it as a direct exec */ - case DMENU_EXEC_COMMAND: - (void)execExecute((char *)tmp->title, (char *)tmp->ptr); - break; - case DMENU_SYSTEM_COMMAND: (void)systemExecute((char *)tmp->ptr); break; /* Same as above, but execute it in a prgbox */ case DMENU_SYSTEM_COMMAND_BOX: use_helpfile(NULL); use_helpline("Select OK to dismiss this dialog"); dialog_prgbox(tmp->title, (char *)tmp->ptr, 22, 76, 1, 1); dialog_clear(); break; case DMENU_CALL: failed = (((int (*)())tmp->ptr)(name)); break; case DMENU_CANCEL: return TRUE; case DMENU_SET_VARIABLE: variable_set((char *)tmp->ptr); break; case DMENU_SET_FLAG: *((unsigned int *)tmp->ptr) |= tmp->parm; break; case DMENU_SET_VALUE: *((unsigned int *)tmp->ptr) = tmp->parm; break; case DMENU_NOP: break; default: msgFatal("Don't know how to deal with menu type %d", tmp->type); } return failed; } Boolean decode_and_dispatch_multiple(DMenu *menu, char *names) { DMenuItem *tmp; int errors = 0; string_prune(names); names = string_skipwhite(names); /* KLUDGE ALERT: * To make multi-choice flag arrays work this assumes that ALL items in * a menu appear in the same mask!! If you need mixed masks, use * submenus. */ if (menu->items[0].type == DMENU_SET_FLAG) *((unsigned int *)menu->items[0].ptr) = 0; while (names) { char *cp; cp = index(names, '\n'); if (cp) *cp++ = 0; /* Were no options actually selected? */ if (!*names) return FALSE; if ((tmp = decode(menu, names)) != NULL) { if (dispatch(tmp, names)) ++errors; } else msgFatal("Couldn't find a handler for item `%s' in menu `%s'!", names, menu->title); names = cp; } return errors ? TRUE : FALSE; } Index: stable/2.1/release/sysinstall/ftp_strat.c =================================================================== --- stable/2.1/release/sysinstall/ftp_strat.c (revision 10989) +++ stable/2.1/release/sysinstall/ftp_strat.c (revision 10990) @@ -1,262 +1,262 @@ /* * The new sysinstall program. * * This is probably the last attempt in the `sysinstall' line, the next * generation being slated to essentially a complete rewrite. * - * $Id: ftp_strat.c,v 1.6.2.25 1995/06/07 09:53:14 jkh Exp $ + * $Id: ftp_strat.c,v 1.7 1995/06/11 19:29:56 rgrimes Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. * Copyright (c) 1995 * Gary J Palmer. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer, * verbatim and that no modifications are made prior to this * point in the file. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * This product includes software developed by Jordan Hubbard * for the FreeBSD Project. * 4. The name of Jordan Hubbard or the FreeBSD project may not be used to * endorse or promote products derived from this software without specific * prior written permission. * * THIS SOFTWARE IS PROVIDED BY JORDAN HUBBARD ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL JORDAN HUBBARD OR HIS PETS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, LIFE OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * */ #include "sysinstall.h" #include #include #include #include #include #include #include "ftp.h" Boolean ftpInitted; static FTP_t ftp; extern int FtpPort; int mediaSetFtpUserPass(char *str) { char *user, *pass; dialog_clear(); if ((user = msgGetInput(getenv(FTP_USER), "Please enter the username you wish to login as")) != NULL) variable_set2(FTP_USER, user); if ((pass = msgGetInput(getenv(FTP_PASS), "Please enter the password for this user.\nWARNING: This password will echo on the screen!")) != NULL) variable_set2(FTP_PASS, pass); dialog_clear(); return 0; } static Boolean get_new_host(Device *dev) { Boolean i; char *oldTitle = MenuMediaFTP.title; Device *netDev = dev->private; MenuMediaFTP.title = "Connection timed out - please select another site"; i = mediaSetFTP(NULL); MenuMediaFTP.title = oldTitle; if (i) { char *cp = getenv(FTP_USER); if (cp && *cp) (void)mediaSetFtpUserPass(NULL); netDev->flags |= OPT_LEAVE_NETWORK_UP; (*dev->shutdown)(dev); i = (*dev->init)(dev); netDev->flags &= ~OPT_LEAVE_NETWORK_UP; } return i; } static Boolean HasDistsDir; Boolean mediaInitFTP(Device *dev) { int i, retries, max_retries = MAX_FTP_RETRIES; char *cp, *hostname, *dir; char *user, *login_name, password[80], url[BUFSIZ]; Device *netDevice = (Device *)dev->private; if (ftpInitted) return TRUE; if (!(*netDevice->init)(netDevice)) return FALSE; if ((ftp = FtpInit()) == NULL) { msgConfirm("FTP initialisation failed!"); goto punt; } if (isDebug()) msgDebug("Initialized FTP library.\n"); cp = getenv("ftp"); if (!cp) goto punt; if (isDebug()) msgDebug("Attempting to open connection for: %s\n", cp); hostname = getenv(VAR_HOSTNAME); if (strncmp("ftp://", cp, 6) != NULL) { msgConfirm("Invalid URL: %s\n(A URL must start with `ftp://' here)", cp); goto punt; } strncpy(url, cp, BUFSIZ); if (isDebug()) msgDebug("Using URL `%s'\n", url); hostname = url + 6; if ((cp = index(hostname, ':')) != NULL) { *(cp++) = '\0'; FtpPort = strtol(cp, 0, 0); } else FtpPort = 21; if ((dir = index(cp ? cp : hostname, '/')) != NULL) *(dir++) = '\0'; if (isDebug()) { msgDebug("hostname = `%s'\n", hostname); msgDebug("dir = `%s'\n", dir ? dir : "/"); msgDebug("port # = `%d'\n", FtpPort); } msgNotify("Looking up host %s..", hostname); if ((gethostbyname(hostname) == NULL) && (inet_addr(hostname) == INADDR_NONE)) { msgConfirm("Cannot resolve hostname `%s'! Are you sure that your\nname server, gateway and network interface are configured?", hostname); goto punt; } user = getenv(FTP_USER); if (!user || !*user) { - snprintf(password, BUFSIZ, "installer@%s", hostname); + snprintf(password, BUFSIZ, "installer@%s", getenv(VAR_HOSTNAME)); login_name = "anonymous"; } else { login_name = user; strcpy(password, getenv(FTP_PASS) ? getenv(FTP_PASS) : login_name); } retries = i = 0; if (OptFlags & (OPT_FTP_RESELECT + OPT_FTP_ABORT)) max_retries = 0; retry: if (i && ++retries > max_retries) { if ((OptFlags & OPT_FTP_ABORT) || !get_new_host(dev)) return FALSE; retries = 0; } msgNotify("Logging in as %s..", login_name); if ((i = FtpOpen(ftp, hostname, login_name, password)) != 0) { if (OptFlags & OPT_NO_CONFIRM) msgNotify("Couldn't open FTP connection to %s\n", hostname); else msgConfirm("Couldn't open FTP connection to %s\n", hostname); goto retry; } FtpPassive(ftp, (OptFlags & OPT_FTP_PASSIVE) ? 1 : 0); FtpBinary(ftp, 1); if (dir && *dir != '\0') { msgNotify("CD to distribution in ~ftp/%s", dir); if ((i = FtpChdir(ftp, dir)) == -2) goto retry; } if (!FtpChdir(ftp, "dists")) { HasDistsDir = TRUE; FtpChdir(ftp, ".."); /* Hope this works! :-( */ } else HasDistsDir = FALSE; if (isDebug()) msgDebug("leaving mediaInitFTP!\n"); ftpInitted = TRUE; return TRUE; punt: FtpClose(ftp); ftp = NULL; (*netDevice->shutdown)(netDevice); return FALSE; } int mediaGetFTP(Device *dev, char *file, Attribs *dist_attrs) { int fd; int nretries = 0, max_retries = MAX_FTP_RETRIES; Boolean inDists = FALSE; if (OptFlags & (OPT_FTP_RESELECT + OPT_FTP_ABORT) || dev->flags & OPT_EXPLORATORY_GET) max_retries = 1; while ((fd = FtpGet(ftp, file)) < 0) { /* If a hard fail, try to "bounce" the ftp server to clear it */ if (fd == -2 || ++nretries > max_retries) { if ((OptFlags & OPT_FTP_ABORT) || (dev->flags & OPT_EXPLORATORY_GET)) return -1; else if (!get_new_host(dev)) return -2; nretries = 0; continue; } if (HasDistsDir) { if (!inDists) { FtpChdir(ftp, "dists"); inDists = TRUE; } else { FtpChdir(ftp, ".."); inDists = FALSE; } } } if (inDists) FtpChdir(ftp, ".."); return fd; } Boolean mediaCloseFTP(Device *dev, int fd) { FtpEOF(ftp); if (!close(fd)) return (TRUE); return FALSE; } void mediaShutdownFTP(Device *dev) { Device *netdev = (Device *)dev->private; if (!ftpInitted) return; if (ftp != NULL) { FtpClose(ftp); ftp = NULL; } (*netdev->shutdown)(netdev); ftpInitted = FALSE; } Index: stable/2.1/release/sysinstall/install.c =================================================================== --- stable/2.1/release/sysinstall/install.c (revision 10989) +++ stable/2.1/release/sysinstall/install.c (revision 10990) @@ -1,518 +1,555 @@ /* * The new sysinstall program. * * This is probably the last program in the `sysinstall' line - the next * generation being essentially a complete rewrite. * - * $Id: install.c,v 1.71.2.3 1995/09/22 23:22:20 jkh Exp $ + * $Id: install.c,v 1.71.2.4 1995/09/23 22:20:12 jkh Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer, * verbatim and that no modifications are made prior to this * point in the file. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * This product includes software developed by Jordan Hubbard * for the FreeBSD Project. * 4. The name of Jordan Hubbard or the FreeBSD project may not be used to * endorse or promote products derived from this software without specific * prior written permission. * * THIS SOFTWARE IS PROVIDED BY JORDAN HUBBARD ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL JORDAN HUBBARD OR HIS PETS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, LIFE OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * */ #include "sysinstall.h" #include #include #include #include #include #include #include Boolean SystemWasInstalled = FALSE; static Boolean copy_self(void); static Boolean root_extract(void); static Chunk *rootdev; static Boolean checkLabels(void) { Device **devs; Disk *disk; Chunk *c1, *c2, *swapdev, *usrdev; int i; rootdev = swapdev = usrdev = NULL; devs = deviceFind(NULL, DEVICE_TYPE_DISK); /* First verify that we have a root device */ for (i = 0; devs[i]; i++) { if (!devs[i]->enabled) continue; disk = (Disk *)devs[i]->private; msgDebug("Scanning disk %s for root filesystem\n", disk->name); if (!disk->chunks) msgFatal("No chunk list found for %s!", disk->name); for (c1 = disk->chunks->part; c1; c1 = c1->next) { if (c1->type == freebsd) { for (c2 = c1->part; c2; c2 = c2->next) { if (c2->type == part && c2->subtype != FS_SWAP && c2->private) { if (c2->flags & CHUNK_IS_ROOT) { if (rootdev) { msgConfirm("WARNING: You have more than one root device set?!\nUsing the first one found."); continue; } rootdev = c2; } else if (!strcmp(((PartInfo *)c2->private)->mountpoint, "/usr")) { if (usrdev) { msgConfirm("WARNING: You have more than one /usr filesystem.\nUsing the first one found."); continue; } usrdev = c2; } } } } } } /* Now check for swap devices */ for (i = 0; devs[i]; i++) { disk = (Disk *)devs[i]->private; msgDebug("Scanning disk %s for swap partitions\n", disk->name); if (!disk->chunks) msgFatal("No chunk list found for %s!", disk->name); for (c1 = disk->chunks->part; c1; c1 = c1->next) { if (c1->type == freebsd) { for (c2 = c1->part; c2; c2 = c2->next) { if (c2->type == part && c2->subtype == FS_SWAP) { swapdev = c2; break; } } } } } if (!rootdev) { msgConfirm("No root device found - you must label a partition as /\n in the label editor."); return FALSE; } else if (rootdev->name[strlen(rootdev->name) - 1] != 'a') { msgConfirm("Invalid placement of root partition. For now, we only support\nmounting root partitions on \"a\" partitions due to limitations\nin the FreeBSD boot code. Please correct this and\ntry again."); return FALSE; } if (!swapdev) { msgConfirm("No swap devices found - you must create at least one\nswap partition."); return FALSE; } if (!usrdev) msgConfirm("WARNING: No /usr filesystem found. This is not technically\nan error if your root filesystem is big enough (or you later\nintend to get your /usr filesystem over NFS), but it may otherwise\ncause you trouble and is not recommended procedure!"); return TRUE; } static Boolean installInitial(void) { static Boolean alreadyDone = FALSE; if (alreadyDone) return TRUE; if (!getenv(DISK_PARTITIONED)) { msgConfirm("You need to partition your disk before you can proceed with\nthe installation."); return FALSE; } if (!getenv(DISK_LABELLED)) { msgConfirm("You need to assign disk labels before you can proceed with\nthe installation."); return FALSE; } if (!checkLabels()) return FALSE; /* If we refuse to proceed, bail. */ if (msgYesNo("Last Chance! Are you SURE you want continue the installation?\n\nIf you're running this on an existing system, we STRONGLY\nencourage you to make proper backups before proceeding.\nWe take no responsibility for lost disk contents!")) return FALSE; (void)diskPartitionWrite(NULL); if (!installFilesystems()) { msgConfirm("Couldn't make filesystems properly. Aborting."); return FALSE; } if (!copy_self()) { msgConfirm("Couldn't clone the boot floppy onto the root file system.\nAborting."); return FALSE; } dialog_clear(); chroot("/mnt"); chdir("/"); variable_set2(RUNNING_ON_ROOT, "yes"); /* stick a helpful shell over on the 4th VTY */ if (OnVTY && !fork()) { int i, fd; extern int login_tty(int); msgDebug("Starting an emergency holographic shell over on the 4th screen\n"); for (i = 0; i < 64; i++) close(i); fd = open("/dev/ttyv3", O_RDWR); ioctl(0, TIOCSCTTY, &fd); dup2(0, 1); dup2(0, 2); if (login_tty(fd) == -1) { msgNotify("Can't set controlling terminal"); exit(1); } printf("Warning: This shell is chroot()'d to /mnt\n"); execlp("sh", "-sh", 0); exit(1); } alreadyDone = TRUE; + return TRUE; +} + +int +installFixit(char *str) +{ + struct ufs_args args; + pid_t child; + int waitstatus; + + memset(&args, 0, sizeof(args)); + args.fspec = "/dev/fd0"; + + while (1) { + int status; + + msgConfirm("Please insert the fixit disk and press return"); + if (mount(MOUNT_UFS, "/mnt", MNT_RDONLY, (caddr_t)&args) != -1) + break; + if (msgYesNo("Unable to mount the fixit floppy - do you want to try again?")) + return TRUE; + } + dialog_clear(); + dialog_update(); + end_dialog(); + DialogActive = FALSE; + if (child = fork()) + (void)waitpid(child, &waitstatus, 0); + else { + setenv("PATH", "/bin:/sbin:/usr/bin:/usr/sbin:/stand:/mnt", 1); + execlp("sh", "-sh", 0); + return -1; + } + DialogActive = TRUE; + dialog_clear(); + dialog_update(); + unmount("/mnt", MNT_FORCE); return TRUE; } int installExpress(char *str) { msgConfirm("In the next menu, you will need to set up a DOS-style\n" "(\"fdisk\") partitioning scheme for your hard disk. If you\n" "don't want to do anything special, just type `A' to use the\n" "whole disk and then `Q' to quit. If you wish to share\n" "a disk with multiple operating systems, do NOT use the\n" "`A' command."); diskPartitionEditor("express"); msgConfirm("Next, you need to lay out BSD partitions inside of the\n" "fdisk partition just created. If you don't want to\n" "do anything special, just type `A' to use the default\n" "partitioning scheme and then `Q' to quit."); diskLabelEditor("express"); msgConfirm("Now it is time to select an installation subset. There\n" "are many different configurations, ranging from minimal\n" "installation sets to full X developer oriented configs.\n" "You can also select a custom software set if none of the\n" "default configurations are suitable."); while(!Dists) { dmenuOpenSimple(&MenuInstallType); } msgConfirm("Finally, you must specify an installation medium."); dmenuOpenSimple(&MenuMedia); installCommit("express"); dmenuOpenSimple(&MenuConfigure); return 0; } /* * What happens when we select "Commit" in the custom installation menu. * * This is broken into multiple stages so that the user can do a full installation but come * back here again to load more distributions, perhaps from a different media type. * This would allow, for example, the user to load the majority of the system from CDROM * and then use ftp to load just the DES dist. */ int installCommit(char *str) { Device **devs; int i; if (!Dists) { msgConfirm("You haven't told me what distributions to load yet!\nPlease select a distribution from the Distributions menu."); return 0; } if (!mediaVerify()) return 0; if (RunningAsInit && !SystemWasInstalled) { if (!installInitial()) return 0; configFstab(); } if (RunningAsInit && !SystemWasInstalled && !root_extract()) { msgConfirm("Failed to load the ROOT distribution. Please correct\nthis problem and try again."); return 0; } /* If we're about to extract the bin dist again, reset the installed state */ if (Dists & DIST_BIN) SystemWasInstalled = FALSE; (void)distExtractAll(NULL); if (!SystemWasInstalled && access("/kernel", R_OK)) { if (vsystem("ln -f /kernel.GENERIC /kernel")) { msgConfirm("Unable to link /kernel into place!"); return 0; } } /* Resurrect /dev after bin distribution screws it up */ if (RunningAsInit && !SystemWasInstalled) { msgNotify("Remaking all devices.. Please wait!"); if (vsystem("cd /dev; sh MAKEDEV all")) msgConfirm("MAKEDEV returned non-zero status"); msgNotify("Resurrecting /dev entries for slices.."); devs = deviceFind(NULL, DEVICE_TYPE_DISK); if (!devs) msgFatal("Couldn't get a disk device list!"); /* Resurrect the slices that the former clobbered */ for (i = 0; devs[i]; i++) { Disk *disk = (Disk *)devs[i]->private; Chunk *c1; if (!disk->chunks) msgFatal("No chunk list found for %s!", disk->name); for (c1 = disk->chunks->part; c1; c1 = c1->next) { if (c1->type == freebsd) { msgNotify("Making slice entries for %s", c1->name); if (vsystem("cd /dev; sh MAKEDEV %sh", c1->name)) msgConfirm("Unable to make slice entries for %s!", c1->name); } } } } /* XXX Do all the last ugly work-arounds here which we'll try and excise someday right?? XXX */ /* BOGON #1: XFree86 extracting /usr/X11R6 with root-only perms */ if (file_readable("/usr/X11R6")) chmod("/usr/X11R6", 0755); /* BOGON #2: We leave /etc in a bad state */ chmod("/etc", 0755); dialog_clear(); /* We get a NULL value for str if run from installExpress(), in which case we don't want to print the following */ if (str) { if (Dists) msgConfirm("Installation completed with some errors. You may wish\nto scroll through the debugging messages on ALT-F2 with the scroll-lock\nfeature. Press [ENTER] to return to the installation menu."); else msgConfirm("Installation completed successfully, now press [ENTER] to return\nto the main menu. If you have any network devices you have not yet\nconfigured, see the Interface configuration item on the\nConfiguration menu."); } SystemWasInstalled = TRUE; return 0; } /* Go newfs and/or mount all the filesystems we've been asked to */ Boolean installFilesystems(void) { int i; Disk *disk; Chunk *c1, *c2; Device **devs; char dname[40]; PartInfo *p = (PartInfo *)rootdev->private; Boolean RootReadOnly; command_clear(); devs = deviceFind(NULL, DEVICE_TYPE_DISK); /* First, create and mount the root device */ if (strcmp(p->mountpoint, "/")) msgConfirm("Warning: %s is marked as a root partition but is mounted on %s", rootdev->name, p->mountpoint); if (p->newfs) { int i; sprintf(dname, "/dev/r%sa", rootdev->disk->name); msgNotify("Making a new root filesystem on %s", dname); i = vsystem("%s %s", p->newfs_cmd, dname); if (i) { msgConfirm("Unable to make new root filesystem! Command returned status %d", i); return FALSE; } RootReadOnly = FALSE; } else { RootReadOnly = TRUE; msgConfirm("Warning: You have selected a Read-Only root device\nand may be unable to find the appropriate device entries on it\nif it is from an older pre-slice version of FreeBSD."); sprintf(dname, "/dev/r%sa", rootdev->disk->name); msgNotify("Checking integrity of existing %s filesystem", dname); i = vsystem("fsck -y %s", dname); if (i) msgConfirm("Warning: fsck returned status off %d - this partition may be\nunsafe to use.", i); } sprintf(dname, "/dev/%sa", rootdev->disk->name); if (Mount("/mnt", dname)) { msgConfirm("Unable to mount the root file system! Giving up."); return FALSE; } /* Now buzz through the rest of the partitions and mount them too */ for (i = 0; devs[i]; i++) { if (!devs[i]->enabled) continue; disk = (Disk *)devs[i]->private; if (!disk->chunks) { msgConfirm("No chunk list found for %s!", disk->name); return FALSE; } /* Make the proper device mount points in /mnt/dev */ if (!(RootReadOnly && disk == rootdev->disk)) { Mkdir("/mnt/dev", NULL); MakeDevDisk(disk, "/mnt/dev"); } for (c1 = disk->chunks->part; c1; c1 = c1->next) { if (c1->type == freebsd) { for (c2 = c1->part; c2; c2 = c2->next) { if (c2->type == part && c2->subtype != FS_SWAP && c2->private) { PartInfo *tmp = (PartInfo *)c2->private; if (!strcmp(tmp->mountpoint, "/")) continue; if (tmp->newfs) command_shell_add(tmp->mountpoint, "%s /mnt/dev/r%s", tmp->newfs_cmd, c2->name); else command_shell_add(tmp->mountpoint, "fsck -y /mnt/dev/r%s", c2->name); command_func_add(tmp->mountpoint, Mount, c2->name); } else if (c2->type == part && c2->subtype == FS_SWAP) { char fname[80]; int i; sprintf(fname, "/mnt/dev/%s", c2->name); i = swapon(fname); if (!i) msgNotify("Added %s as a swap device", fname); else msgConfirm("Unable to add %s as a swap device: %s", fname, strerror(errno)); } } } else if (c1->type == fat && c1->private && !RootReadOnly) { char name[FILENAME_MAX]; sprintf(name, "/mnt%s", ((PartInfo *)c1->private)->mountpoint); Mkdir(name, NULL); } } } /* Copy the boot floppy's dev files */ if (vsystem("find -x /dev | cpio -pdmV /mnt")) { msgConfirm("Couldn't clone the /dev files!"); return FALSE; } command_sort(); command_execute(); return TRUE; } /* Copy the boot floppy contents into /stand */ static Boolean copy_self(void) { int i; msgWeHaveOutput("Copying the boot floppy to /stand on root filesystem"); i = vsystem("find -x /stand | cpio -pdmV /mnt"); if (i) { msgConfirm("Copy returned error status of %d!", i); return FALSE; } /* Copy the /etc files into their rightful place */ if (vsystem("cd /mnt/stand; find etc | cpio -pdmV /mnt")) { msgConfirm("Couldn't copy up the /etc files!"); return TRUE; } return TRUE; } static Boolean loop_on_root_floppy(void); static Boolean root_extract(void) { int fd; static Boolean alreadyExtracted = FALSE; if (alreadyExtracted) return TRUE; if (mediaDevice) { if (isDebug()) msgDebug("Attempting to extract root image from %s device\n", mediaDevice->description); switch(mediaDevice->type) { case DEVICE_TYPE_FLOPPY: alreadyExtracted = loop_on_root_floppy(); break; default: if (!(*mediaDevice->init)(mediaDevice)) break; fd = (*mediaDevice->get)(mediaDevice, "floppies/root.flp", NULL); if (fd < 0) { msgConfirm("Couldn't get root image from %s!\nWill try to get it from floppy.", mediaDevice->name); (*mediaDevice->shutdown)(mediaDevice); alreadyExtracted = loop_on_root_floppy(); } else { msgNotify("Loading root image from %s", mediaDevice->name); alreadyExtracted = mediaExtractDist("/", fd); (*mediaDevice->close)(mediaDevice, fd); } break; } } else alreadyExtracted = loop_on_root_floppy(); return alreadyExtracted; } static Boolean loop_on_root_floppy(void) { int fd; int status = FALSE; while (1) { fd = getRootFloppy(); if (fd != -1) { msgNotify("Extracting root floppy.."); status = mediaExtractDist("/", fd); close(fd); break; } } return status; } Index: stable/2.1/release/sysinstall/media.c =================================================================== --- stable/2.1/release/sysinstall/media.c (revision 10989) +++ stable/2.1/release/sysinstall/media.c (revision 10990) @@ -1,486 +1,486 @@ /* * The new sysinstall program. * * This is probably the last attempt in the `sysinstall' line, the next * generation being slated to essentially a complete rewrite. * - * $Id: media.c,v 1.25 1995/06/11 19:30:03 rgrimes Exp $ + * $Id: media.c,v 1.25.2.1 1995/07/21 10:53:58 rgrimes Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer, * verbatim and that no modifications are made prior to this * point in the file. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * This product includes software developed by Jordan Hubbard * for the FreeBSD Project. * 4. The name of Jordan Hubbard or the FreeBSD project may not be used to * endorse or promote products derived from this software without specific * prior written permission. * * THIS SOFTWARE IS PROVIDED BY JORDAN HUBBARD ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL JORDAN HUBBARD OR HIS PETS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, LIFE OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * */ #include #include #include #include #include #include #include #include "sysinstall.h" static int genericHook(char *str, DeviceType type) { Device **devs; /* Clip garbage off the ends */ string_prune(str); str = string_skipwhite(str); if (!*str) return 0; devs = deviceFind(str, type); if (devs) mediaDevice = devs[0]; return devs ? 1 : 0; } static int cdromHook(char *str) { return genericHook(str, DEVICE_TYPE_CDROM); } /* * Return 1 if we successfully found and set the installation type to * be a CD. */ int mediaSetCDROM(char *str) { Device **devs; int cnt; devs = deviceFind(NULL, DEVICE_TYPE_CDROM); cnt = deviceCount(devs); if (!cnt) { msgConfirm("No CDROM devices found! Please check that your system's\nconfiguration is correct and that the CDROM drive is of a supported\ntype. For more information, consult the hardware guide\nin the Doc menu."); return 0; } else if (cnt > 1) { DMenu *menu; int status; menu = deviceCreateMenu(&MenuMediaCDROM, DEVICE_TYPE_CDROM, cdromHook); if (!menu) msgFatal("Unable to create CDROM menu! Something is seriously wrong."); status = dmenuOpenSimple(menu); free(menu); if (!status) return 0; } else mediaDevice = devs[0]; return mediaDevice ? 1 : 0; } static int floppyHook(char *str) { return genericHook(str, DEVICE_TYPE_FLOPPY); } /* * Return 1 if we successfully found and set the installation type to * be a floppy */ int mediaSetFloppy(char *str) { Device **devs; int cnt; devs = deviceFind(NULL, DEVICE_TYPE_FLOPPY); cnt = deviceCount(devs); if (!cnt) { msgConfirm("No floppy devices found! Please check that your system's\nconfiguration is correct. For more information, consult the hardware guide\nin the Doc menu."); return 0; } else if (cnt > 1) { DMenu *menu; int status; menu = deviceCreateMenu(&MenuMediaFloppy, DEVICE_TYPE_FLOPPY, floppyHook); if (!menu) msgFatal("Unable to create Floppy menu! Something is seriously wrong."); status = dmenuOpenSimple(menu); free(menu); if (!status) return 0; } else mediaDevice = devs[0]; return mediaDevice ? 1 : 0; } static int DOSHook(char *str) { return genericHook(str, DEVICE_TYPE_DOS); } /* * Return 1 if we successfully found and set the installation type to * be a DOS partition. */ int mediaSetDOS(char *str) { Device **devs; int cnt; devs = deviceFind(NULL, DEVICE_TYPE_DOS); cnt = deviceCount(devs); if (!cnt) { msgConfirm("No DOS primary partitions found! This installation method is unavailable"); return 0; } else if (cnt > 1) { DMenu *menu; int status; menu = deviceCreateMenu(&MenuMediaDOS, DEVICE_TYPE_DOS, DOSHook); if (!menu) msgFatal("Unable to create DOS menu! Something is seriously wrong."); status = dmenuOpenSimple(menu); free(menu); if (!status) return 0; } else mediaDevice = devs[0]; return mediaDevice ? 1 : 0; } static int tapeHook(char *str) { return genericHook(str, DEVICE_TYPE_TAPE); } /* * Return 1 if we successfully found and set the installation type to * be a tape drive. */ int mediaSetTape(char *str) { Device **devs; int cnt; devs = deviceFind(NULL, DEVICE_TYPE_TAPE); cnt = deviceCount(devs); if (!cnt) { msgConfirm("No tape drive devices found! Please check that your system's\nconfiguration is correct. For more information, consult the hardware guide\nin the Doc menu."); return 0; } else if (cnt > 1) { DMenu *menu; int status; menu = deviceCreateMenu(&MenuMediaTape, DEVICE_TYPE_TAPE, tapeHook); if (!menu) msgFatal("Unable to create tape drive menu! Something is seriously wrong."); status = dmenuOpenSimple(menu); free(menu); if (!status) return 0; } else mediaDevice = devs[0]; if (mediaDevice) { char *val; val = msgGetInput("/usr/tmp", "Please enter the name of a temporary directory containing\nsufficient space for holding the contents of this tape (or\ntapes). The contents of this directory will be removed\nafter installation, so be sure to specify a directory that\ncan be erased afterward!"); if (!val) mediaDevice = NULL; else mediaDevice->private = strdup(val); } return mediaDevice ? 1 : 0; } /* * Return 0 if we successfully found and set the installation type to * be an ftp server */ int mediaSetFTP(char *str) { static Device ftpDevice; char *cp; if (!dmenuOpenSimple(&MenuMediaFTP)) return 0; cp = getenv("ftp"); if (!cp) return 0; if (!strcmp(cp, "other")) { cp = msgGetInput("ftp://", "Please specify the URL of a FreeBSD distribution on a\nremote ftp site. This site must accept either anonymous\nftp or you should have set an ftp username and password\nin the Options Menu.\nA URL looks like this: ftp:///\nWhere is relative to the anonymous ftp directory or the\nhome directory of the user being logged in as."); if (!cp || strncmp("ftp://", cp, 6)) return 0; else variable_set2("ftp", cp); } strcpy(ftpDevice.name, cp); /* XXX hack: if str == NULL, we were called by an ftp strategy routine and don't need to reinit all */ if (!str) return 1; if (!tcpDeviceSelect()) return 0; ftpDevice.type = DEVICE_TYPE_FTP; ftpDevice.init = mediaInitFTP; ftpDevice.get = mediaGetFTP; ftpDevice.close = mediaCloseFTP; ftpDevice.shutdown = mediaShutdownFTP; ftpDevice.private = mediaDevice; /* Set to network device by tcpDeviceSelect() */ mediaDevice = &ftpDevice; return 1; } int mediaSetFTPActive(char *str) { OptFlags &= OPT_FTP_ACTIVE; return mediaSetFTP(str); } int mediaSetFTPPassive(char *str) { OptFlags &= OPT_FTP_PASSIVE; return mediaSetFTP(str); } int mediaSetUFS(char *str) { static Device ufsDevice; char *val; val = msgGetInput(NULL, "Enter a fully qualified pathname for the directory\ncontaining the FreeBSD distribution files:"); if (!val) return 0; strcpy(ufsDevice.name, "ufs"); ufsDevice.type = DEVICE_TYPE_UFS; ufsDevice.init = dummyInit; ufsDevice.get = mediaGetUFS; ufsDevice.close = dummyClose; ufsDevice.shutdown = dummyShutdown; ufsDevice.private = strdup(val); mediaDevice = &ufsDevice; return 1; } int mediaSetNFS(char *str) { static Device nfsDevice; char *val; val = msgGetInput(NULL, "Please enter the full NFS file specification for the remote\nhost and directory containing the FreeBSD distribution files.\nThis should be in the format: hostname:/some/freebsd/dir"); if (!val) return 0; strncpy(nfsDevice.name, val, DEV_NAME_MAX); if (!tcpDeviceSelect()) return 0; nfsDevice.type = DEVICE_TYPE_NFS; nfsDevice.init = mediaInitNFS; nfsDevice.get = mediaGetNFS; nfsDevice.close = dummyClose; nfsDevice.shutdown = mediaShutdownNFS; nfsDevice.private = mediaDevice; mediaDevice = &nfsDevice; return 1; } Boolean mediaExtractDistBegin(char *dir, int *fd, int *zpid, int *cpid) { int i, pfd[2],qfd[2]; if (!dir) dir = "/"; Mkdir(dir, NULL); chdir(dir); pipe(pfd); pipe(qfd); *zpid = fork(); if (!*zpid) { dup2(qfd[0], 0); close(qfd[0]); dup2(pfd[1], 1); close(pfd[1]); if (DebugFD != -1) dup2(DebugFD, 2); else { close(2); open("/dev/null", O_WRONLY); } close(qfd[1]); close(pfd[0]); i = execl("/stand/gunzip", "/stand/gunzip", 0); if (isDebug()) msgDebug("/stand/gunzip command returns %d status\n", i); exit(i); } *fd = qfd[1]; close(qfd[0]); *cpid = fork(); if (!*cpid) { dup2(pfd[0], 0); close(pfd[0]); close(pfd[1]); close(qfd[1]); if (DebugFD != -1) { dup2(DebugFD, 1); dup2(DebugFD, 2); } else { close(1); open("/dev/null", O_WRONLY); dup2(1, 2); } - i = execl("/stand/cpio", "/stand/cpio", "-iduVm", "-H", "tar", 0); + i = execl("/stand/cpio", "/stand/cpio", "-iduVm", 0); if (isDebug()) msgDebug("/stand/cpio command returns %d status\n", i); exit(i); } close(pfd[0]); close(pfd[1]); return TRUE; } Boolean mediaExtractDistEnd(int zpid, int cpid) { int i,j; i = waitpid(zpid, &j, 0); if (i < 0) { /* Don't check status - gunzip seems to return a bogus one! */ dialog_clear(); if (isDebug()) msgDebug("wait for gunzip returned status of %d!\n", i); return FALSE; } i = waitpid(cpid, &j, 0); if (i < 0 || WEXITSTATUS(j)) { dialog_clear(); if (isDebug()) msgDebug("cpio returned error status of %d!\n", WEXITSTATUS(j)); return FALSE; } return TRUE; } Boolean mediaExtractDist(char *dir, int fd) { int i, j, zpid, cpid, pfd[2]; if (!dir) dir = "/"; Mkdir(dir, NULL); chdir(dir); pipe(pfd); zpid = fork(); if (!zpid) { dup2(fd, 0); close(fd); dup2(pfd[1], 1); close(pfd[1]); if (DebugFD != -1) dup2(DebugFD, 2); else { close(2); open("/dev/null", O_WRONLY); } close(pfd[0]); i = execl("/stand/gunzip", "/stand/gunzip", 0); if (isDebug()) msgDebug("/stand/gunzip command returns %d status\n", i); exit(i); } cpid = fork(); if (!cpid) { dup2(pfd[0], 0); close(pfd[0]); close(fd); close(pfd[1]); if (DebugFD != -1) { dup2(DebugFD, 1); dup2(DebugFD, 2); } else { close(1); open("/dev/null", O_WRONLY); dup2(1, 2); } i = execl("/stand/cpio", "/stand/cpio", "-iduVm", "-H", "tar", 0); if (isDebug()) msgDebug("/stand/cpio command returns %d status\n", i); exit(i); } close(pfd[0]); close(pfd[1]); i = waitpid(zpid, &j, 0); if (i < 0) { /* Don't check status - gunzip seems to return a bogus one! */ dialog_clear(); if (isDebug()) msgDebug("wait for gunzip returned status of %d!\n", i); return FALSE; } i = waitpid(cpid, &j, 0); if (i < 0 || WEXITSTATUS(j)) { dialog_clear(); if (isDebug()) msgDebug("cpio returned error status of %d!\n", WEXITSTATUS(j)); return FALSE; } return TRUE; } Boolean mediaGetType(void) { if (!dmenuOpenSimple(&MenuMedia)) return FALSE; return TRUE; } /* Return TRUE if all the media variables are set up correctly */ Boolean mediaVerify(void) { if (!mediaDevice) { msgConfirm("Media type not set! Please select a media type\nfrom the Installation menu before proceeding."); return FALSE; } return TRUE; } Index: stable/2.1/release/sysinstall/menus.c =================================================================== --- stable/2.1/release/sysinstall/menus.c (revision 10989) +++ stable/2.1/release/sysinstall/menus.c (revision 10990) @@ -1,916 +1,916 @@ /* * The new sysinstall program. * * This is probably the last program in the `sysinstall' line - the next * generation being essentially a complete rewrite. * - * $Id: menus.c,v 1.42.2.6 1995/09/22 23:35:20 jkh Exp $ + * $Id: menus.c,v 1.42.2.7 1995/09/23 22:03:13 jkh Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer, * verbatim and that no modifications are made prior to this * point in the file. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * This product includes software developed by Jordan Hubbard * for the FreeBSD Project. * 4. The name of Jordan Hubbard or the FreeBSD project may not be used to * endorse or promote products derived from this software without specific * prior written permission. * * THIS SOFTWARE IS PROVIDED BY JORDAN HUBBARD ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL JORDAN HUBBARD OR HIS PETS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, LIFE OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * */ #include "sysinstall.h" /* All the system menus go here. * * Hardcoded things like version number strings will disappear from * these menus just as soon as I add the code for doing inline variable * expansion. */ /* The initial installation menu */ DMenu MenuInitial = { DMENU_NORMAL_TYPE, "Welcome to FreeBSD RELEASE_NAME!", /* title */ "This is the main menu of the FreeBSD installation system. Please\n\ select one of the options below by using the arrow keys or typing the\n\ first character of the option name you're interested in. Invoke an\n\ option by pressing [ENTER].", /* prompt */ "Press F1 for usage instructions", /* help line */ "usage", /* help file */ { { "Usage", "Quick start - How to use this menu system.", /* U */ DMENU_DISPLAY_FILE, "usage", 0, 0 }, { "Doc", "More detailed documentation on FreeBSD.", /* D */ DMENU_SUBMENU, &MenuDocumentation, 0, 0 }, { "Options", "Select various options for this utility.", /* O */ DMENU_SUBMENU, &MenuOptions, 0, 0 }, { "Custom", "Begin a custom installation", /* C */ DMENU_SUBMENU, &MenuInstallCustom, 0, 0 }, { "Express", "Begin a quick installation", /* E */ DMENU_CALL, &installExpress, 0, 0 }, - { "sh", "Go to a shell for debugging or repair", - DMENU_EXEC_COMMAND, "-sh", 0, 0 }, + { "Fixit", "Mount fixit floppy and go into repair mode", + DMENU_CALL, &installFixitMode, 0, 0 }, { "Quit", "Exit this menu (and the installation)", /* Q */ DMENU_CANCEL, NULL, 0, 0 }, { NULL } }, }; /* The main documentation menu */ DMenu MenuDocumentation = { DMENU_NORMAL_TYPE, "Documentation for FreeBSD RELEASE_NAME", /* Title */ "If you are at all unsure about the configuration of your hardware\n\ or are looking to build a system specifically for FreeBSD, read the\n\ Hardware guide! New users should also read the Install document for\n\ a step-by-step tutorial on installing FreeBSD. For general information,\n\ consult the README file.", "Confused? Press F1 for help.", "usage", { { "README", "Read this for a general description of FreeBSD", DMENU_DISPLAY_FILE, "README", 0, 0 }, { "Hardware", "The FreeBSD survival guide for PC hardware.", DMENU_DISPLAY_FILE, "hardware", 0, 0 }, { "Install", "A step-by-step guide to installing FreeBSD.", DMENU_DISPLAY_FILE, "install", 0, 0 }, { "Copyright", "The FreeBSD Copyright notices.", DMENU_DISPLAY_FILE, "COPYRIGHT", 0, 0 }, { "Release", "The release notes for this version of FreeBSD.", DMENU_DISPLAY_FILE, "RELNOTES", 0, 0 }, { "Exit", "Exit this menu (returning to previous)", DMENU_CANCEL, NULL, 0, 0 }, { NULL } }, }; DMenu MenuMediaCDROM = { DMENU_NORMAL_TYPE | DMENU_SELECTION_RETURNS, "Choose a CDROM type", "FreeBSD can be installed directly from a CDROM containing a valid\n\ FreeBSD RELEASE_NAME distribution. If you are seeing this menu it is because\n\ more than one CDROM drive was found on your system. Please select one\n\ of the following CDROM drives as your installation drive.", "Press F1 to read the installation guide", "install", { { NULL } }, }; DMenu MenuMediaFloppy = { DMENU_NORMAL_TYPE | DMENU_SELECTION_RETURNS, "Choose a Floppy drive", "You have more than one floppy drive. Please chose the drive\n\ you would like to use for this operation", NULL, NULL, { { NULL } }, }; DMenu MenuMediaDOS = { DMENU_NORMAL_TYPE | DMENU_SELECTION_RETURNS, "Choose a DOS partition", "FreeBSD can be installed directly from a DOS partition\n\ assuming, of course, that you have copied the relevant\n\ distributions into your DOS partition before starting this\n\ installation. If this is not the case then you should reboot\n\ DOS at this time and copy the distributions you wish to install\n\ into a \"FREEBSD\" subdirectory on one of your DOS partitions.\n\ Otherwise, please select the DOS partition containing the FreeBSD\n\ distribution files.", "Press F1 to read the installation guide", "install", { { NULL } }, }; DMenu MenuMediaFTP = { DMENU_NORMAL_TYPE | DMENU_SELECTION_RETURNS, "Please specify an FTP site", "FreeBSD is distributed from a number of sites on the Internet. Please\n\ select the site closest to you or \"other\" if you'd like to specify another\n\ choice. Also note that not all sites carry every possible distribution!\n\ Distributions other than the basic user set are only guaranteed to be\n\ available from the Primary site.\n\n\ If the first site selected doesn't respond, try one of the alternates.\n\ You may also wish to investigate the options menu in case of trouble.\n\ To specify a URL not in this list, chose \"other\".", "Select a site that's close!", "install", { { "Primary Site", "ftp.freebsd.org", DMENU_SET_VARIABLE, "ftp=ftp://ftp.freebsd.org/pub/FreeBSD/RELEASE_NAME", 0, 0 }, { "Secondary Site", "freefall.cdrom.com", DMENU_SET_VARIABLE, "ftp=ftp://freefall.cdrom.com/pub/FreeBSD/RELEASE_NAME", 0, 0 }, { "Other", "Specify some other ftp site by URL", DMENU_SET_VARIABLE, "ftp=other", 0, 0 }, { "Australia", "ftp.physics.usyd.edu.au", DMENU_SET_VARIABLE, "ftp=ftp://ftp.physics.usyd.edu.au/FreeBSD/RELEASE_NAME", 0, 0 }, { "Finland", "nic.funet.fi", DMENU_SET_VARIABLE, "ftp=ftp://nic.funet.fi/pub/unix/FreeBSD/RELEASE_NAME", 0, 0 }, { "France", "ftp.ibp.fr", DMENU_SET_VARIABLE, "ftp=ftp://ftp.ibp.fr/pub/FreeBSD/RELEASE_NAME", 0, 0 }, { "Germany", "ftp.fb9dv.uni-duisburg.de", DMENU_SET_VARIABLE, "ftp=ftp://ftp.fb9dv.uni-duisburg.de/pub/unix/FreeBSD/RELEASE_NAME", 0, 0 }, { "Germany #2", "gil.physik.rwth-aachen.de", DMENU_SET_VARIABLE, "ftp=ftp://gil.physik.rwth-aachen.de/pub/FreeBSD/RELEASE_NAME", 0, 0 }, { "Germany #3", "ftp.uni-paderborn.de", DMENU_SET_VARIABLE, "ftp=ftp://ftp.uni-paderborn.de/freebsd/RELEASE_NAME", 0, 0 }, { "Hong Kong", "ftp.hk.super.net", DMENU_SET_VARIABLE, "ftp=ftp://ftp.hk.super.net/pub/FreeBSD/RELEASE_NAME", 0, 0 }, { "Israel", "orgchem.weizmann.ac.il", DMENU_SET_VARIABLE, "ftp=ftp://orgchem.weizmann.ac.il/pub/FreeBSD-RELEASE_NAME", 0, 0 }, { "Japan", "ftp.sra.co.jp", DMENU_SET_VARIABLE, "ftp=ftp://ftp.sra.co.jp/pub/os/FreeBSD/RELEASE_NAME", 0, 0 }, { "Japan #2", "ftp.mei.co.jp", DMENU_SET_VARIABLE, "ftp=ftp://ftp.mei.co.jp/free/PC-UNIX/FreeBSD/RELEASE_NAME", 0, 0 }, { "Japan #3", "ftp.waseda.ac.jp", DMENU_SET_VARIABLE, "ftp=ftp://ftp.waseda.ac.jp/pub/FreeBSD/RELEASE_NAME", 0, 0 }, { "Japan #4", "ftp.pu-toyama.ac.jp", DMENU_SET_VARIABLE, "ftp=ftp://ftp.pu-toyama.ac.jp/pub/FreeBSD/RELEASE_NAME", 0, 0 }, { "Japan #5", "ftpsv1.u-aizu.ac.jp", DMENU_SET_VARIABLE, "ftp=ftp://ftpsv1.u-aizu.ac.jp/pub/os/FreeBSD/RELEASE_NAME", 0, 0 }, { "Japan #6", "ftp.tut.ac.jp", DMENU_SET_VARIABLE, "ftp://ftp.tut.ac.jp/FreeBSD/RELEASE_NAME", 0, 0 }, { "Japan #7", "ftp.ee.uec.ac.jp", DMENU_SET_VARIABLE, "ftp=ftp://ftp.ee.uec.ac.jp/pub/os/mirror/ftp.freebsd.org/RELEASE_NAME", 0, 0 }, { "Japan #8", "ftp.tokyonet.ad.jp", DMENU_SET_VARIABLE, "ftp://ftp.tokyonet.ad.jp/pub/FreeBSD/RELEASE_NAME", 0, 0 }, { "Korea", "ftp.cau.ac.kr", DMENU_SET_VARIABLE, "ftp=ftp://ftp.cau.ac.kr/pub/FreeBSD/RELEASE_NAME", 0, 0 }, { "Netherlands", "ftp.nl.net", DMENU_SET_VARIABLE, "ftp=ftp://ftp.nl.net/pub/os/FreeBSD/RELEASE_NAME", 0, 0 }, { "Russia", "ftp.kiae.su", DMENU_SET_VARIABLE, "ftp=ftp://ftp.kiae.su/FreeBSD/RELEASE_NAME", 0, 0 }, { "Sweden", "ftp.luth.se", DMENU_SET_VARIABLE, "ftp=ftp://ftp.luth.se/pub/FreeBSD/RELEASE_NAME", 0, 0 }, { "Taiwan", "netbsd.csie.nctu.edu.tw", DMENU_SET_VARIABLE, "ftp=ftp://netbsd.csie.nctu.edu.tw/pub/FreeBSD/RELEASE_NAME", 0, 0 }, { "Thailand", "ftp.nectec.or.th", DMENU_SET_VARIABLE, "ftp=ftp://ftp.nectec.or.th/pub/FreeBSD/RELEASE_NAME", 0, 0 }, { "UK", "ftp.demon.co.uk", DMENU_SET_VARIABLE, "ftp=ftp://ftp.demon.co.uk/pub/BSD/FreeBSD/RELEASE_NAME", 0, 0 }, { "UK #2", "src.doc.ic.ac.uk", DMENU_SET_VARIABLE, "ftp=ftp://src.doc.ic.ac.uk/packages/unix/FreeBSD/RELEASE_NAME", 0, 0 }, { "UK #3", "unix.hensa.ac.uk", DMENU_SET_VARIABLE, "ftp=ftp://unix.hensa.ac.uk/mirrors/walnut.creek/FreeBSD/RELEASE_NAME", 0, 0 }, { "USA", "ref.tfs.com", DMENU_SET_VARIABLE, "ftp=ftp://ref.tfs.com/pub/FreeBSD/RELEASE_NAME", 0, 0 }, { "USA #2", "ftp.dataplex.net", DMENU_SET_VARIABLE, "ftp=ftp://ftp.dataplex.net/pub/FreeBSD/RELEASE_NAME", 0, 0 }, { "USA #3", "kryten.atinc.com", DMENU_SET_VARIABLE, "ftp=ftp://kryten.atinc.com/pub/FreeBSD/RELEASE_NAME", 0, 0 }, { "USA #4", "ftp.neosoft.com", DMENU_SET_VARIABLE, "ftp=ftp://ftp.neosoft.com/systems/FreeBSD/RELEASE_NAME", 0, 0 }, { NULL } } }; DMenu MenuMediaTape = { DMENU_NORMAL_TYPE | DMENU_SELECTION_RETURNS, "Choose a tape drive type", "FreeBSD can be installed from tape drive, though this installation\n\ method requires a certain amount of temporary storage in addition\n\ to the space required by the distribution itself (tape drives make\n\ poor random-access devices, so we extract _everything_ on the tape\n\ in one pass). If you have sufficient space for this, then you should\n\ select one of the following tape devices detected on your system.", "Press F1 to read the installation guide", "install", { { NULL } }, }; DMenu MenuNetworkDevice = { DMENU_NORMAL_TYPE | DMENU_SELECTION_RETURNS, "Choose a network interface type", "FreeBSD can be installed directly over a network, using NFS or FTP.\n If you are using PPP over a serial device (cuaa0 or cuaa1) as opposed\n\ to a direct ethernet connection, then you may first need to dial your\n\ service provider using the ppp utility we provide for that purpose.\n\ You can also install over a parallel port using a special \"laplink\"\n\ cable, though this only works if you have another FreeBSD machine running\n\ a fairly recent (2.0R or later) release to talk to.\n\n\ To use PPP select one of the serial devices, otherwise select lp0 for\n\ the parallel port or one of the ethernet controllers (if you have one)\n\ for an ethernet installation.", "Press F1 to read network configuration manual", "network_device", { { NULL } }, }; /* The media selection menu */ DMenu MenuMedia = { DMENU_NORMAL_TYPE | DMENU_SELECTION_RETURNS, "Choose Installation Media", "FreeBSD can be installed from a variety of different installation\n\ media, ranging from floppies to the Internet. If you're installing\n\ FreeBSD from a supported CDROM drive then this is generally the best\n\ media to use, unless you have some overriding reason for using another\n\ media.", "Press F1 for more information on the various media types", "media", { { "CDROM", "Install from a FreeBSD CDROM", DMENU_CALL, mediaSetCDROM, 0, 0 }, { "DOS", "Install from a DOS partition", DMENU_CALL, mediaSetDOS, 0, 0 }, { "File System", "Install from a mounted filesystem", DMENU_CALL, mediaSetUFS, 0, 0 }, { "Floppy", "Install from a floppy disk set", DMENU_CALL, mediaSetFloppy, 0, 0 }, { "FTP Active", "Install from an FTP server in active mode", DMENU_CALL, mediaSetFTPActive, 0, 0 }, { "FTP Passive", "Install from an FTP server in passive mode", DMENU_CALL, mediaSetFTPPassive, 0, 0 }, { "NFS", "Install over NFS", DMENU_CALL, mediaSetNFS, 0, 0 }, { "Tape", "Install from SCSI or QIC tape", DMENU_CALL, mediaSetTape, 0, 0 }, { NULL } }, }; /* The installation type menu */ DMenu MenuInstallType = { DMENU_NORMAL_TYPE | DMENU_SELECTION_RETURNS, "Choose Installation Type", "As a convenience, we provide several \"canned\" installation types.\n\ These select what we consider to be the most reasonable defaults for the\n\ type of system in question. If you would prefer to pick and choose\n\ the list of distributions yourself, simply select \"custom\".", "Press F1 for more information on these options.", "distributions", { { "Developer", "Full sources, binaries and doc but no games [171MB]", DMENU_CALL, distSetDeveloper, 0, 0 }, { "X-Developer", "Same as above, but includes XFree86 [196MB]", DMENU_CALL, distSetXDeveloper, 0, 0 }, { "Kern-Developer", "Full binaries and doc, kernel sources only [35MB]", DMENU_CALL, distSetKernDeveloper, 0, 0 }, { "User", "Average user - binaries and doc but no sources [19MB]", DMENU_CALL, distSetUser, 0, 0 }, { "X-User", "Same as above, but includes XFree86 [45MB]", DMENU_CALL, distSetXUser, 0, 0 }, { "Minimal", "The smallest configuration possible [15MB]", DMENU_CALL, distSetMinimum, 0, 0 }, { "Everything", "All sources, binaries and XFree86 binaries [700MB]", DMENU_CALL, distSetEverything, 0, 0 }, { "Custom", "Specify your own distribution set [?]", DMENU_SUBMENU, &MenuDistributions, 0, 0 }, { "Clear", "Reset selected distribution list to None", DMENU_CALL, distReset, 0, 0 }, { NULL } }, }; static char * DESFlagCheck(DMenuItem *item) { return (Dists & DIST_DES) ? "ON" : "OFF"; } static char * srcFlagCheck(DMenuItem *item) { return (Dists & DIST_SRC) ? "ON" : "OFF"; } static char * x11FlagCheck(DMenuItem *item) { return (Dists & DIST_XF86) ? "ON" : "OFF"; } DMenu MenuDistributions = { DMENU_MULTIPLE_TYPE | DMENU_SELECTION_RETURNS, "Select the distributions you wish to install.", "Please check off the distributions you wish to install. At the\n\ very minimum, this should be \"bin\". WARNING: Do not export the\n\ DES distribution out of the U.S.! It is for U.S. customers only.", NULL, NULL, { { "bin", "Binary base distribution (required) [36MB]", DMENU_SET_FLAG, &Dists, DIST_BIN, 0, dmenuFlagCheck }, { "commercial", "Commercial demos and shareware [10MB]", DMENU_SET_FLAG, &Dists, DIST_COMMERCIAL, 0, dmenuFlagCheck }, { "compat1x", "FreeBSD 1.x binary compatibility package [2MB]", DMENU_SET_FLAG, &Dists, DIST_COMPAT1X, 0, dmenuFlagCheck }, { "compat20", "FreeBSD 2.0 binary compatibility package [2MB]", DMENU_SET_FLAG, &Dists, DIST_COMPAT20, 0, dmenuFlagCheck }, { "DES", "DES encryption code - NOT FOR EXPORT! [.3MB]", DMENU_CALL, distSetDES, 0, 0, DESFlagCheck }, { "dict", "Spelling checker dictionary files [4.2MB]", DMENU_SET_FLAG, &Dists, DIST_DICT, 0, dmenuFlagCheck }, { "games", "Games (non-commercial) [6.4MB]", DMENU_SET_FLAG, &Dists, DIST_GAMES, 0, dmenuFlagCheck }, { "info", "GNU info files [4.1MB]", DMENU_SET_FLAG, &Dists, DIST_INFO, 0, dmenuFlagCheck }, { "man", "System manual pages - recommended [3.3MB]", DMENU_SET_FLAG, &Dists, DIST_MANPAGES, 0, dmenuFlagCheck }, { "proflibs", "Profiled versions of the libraries [3.3MB]", DMENU_SET_FLAG, &Dists, DIST_PROFLIBS, 0, dmenuFlagCheck }, { "src", "Sources for everything but DES [120MB]", DMENU_CALL, distSetSrc, 0, 0, srcFlagCheck }, { "XFree86", "The XFree86 3.1.1u1 distribution [?]", DMENU_CALL, distSetXF86, 0, 0, x11FlagCheck }, { "Experimental", "Work in progress!", DMENU_SET_FLAG, &Dists, DIST_EXPERIMENTAL, 0, dmenuFlagCheck }, { NULL } }, }; DMenu MenuDESDistributions = { DMENU_MULTIPLE_TYPE | DMENU_SELECTION_RETURNS, "Select the encryption facilities you wish to install.", "Please check off any special DES-based encryption distributions\n\ you would like to install. Please note that these services are NOT FOR\n\ EXPORT from the United States, nor are they available on CDROM (for the\n\ same reason). For information on non-U.S. FTP distributions of this\n\ software, please consult the release notes.", NULL, NULL, { { "des", "Basic DES services (rlogin, init, etc) [1MB]", DMENU_SET_FLAG, &DESDists, DIST_DES_DES, 0, dmenuFlagCheck }, { "krb", "Kerberos encryption services [2MB]", DMENU_SET_FLAG, &DESDists, DIST_DES_KERBEROS, 0, dmenuFlagCheck }, { "sebones", "Sources for eBones (Kerberos) [1MB]", DMENU_SET_FLAG, &DESDists, DIST_DES_SEBONES, 0, dmenuFlagCheck }, { "ssecure", "Sources for DES libs and utilities [1MB]", DMENU_SET_FLAG, &DESDists, DIST_DES_SSECURE, 0, dmenuFlagCheck }, { NULL } }, }; DMenu MenuSrcDistributions = { DMENU_MULTIPLE_TYPE | DMENU_SELECTION_RETURNS, "Select the sub-components of src you wish to install.", "Please check off those portions of the FreeBSD source tree\n\ you wish to install.", NULL, NULL, { { "base", "top-level files in /usr/src [300K]", DMENU_SET_FLAG, &SrcDists, DIST_SRC_BASE, 0, dmenuFlagCheck }, { "gnu", "/usr/src/gnu (software from the GNU Project) [42MB]", DMENU_SET_FLAG, &SrcDists, DIST_SRC_GNU, 0, dmenuFlagCheck }, { "etc", "/usr/src/etc (miscellaneous system files) [460K]", DMENU_SET_FLAG, &SrcDists, DIST_SRC_ETC, 0, dmenuFlagCheck }, { "games", "/usr/src/games (diversions) [7.8MB]", DMENU_SET_FLAG, &SrcDists, DIST_SRC_GAMES, 0, dmenuFlagCheck }, { "include", "/usr/src/include (header files) [467K]", DMENU_SET_FLAG, &SrcDists, DIST_SRC_INCLUDE, 0, dmenuFlagCheck }, { "lib", "/usr/src/lib (system libraries) [9.2MB]", DMENU_SET_FLAG, &SrcDists, DIST_SRC_LIB, 0, dmenuFlagCheck }, { "libexec", "/usr/src/libexec (system programs) [1.2MB]", DMENU_SET_FLAG, &SrcDists, DIST_SRC_LIBEXEC, 0, dmenuFlagCheck }, { "lkm", "/usr/src/lkm (Loadable Kernel Modules) [193K]", DMENU_SET_FLAG, &SrcDists, DIST_SRC_LKM, 0, dmenuFlagCheck }, { "release", "/usr/src/release (release-generation tools) [533K]", DMENU_SET_FLAG, &SrcDists, DIST_SRC_RELEASE, 0, dmenuFlagCheck }, { "bin", "/usr/src/bin (system binaries) [2.5MB]", DMENU_SET_FLAG, &SrcDists, DIST_SRC_BIN, 0, dmenuFlagCheck }, { "sbin", "/usr/src/sbin (system binaries) [1.3MB]", DMENU_SET_FLAG, &SrcDists, DIST_SRC_SBIN, 0, dmenuFlagCheck }, { "share", "/usr/src/share (documents and shared files) [10MB]", DMENU_SET_FLAG, &SrcDists, DIST_SRC_SHARE, 0, dmenuFlagCheck }, { "sys", "/usr/src/sys (FreeBSD kernel) [13MB]", DMENU_SET_FLAG, &SrcDists, DIST_SRC_SYS, 0, dmenuFlagCheck }, { "ubin", "/usr/src/usr.bin (user binaries) [13MB]", DMENU_SET_FLAG, &SrcDists, DIST_SRC_UBIN, 0, dmenuFlagCheck }, { "usbin", "/usr/src/usr.sbin (aux system binaries) [14MB]", DMENU_SET_FLAG, &SrcDists, DIST_SRC_USBIN, 0, dmenuFlagCheck }, { NULL } }, }; static int clearx11(char *str) { XF86Dists = 0; XF86ServerDists = 0; XF86FontDists = 0; Dists &= ~DIST_XF86; return 0; } DMenu MenuXF86Select = { DMENU_NORMAL_TYPE, "XFree86 3.1.1u1 Distribution", "Please select the components you need from the XFree86 3.1.1u1\n\ distribution. We recommend that you select what you need from the basic\n\ components set and at least one entry from the Server and Font set menus.", "Press F1 to read the XFree86 release notes for FreeBSD", "XF86", { { "Basic", "Basic component menu (required)", DMENU_SUBMENU, &MenuXF86SelectCore, 0, 0 }, { "Server", "X server menu", DMENU_SUBMENU, &MenuXF86SelectServer, 0, 0 }, { "Fonts", "Font set menu", DMENU_SUBMENU, &MenuXF86SelectFonts, 0, 0 }, { "Clear", "Reset XFree86 distribution list", DMENU_CALL, clearx11, 0, 0, 0 }, { "Exit", "Exit this menu (returning to previous)", DMENU_CANCEL, NULL, 0, 0 }, { NULL } }, }; DMenu MenuXF86SelectCore = { DMENU_MULTIPLE_TYPE | DMENU_SELECTION_RETURNS, "XFree86 3.1.1 base distribution types", "Please check off the basic XFree86 components you wish to install.", "Press F1 to read the XFree86 release notes for FreeBSD", "XF86", { { "bin", "X client applications and shared libs [4MB].", DMENU_SET_FLAG, &XF86Dists, DIST_XF86_BIN, 0, dmenuFlagCheck }, { "lib", "Data files needed at runtime [600K]", DMENU_SET_FLAG, &XF86Dists, DIST_XF86_LIB, 0, dmenuFlagCheck }, { "xicf", "Customizable xinit runtime configuration file [100K]", DMENU_SET_FLAG, &XF86Dists, DIST_XF86_XINIT, 0, dmenuFlagCheck }, { "xdcf", "Customizable xdm runtime configuration file [100K]", DMENU_SET_FLAG, &XF86Dists, DIST_XF86_XDMCF, 0, dmenuFlagCheck }, { "doc", "READMEs and XFree86 specific man pages [500K]", DMENU_SET_FLAG, &XF86Dists, DIST_XF86_DOC, 0, dmenuFlagCheck }, { "man", "Man pages (except XFree86 specific ones) [1.2MB]", DMENU_SET_FLAG, &XF86Dists, DIST_XF86_MAN, 0, dmenuFlagCheck }, { "prog", "Programmer's header and library files [4MB]", DMENU_SET_FLAG, &XF86Dists, DIST_XF86_PROG, 0, dmenuFlagCheck }, { "link", "X Server reconfiguration kit [7.8MB]", DMENU_SET_FLAG, &XF86Dists, DIST_XF86_LINK, 0, dmenuFlagCheck }, { "pex", "PEX fonts and libs needed by PEX apps [500K]", DMENU_SET_FLAG, &XF86Dists, DIST_XF86_PEX, 0, dmenuFlagCheck }, { "sources", "XFree86 3.1.1u1 standard + contrib sources [200MB]", DMENU_SET_FLAG, &XF86Dists, DIST_XF86_SRC, 0, dmenuFlagCheck }, { NULL } }, }; DMenu MenuXF86SelectFonts = { DMENU_MULTIPLE_TYPE | DMENU_SELECTION_RETURNS, "Font distribution selection.", "Please check off the individual font distributions you wish to\n\ install. At the minimum, you should install the standard\n\ 75 DPI and misc fonts if you're also installing a server\n\ (these are selected by default).", "Press F1 to read the XFree86 release notes for FreeBSD", "XF86", { { "fnts", "Standard 75 DPI and miscellaneous fonts [3.6MB]", DMENU_SET_FLAG, &XF86FontDists, DIST_XF86_FONTS_MISC, 0, dmenuFlagCheck }, { "f100", "100 DPI fonts [1.8MB]", DMENU_SET_FLAG, &XF86FontDists, DIST_XF86_FONTS_100, 0, dmenuFlagCheck }, { "fscl", "Speedo and Type scalable fonts [1.6MB]", DMENU_SET_FLAG, &XF86FontDists, DIST_XF86_FONTS_SCALE, 0, dmenuFlagCheck }, { "non", "Japanese, Chinese and other non-english fonts [3.3MB]", DMENU_SET_FLAG, &XF86FontDists, DIST_XF86_FONTS_NON, 0, dmenuFlagCheck }, { "server", "Font server [0.3MB]", DMENU_SET_FLAG, &XF86FontDists, DIST_XF86_FONTS_SERVER, 0, dmenuFlagCheck }, { NULL } }, }; DMenu MenuXF86SelectServer = { DMENU_MULTIPLE_TYPE | DMENU_SELECTION_RETURNS, "X Server selection.", "Please check off the types of X servers you wish to install.\n\ If you are unsure as to which server will work for your graphics card,\n\ it is recommended that try the SVGA or VGA16 servers (the VGA16 and\n\ Mono servers are particularly well-suited to most LCD displays).", "Press F1 to read the XFree86 release notes for FreeBSD", "XF86", { { "SVGA", "Standard VGA or Super VGA display [1MB]", DMENU_SET_FLAG, &XF86ServerDists, DIST_XF86_SERVER_SVGA, 0, dmenuFlagCheck }, { "VGA16", "Standard 16 color VGA display [1MB]", DMENU_SET_FLAG, &XF86ServerDists, DIST_XF86_SERVER_VGA16, 0, dmenuFlagCheck }, { "Mono", "Standard Monochrome display [1MB]", DMENU_SET_FLAG, &XF86ServerDists, DIST_XF86_SERVER_MONO, 0, dmenuFlagCheck }, { "8514", "8-bit (256 color) IBM 8514 or compatible card [1MB]", DMENU_SET_FLAG, &XF86ServerDists, DIST_XF86_SERVER_8514, 0, dmenuFlagCheck }, { "AGX", "8-bit AGX card [1MB]", DMENU_SET_FLAG, &XF86ServerDists, DIST_XF86_SERVER_AGX, 0, dmenuFlagCheck }, { "Ma8", "8-bit ATI Mach8 card [1MB]", DMENU_SET_FLAG, &XF86ServerDists, DIST_XF86_SERVER_MACH8, 0, dmenuFlagCheck }, { "Ma32", "8 and 16-bit (65K color) for ATI Mach32 card [1MB]", DMENU_SET_FLAG, &XF86ServerDists, DIST_XF86_SERVER_MACH32, 0, dmenuFlagCheck }, { "Ma64", "8 and 16-bit (65K color) for ATI Mach64 card [1MB]", DMENU_SET_FLAG, &XF86ServerDists, DIST_XF86_SERVER_MACH64, 0, dmenuFlagCheck }, { "P9K", "8, 16, and 24-bit color for Weitek P9000 based boards [1MB]", DMENU_SET_FLAG, &XF86ServerDists, DIST_XF86_SERVER_P9000, 0, dmenuFlagCheck }, { "S3", "8, 16 and 24-bit color for S3 based boards [1MB]", DMENU_SET_FLAG, &XF86ServerDists, DIST_XF86_SERVER_S3, 0, dmenuFlagCheck }, { "W32", "8-bit Color for ET4000/W32, /W32i and /W32p cards [1MB]", DMENU_SET_FLAG, &XF86ServerDists, DIST_XF86_SERVER_W32, 0, dmenuFlagCheck }, { "nest", "A nested server for testing purposes [1MB]", DMENU_SET_FLAG, &XF86ServerDists, DIST_XF86_SERVER_NEST, 0, dmenuFlagCheck }, { NULL } }, }; DMenu MenuDiskDevices = { DMENU_MULTIPLE_TYPE | DMENU_SELECTION_RETURNS, "Select Drive(s)", "Please select the drive, or drives, on which you wish to install\n\ FreeBSD. You need to select at least one drive containing some free\n\ space, though FreeBSD can be installed across several drives if you do\n\ not have the required space on a single drive. If you wish to boot\n\ off a drive that's not a `zero drive', or have multiple operating\n\ systems on your machine, you will have the option to install a boot\n\ manager later. To select a drive, use the arrow keys to move to it\n\ and press [SPACE].", "Press F1 for important information regarding geometry!", "drives", { { NULL } }, }; /* Local work func for MenuOptions */ static int clearFlags(char *str) { OptFlags = 0; return 1; /* Gross, but forces menu rebuild */ } static char * userPassCheck(DMenuItem *item) { char *cp = getenv(FTP_USER); return (cp && *cp) ? "ON" : "OFF"; } static char * ftpFlagCheck(DMenuItem *item) { /* Verify that everything's sane */ if ((OptFlags & (OPT_FTP_ABORT + OPT_FTP_RESELECT)) == (OPT_FTP_ABORT + OPT_FTP_RESELECT)) OptFlags &= ~OPT_FTP_RESELECT; if (!(OptFlags & (OPT_FTP_ABORT + OPT_FTP_RESELECT))) OptFlags |= OPT_FTP_ABORT; if (*((unsigned int *)item->ptr) & item->parm) return "ON"; return "OFF"; } /* The installation options menu */ DMenu MenuOptions = { DMENU_MULTIPLE_TYPE | DMENU_SELECTION_RETURNS, "Choose Installation Options", "The following options control how this utility will deal\n\ with various possible error conditions and how verbose it will\n\ be at various stages.", "Press F1 for more help on these options", "options", { { "FTP Options", "Set FTP specific options", DMENU_SUBMENU, &MenuFTPOptions, 0, 0, 0 }, { "NFS Secure", "NFS server talks only on a secure port", DMENU_SET_FLAG, &OptFlags, OPT_NFS_SECURE, 0, dmenuFlagCheck }, { "NFS Slow", "User is using a slow PC or ethernet card", DMENU_SET_FLAG, &OptFlags, OPT_SLOW_ETHER, 0, dmenuFlagCheck }, { "Debugging", "Turn on the extra debugging flag", DMENU_SET_FLAG, &OptFlags, OPT_DEBUG, 0, dmenuFlagCheck }, { "Yes To All", "Assume \"Yes\" answers to all non-critical dialogs", DMENU_SET_FLAG, &OptFlags, OPT_NO_CONFIRM, 0, dmenuFlagCheck }, { "Clear", "Clear All Option Flags", DMENU_CALL, clearFlags, 0, 0 }, { "Exit", "Exit this menu (returning to previous)", DMENU_CANCEL, NULL, 0, 0 }, { NULL } }, }; DMenu MenuFTPOptions = { DMENU_MULTIPLE_TYPE | DMENU_SELECTION_RETURNS, "Choose FTP Options", "This menu allows you to customize the behavior of FTP transfers\n\ for an FTP installation. To select \"Active\" or \"Passive\" mode\n\ FTP, see the Media menu.", NULL, NULL, { { "FTP Abort", "On transfer failure, abort", DMENU_SET_FLAG, &OptFlags, OPT_FTP_ABORT, 0, ftpFlagCheck }, { "FTP Reselect", "On transfer failure, ask for another host", DMENU_SET_FLAG, &OptFlags, OPT_FTP_RESELECT, 0, ftpFlagCheck }, { "FTP userpass", "Specify username and password instead of anonymous", DMENU_CALL, mediaSetFtpUserPass, 0, 0, userPassCheck }, { NULL } }, }; /* The main installation menu */ DMenu MenuInstallCustom = { DMENU_NORMAL_TYPE, "Choose Custom Installation Options", "This is the custom installation menu. You may use this menu to specify\n\ details on the type of distribution you wish to have, where you wish\n\ to install it from and how you wish to allocate disk storage to FreeBSD.", "Press F1 to read the installation guide", "install", { { "Partition", "Allocate disk space for FreeBSD", DMENU_CALL, diskPartitionEditor, 0, 0 }, { "Label", "Label allocated disk partitions", DMENU_CALL, diskLabelEditor, 0, 0 }, { "Distributions", "Choose the type of installation you want", DMENU_SUBMENU, &MenuInstallType, 0, 0 }, { "Media", "Choose the installation media type", DMENU_SUBMENU, &MenuMedia, 0, 0 }, { "Extract", "Extract distributions from selected media", DMENU_CALL, distExtractAll, 0, 0 }, { "Options", "Go to Options submenu", DMENU_SUBMENU, &MenuOptions, 0, 0 }, { "Commit", "Do Write/Make/Extract options in one step", DMENU_CALL, installCommit, 0, 0 }, { "Configure", "Do post-install configuration of FreeBSD", DMENU_SUBMENU, &MenuConfigure, 0, 0 }, { "Exit", "Exit this menu (returning to previous)", DMENU_CANCEL, NULL, 0, 0 }, { NULL } }, }; /* MBR type menu */ DMenu MenuMBRType = { DMENU_RADIO_TYPE | DMENU_SELECTION_RETURNS, "Chose boot manager type", /* title */ "FreeBSD comes with a boot selector that allows you to easily\n\ select between FreeBSD and other operating systems on your machine\n\ at boot time. If you have more than one drive and wish to boot\n\ from other than the first, the boot selector will also allow you\n\ to do so (limitations in the PC BIOS usually prevent this otherwise).\n\ If you do not want a boot selector, or wish to replace an existing\n\ one, select \"standard\". If you would prefer your Master Boot\n\ Record to remain untouched, then select \"none\".", "Press F1 to read the installation guide", "install", { { "BootMgr", "Install the FreeBSD Boot Manager (\"Booteasy\")", DMENU_SET_VALUE, &BootMgr, 0, 0, dmenuRadioCheck }, { "Standard", "Use a standard MBR (no boot manager)", DMENU_SET_VALUE, &BootMgr, 1, 0, dmenuRadioCheck }, { "None", "Leave the Master Boot Record untouched", DMENU_SET_VALUE, &BootMgr, 2, 0, dmenuRadioCheck }, { NULL } }, }; /* Final configuration menu */ DMenu MenuConfigure = { DMENU_NORMAL_TYPE, "FreeBSD Configuration Menu", /* title */ "If you've already installed FreeBSD, you may use this menu to\n\ customize it somewhat to suit your particular configuration. Most\n\ importantly, you can use the Packages utility to load extra \"3rd party\"\n\ software not provided in the base distributions.", "Press F1 for more information on these options", "configure", { { "Add User", "Add users to the system", DMENU_SYSTEM_COMMAND, "adduser -silent", 0, 0 }, { "Console", "Customize system console behavior", DMENU_SUBMENU, &MenuSyscons, 0, 0 }, { "Networking", "Configure additional network services", DMENU_SUBMENU, &MenuNetworking, 0, 0 }, { "Time Zone", "Set which time zone you're in", DMENU_SYSTEM_COMMAND, "rm -f /etc/wall_cmos_clock /etc/localtime; tzsetup", 0, 0 }, { "Packages", "Install extra FreeBSD packaged software", DMENU_CALL, configPackages, 0, 0 }, { "Ports", "Enable the FreeBSD Ports Collection from CD", DMENU_CALL, configPorts, 0, 1 }, { "Root Password", "Set the system manager's password", DMENU_SYSTEM_COMMAND, "passwd root", 0, 0 }, { "XFree86", "Configure XFree86 (if installed)", DMENU_SYSTEM_COMMAND, "/usr/X11R6/bin/xf86config", 0, 0 }, { "Exit", "Exit this menu (returning to previous)", DMENU_CANCEL, NULL, 0, 0 }, { NULL } }, }; static char * menuCheckNTP(DMenuItem *item) { return getenv("ntpdate") ? "ON" : "OFF"; } static char * menuCheckRouted(DMenuItem *item) { return getenv("routedflags") ? "ON" : "OFF"; } DMenu MenuNetworking = { DMENU_MULTIPLE_TYPE | DMENU_SELECTION_RETURNS, "Network Services Menu", "You may have already configured one network device (and the\n\ other various hostname/gateway/name server parameters) in the process\n\ of installing FreeBSD. This menu allows you to configure other\n\ aspects of your system's network configuration.", NULL, NULL, { { "NFS client", "This machine will be an NFS client", DMENU_SET_VARIABLE, "nfs_client=YES", 0, 0, dmenuVarCheck }, { "NFS server", "This machine will be an NFS server", DMENU_SET_VARIABLE, "nfs_server=YES", 0, 0, dmenuVarCheck }, { "Interfaces", "Configure network interfaces", DMENU_CALL, tcpMenuSelect, 0, 0 }, { "ntpdate", "Select a clock-syncronization server", DMENU_SUBMENU, &MenuNTP, 0, 0, menuCheckNTP }, { "routed", "Set flags for routed (default: -q)", DMENU_CALL, configRoutedFlags, 0, 0, menuCheckRouted }, { "rwhod", "This machine wants to run the rwho daemon", DMENU_SET_VARIABLE, "rwhod=YES", 0, 0, dmenuVarCheck }, { "Exit", "Exit this menu (returning to previous)", DMENU_CANCEL, NULL, 0, 0 }, { NULL } }, }; DMenu MenuNTP = { DMENU_NORMAL_TYPE | DMENU_SELECTION_RETURNS, "NTPDATE Server Selection", "There are a number of time syncronization servers available\n\ for public use around the Internet. Please select one reasonably\n\ close to you to have your system time syncronized accordingly.", "These are the primary open-access NTP servers", NULL, { { "Other", "Select a site not on this list", DMENU_CALL, configNTP, 0, 0 }, { "Australia", "ntp.syd.dms.csiro.au (HP 5061 Cesium Beam)", DMENU_SET_VARIABLE, "ntpdate=ntp.syd.dms.csiro.au", 0, 0 }, { "Canada", "tick.usask.ca (GOES clock)", DMENU_SET_VARIABLE, "ntpdate=tick.usask.ca", 0, 0 }, { "France", "canon.inria.fr (TDF clock)", DMENU_SET_VARIABLE, "ntpdate=canon.inria.fr", 0, 0 }, { "Germany", "ntps1-{0,1,2}.uni-erlangen.de (GPS)", DMENU_SET_VARIABLE, "ntpdate=ntps1-0.uni-erlangen.de", 0, 0 }, { "Germany #2", "ntps1-0.cs.tu-berlin.de (GPS)", DMENU_SET_VARIABLE, "ntpdate=ntps1-0.cs.tu-berlin.de", 0, 0 }, { "Japan", "clock.nc.fukuoka-u.ac.jp (GPS clock)", DMENU_SET_VARIABLE, "ntpdate=clock.nc.fukuoka-u.ac.jp", 0, 0}, { "Japan #2", "clock.tl.fukuoka-u.ac.jp (GPS clock)", DMENU_SET_VARIABLE, "ntpdate=clock.tl.fukuoka-u.ac.jp", 0, 0}, { "Netherlands", "ntp0.nl.net (GPS clock)", DMENU_SET_VARIABLE, "ntpdate=ntp0.nl.net", 0, 0 }, { "Norway", "timer.unik.no (NTP clock)", DMENU_SET_VARIABLE, "ntpdate=timer.unik.no", 0, 0 }, { "Sweden", "Time1.Stupi.SE (Cesium/GPS)", DMENU_SET_VARIABLE, "ntpdate=Time1.Stupi.SE", 0, 0 }, { "Switzerland", "swisstime.ethz.ch (DCF77 clock)", DMENU_SET_VARIABLE, "ntpdate=swisstime.ethz.ch", 0, 0 }, { "U.S. East Coast", "bitsy.mit.edu (WWV clock)", DMENU_SET_VARIABLE, "ntpdate=bitsy.mit.edu", 0, 0 }, { "U.S. East Coast #2", "otc1.psu.edu (WWV clock)", DMENU_SET_VARIABLE, "ntpdate=otc1.psu.edu", 0, 0 }, { "U.S. West Coast", "apple.com (WWV clock)", DMENU_SET_VARIABLE, "ntpdate=apple.com", 0, 0 }, { "U.S. West Coast #2", "clepsydra.dec.com (GOES clock)", DMENU_SET_VARIABLE, "ntpdate=clepsydra.dec.com", 0, 0 }, { "U.S. West Coast #3", "clock.llnl.gov (WWVB clock)", DMENU_SET_VARIABLE, "ntpdate=clock.llnl.gov", 0, 0 }, { "U.S. Midwest", "ncar.ucar.edu (WWVB clock)", DMENU_SET_VARIABLE, "ntpdate=ncar.ucar.edu", 0, 0 }, { "U.S. Pacific", "chantry.hawaii.net (WWV/H clock)", DMENU_SET_VARIABLE, "ntpdate=chantry.hawaii.net", 0, 0 }, { "U.S. Southwest", "shorty.chpc.utexas.edu (WWV clock)", DMENU_SET_VARIABLE, "ntpdate=shorty.chpc.utexas.edu", 0, 0 }, { NULL } }, }; DMenu MenuSyscons = { DMENU_NORMAL_TYPE, "System Console Configuration", "The default system console driver for FreeBSD (syscons) has a\n\ number of configuration options which may be set according to\n\ your preference.\n\n\ When you are done setting configuration options, select Cancel.", "Configure your system console settings", NULL, { { "Keymap", "Choose an alternate keyboard map", DMENU_SUBMENU, &MenuSysconsKeymap, 0, 0 }, { "Repeat", "Set the rate at which keys repeat", DMENU_SUBMENU, &MenuSysconsKeyrate, 0, 0 }, { "Saver", "Configure the screen saver", DMENU_SUBMENU, &MenuSysconsSaver, 0, 0 }, { "Exit", "Exit this menu (returning to previous)", DMENU_CANCEL, NULL, 0, 0 }, { NULL } }, }; DMenu MenuSysconsKeymap = { DMENU_RADIO_TYPE | DMENU_SELECTION_RETURNS, "System Console Keymap", "The default system console driver for FreeBSD (syscons) defaults\n\ to a standard \"American\" keyboard map. Users in other countries\n\ (or with different keyboard preferences) may wish to choose one of\n\ the other keymaps below.", "Choose a keyboard map", NULL, { { "Danish CP865", "Danish Code Page 865 keymap", DMENU_SET_VARIABLE, "keymap=danish.cp865", 0, 0, dmenuVarCheck }, { "Danish ISO", "Danish ISO keymap", DMENU_SET_VARIABLE, "keymap=danish.iso", 0, 0, dmenuVarCheck }, { "French ISO", "French ISO keymap", DMENU_SET_VARIABLE, "keymap=fr.iso", 0, 0, dmenuVarCheck }, { "German CP850", "German Code Page 850 keymap", DMENU_SET_VARIABLE, "keymap=german.cp850", 0, 0, dmenuVarCheck }, { "German ISO", "German ISO keymap", DMENU_SET_VARIABLE, "keymap=german.iso", 0, 0, dmenuVarCheck }, { "Russian CP866", "Russian Code Page 866 keymap", DMENU_SET_VARIABLE, "keymap=ru.cp866", 0, 0, dmenuVarCheck }, { "Russian KOI8", "Russian koi8 keymap", DMENU_SET_VARIABLE, "keymap=ru.koi8-r", 0, 0, dmenuVarCheck }, { "Russian s-KOI8", "Russian shifted koi8 keymap", DMENU_SET_VARIABLE, "keymap=ru.koi8-r.shift", 0, 0, dmenuVarCheck }, { "Swedish CP850", "Swedish Code Page 850 keymap", DMENU_SET_VARIABLE, "keymap=swedish.cp850", 0, 0, dmenuVarCheck }, { "Swedish ISO", "Swedish ISO keymap", DMENU_SET_VARIABLE, "keymap=swedish.iso", 0, 0, dmenuVarCheck }, { "U.K. CP850", "United Kingdom Code Page 850 keymap", DMENU_SET_VARIABLE, "keymap=uk.cp850", 0, 0, dmenuVarCheck }, { "U.K. ISO", "United Kingdom ISO keymap", DMENU_SET_VARIABLE, "keymap=uk.iso", 0, 0, dmenuVarCheck }, { "U.S. ISO", "United States ISO keymap", DMENU_SET_VARIABLE, "keymap=us.iso", 0, 0, dmenuVarCheck }, { NULL } }, }; DMenu MenuSysconsKeyrate = { DMENU_RADIO_TYPE | DMENU_SELECTION_RETURNS, "System Console Keyboard Repeat Rate", "This menu allows you to set the speed at which keys repeat\n\ when held down.", "Choose a keyboard repeat rate", NULL, { { "Slow", "Slow keyboard repeat rate", DMENU_SET_VARIABLE, "keyrate=slow", 0, 0, dmenuVarCheck }, { "Normal", "\"Normal\" keyboard repeat rate", DMENU_SET_VARIABLE, "keyrate=normal", 0, 0, dmenuVarCheck }, { "Fast", "Fast keyboard repeat rate", DMENU_SET_VARIABLE, "keyrate=fast", 0, 0, dmenuVarCheck }, { "Default", "Use default keyboard repeat rate", DMENU_SET_VARIABLE, "keyrate=NO", 0, 0, dmenuVarCheck }, { NULL } }, }; static char * menuSaverTimeoutCheck(DMenuItem *item) { return getenv("blanktime") ? "ON" : "OFF"; } DMenu MenuSysconsSaver = { DMENU_MULTIPLE_TYPE | DMENU_SELECTION_RETURNS, "System Console Screen Saver", "By default, the console driver will not attempt to do anything\n\ special with your screen when it's idle. If you expect to leave your\n\ monitor switched on and idle for long periods of time then you should\n\ probably enable one of these screen savers to prevent phosphor burn-in.", "Choose a nifty-looking screen saver", NULL, { { "blank", "Simply blank the screen", DMENU_SET_VARIABLE, "saver=blank", 0, 0, dmenuVarCheck }, { "Green", "\"Green\" power saving mode (if supported by monitor)", DMENU_SET_VARIABLE, "saver=green", 0, 0, dmenuVarCheck }, { "Snake", "Draw a FreeBSD \"snake\" on your screen", DMENU_SET_VARIABLE, "saver=snake", 0, 0, dmenuVarCheck }, { "Star", "A \"twinkling stars\" effect", DMENU_SET_VARIABLE, "saver=star", 0, 0, dmenuVarCheck }, { "Timeout", "Set the screen saver timeout interval", DMENU_CALL, configSaverTimeout, 0, 0, menuSaverTimeoutCheck }, { "Exit", "Exit this menu (returning to previous)", DMENU_CANCEL, NULL, 0, 0 }, { NULL } }, }; Index: stable/2.1/release/sysinstall/network.c =================================================================== --- stable/2.1/release/sysinstall/network.c (revision 10989) +++ stable/2.1/release/sysinstall/network.c (revision 10990) @@ -1,219 +1,223 @@ /* * The new sysinstall program. * * This is probably the last attempt in the `sysinstall' line, the next * generation being slated to essentially a complete rewrite. * - * $Id: network.c,v 1.7.2.2 1995/07/21 10:57:33 rgrimes Exp $ + * $Id: network.c,v 1.7.2.3 1995/09/18 17:00:24 peter Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer, * verbatim and that no modifications are made prior to this * point in the file. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * This product includes software developed by Jordan Hubbard * for the FreeBSD Project. * 4. The name of Jordan Hubbard or the FreeBSD project may not be used to * endorse or promote products derived from this software without specific * prior written permission. * * THIS SOFTWARE IS PROVIDED BY JORDAN HUBBARD ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL JORDAN HUBBARD OR HIS PETS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, LIFE OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * */ /* These routines deal with getting things off of network media */ #include "sysinstall.h" #include #include #include static Boolean networkInitialized; static pid_t pppPid; static pid_t startPPP(Device *devp); Boolean mediaInitNetwork(Device *dev) { int i; char *rp; char *cp, ifconfig[64]; + char ifname[64]; if (!RunningAsInit || networkInitialized || (dev->flags & OPT_LEAVE_NETWORK_UP)) return TRUE; configResolv(); if (!strncmp("cuaa", dev->name, 4)) { if (!msgYesNo("You have selected a serial-line network interface.\nDo you want to use PPP with it?")) { if (!(dev->private = (void *)startPPP(dev))) { msgConfirm("Unable to start PPP! This installation method\ncannot be used."); return FALSE; } networkInitialized = TRUE; return TRUE; } else { char *val; char attach[256]; /* Cheesy slip attach */ snprintf(attach, 256, "slattach -a -h -l -s 9600 %s", dev->devname); val = msgGetInput(attach, "Warning: SLIP is rather poorly supported in this revision\nof the installation due to the lack of a dialing utility.\nIf you can use PPP for this instead then you're much better\noff doing so, otherwise SLIP works fairly well for *hardwired*\nlinks. Please edit the following slattach command for\ncorrectness (default here is VJ compression, Hardware flow-control,\nignore carrier and 9600 baud data rate) and hit return to execute it."); if (!val) return FALSE; else strcpy(attach, val); if (!vsystem(attach)) dev->private = NULL; else { msgConfirm("slattach returned a bad status! Please verify that\nthe command is correct and try again."); return FALSE; } } + strcpy(ifname, "sl0"); } + else + strcpy(ifname, dev->name); - snprintf(ifconfig, 64, "%s%s", VAR_IFCONFIG, dev->name); + snprintf(ifconfig, 64, "%s%s", VAR_IFCONFIG, ifname); cp = getenv(ifconfig); if (!cp) { - msgConfirm("The %s device is not configured. You will need to do so\nin the Networking configuration menu before proceeding."); + msgConfirm("The %s device is not configured. You will need to do so\nin the Networking configuration menu before proceeding.", ifname); return FALSE; } - i = vsystem("ifconfig %s %s", "sl0", cp); + i = vsystem("ifconfig %s %s", ifname, cp); if (i) { - msgConfirm("Unable to configure the %s interface!\nThis installation method cannot be used.", dev->name); + msgConfirm("Unable to configure the %s interface!\nThis installation method cannot be used.", ifname); return FALSE; } rp = getenv(VAR_GATEWAY); if (!rp || *rp == '0') msgConfirm("No gateway has been set. You may be unable to access hosts\nnot on your local network\n"); else vsystem("route add default %s", rp); networkInitialized = TRUE; return TRUE; } void mediaShutdownNetwork(Device *dev) { char *cp; if (!RunningAsInit || !networkInitialized || (dev->flags & OPT_LEAVE_NETWORK_UP)) return; if (strncmp("cuaa", dev->name, 4)) { int i; char ifconfig[64]; snprintf(ifconfig, 64, "%s%s", VAR_IFCONFIG, dev->name); cp = getenv(ifconfig); if (!cp) return; i = vsystem("ifconfig %s down", dev->name); if (i) msgConfirm("Warning: Unable to down the %s interface properly", dev->name); cp = getenv(VAR_GATEWAY); if (cp) vsystem("route delete default"); networkInitialized = FALSE; } else if (pppPid != 0) { kill(pppPid, SIGTERM); pppPid = 0; } } /* Start PPP on the 3rd screen */ static pid_t startPPP(Device *devp) { int vfd, fd2; FILE *fp; char *val; pid_t pid; char myaddr[16], provider[16], speed[16]; /* We're going over to VTY2 */ vfd = open("/dev/ttyv2", O_RDWR); if (vfd == -1) return 0; /* These are needed to make ppp work */ Mkdir("/var/log", NULL); Mkdir("/var/spool/lock", NULL); Mkdir("/etc/ppp", NULL); /* Get any important user values */ val = msgGetInput("115200", "Enter the baud rate for your modem - this can be higher than the actual\nmaximum data rate since most modems can talk at one speed to the\ncomputer and at another speed to the remote end.\n\nIf you're not sure what to put here, just select the default."); strcpy(speed, val ? val : "115200"); strcpy(provider, getenv(VAR_GATEWAY) ? getenv(VAR_GATEWAY) : "0"); val = msgGetInput(provider, "Enter the IP address of your service provider or 0 if you\ndon't know it and would prefer to negotiate it dynamically."); strcpy(provider, val ? val : "0"); if (devp->private && ((DevInfo *)devp->private)->ipaddr[0]) strcpy(myaddr, ((DevInfo *)devp->private)->ipaddr); else strcpy(myaddr, "0"); fp = fopen("/etc/ppp/ppp.linkup", "w"); if (fp != NULL) { fprintf(fp, "MYADDR:\n"); fprintf(fp, " delete ALL\n"); fprintf(fp, " add 0 0 HISADDR\n"); fchmod(fileno(fp), 0755); fclose(fp); } fd2 = open("/etc/ppp/ppp.secret", O_CREAT); if (fd2 != -1) { fchmod(fd2, 0755); close(fd2); } fp = fopen("/etc/ppp/ppp.conf", "w"); if (!fp) { msgConfirm("Couldn't open /etc/ppp/ppp.conf file! This isn't going to work"); return 0; } fprintf(fp, "default:\n"); fprintf(fp, " set speed %s\n", speed); fprintf(fp, " set device %s\n", devp->devname); fprintf(fp, " set ifaddr %s %s\n", myaddr, provider); fclose(fp); if (isDebug()) msgDebug("Creating /dev/tun0 device.\n"); if (!file_readable("/dev/tun0") && mknod("/dev/tun0", 0600 | S_IFCHR, makedev(52, 0))) { msgConfirm("Warning: No /dev/tun0 device. PPP will not work!"); return 0; } if (!(pid = fork())) { dup2(vfd, 0); dup2(vfd, 1); dup2(vfd, 2); execl("/stand/ppp", "/stand/ppp", (char *)NULL); exit(1); } msgConfirm("The PPP command is now started on screen 3 (type ALT-F3 to\ninteract with it, ALT-F1 to switch back here). The only command\nyou'll probably want or need to use is the \"term\" command\nwhich starts a terminal emulator you can use to talk to your\nmodem and dial the service provider. Once you're connected,\ncome back to this screen and press return. DO NOT PRESS RETURN\nHERE UNTIL THE CONNECTION IS FULLY ESTABLISHED!"); return pid; } Index: stable/2.1/release/sysinstall/sysinstall.h =================================================================== --- stable/2.1/release/sysinstall/sysinstall.h (revision 10989) +++ stable/2.1/release/sysinstall/sysinstall.h (revision 10990) @@ -1,514 +1,514 @@ /* * The new sysinstall program. * * This is probably the last attempt in the `sysinstall' line, the next * generation being slated to essentially a complete rewrite. * - * $Id: sysinstall.h,v 1.42.2.2 1995/09/18 17:00:25 peter Exp $ + * $Id: sysinstall.h,v 1.42.2.3 1995/09/23 22:03:17 jkh Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer, * verbatim and that no modifications are made prior to this * point in the file. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * This product includes software developed by Jordan Hubbard * for the FreeBSD Project. * 4. The name of Jordan Hubbard or the FreeBSD project may not be used to * endorse or promote products derived from this software without specific * prior written permission. * * THIS SOFTWARE IS PROVIDED BY JORDAN HUBBARD ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL JORDAN HUBBARD OR HIS PETS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, LIFE OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * */ #ifndef _SYSINSTALL_H_INCLUDE #define _SYSINSTALL_H_INCLUDE #include #include #include #include #include #include #include #include "libdisk.h" #include "dist.h" /*** Defines ***/ /* Bitfields for menu options */ #define DMENU_NORMAL_TYPE 0x1 /* Normal dialog menu */ #define DMENU_RADIO_TYPE 0x2 /* Radio dialog menu */ #define DMENU_MULTIPLE_TYPE 0x4 /* Multiple choice menu */ #define DMENU_SELECTION_RETURNS 0x8 /* Select item then exit */ #define DMENU_CALL_FIRST 0x10 /* In multiple, use one handler */ /* variable limits */ #define VAR_NAME_MAX 128 #define VAR_VALUE_MAX 1024 /* device limits */ #define DEV_NAME_MAX 128 /* The maximum length of a device name */ #define DEV_MAX 200 /* The maximum number of devices we'll deal with */ #define INTERFACE_MAX 50 /* Maximum number of network interfaces we'll deal with */ #define MAX_FTP_RETRIES 3 /* How many times to beat our heads against the wall */ /* * I make some pretty gross assumptions about having a max of 50 chunks * total - 8 slices and 42 partitions. I can't easily display many more * than that on the screen at once! * * For 2.1 I'll revisit this and try to make it more dynamic, but since * this will catch 99.99% of all possible cases, I'm not too worried. */ #define MAX_CHUNKS 50 /* Internal flag variables */ #define DISK_PARTITIONED "_diskPartitioned" #define DISK_LABELLED "_diskLabelled" #define RUNNING_ON_ROOT "_runningOnRoot" #define TCP_CONFIGURED "_tcpConfigured" #define FTP_USER "_ftpUser" #define FTP_PASS "_ftpPass" #define OPT_NO_CONFIRM 0x0001 #define OPT_NFS_SECURE 0x0002 #define OPT_DEBUG 0x0004 #define OPT_FTP_ACTIVE 0x0008 #define OPT_FTP_PASSIVE 0x0010 #define OPT_FTP_RESELECT 0x0020 #define OPT_FTP_ABORT 0x0040 #define OPT_SLOW_ETHER 0x0080 #define OPT_EXPLORATORY_GET 0x0100 #define OPT_LEAVE_NETWORK_UP 0x0200 #define VAR_HOSTNAME "hostname" #define VAR_DOMAINNAME "domainname" #define VAR_NAMESERVER "nameserver" #define VAR_GATEWAY "defaultrouter" #define VAR_IPADDR "ipaddr" #define VAR_IFCONFIG "ifconfig_" #define VAR_INTERFACES "network_interfaces" /* The help file for the TCP/IP setup screen */ #define TCP_HELPFILE "tcp" /*** Types ***/ typedef unsigned int Boolean; typedef struct disk Disk; typedef struct chunk Chunk; typedef enum { DMENU_DISPLAY_FILE, /* Display a file's contents */ DMENU_SUBMENU, /* Recurse into another menu */ - DMENU_EXEC_COMMAND, /* Exec commmand directly */ DMENU_SYSTEM_COMMAND, /* Run shell commmand */ DMENU_SYSTEM_COMMAND_BOX, /* Same as above, but in prgbox */ DMENU_SET_VARIABLE, /* Set an environment/system var */ DMENU_SET_FLAG, /* Set flag in an unsigned int */ DMENU_SET_VALUE, /* Set unsigned int to value */ DMENU_CALL, /* Call back a C function */ DMENU_CANCEL, /* Cancel out of this menu */ DMENU_NOP, /* Do nothing special for item */ } DMenuItemType; typedef struct _dmenuItem { char *title; /* Our title */ char *prompt; /* Our prompt */ DMenuItemType type; /* What type of item we are */ void *ptr; /* Generic data ptr */ u_long parm; /* Parameter for above */ Boolean disabled; /* Are we temporarily disabled? */ char * (*check)(struct _dmenuItem *); /* Our state */ } DMenuItem; typedef struct _dmenu { unsigned int options; /* What sort of menu we are */ char *title; /* Our title */ char *prompt; /* Our prompt */ char *helpline; /* Line of help at bottom */ char *helpfile; /* Help file for "F1" */ DMenuItem items[0]; /* Array of menu items */ } DMenu; /* A sysconfig variable */ typedef struct _variable { struct _variable *next; char name[VAR_NAME_MAX]; char value[VAR_VALUE_MAX]; } Variable; #define MAX_ATTRIBS 200 #define MAX_NAME 511 #define MAX_VALUE 4095 typedef struct _attribs { char *name; char *value; } Attribs; typedef enum { DEVICE_TYPE_NONE, DEVICE_TYPE_DISK, DEVICE_TYPE_FLOPPY, DEVICE_TYPE_FTP, DEVICE_TYPE_NETWORK, DEVICE_TYPE_CDROM, DEVICE_TYPE_TAPE, DEVICE_TYPE_DOS, DEVICE_TYPE_UFS, DEVICE_TYPE_NFS, DEVICE_TYPE_ANY, } DeviceType; /* A "device" from sysinstall's point of view */ typedef struct _device { char name[DEV_NAME_MAX]; char *description; char *devname; DeviceType type; Boolean enabled; Boolean (*init)(struct _device *dev); int (*get)(struct _device *dev, char *file, Attribs *dist_attrs); Boolean (*close)(struct _device *dev, int fd); void (*shutdown)(struct _device *dev); void *private; unsigned int flags; } Device; /* Some internal representations of partitions */ typedef enum { PART_NONE, PART_SLICE, PART_SWAP, PART_FILESYSTEM, PART_FAT, } PartType; /* The longest newfs command we'll hand to system() */ #define NEWFS_CMD_MAX 256 typedef struct _part_info { Boolean newfs; char mountpoint[FILENAME_MAX]; char newfs_cmd[NEWFS_CMD_MAX]; } PartInfo; typedef int (*commandFunc)(char *key, void *data); #define HOSTNAME_FIELD_LEN 256 #define IPADDR_FIELD_LEN 16 #define EXTRAS_FIELD_LEN 256 /* This is the structure that Network devices carry around in their private, erm, structures */ typedef struct _devPriv { char ipaddr[IPADDR_FIELD_LEN]; char netmask[IPADDR_FIELD_LEN]; char extras[EXTRAS_FIELD_LEN]; } DevInfo; /*** Externs ***/ extern int DebugFD; /* Where diagnostic output goes */ extern Boolean SystemWasInstalled; /* Did we install it? */ extern Boolean RunningAsInit; /* Are we running stand-alone? */ extern Boolean DialogActive; /* Is the dialog() stuff up? */ extern Boolean ColorDisplay; /* Are we on a color display? */ extern Boolean OnVTY; /* On a syscons VTY? */ extern Variable *VarHead; /* The head of the variable chain */ extern Device *mediaDevice; /* Where we're getting our distribution from */ extern unsigned int Dists; /* Which distributions we want */ extern unsigned int DESDists; /* Which naughty distributions we want */ extern unsigned int SrcDists; /* Which src distributions we want */ extern unsigned int XF86Dists; /* Which XFree86 dists we want */ extern unsigned int XF86ServerDists; /* The XFree86 servers we want */ extern unsigned int XF86FontDists; /* The XFree86 fonts we want */ extern unsigned int OptFlags; /* Global options */ extern int BootMgr; /* Which boot manager to use */ extern char *InstallPrefix; /* A location bias */ extern DMenu MenuInitial; /* Initial installation menu */ extern DMenu MenuMBRType; /* Type of MBR to write on the disk */ extern DMenu MenuConfigure; /* Final configuration menu */ extern DMenu MenuDocumentation; /* Documentation menu */ extern DMenu MenuFTPOptions; /* FTP Installation options */ extern DMenu MenuOptions; /* Installation options */ extern DMenu MenuOptionsLanguage; /* Language options menu */ extern DMenu MenuMedia; /* Media type menu */ extern DMenu MenuMediaCDROM; /* CDROM media menu */ extern DMenu MenuMediaDOS; /* DOS media menu */ extern DMenu MenuMediaFloppy; /* Floppy media menu */ extern DMenu MenuMediaFTP; /* FTP media menu */ extern DMenu MenuMediaTape; /* Tape media menu */ extern DMenu MenuNetworkDevice; /* Network device menu */ extern DMenu MenuNTP; /* NTP time server menu */ extern DMenu MenuSyscons; /* System console configuration menu */ extern DMenu MenuSysconsKeymap; /* System console keymap configuration menu */ extern DMenu MenuSysconsKeyrate; /* System console keyrate configuration menu */ extern DMenu MenuSysconsSaver; /* System console saver configuration menu */ extern DMenu MenuNetworking; /* Network configuration menu */ extern DMenu MenuInstallCustom; /* Custom Installation menu */ extern DMenu MenuInstallType; /* Installation type menu */ extern DMenu MenuDistributions; /* Distribution menu */ extern DMenu MenuDESDistributions; /* DES distribution menu */ extern DMenu MenuSrcDistributions; /* Source distribution menu */ extern DMenu MenuXF86; /* XFree86 main menu */ extern DMenu MenuXF86Select; /* XFree86 distribution selection menu */ extern DMenu MenuXF86SelectCore; /* XFree86 core distribution menu */ extern DMenu MenuXF86SelectServer; /* XFree86 server distribution menu */ extern DMenu MenuXF86SelectFonts; /* XFree86 font selection menu */ extern DMenu MenuDiskDevices; /* Disk devices menu */ /*** Prototypes ***/ /* attrs.c */ extern const char *attr_match(Attribs *attr, char *name); extern int attr_parse(Attribs **attr, char *file); /* cdrom.c */ extern Boolean mediaInitCDROM(Device *dev); extern int mediaGetCDROM(Device *dev, char *file, Attribs *dist_attrs); extern void mediaShutdownCDROM(Device *dev); /* command.c */ extern void command_clear(void); extern void command_sort(void); extern void command_execute(void); extern void command_shell_add(char *key, char *fmt, ...); extern void command_func_add(char *key, commandFunc func, void *data); /* config.c */ extern void configFstab(void); extern void configSysconfig(void); extern void configResolv(void); extern int configPorts(char *str); extern int configPackages(char *str); extern int configSaverTimeout(char *str); extern int configNTP(char *str); extern int configRoutedFlags(char *str); /* crc.c */ extern int crc(int, unsigned long *, unsigned long *); /* decode.c */ extern DMenuItem *decode(DMenu *menu, char *name); extern Boolean dispatch(DMenuItem *tmp, char *name); extern Boolean decode_and_dispatch_multiple(DMenu *menu, char *names); /* devices.c */ extern DMenu *deviceCreateMenu(DMenu *menu, DeviceType type, int (*hook)()); extern void deviceGetAll(void); extern Device **deviceFind(char *name, DeviceType type); extern int deviceCount(Device **devs); extern Device *new_device(char *name); extern Device *deviceRegister(char *name, char *desc, char *devname, DeviceType type, Boolean enabled, Boolean (*init)(Device *mediadev), int (*get)(Device *dev, char *file, Attribs *dist_attrs), Boolean (*close)(Device *mediadev, int fd), void (*shutDown)(Device *mediadev), void *private); extern Boolean dummyInit(Device *dev); extern int dummyGet(Device *dev, char *dist, Attribs *dist_attrs); extern Boolean dummyClose(Device *dev, int fd); extern void dummyShutdown(Device *dev); /* disks.c */ extern int diskPartitionEditor(char *unused); extern int diskPartitionWrite(char *unused); /* dist.c */ extern int distReset(char *str); extern int distSetDeveloper(char *str); extern int distSetXDeveloper(char *str); extern int distSetKernDeveloper(char *str); extern int distSetUser(char *str); extern int distSetXUser(char *str); extern int distSetMinimum(char *str); extern int distSetEverything(char *str); extern int distSetDES(char *str); extern int distSetSrc(char *str); extern int distSetXF86(char *str); extern int distExtractAll(char *str); /* dmenu.c */ extern Boolean dmenuOpen(DMenu *menu, int *choice, int *scroll, int *curr, int *max); extern Boolean dmenuOpenSimple(DMenu *menu); extern char *dmenuVarCheck(DMenuItem *item); extern char *dmenuFlagCheck(DMenuItem *item); extern char *dmenuRadioCheck(DMenuItem *item); /* dos.c */ extern Boolean mediaInitDOS(Device *dev); extern int mediaGetDOS(Device *dev, char *file, Attribs *dist_attrs); extern void mediaShutdownDOS(Device *dev); /* floppy.c */ extern int getRootFloppy(void); extern Boolean mediaInitFloppy(Device *dev); extern int mediaGetFloppy(Device *dev, char *file, Attribs *dist_attrs); extern void mediaShutdownFloppy(Device *dev); /* ftp_strat.c */ extern Boolean mediaCloseFTP(Device *dev, int fd); extern Boolean mediaInitFTP(Device *dev); extern int mediaGetFTP(Device *dev, char *file, Attribs *dist_attrs); extern void mediaShutdownFTP(Device *dev); extern int mediaSetFtpUserPass(char *str); /* globals.c */ extern void globalsInit(void); /* install.c */ extern int installCommit(char *str); extern int installExpress(char *str); +extern int installFixit(char *str); extern Boolean installFilesystems(void); /* lang.c */ extern void lang_set_Danish(char *str); extern void lang_set_Dutch(char *str); extern void lang_set_English(char *str); extern void lang_set_French(char *str); extern void lang_set_German(char *str); extern void lang_set_Italian(char *str); extern void lang_set_Japanese(char *str); extern void lang_set_Norwegian(char *str); extern void lang_set_Russian(char *str); extern void lang_set_Spanish(char *str); extern void lang_set_Swedish(char *str); /* label.c */ extern int diskLabelEditor(char *str); extern int diskLabelCommit(char *str); /* makedevs.c (auto-generated) */ extern const char termcap_vt100[]; extern const char termcap_cons25[]; extern const char termcap_cons25_m[]; extern const char termcap_cons25r[]; extern const char termcap_cons25r_m[]; extern const char termcap_cons25l1[]; extern const char termcap_cons25l1_m[]; extern const u_char font_iso_8x16[]; extern const u_char font_cp850_8x16[]; extern const u_char font_cp866_8x16[]; extern const u_char koi8_r2cp866[]; extern u_char default_scrnmap[]; /* media.c */ extern int mediaSetCDROM(char *str); extern int mediaSetFloppy(char *str); extern int mediaSetDOS(char *str); extern int mediaSetTape(char *str); extern int mediaSetFTP(char *str); extern int mediaSetFTPActive(char *str); extern int mediaSetFTPPassive(char *str); extern int mediaSetUFS(char *str); extern int mediaSetNFS(char *str); extern Boolean mediaGetType(void); extern Boolean mediaExtractDist(char *dir, int fd); extern Boolean mediaExtractDistBegin(char *dir, int *fd, int *zpid, int *cpic); extern Boolean mediaExtractDistEnd(int zpid, int cpid); extern Boolean mediaVerify(void); /* misc.c */ extern Boolean file_readable(char *fname); extern Boolean file_executable(char *fname); extern char *string_concat(char *p1, char *p2); extern char *string_prune(char *str); extern char *string_skipwhite(char *str); extern void safe_free(void *ptr); extern void *safe_malloc(size_t size); extern void *safe_realloc(void *orig, size_t size); extern char **item_add(char **list, char *item, int *curr, int *max); extern char **item_add_pair(char **list, char *item1, char *item2, int *curr, int *max); extern void items_free(char **list, int *curr, int *max); extern int Mkdir(char *, void *data); extern int Mount(char *, void *data); /* msg.c */ extern Boolean isDebug(void); extern void msgInfo(char *fmt, ...); extern void msgYap(char *fmt, ...); extern void msgWarn(char *fmt, ...); extern void msgDebug(char *fmt, ...); extern void msgError(char *fmt, ...); extern void msgFatal(char *fmt, ...); extern void msgConfirm(char *fmt, ...); extern void msgNotify(char *fmt, ...); extern void msgWeHaveOutput(char *fmt, ...); extern int msgYesNo(char *fmt, ...); extern char *msgGetInput(char *buf, char *fmt, ...); /* network.c */ extern Boolean mediaInitNetwork(Device *dev); extern void mediaShutdownNetwork(Device *dev); /* nfs.c */ extern Boolean mediaInitNFS(Device *dev); extern int mediaGetNFS(Device *dev, char *file, Attribs *dist_attrs); extern void mediaShutdownNFS(Device *dev); /* system.c */ extern void systemInitialize(int argc, char **argv); extern void systemShutdown(void); extern int execExecute(char *cmd, char *name); extern int systemExecute(char *cmd); extern int systemDisplayFile(char *file); extern char *systemHelpFile(char *file, char *buf); extern void systemChangeFont(const u_char font[]); extern void systemChangeLang(char *lang); extern void systemChangeTerminal(char *color, const u_char c_termcap[], char *mono, const u_char m_termcap[]); extern void systemChangeScreenmap(const u_char newmap[]); extern int vsystem(char *fmt, ...); /* tape.c */ extern Boolean mediaInitTape(Device *dev); extern int mediaGetTape(Device *dev, char *file, Attribs *dist_attrs); extern void mediaShutdownTape(Device *dev); /* tcpip.c */ extern int tcpOpenDialog(Device *dev); extern int tcpMenuSelect(char *str); extern Boolean tcpDeviceSelect(void); /* termcap.c */ extern int set_termcap(void); /* ufs.c */ extern void mediaShutdownUFS(Device *dev); extern Boolean mediaInitUFS(Device *dev); extern int mediaGetUFS(Device *dev, char *file, Attribs *dist_attrs); /* variables.c */ extern void variable_set(char *var); extern void variable_set2(char *name, char *value); /* wizard.c */ extern void slice_wizard(Disk *d); #endif /* _SYSINSTALL_H_INCLUDE */ Index: stable/2.1/release/sysinstall/system.c =================================================================== --- stable/2.1/release/sysinstall/system.c (revision 10989) +++ stable/2.1/release/sysinstall/system.c (revision 10990) @@ -1,287 +1,264 @@ /* * The new sysinstall program. * * This is probably the last program in the `sysinstall' line - the next * generation being essentially a complete rewrite. * - * $Id: system.c,v 1.44.2.1 1995/09/18 17:00:26 peter Exp $ + * $Id: system.c,v 1.44.2.2 1995/09/23 22:03:23 jkh Exp $ * * Jordan Hubbard * * My contributions are in the public domain. * * Parts of this file are also blatently stolen from Poul-Henning Kamp's * previous version of sysinstall, and as such fall under his "BEERWARE license" * so buy him a beer if you like it! Buy him a beer for me, too! * Heck, get him completely drunk and send me pictures! :-) */ #include "sysinstall.h" #include #include #include #include #include #include /* * Handle interrupt signals - this probably won't work in all cases * due to our having bogotified the internal state of dialog or curses, * but we'll give it a try. */ static void handle_intr(int sig) { if (!msgYesNo("Are you sure you want to abort the installation?")) systemShutdown(); } /* Initialize system defaults */ void systemInitialize(int argc, char **argv) { int i; signal(SIGINT, SIG_IGN); globalsInit(); /* Are we running as init? */ if (getpid() == 1) { setsid(); close(0); open("/dev/ttyv0", O_RDWR); close(1); dup(0); close(2); dup(0); printf("%s running as init\n", argv[0]); i = ioctl(0, TIOCSCTTY, (char *)NULL); setlogin("root"); setenv("PATH", "/stand:/bin:/sbin:/usr/sbin:/usr/bin:/mnt/bin:/mnt/sbin:/mnt/usr/sbin:/mnt/usr/bin:/usr/X11R6/bin", 1); setbuf(stdin, 0); setbuf(stderr, 0); } if (set_termcap() == -1) { printf("Can't find terminal entry\n"); exit(-1); } /* XXX - libdialog has particularly bad return value checking */ init_dialog(); /* If we haven't crashed I guess dialog is running ! */ DialogActive = TRUE; signal(SIGINT, handle_intr); } /* Close down and prepare to exit */ void systemShutdown(void) { if (DialogActive) { end_dialog(); DialogActive = FALSE; } /* REALLY exit! */ if (RunningAsInit) { /* Put the console back */ ioctl(0, VT_ACTIVATE, 2); reboot(RB_HALT); } else exit(1); } /* Run some general command */ int systemExecute(char *command) { int status; dialog_clear(); dialog_update(); end_dialog(); DialogActive = FALSE; status = system(command); DialogActive = TRUE; dialog_clear(); dialog_update(); return status; -} - -/* Run some direct exec command */ -int -execExecute(char *command, char *name) -{ - pid_t child; - int waitstatus; - - dialog_clear(); - dialog_update(); - end_dialog(); - DialogActive = FALSE; - if (child = fork()) - (void)waitpid(child, &waitstatus, 0); - else { - execlp(command, name, 0); - return -1; - } - DialogActive = TRUE; - dialog_clear(); - dialog_update(); - return waitstatus; } /* Display a file in a filebox */ int systemDisplayFile(char *file) { char *fname = NULL; char buf[FILENAME_MAX]; WINDOW *w; fname = systemHelpFile(file, buf); if (!fname) { snprintf(buf, FILENAME_MAX, "The %s file is not provided on this particular floppy image.", file); use_helpfile(NULL); use_helpline(NULL); w = dupwin(newscr); dialog_mesgbox("Sorry!", buf, -1, -1); touchwin(w); wrefresh(w); delwin(w); return 1; } else { use_helpfile(NULL); use_helpline(NULL); w = dupwin(newscr); dialog_textbox(file, fname, LINES, COLS); touchwin(w); wrefresh(w); delwin(w); } return 0; } char * systemHelpFile(char *file, char *buf) { if (!file) return NULL; snprintf(buf, FILENAME_MAX, "/stand/help/%s.hlp", file); if (file_readable(buf)) return buf; return NULL; } void systemChangeTerminal(char *color, const u_char c_term[], char *mono, const u_char m_term[]) { extern void init_acs(void); if (OnVTY) { if (ColorDisplay) { setenv("TERM", color, 1); setenv("TERMCAP", c_term, 1); reset_shell_mode(); setterm(color); init_acs(); cbreak(); noecho(); } else { setenv("TERM", mono, 1); setenv("TERMCAP", m_term, 1); reset_shell_mode(); setterm(mono); init_acs(); cbreak(); noecho(); } } clear(); refresh(); dialog_clear(); } int vsystem(char *fmt, ...) { va_list args; int pstat; pid_t pid; int omask; sig_t intsave, quitsave; char *cmd,*p; int i,magic=0; cmd = (char *)malloc(FILENAME_MAX); cmd[0] = '\0'; va_start(args, fmt); vsnprintf(cmd, FILENAME_MAX, fmt, args); va_end(args); /* Find out if this command needs the wizardry of the shell */ for (p="<>|'`=\"()" ; *p; p++) if (strchr(cmd, *p)) magic++; omask = sigblock(sigmask(SIGCHLD)); if (isDebug()) msgDebug("Executing command `%s' (Magic=%d)\n", cmd, magic); switch(pid = fork()) { case -1: /* error */ (void)sigsetmask(omask); i = 127; case 0: /* child */ (void)sigsetmask(omask); if (DebugFD != -1) { if (OnVTY && isDebug()) msgInfo("Command output is on debugging screen - type ALT-F2 to see it"); dup2(DebugFD, 0); dup2(DebugFD, 1); dup2(DebugFD, 2); } #ifdef NOT_A_GOOD_IDEA_CRUNCHED_BINARY if (magic) { char *argv[100]; i = 0; argv[i++] = "crunch"; argv[i++] = "sh"; argv[i++] = "-c"; argv[i++] = cmd; argv[i] = 0; exit(crunched_main(i,argv)); } else { char *argv[100]; i = 0; argv[i++] = "crunch"; while (cmd && *cmd) { argv[i] = strsep(&cmd," \t"); if (*argv[i]) i++; } argv[i] = 0; if (crunched_here(argv[1])) exit(crunched_main(i,argv)); else execvp(argv[1],argv+1); kill(getpid(),9); } #else /* !CRUNCHED_BINARY */ execl("/stand/sh", "sh", "-c", cmd, (char *)NULL); kill(getpid(),9); #endif /* CRUNCHED_BINARY */ } intsave = signal(SIGINT, SIG_IGN); quitsave = signal(SIGQUIT, SIG_IGN); pid = waitpid(pid, &pstat, 0); (void)sigsetmask(omask); (void)signal(SIGINT, intsave); (void)signal(SIGQUIT, quitsave); i = (pid == -1) ? -1 : WEXITSTATUS(pstat); if (isDebug()) msgDebug("Command `%s' returns status of %d\n", cmd, i); free(cmd); return i; }