head	1.28;
access;
symbols
	RELENG_4_11_0_RELEASE:1.24.2.7
	RELENG_4_11:1.24.2.7.0.18
	RELENG_4_11_BP:1.24.2.7
	RELENG_4_10_0_RELEASE:1.24.2.7
	RELENG_4_10:1.24.2.7.0.16
	RELENG_4_10_BP:1.24.2.7
	RELENG_4_9_0_RELEASE:1.24.2.7
	RELENG_4_9:1.24.2.7.0.14
	RELENG_4_9_BP:1.24.2.7
	RELENG_4_8_0_RELEASE:1.24.2.7
	RELENG_4_8:1.24.2.7.0.12
	RELENG_4_8_BP:1.24.2.7
	RELENG_4_7_0_RELEASE:1.24.2.7
	RELENG_4_7:1.24.2.7.0.10
	RELENG_4_7_BP:1.24.2.7
	RELENG_4_6_2_RELEASE:1.24.2.7
	RELENG_4_6_1_RELEASE:1.24.2.7
	RELENG_4_6_0_RELEASE:1.24.2.7
	RELENG_4_6:1.24.2.7.0.8
	RELENG_4_6_BP:1.24.2.7
	RELENG_4_5_0_RELEASE:1.24.2.7
	RELENG_4_5:1.24.2.7.0.6
	RELENG_4_5_BP:1.24.2.7
	RELENG_4_4_0_RELEASE:1.24.2.7
	RELENG_4_4:1.24.2.7.0.4
	RELENG_4_4_BP:1.24.2.7
	RELENG_4_3_0_RELEASE:1.24.2.7
	RELENG_4_3:1.24.2.7.0.2
	RELENG_4_3_BP:1.24.2.7
	RELENG_4_2_0_RELEASE:1.24.2.3
	RELENG_4_1_1_RELEASE:1.24
	PRE_SMPNG:1.25
	RELENG_4_1_0_RELEASE:1.24
	RELENG_3_5_0_RELEASE:1.12.2.8
	RELENG_4_0_0_RELEASE:1.24
	RELENG_4:1.24.0.2
	RELENG_4_BP:1.24
	RELENG_3_4_0_RELEASE:1.12.2.7
	RELENG_3_3_0_RELEASE:1.12.2.6
	RELENG_3_2_PAO:1.12.2.1.0.2
	RELENG_3_2_PAO_BP:1.12.2.1
	RELENG_3_2_0_RELEASE:1.12.2.1
	RELENG_3_1_0_RELEASE:1.12
	RELENG_3:1.12.0.2
	RELENG_3_BP:1.12
	RELENG_3_0_0_RELEASE:1.10
	v0_4:1.1.1.1
	PICOBSD:1.1.1;
locks; strict;
comment	@# @;


1.28
date	2001.04.23.19.55.03;	author joe;	state dead;
branches;
next	1.27;

1.27
date	2001.01.29.22.47.46;	author luigi;	state Exp;
branches;
next	1.26;

1.26
date	2000.10.16.08.08.31;	author joe;	state Exp;
branches;
next	1.25;

1.25
date	2000.04.25.18.59.50;	author dwhite;	state Exp;
branches;
next	1.24;

1.24
date	2000.02.08.08.24.59;	author luigi;	state Exp;
branches
	1.24.2.1;
next	1.23;

1.23
date	99.10.20.04.48.35;	author dwhite;	state Exp;
branches;
next	1.22;

1.22
date	99.10.11.20.52.50;	author dwhite;	state Exp;
branches;
next	1.21;

1.21
date	99.10.08.03.59.58;	author dwhite;	state Exp;
branches;
next	1.20;

1.20
date	99.08.29.19.16.29;	author dwhite;	state Exp;
branches;
next	1.19;

1.19
date	99.08.29.19.11.11;	author dwhite;	state Exp;
branches;
next	1.18;

1.18
date	99.08.28.08.04.15;	author roger;	state Exp;
branches;
next	1.17;

1.17
date	99.08.28.01.33.13;	author peter;	state Exp;
branches;
next	1.16;

1.16
date	99.08.27.07.41.25;	author roger;	state Exp;
branches;
next	1.15;

1.15
date	99.08.23.08.33.07;	author luigi;	state Exp;
branches;
next	1.14;

1.14
date	99.08.22.21.42.30;	author dwhite;	state Exp;
branches;
next	1.13;

1.13
date	99.06.14.15.37.10;	author roger;	state Exp;
branches;
next	1.12;

1.12
date	99.01.19.23.02.05;	author abial;	state Exp;
branches
	1.12.2.1;
next	1.11;

1.11
date	99.01.14.23.14.45;	author abial;	state Exp;
branches;
next	1.10;

1.10
date	98.09.23.14.54.46;	author abial;	state Exp;
branches;
next	1.9;

1.9
date	98.09.22.15.40.00;	author abial;	state Exp;
branches;
next	1.8;

1.8
date	98.09.20.00.46.07;	author abial;	state Exp;
branches;
next	1.7;

1.7
date	98.09.19.21.44.42;	author abial;	state Exp;
branches;
next	1.6;

1.6
date	98.09.15.11.12.13;	author abial;	state Exp;
branches;
next	1.5;

1.5
date	98.09.07.06.46.25;	author abial;	state Exp;
branches;
next	1.4;

1.4
date	98.09.04.19.38.57;	author abial;	state Exp;
branches;
next	1.3;

1.3
date	98.09.04.08.08.05;	author abial;	state Exp;
branches;
next	1.2;

1.2
date	98.09.03.10.40.27;	author abial;	state Exp;
branches;
next	1.1;

1.1
date	98.08.27.17.38.42;	author abial;	state Exp;
branches
	1.1.1.1;
next	;

1.1.1.1
date	98.08.27.17.38.42;	author abial;	state Exp;
branches;
next	;

1.12.2.1
date	99.02.22.21.25.15;	author abial;	state Exp;
branches;
next	1.12.2.2;

1.12.2.2
date	99.08.22.23.07.42;	author dwhite;	state Exp;
branches;
next	1.12.2.3;

1.12.2.3
date	99.08.23.11.36.18;	author luigi;	state Exp;
branches;
next	1.12.2.4;

1.12.2.4
date	99.08.29.15.52.25;	author peter;	state Exp;
branches;
next	1.12.2.5;

1.12.2.5
date	99.08.29.19.08.38;	author dwhite;	state Exp;
branches;
next	1.12.2.6;

1.12.2.6
date	99.08.29.19.18.57;	author dwhite;	state Exp;
branches;
next	1.12.2.7;

1.12.2.7
date	99.10.17.23.05.11;	author dwhite;	state Exp;
branches;
next	1.12.2.8;

1.12.2.8
date	2000.02.12.19.04.01;	author luigi;	state Exp;
branches;
next	;

1.24.2.1
date	2000.11.08.01.07.25;	author joe;	state Exp;
branches;
next	1.24.2.2;

1.24.2.2
date	2000.11.08.01.24.18;	author joe;	state Exp;
branches;
next	1.24.2.3;

1.24.2.3
date	2000.11.08.02.11.54;	author joe;	state Exp;
branches;
next	1.24.2.4;

1.24.2.4
date	2000.12.06.20.36.39;	author luigi;	state Exp;
branches;
next	1.24.2.5;

1.24.2.5
date	2000.12.22.02.11.13;	author luigi;	state Exp;
branches;
next	1.24.2.6;

1.24.2.6
date	2001.01.26.20.56.19;	author luigi;	state Exp;
branches;
next	1.24.2.7;

1.24.2.7
date	2001.02.19.23.49.54;	author luigi;	state dead;
branches;
next	;


desc
@@


1.28
log
@MF4S: Sync with the developments that Luigi's been doing in -stable.
@
text
@#!/bin/sh -

#
# $FreeBSD: src/release/picobsd/build/build,v 1.27 2001/01/29 22:47:46 luigi Exp $
#
# You can set the SRC variable which points to your source tree. It's
# /usr/src by default (most people shouldn't change it).
SRC=/usr/src
OBJ=/usr/obj-pico

# --------- YOU SHOULD NOT NEED TO CHANGE ANYTHING BELOW -----------
# The "build" script will ask you for parameters. Just run it... :-)
# --------- YOU SHOULD NOT NEED TO CHANGE ANYTHING BELOW -----------

# EDITOR is the editor you use
EDITOR=${EDITOR:-vi}
# LANGUAGE     language to be used (en or pl)
LANGUAGE=en
# SITE         site-specific files
SITE=

# FLOPPY_SIZE  floppy size in KB (default to 1440)
FLOPPY_SIZE=1440 # 1440 1480 1720 (the latter will not boot!)

# DEVFS is currently broken. Always set this.
#
NO_DEVFS=yes

# RISU is where dialog replies go.
RISU=.build.reply

# abort in case of error...
set -e

. ../Version

# support symbolically linked custom directory
BUILDDIR=`pwd`
export BUILDDIR

# assign default values to variables.
set_defaults() {
    TYPE=${TYPE:-dial} # PicoBSD type (isp, router, net, custom, ...

    # build image list
    cat /dev/null > .image.list
    for i in ../* ; do
	if [ -d $i -a -f $i/PICOBSD ] ; then
	    a=`awk '/^#PicoBSD/ {print $2, $3, $4, $5, $6}' < $i/PICOBSD`
	    if [ "$a" != "" ]; then
		echo "`basename $i`  $a" >>.image.list
	    fi
	fi
    done
    while read name sz init mfs_in floppy_in ; do
	if [ "$name" != "#" -a $name != "" ] ; then
	    eval ${name}_DFLT_SIZE=$sz
	    eval ${name}_INIT=$init
	    eval ${name}_MFS_INODES=$mfs_in
	    eval ${name}_FLOPPY_INODES=$floppy_in
	fi
    done < .image.list
}

set_msgs() {
    MSG1="Type: ${TYPE}"
    if [ "X${TYPE}" = "Xcustom" ] ; then
	MSG1="${MSG1} (from ${CUST_DIR})"
    fi

    MSG="PicoBSD build -- Current parameters:\n\n\t1.  ${MSG1}\n\
\t2.  MFS size: ${MFS_SIZE} kB\n\t3.  Language: ${LANGUAGE}\n\
\t4.  Site-info: ${SITE}\n"
}


# Main build procedure. It calls another script (stage1)
main() {

    if [ "X${TYPE}" = "X" ] ; then
       echo "^G^G^G-> wrong floppy type"
       exit 10
    fi

    export suffix

    clear
    set_msgs
    printf "${MSG}"
    echo "-> We'll use the sources living in ${SRC}"
    echo ""
    echo "-> I hope you have checked the ../${TYPE}/PICOBSD config file..."
    echo ""
    echo ""
    sleep 2

    export MFS_SIZE LANGUAGE TYPE SRC OBJ NO_DEVFS INIT
    export SITE MFS_INODES FLOPPY_INODES FLOPPY_SIZE

    ./stage1
    if [ "X$?" != "X0" ] ; then
	echo ""
	echo "-> ERROR in \"${i}\" script. Aborting the build process."
	echo -n "-> Cleaning temporary files... "
	umount -f ${MFS_MOUNTPOINT}
	rm -rf ${MFS_MOUNTPOINT}
	vnconfig -u /dev/rvn${VNUM}
	./clean ${TYPE}
	echo "Done."
	exit 10
    fi
    echo "==================== ${i} completed ====================="
}

# check for existing custom config directory and ask user if they want to use it
# 
# Note that specifying an alternate directory is broken due to relative
# path assumptions during the kernel compilation phase of the build.
# For now just dialog-ify.

check_for_old_custom() {
   KEEP_CUSTOM=no
   if [ ! -d ../custom ] ; then
       return
   fi
   
   CUSTOMLINK=`ls -l ../custom | awk -F\> '{ print $2 }' | awk '{ print $1 }'`
   if dialog --title "Custom directory setup" --yesno "A custom configuration\n ${CUSTOMLINK}\nalready exists. Would you like to use it?" 7 50 ; then 
       KEEP_CUSTOM=yes
       CUST_DIR=${CUSTOMLINK}
   else 
       KEEP_CUSTOM=no
   fi

   # If custom is just a simple directory, assume the user wants it

}

# Ask for, and set the custom config directory

set_custom() {
    dialog --title "Custom directory setup" --inputbox \
    "Please enter the full path to the directory containing your \
    custom setup. \
    This directory tree must be laid out exactly like the standard \
    ones. (E.g. you can type in /home/abial/work/custom, which \
    should contain crunch1/, floppy.tree/, lang/ )." \
    10 70 2> ${RISU}
    CUST_DIR=`cat ${RISU}`
}

# Set type of floppy interactively. Also set the various defaults
# associated to each type. We can override them manually afterwards.

set_type() {
    eval MFS_SIZE=$"${TYPE}_DFLT_SIZE"
    eval INIT=$"${TYPE}_INIT"
    eval MFS_INODES=$"${TYPE}_MFS_INODES"
    eval FLOPPY_INODES=$"${TYPE}_FLOPPY_INODES"
    suffix="-${TYPE}"
    if [ "${MFS_SIZE}" = "" ] ; then
	echo "TYPE $TYPE not found!"
	sleep 2
	TYPE=""
    fi

    case ${TYPE} in
    custom)
	check_for_old_custom
	if [ "X${KEEP_CUSTOM}" != "Xyes" ] ; then
	    [ -r ../custom ] && rm -f ../custom
	    set_custom
	    (cd ..; ln -sf ${CUST_DIR} custom)
        fi
	;;
    esac
	
}


build_package() {
    touch build.status
    echo "##############################################" >>build.status
    echo "## `date` ">>build.status
    echo "##############################################" >>build.status
    ./clean dial
    for y in en pl ; do
	for z in dial router net isp ; do
	    TYPE=${z}
	    LANGUAGE=${y}
	    set_type
	    echo "---------------------------------------------">>build.status
	    echo "Building TYPE=${z}, LANGUAGE=${y}, SIZE=${MFS_SIZE}" >>build.status
	    main
	    if [ "X$?" != "X0" ] ; then
		echo "	** FAILED! **">>build.status
	    else
		echo "	(ok)">>build.status
	    fi
	    mv picobsd.bin pb_${y}${suffix}.bin
	    echo "Calling ./clean for ${TYPE}, ${LANGUAGE}, ${MFS_SIZE}">>build.status
	    ./clean ${TYPE}
	done
    done
    exit 0
}

# Set build parameters interactively

main_dialog() {
  while [ true ] ; do
    set_msgs
    dialog --menu "PicoBSD build menu -- ver ${VER} (22aug1999)" 19 70 12 \
	N "No change, build it" \
	T "${MSG1}" \
	K "edit Kernel config file for ${TYPE}" \
	E "Edit crunch.conf file for ${TYPE}" \
	S "MFS Size: ${MFS_SIZE}kB" \
	L "Language: ${LANGUAGE}" \
	I "Init type: ${INIT}" \
	F "Floppy size: ${FLOPPY_SIZE}kB" \
	M "MFS bytes per inode: ${MFS_INODES}" \
	U "UFS bytes per inode: ${FLOPPY_INODES}" \
	$ "Site-info: ${SITE}" \
	Q "Quit" \
	2> ${RISU}
    ans=`cat ${RISU}`
    rm ${RISU}
    case ${ans} in
    T)
	dialog --menu "Setup the type of configuration" 12 70 5 \
	    `awk '{ print $1, $1 }' < .image.list` \
		2> ${RISU} || rm ${RISU}
	if [ -f ${RISU} ] ; then
	    TYPE=`cat ${RISU}`
	    set_type
	fi
	;;
    I)
	dialog --menu "Choose your init(8) program" \
	10 70 2 init "Standard init (requires getty)" \
	oinit "small init from TinyWare" 2> ${RISU} || rm ${RISU}
	if [ -f ${RISU} ] ; then
	    INIT=`cat ${RISU}`
	fi
	;;

    K) ${EDITOR} ../${TYPE}/PICOBSD ;;

    E) ${EDITOR} ../${TYPE}/crunch1/crunch.conf ;;

    S)
	dialog --title "MFS Size setup" --inputbox \
"MFS size depends on what you need to put on the MFS image. Typically \
ranges between 820kB (for very small bridge/router images) to \
as much as 2500kB kB for a densely packed image. \
Keep in mind that this memory is \
totally lost to other programs. Usually you want to keep \
this as small as possible. " 10 70 2> ${RISU} || rm ${RISU}
	if [ -f ${RISU} ] ; then
	    MFS_SIZE=`cat ${RISU}`
	    if [ "${MFS_SIZE}" = "" ] ; then
		eval MFS_SIZE=$"${TYPE}_DFLT_SIZE"
	    fi
	fi
	;;

    L)
	dialog --menu "Please choose language" \
	10 40 2 en English pl Polish 2> ${RISU} || rm ${RISU}
	if [ -f ${RISU} ] ; then
	    LANGUAGE=`cat ${RISU}`
	fi
	;;

    \$)
	dialog --title "Site info setup" --inputbox \
	"Please enter the full path to the directory \
	containing site-specific setup. \
	This directory tree must contain files that replace \
	standard ones in floppy.tree/ and mfs.tree/ . " \
	10 70 2> ${RISU} || rm ${RISU}
	if [ -f ${RISU} ] ; then
	    SITE=`cat ${RISU}`
	fi
	;;

    F)
	dialog --menu "Set floppy size" 15 70 4 \
		1440 "1.44MB" 1720 "1.72MB" \
		2880 "2.88MB" 4096 "4MB" 2> ${RISU} || rm ${RISU}
	if [ -f ${RISU} ] ; then
	    FLOPPY_SIZE=`cat ${RISU}`
	fi
	;;

    M)
	dialog --title "MFS bytes per inode:" --inputbox \
	"Enter MFS bytes per inode (typically 4096..65536). \
	A larger value means fewer inodes but more space on MFS" \
	10 70 2> ${RISU} || rm ${RISU}
	if [ -f ${RISU} ] ; then
	    MFS_INODES=`cat ${RISU}`
	    if [ "${MFS_INODES}" = "" ] ; then
		eval MFS_INODES=$"${TYPE}_DFLT_MFS_INODES"
	    fi
	fi
	;;

    U)
	dialog --title "Floppy bytes per inode:" --inputbox \
	"Enter floppy bytes per inode (typically 3072..65536). \
	A larger value means fewer inodes but more space on the floppy." \
	10 70 2> ${RISU} || rm ${RISU}
	if [ -f ${RISU} ] ; then
	    FLOPPY_INODES=`cat ${RISU}`
	    if [ "${FLOPPY_INODES}" = "" ] ; then
		eval FLOPPY_INODES=$"${TYPE}_DFLT_FLOPPY_INODES"
	    fi
	fi
	;;

    N) break 2
	;;

    Q) exit 0 ;;

    *) echo "Unknown option \"${ans}\". Try again."
	sleep 2
	clear
	;;
    esac
  done
}

# Call the build procedure
# Install image
do_install() {
    dialog --title "Build ${TYPE} completed" --inputbox \
"\nThe build process was completed successfuly.\n\
`cat .build.reply` \n\n\
Now we are going to install the image on the floppy.\n\
Please insert a blank floppy in /dev/fd0.\\n
WARNING: the contents of the floppy will be permanently erased!\n\
\n\
Your options:\n\
	* ^C or [Cancel] to abort,\n\
	* Enter to install \"picobsd.bin\",\n\
	* name of other file to install.\n\
" 20 80 2> ${RISU}
    if [ "$?" = "0" ]; then
	FILENAME=`cat ${RISU}`
	if [ "${FILENAME}" = "" ] ; then
	    FILENAME=picobsd.bin
	fi
	echo "Writing ${FILENAME}..."
	dd if=${FILENAME} of=/dev/rfd0.${FLOPPY_SIZE}
    else
	echo "Ok, the image is in picobsd.bin"
    fi
    echo "Done."
}

#-------------------------------------------------------------------
# Main entry of the script

interactive="YES"
if [ "$1" = "-n" ] ; then
    interactive="NO"
    shift
fi
TYPE=$1
SITE=$2
set_defaults
set_type

# If $1="package", it creates a neat set of floppies

if [ "$1" = "package" ] ; then
    build_package
fi
if [ "$interactive" = "YES" ] ; then
    main_dialog
fi
main	# build ${TYPE}
do_install
exit 0
@


1.27
log
@Put picobsd build scripts in sync with the ones in -STABLE.

With these scripts i was able to build a _working_ image of a
bridge-like floppy image with a reasonable set of utilities
in it, despite the code size increase we have in 5.0

The scripts are slightly different from the previous ones especially
on the place where the kernel and binaries are built. Hopefully
this will not cause too much trouble to people (is there any???)
using the old scripts.
@
text
@d4 1
a4 1
# $FreeBSD: src/release/picobsd/build/build,v 1.26 2000/10/16 08:08:31 joe Exp $
@


1.26
log
@Build the PICOBSD kernels using the 'make buildkernel' method.
@
text
@d4 1
a4 1
# $FreeBSD: src/release/picobsd/build/build,v 1.25 2000/04/25 18:59:50 dwhite Exp $
d9 1
a9 1
OBJ=/usr/obj
d23 1
a23 1
FLOPPY_SIZE=1440
d341 1
a341 1
`cat .build.reply` \
d357 1
a357 1
	dd if=${FILENAME} of=/dev/rfd0
@


1.25
log
@Commit PicoBSD mega-patch:
. Bring PicoBSD up to date with -CURRENT reality.
. Make PicoBSD smart and not spam /dev/vn0 and /mnt.  Now it uses the first
  unused vn device and creates a temporary mountpoint in /tmp.
. Miscellaneous build cleanups and optimizations.

Unfortunately the bridge, isp, and router floppies are too big and need
the axe treatment.  The install floppy needs updating to -CURRENT. Dial and
net build and (appear to) run OK.  I will be adressing these in the
near future (unless someone beats me to it :-) ).

PR:		misc/17737
Submitted by:	Omachonu Ogali <oogali@@intranova.net>
@
text
@d4 1
a4 1
# $FreeBSD: src/release/picobsd/build/build,v 1.24 2000/02/08 08:24:59 luigi Exp $
d9 1
d97 1
a97 1
    export MFS_SIZE LANGUAGE TYPE SRC NO_DEVFS INIT
@


1.24
log
@Cleanup the build scripts.

Approved-by: jordan
@
text
@d4 1
a4 1
# $FreeBSD: src/release/picobsd/build/build,v 1.23 1999/10/20 04:48:35 dwhite Exp $
d76 1
a76 1
# Main build procedure. It calls another scripts (stage1)
d104 3
a106 2
	umount -f /mnt
	vnconfig -u /dev/rvn0
@


1.24.2.1
log
@MFC: Clean up a comment.

Approved by:	jkh
@
text
@d4 1
a4 1
# $FreeBSD: src/release/picobsd/build/build,v 1.24 2000/02/08 08:24:59 luigi Exp $
d76 1
a76 1
# Main build procedure. It calls another script (stage1)
@


1.24.2.2
log
@MFS: Build the kernel in /usr/obj/usr/src/sys/ using 'make buildkernel'.
@
text
@d4 1
a4 1
# $FreeBSD: src/release/picobsd/build/build,v 1.24.2.1 2000/11/08 01:07:25 joe Exp $
a8 1
OBJ=/usr/obj
d96 1
a96 1
    export MFS_SIZE LANGUAGE TYPE SRC OBJ NO_DEVFS INIT
@


1.24.2.3
log
@MFC: Make PicoBSD smart and not spam /dev/vn0 and /mnt.  Now it
     uses the first unused vn device and creates a temporary
     mountpoint in /tmp.

Approved by:	jkh
@
text
@d4 1
a4 1
# $FreeBSD: src/release/picobsd/build/build,v 1.24.2.2 2000/11/08 01:24:18 joe Exp $
d105 2
a106 3
	umount -f ${MFS_MOUNTPOINT}
	rm -rf ${MFS_MOUNTPOINT}
	vnconfig -u /dev/rvn${VNUM}
@


1.24.2.4
log
@Mve build directory to /usr/obj-pico just to be sure
that everything works with objects outside the standard place.
@
text
@d4 1
a4 1
# $FreeBSD: src/release/picobsd/build/build,v 1.24.2.3 2000/11/08 02:11:54 joe Exp $
d9 1
a9 1
OBJ=/usr/obj-pico
@


1.24.2.5
log
@Add support for different floppy sizes (1480, 1720, 2880).
The "1720" format will not boot most likely.

The "1480" format (really 1476KB, 18 sectors x 82 tracks) does
boot fine on the systems i have tried.
@
text
@d4 1
a4 1
# $FreeBSD$
d23 1
a23 1
FLOPPY_SIZE=1440 # 1440 1480 1720 (the latter will not boot!)
d357 1
a357 1
	dd if=${FILENAME} of=/dev/rfd0.${FLOPPY_SIZE}
@


1.24.2.6
log
@Better formatting of the final report.
@
text
@d4 1
a4 1
# $FreeBSD: src/release/picobsd/build/build,v 1.24.2.5 2000/12/22 02:11:13 luigi Exp $
d341 1
a341 1
`cat .build.reply` \n\n\
@


1.24.2.7
log
@Add the new picobsd build script, and remove the old ones.
This script should be a significant improvement over the old
ones for the following reasons (modulo bugs...):

 + it can be run from anywhere;
 + a single script does everything including cleanup;
 + removes the need for a number of makefiles used before;
 + it does not write anymore into /usr/src/release/picobsd/ ;
 + all the files produced by the compilation are put into a single
   directory (plus OBJDIR as specified by the various programs);
 + it has slightly better diagnosting and debugging modes;
 + it permits PicoBSD configurations to be placed anywhere;
 + configurations can now be as simple as two files -- PICOBSD
   and crunch.conf, thus removing the need for supporting
   language-specific versions. You just define a new floppy
   type and populate the tree.
@
text
@d4 1
a4 1
# $FreeBSD: src/release/picobsd/build/build,v 1.24.2.6 2001/01/26 20:56:19 luigi Exp $
@


1.23
log
@Change MFS sizes to 2400k since gzip will compact free space anyway.
Add 'install' to the internal floppy type list.
@
text
@d4 1
a4 1
# $FreeBSD: src/release/picobsd/build/build,v 1.22 1999/10/11 20:52:50 dwhite Exp $
d44 11
a54 1
    while read name suff sz init mfs_in floppy_in ; do
a55 1
	    eval ${name}_suffix=$suff
d61 1
a61 10
    done <<__eof__
# build	MFS		- Byte/inode -
# name		suffix	DFLT_SZ	init	MFS	FLOPPY
dial		-D	2400	init	4096	32768
router		-R	2400	oinit	3072	32768
net		-N	2400	init	4096	32768
isp		-I	2400	init	4096	32768
install		-S	2400	init	4096	4096
custom		-C	2400	init	8192	32768
__eof__
d71 1
a71 1
\t2.  MFS size: ${SIZE} kB\n\t3.  Language: ${LANGUAGE}\n\
d79 5
d96 1
a96 1
    export SIZE LANGUAGE TYPE SRC NO_DEVFS INIT
a98 6
    # Build the kernel, if necessary
    echo ""
    echo "-> Checking if we have to build the PICOBSD kernel..."
    (cd ../${TYPE}; make -f ${BUILDDIR}/Makefile.conf )
    echo ""

d154 1
a154 2

    eval SIZE=$"${TYPE}_DFLT_SIZE"
d158 6
a163 1
    eval suffix=$"${TYPE}_suffix"
d191 1
a191 1
	    echo "Building TYPE=${z}, LANGUAGE=${y}, SIZE=${SIZE}" >>build.status
d199 1
a199 1
	    echo "Calling ./clean for ${TYPE}, ${LANGUAGE}, ${SIZE}">>build.status
d216 1
a216 1
	S "MFS Size: ${SIZE}kB" \
d230 2
a231 6
	    dial "dialin (ppp etc.)" \
	    router "router/bridge/mrouter" \
	    net "net admin tool" \
            install "network system installer" \
	    isp "isp (ppp and terminal server)" \
	    custom "custom config (need pathname)" 2> ${RISU} || rm ${RISU}
d259 3
a261 3
	    SIZE=`cat ${RISU}`
	    if [ "${SIZE}" = "" ] ; then
		eval SIZE=$"${TYPE}_DFLT_SIZE"
d339 1
d348 1
a348 1
" 20 70 2> ${RISU}
d371 1
@


1.22
log
@Fix handling of the 'custom' directory symlink.
Properly abstract the PicoBSD build directory instead of depending too much
on pwd's and relative paths.

Submitted by:	 John Baldwin <jobaldwi@@vt.edu>
@
text
@d4 1
a4 1
# $FreeBSD: src/release/picobsd/build/build,v 1.21 1999/10/08 03:59:58 dwhite Exp $
d55 3
a57 3
dial		-D	1600	init	4096	32768
router		-R	820	oinit	3072	32768
net		-N	2200	init	4096	32768
d230 1
@


1.21
log
@Add a new floppy type, install.  This type builds a disk that can
slice, partition, newfs, and install FreeBSD from a tarball on a remote server.
Handy for doing mass-installs for server farms.

Documentation following shortly.
@
text
@d4 1
a4 1
# $FreeBSD: src/release/picobsd/build/build,v 1.20 1999/08/29 19:16:29 dwhite Exp $
d36 4
d97 1
a97 1
    (cd ../${TYPE}; make -f ../build/Makefile.conf )
d129 1
d345 1
a345 1
	* Enter to install \"${FILENAME}\",\n\
@


1.20
log
@Remove tee from stage1 call.  You can't capture the return code from stage1
(easily) so it gives false 'success' indications.
@
text
@d4 1
a4 1
# $FreeBSD: src/release/picobsd/build/build,v 1.19 1999/08/29 19:11:11 dwhite Exp $
d55 1
@


1.19
log
@MFS: Dialog-ify 'reuse custom directory' question.
@
text
@d4 1
a4 1
# $FreeBSD: src/release/picobsd/build/build,v 1.12.2.5 1999/08/29 19:08:38 dwhite Exp $
d95 1
a95 1
    ./stage1 2>&1 | tee stage1.out
@


1.18
log
@Backout my last commit. Exit status is $?
@
text
@d4 1
a4 1
# $FreeBSD: src/release/picobsd/build/build,v 1.17 1999/08/28 01:33:13 peter Exp $
d110 4
d120 10
a129 7
   clear
   echo "                   Custom directory setup"
   echo ""
   echo "There is an existing custom configuration linked to"
   ls -l ../custom | awk -F\> '{ print $2 }' | awk '{ print $1 }'
   echo ""
   read -p "Do you wish to use the existing custom directory? (yes/no): " KEEP_CUSTOM
@


1.17
log
@$Id$ -> $FreeBSD$
@
text
@d4 1
a4 1
# $FreeBSD$
d96 1
a96 1
    if [ "X?" != "X0" ] ; then
@


1.16
log
@'build' calls 'stage1'
The check for the exit status of the 'stage1' script was broken.
Change "X$?" != "X0" to "X?" != "X0"
@
text
@d4 1
a4 1
#	$Id: build,v 1.15 1999/08/23 08:33:07 luigi Exp $
@


1.15
log
@Additional cleanup of the picobsd scripts.
Also bump Version to 0.445
@
text
@d4 1
a4 1
#	$Id: build,v 1.14 1999/08/22 21:42:30 dwhite Exp $
d96 1
a96 1
    if [ "X$?" != "X0" ] ; then
@


1.14
log
@Major PicoBSD update by luigi with some debugging help from myself.

. Now builds on -STABLE (-CURRENT is broken due to bugs)
. etc directory contents centralized instead of in each
  type directory (can exclude & override as desired)
. Removed extraneous language files (lang files for rc really necessary?)
. dialog-based build tool with support for custom floppy builds
. MFS image loads as a mfs_root module instead of compiled into kernel

THIS IS BROKEN ON CURRENT.  I'll MFC to -STABLE immediately following.
luigi tells me I have an OK from jkh on the MFC.

Submitted by:	luigi
@
text
@d4 1
a4 1
#	$Id: build,v 1.12.2.1 1999/02/22 21:25:15 abial Exp $
a17 2
# TYPE         PicoBSD type (isp, router, net, custom)
TYPE=${1:-dial}
d34 1
a34 1
# Build kernel with previously set parameters.
a36 1

d38 1
d95 1
a95 1
    ./stage1
a161 7
#-------------------------------------------------------------------
# Main entry of the script

set_defaults
set_type

# If $1="package", it creates a neat set of floppies
d163 1
a163 2
if [ X"$1" = X"package" ] ; then
    shift
d188 1
a188 1
fi
d192 2
a193 1
while [ "X${ans}" != "Xn" ] ; do
d195 14
a208 12
    dialog --menu "PicoBSD build menu -- ver 0.44 (20aug1999)" 19 70 12 \
	1 "${MSG1}" \
	a "init type: ${INIT}" \
	e "edit kernel config file for ${TYPE}" \
	c "edit crunch.conf file for ${TYPE}" \
	2 "MFS size: ${SIZE}kB" \
	3 "Language: ${LANGUAGE}" \
	4 "Site-info: ${SITE}" \
	5 "Floppy size: ${FLOPPY_SIZE}kB" \
	6 "MFS bytes per inode: ${MFS_INODES}" \
	7 "UFS bytes per inode: ${FLOPPY_INODES}" \
	n "no change, build it" q "quit" 2> ${RISU}
d210 1
d212 1
a212 1
    1)
d218 2
a219 2
	    custom "custom config (need pathname)" 2> ${RISU}
	if [ $? = 0 ]; then
d224 1
a224 1
    a)
d227 2
a228 2
	oinit "small init from TinyWare" 2> ${RISU}
	if [ "$?" = "0" ]; then
d233 6
a238 3
    e) ${EDITOR} ../${TYPE}/PICOBSD ;;
    c) ${EDITOR} ../${TYPE}/crunch1/crunch.conf ;;
    2) dialog --title "MFS Size setup" --inputbox \
d240 1
a240 1
ranges between 800kB (for very small bridge/router images) to \
d244 6
a249 4
this as small as possible. " 10 70 2> ${RISU}
	SIZE=`cat ${RISU}`
	if [ "X${SIZE}" = "X" ] ; then
	    eval SIZE=${TYPE}_DFLT_SIZE
d252 7
a258 3
    3)      dialog --menu "Please choose language" \
	10 40 2 en English pl Polish 2> ${RISU}
	LANGUAGE=`cat ${RISU}`
d260 3
a262 1
    4) dialog --title "Site info setup" --inputbox \
d267 4
a270 2
	10 70 2> ${RISU}
	SITE=`cat ${RISU}`
d272 3
a274 1
    5) dialog --menu "Set floppy size" 15 70 4 \
d276 4
a279 2
		2880 "2.88MB" 4096 "4MB" 2> ${RISU}
	FLOPPY_SIZE=`cat ${RISU}`
d281 3
a283 1
    6) dialog --title "MFS bytes per inode:" --inputbox \
d286 7
a292 2
	10 70 2> ${RISU}
	MFS_INODES=`cat ${RISU}`
d294 3
a296 1
    7) dialog --title "Floppy bytes per inode:" --inputbox \
d299 10
a308 2
	10 70 2> ${RISU}
	FLOPPY_INODES=`cat ${RISU}`
d310 4
a313 3
    n) ;;
    q) exit 0 ;;
    *) echo "Unknown option \"${ans}\". Try again."
d318 2
a319 1
done
d322 22
a343 18
main
# Install if it's ok.
echo ""
if [ "X$?" = "X0" ] ; then
FILENAME=picobsd.bin
    echo "The build process was completed successfuly."
    echo ""
    echo "Now we are going to install the image on the floppy."
    echo "Please insert a blank floppy in /dev/fd0."
    echo "WARNING: the contents of the floppy will be permanently erased!"
    echo "Your options:"
    echo "	* ^C to abort,"
    echo "	* Enter to install \"${FILENAME}\","
    echo "	* name of other file to install."
    echo ""
    read -p "Your choice: " junk
    if [ "X${junk}" != "X" ] ; then
	FILENAME=${junk}
a344 2
    echo "Writing ${FILENAME}..."
    dd if=${FILENAME} of=/dev/rfd0
d346 21
d368 2
@


1.13
log
@Update to PicoBSD 0.44 from RELENG_3
@
text
@a5 1

d10 12
a21 2
# Default MFS sizes for different types of the floppy. Again, most people
# shouldn't change them unless they know what they are doing.
d23 2
a24 4
DIAL_DFLT_SIZE=1600
ROUTER_DFLT_SIZE=820
NET_DFLT_SIZE=1700
ISP_DFLT_SIZE=1700
d30 2
a31 6
# Path to srcdirs of special program for init(8) (standard if empty)
INIT=

# --------- YOU SHOULD NOT NEED TO CHANGE ANYTHING BELOW -----------
# The "build" script will ask you for parameters. Just run it... :-)
# --------- YOU SHOULD NOT NEED TO CHANGE ANYTHING BELOW -----------
d33 1
d38 21
a58 5
build_kernel() {
	echo ""
	echo "-> Checking if we have to build the PICOBSD kernel..."
	(cd ../${TYPE}/conf; make)
	echo ""
d61 10
a70 24
# Main build procedure. It calls other scripts (stage1-3 and populate)
main() {

if [ "${TYPE}" = "dial" ]
then
	suffix="-D"
fi
if [ "${TYPE}" = "net" ]
then
	suffix="-N"
fi
if [ "${TYPE}" = "isp" ]
then
	suffix="-I"
fi
if [ "${TYPE}" = "router" ]
then
	suffix="-R"
fi
if [ "${TYPE}" = "custom" ]
then
	suffix="-C"
fi
export suffix
a71 18
clear
echo "-> Building with following parameters:"
echo -n "	Type:     ${TYPE}"
if [ "X${INIT}" != "X" ]
then
	echo " (using ${INIT} as init(8))"
else
	echo ""
fi
echo "	MFS size: ${SIZE} kB"
echo "	Language: ${LANGUAGE}"
echo ""
echo "-> We'll use the sources living in ${SRC}"
echo ""
echo "-> I hope you have checked the ../${TYPE}/conf/PICOBSD config file..."
echo ""
echo ""
sleep 2
d73 2
a74 2
# Build the kernel, if necessary
build_kernel
d76 1
a76 1
export SIZE LANGUAGE TYPE SRC NO_DEVFS INIT
d78 31
a108 18
for i in stage1 populate stage2 stage3
do
	echo "====================== ${i} started ====================="
	./${i}
	if [ "X$?" != "X0" ]
	then
		echo ""
		echo "-> ERROR in \"${i}\" script. Aborting the build process."
		echo -n "-> Cleaning temporary files... "
		umount -f /mnt
		vnconfig -u /dev/rvn0
		./clean ${TYPE}
		echo "Done."
		exit 10
	else
	echo "==================== ${i} completed ====================="
	fi
done
d114 11
a124 12
       KEEP_CUSTOM=no
       if [ ! -d ../custom ]
       then
               return
       fi
       clear
       echo "                   Custom directory setup"
       echo ""
       echo "There is an existing custom configuration linked to"
       ls -l ../custom | awk -F\> '{ print $2 }' | awk '{ print $1 }'
       echo ""
       read -p "Do you wish to use the existing custom directory? (yes/no): " KEEP_CUSTOM
d130 8
a137 15
	clear
	echo "                   Custom directory setup"
	echo ""
	echo "Please enter the full path to the directory containing your"
	echo "custom setup."
	echo "This directory tree must be laid out exactly like the standard"
	echo "ones. (E.g. you can type in /home/abial/work/custom, which"
	echo "should contain conf/, crunch1/, floppy.tree/, lang/, mfs.tree/)."
	echo ""
	read -p "Enter the custom directory: " CUST_DIR
	if [ "X${CUST_DIR}" = "X" ]
	then
		echo "-> Error. Custom directory cannot be null!"
		exit 1
	fi
d140 2
a141 91
# Set the LANGUAGE variable

set_lang() {
	clear
	echo "                    Language setup"
	echo ""
	echo "Language can be either 'en' (English - default) or 'pl' (Polish)"
	echo ""
	read -p "Enter the LANGUAGE (en, pl): " LANGUAGE
	if [ "X${LANGUAGE}" = "X" ]
	then
		LANGUAGE=en
	fi
}

# Set the INIT variable

set_init() {
	clear
	echo "                Choose your init(8) program"
	echo ""
	echo "You can choose either standard init(8) (which requires getty), or"
	echo "you can choose 'oinit' from TinyWare collection."
	echo ""
	read -p "Enter the INIT (init, oinit): " INIT
	if [ "X${INIT}" = "Xinit" ]
	then
		unset INIT
	fi
}

# Set the default MFS size depending on the type of setup

set_dflt_size() {
	echo ""
	if [ "X${TYPE}" = "X" ]
	then
		TYPE=dial
	fi
	echo "Setting default MFS size for \"${TYPE}\" type floppy."
	if [ "X${TYPE}" = "Xdial" ]
	then
		SIZE=$DIAL_DFLT_SIZE
	elif [ "X${TYPE}" = "Xnet" ]
	then
		SIZE=$NET_DFLT_SIZE
	elif [ "X${TYPE}" = "Xrouter" ]
	then
		SIZE=$ROUTER_DFLT_SIZE
	elif [ "X${TYPE}" = "Xisp" ]
	then
		SIZE=$ISP_DFLT_SIZE
	elif [ "X${TYPE}" = "Xcustom" ]
	then
		SIZE=$DIAL_DFLT_SIZE
	else
		echo "Unknown type of setup: \"${TYPE}\". Aborting..."
		exit 10
	fi
}

# Set MFS size interactively

set_size() {
	clear
	echo "            Memory Filesystem (MFS) Size setup"
	echo ""
	echo " Size can be anything decent (usually 1700 or 2500) in kB."
	echo " NOTE1: you can also use other numbers (e.g. 1500, 1456, 1789 ...)"
	echo " even much bigger (like 4567), but keep in mind that this memory is"
	echo " totally lost to other programs. Usually you want to keep this as small as"
	echo " possible."
	echo ""
	echo " NOTE2: for pre-canned setups there are specific requirements:"
	echo "	dial   - requires at least SIZE=$DIAL_DFLT_SIZE"
	echo "	router - requires at least SIZE=$ROUTER_DFLT_SIZE (500kB less without SNMP)"
	echo "	net    - requires at least SIZE=$NET_DFLT_SIZE (500kB less without SNMP)"
	echo "	isp    - requires at least SIZE=$ISP_DFLT_SIZE (500kB less without SNMP)"
	echo ""
	echo " The last two configurations are not likely to run reliably on machines"
	echo " with less than 10MB of RAM, while the 'dial' is tested and proved to run"
	echo " as many as ~30 processes on 10 consoles with only 8MB RAM. YMMV."
	echo ""
	read -p "Enter the SIZE in kB: " SIZE
	if [ "X${SIZE}" = "X" ]
	then
		set_dflt_size
	fi
}

# Set type of floppy interactively
a143 3
	clear
	echo "               Setup the type of configuration"
	echo ""
d145 13
a157 34
	echo " Type can be either 'dial', 'router', 'net' or 'isp'. There are four"
	echo " sets of configuration files in subdirs ../dial, ../router, ../net"
	echo " and ../isp respectively - the contents of the floppy is constructed"
	echo " basing on the Makefiles and scripts in them."
	echo ""
	echo " You can also type in 'custom', and you'll be asked to enter the"
	echo " full path to directory tree, where you stored your custom"
	echo " configuration, laid out exactly like the standard ones. (E.g."
	echo " you can type in /home/abial/work/custom, which should contain"
	echo " conf/, crunch1/, floppy.tree/, lang/, mfs.tree/)."
	echo ""
	echo " If you define TYPE=dial, you'll end up having a floppy which is"
	echo " suitable for dialup access and not much else. If you define TYPE=net,"
	echo " you'll have a small router-fixit-like floppy, which lacks most"
	echo " interactive tools. TYPE=isp gives you a dialin server floppy."
	echo ""
	read -p "Enter the TYPE of the floppy (dial, net, router, isp): " TYPE
	if [ "X${TYPE}" = "X" ]
	then
		TYPE=dial
	fi
	if [ "X${TYPE}" = "Xrouter" ]
	then
		INIT=oinit
	fi
        if [ "X${TYPE}" = "Xcustom" ]
        then
                check_for_old_custom
                if [ "X${KEEP_CUSTOM}" != "Xyes" ]
                then
                        [ -r ../custom ] && rm -f ../custom
                        set_custom
                        (cd ..; ln -sf ${CUST_DIR} custom)
                fi
d159 2
a160 4
	if [ "X${TYPE}" = "Xdial" -a "X${INIT}" = "X" ]
	then
		set_init
	fi
a161 1
	set_dflt_size
a163 8
put_title() {
	clear
	echo "                     Building the PicoBSD v. 0.4 floppy"
	echo "============================================================================"
	echo ""
}


d167 3
d172 23
a194 28
if [ X"$1" = X"package" ]
then
	touch build.status
	echo "##############################################" >>build.status
	echo "## `date` ">>build.status
	echo "##############################################" >>build.status
	./clean dial
	for y in en pl
	do
		for z in dial router net isp
		do
			TYPE=${z}
			LANGUAGE=${y}
			set_dflt_size
			echo "---------------------------------------------">>build.status
			echo "Building TYPE=${z}, LANGUAGE=${y}, SIZE=${SIZE}" >>build.status
			export TYPE SIZE LANGUAGE SRC NO_DEVFS INIT
			main
			if [ "X$?" != "X0" ]
			then
				echo "	** FAILED! **">>build.status
			else
				echo "	(ok)">>build.status
			fi
			mv picobsd.bin pb_${y}${suffix}.bin
			echo "Calling ./clean for ${TYPE}, ${LANGUAGE}, ${SIZE}">>build.status
			./clean ${TYPE}
		done
d196 2
a197 1
	exit 0
d202 87
a288 45
TYPE=dial
LANGUAGE=en
set_dflt_size
while [ "X${ans}" != "Xn" ]
do
	put_title
	echo "Current build parameters are as follows:"
	echo ""
	echo "	1.	Type:     ${TYPE}"
	if [ "X${INIT}" != "X" ]
	then
		echo "		a. (using ${INIT} as init(8))"
	else
		echo "		a. (using stock init as init(8))"
	fi
	echo ""
	echo "	2.	MFS size: ${SIZE} kB"
	echo "	3.	Language: ${LANGUAGE}"
	echo ""
	echo "Which parameter would you like to change?"
	read -p "(1, a, 2, 3; n -no change, build it ; q -quit): " ans
	case ${ans} in
	1)	set_type
		clear
		;;
	a)	set_init
		clear
		;;
	2)	set_size
		clear
		;;
	3)	set_lang
		clear
		;;
	q)	echo ""
		echo "Hey! Don't give up so quickly. Quitting for now..."
		echo ""
		exit 0
		;;
	n)	;;
	*)	echo "Unknown option \"${ans}\". Try again."
		sleep 2
		clear
		;;
	esac
d290 1
a290 2
# Export the parameters
export LANGUAGE SIZE TYPE SRC NO_DEVFS INIT
d295 19
a313 6
if [ "X$?" = "X0" ]
then
	echo "The build process was completed successfuly."
	echo ""
	echo "Now we are going to install the image on the floppy."
	./install
@


1.12
log
@Next round of fixes before 3.1-RELEASE.
@
text
@d4 1
a4 1
#	$Id: build,v 1.11 1999/01/14 23:14:45 abial Exp $
d110 17
d269 10
a278 5
	if [ "X${TYPE}" = "Xcustom" ]
	then
		set_custom
		(cd ..; ln -sf ${CUST_DIR} custom)
	fi
@


1.12.2.1
log
@Improve check for "custom" directory.

PR:		misc/10155
Submitted by:	John Baldwin <jobaldwi@@vt.edu>
@
text
@d4 1
a4 1
#	$Id: build,v 1.12 1999/01/19 23:02:05 abial Exp $
a109 17
# check for existing custom config directory and ask user if they want to use it

check_for_old_custom() {
       KEEP_CUSTOM=no
       if [ ! -d ../custom ]
       then
               return
       fi
       clear
       echo "                   Custom directory setup"
       echo ""
       echo "There is an existing custom configuration linked to"
       ls -l ../custom | awk -F\> '{ print $2 }' | awk '{ print $1 }'
       echo ""
       read -p "Do you wish to use the existing custom directory? (yes/no): " KEEP_CUSTOM
}

d252 5
a256 10
        if [ "X${TYPE}" = "Xcustom" ]
        then
                check_for_old_custom
                if [ "X${KEEP_CUSTOM}" != "Xyes" ]
                then
                        [ -r ../custom ] && rm -f ../custom
                        set_custom
                        (cd ..; ln -sf ${CUST_DIR} custom)
                fi
        fi
@


1.12.2.2
log
@MFC: PicoBSD mega-upgrade.  It actually works in -STABLE, let's hope I
didn't miss anything.  According to luigi, I have jkh's OK on this.

Submitted by:  luigi
@
text
@d4 1
a4 1
#	$Id: build,v 1.12.2.1 1999/02/22 21:25:15 abial Exp $
d6 1
d11 2
a12 12
# --------- YOU SHOULD NOT NEED TO CHANGE ANYTHING BELOW -----------
# The "build" script will ask you for parameters. Just run it... :-)
# --------- YOU SHOULD NOT NEED TO CHANGE ANYTHING BELOW -----------

# EDITOR is the editor you use
EDITOR=${EDITOR:-vi}
# LANGUAGE     language to be used (en or pl)
LANGUAGE=en
# TYPE         PicoBSD type (isp, router, net, custom)
TYPE=${1:-dial}
# SITE         site-specific files
SITE=
d14 4
a17 2
# FLOPPY_SIZE  floppy size in KB (default to 1440)
FLOPPY_SIZE=1440
d23 6
a28 2
# RISU is where dialog replies go.
RISU=.build.reply
a29 1
# abort in case of error...
d34 6
a39 1
# assign default values to variables.
d41 2
a42 1
set_defaults() {
d44 21
a64 18
    while read name suff sz init mfs_in floppy_in ; do
	if [ "$name" != "#" -a $name != "" ] ; then
	    eval ${name}_suffix=$suff
	    eval ${name}_DFLT_SIZE=$sz
	    eval ${name}_INIT=$init
	    eval ${name}_MFS_INODES=$mfs_in
	    eval ${name}_FLOPPY_INODES=$floppy_in
	fi
    done <<__eof__
# build	MFS		- Byte/inode -
# name		suffix	DFLT_SZ	init	MFS	FLOPPY
dial		-D	1600	init	4096	32768
router		-R	820	oinit	3072	32768
net		-N	2200	init	4096	32768
isp		-I	2400	init	4096	32768
custom		-C	2400	init	8192	32768
__eof__
}
d66 18
a83 10
set_msgs() {
    MSG1="Type: ${TYPE}"
    if [ "X${TYPE}" = "Xcustom" ] ; then
	MSG1="${MSG1} (from ${CUST_DIR})"
    fi

    MSG="PicoBSD build -- Current parameters:\n\n\t1.  ${MSG1}\n\
\t2.  MFS size: ${SIZE} kB\n\t3.  Language: ${LANGUAGE}\n\
\t4.  Site-info: ${SITE}\n"
}
d85 2
d88 1
a88 2
# Main build procedure. It calls another scripts (stage1)
main() {
d90 18
a107 33
    export suffix

    clear
    set_msgs
    printf "${MSG}"
    echo "-> We'll use the sources living in ${SRC}"
    echo ""
    echo "-> I hope you have checked the ../${TYPE}/PICOBSD config file..."
    echo ""
    echo ""
    sleep 2

    export SIZE LANGUAGE TYPE SRC NO_DEVFS INIT
    export SITE MFS_INODES FLOPPY_INODES FLOPPY_SIZE

    # Build the kernel, if necessary
    echo ""
    echo "-> Checking if we have to build the PICOBSD kernel..."
    (cd ../${TYPE}; make -f ../build/Makefile.conf )
    echo ""

    ./stage1
    if [ "X$?" != "X0" ] ; then
	echo ""
	echo "-> ERROR in \"${i}\" script. Aborting the build process."
	echo -n "-> Cleaning temporary files... "
	umount -f /mnt
	vnconfig -u /dev/rvn0
	./clean ${TYPE}
	echo "Done."
	exit 10
    fi
    echo "==================== ${i} completed ====================="
d113 12
a124 11
   KEEP_CUSTOM=no
   if [ ! -d ../custom ] ; then
       return
   fi
   clear
   echo "                   Custom directory setup"
   echo ""
   echo "There is an existing custom configuration linked to"
   ls -l ../custom | awk -F\> '{ print $2 }' | awk '{ print $1 }'
   echo ""
   read -p "Do you wish to use the existing custom directory? (yes/no): " KEEP_CUSTOM
d130 15
a144 8
    dialog --title "Custom directory setup" --inputbox \
    "Please enter the full path to the directory containing your \
    custom setup. \
    This directory tree must be laid out exactly like the standard \
    ones. (E.g. you can type in /home/abial/work/custom, which \
    should contain crunch1/, floppy.tree/, lang/ )." \
    10 70 2> ${RISU}
    CUST_DIR=`cat ${RISU}`
d147 91
a237 2
# Set type of floppy interactively. Also set the various defaults
# associated to each type. We can override them manually afterwards.
d240 3
d244 34
a277 13
    eval SIZE=$"${TYPE}_DFLT_SIZE"
    eval INIT=$"${TYPE}_INIT"
    eval MFS_INODES=$"${TYPE}_MFS_INODES"
    eval FLOPPY_INODES=$"${TYPE}_FLOPPY_INODES"
    eval suffix=$"${TYPE}_suffix"

    case ${TYPE} in
    custom)
	check_for_old_custom
	if [ "X${KEEP_CUSTOM}" != "Xyes" ] ; then
	    [ -r ../custom ] && rm -f ../custom
	    set_custom
	    (cd ..; ln -sf ${CUST_DIR} custom)
d279 4
a282 2
	;;
    esac
d284 1
d287 8
a297 3
set_defaults
set_type

d300 28
a327 23
if [ X"$1" = X"package" ] ; then
    shift
    touch build.status
    echo "##############################################" >>build.status
    echo "## `date` ">>build.status
    echo "##############################################" >>build.status
    ./clean dial
    for y in en pl ; do
	for z in dial router net isp ; do
	    TYPE=${z}
	    LANGUAGE=${y}
	    set_type
	    echo "---------------------------------------------">>build.status
	    echo "Building TYPE=${z}, LANGUAGE=${y}, SIZE=${SIZE}" >>build.status
	    main
	    if [ "X$?" != "X0" ] ; then
		echo "	** FAILED! **">>build.status
	    else
		echo "	(ok)">>build.status
	    fi
	    mv picobsd.bin pb_${y}${suffix}.bin
	    echo "Calling ./clean for ${TYPE}, ${LANGUAGE}, ${SIZE}">>build.status
	    ./clean ${TYPE}
d329 1
a329 2
    done
    exit 0
d334 45
a378 87
while [ "X${ans}" != "Xn" ] ; do
    set_msgs
    dialog --menu "PicoBSD build menu -- ver 0.44 (20aug1999)" 19 70 12 \
	1 "${MSG1}" \
	a "init type: ${INIT}" \
	e "edit kernel config file for ${TYPE}" \
	c "edit crunch.conf file for ${TYPE}" \
	2 "MFS size: ${SIZE}kB" \
	3 "Language: ${LANGUAGE}" \
	4 "Site-info: ${SITE}" \
	5 "Floppy size: ${FLOPPY_SIZE}kB" \
	6 "MFS bytes per inode: ${MFS_INODES}" \
	7 "UFS bytes per inode: ${FLOPPY_INODES}" \
	n "no change, build it" q "quit" 2> ${RISU}
    ans=`cat ${RISU}`
    case ${ans} in
    1)
	dialog --menu "Setup the type of configuration" 12 70 5 \
	    dial "dialin (ppp etc.)" \
	    router "router/bridge/mrouter" \
	    net "net admin tool" \
	    isp "isp (ppp and terminal server)" \
	    custom "custom config (need pathname)" 2> ${RISU}
	if [ $? = 0 ]; then
	    TYPE=`cat ${RISU}`
	    set_type
	fi
	;;
    a)
	dialog --menu "Choose your init(8) program" \
	10 70 2 init "Standard init (requires getty)" \
	oinit "small init from TinyWare" 2> ${RISU}
	if [ "$?" = "0" ]; then
	    INIT=`cat ${RISU}`
	fi
	;;

    e) ${EDITOR} ../${TYPE}/PICOBSD ;;
    c) ${EDITOR} ../${TYPE}/crunch1/crunch.conf ;;
    2) dialog --title "MFS Size setup" --inputbox \
"MFS size depends on what you need to put on the MFS image. Typically \
ranges between 800kB (for very small bridge/router images) to \
as much as 2500kB kB for a densely packed image. \
Keep in mind that this memory is \
totally lost to other programs. Usually you want to keep \
this as small as possible. " 10 70 2> ${RISU}
	SIZE=`cat ${RISU}`
	if [ "X${SIZE}" = "X" ] ; then
	    eval SIZE=${TYPE}_DFLT_SIZE
	fi
	;;
    3)      dialog --menu "Please choose language" \
	10 40 2 en English pl Polish 2> ${RISU}
	LANGUAGE=`cat ${RISU}`
	;;
    4) dialog --title "Site info setup" --inputbox \
	"Please enter the full path to the directory \
	containing site-specific setup. \
	This directory tree must contain files that replace \
	standard ones in floppy.tree/ and mfs.tree/ . " \
	10 70 2> ${RISU}
	SITE=`cat ${RISU}`
	;;
    5) dialog --menu "Set floppy size" 15 70 4 \
		1440 "1.44MB" 1720 "1.72MB" \
		2880 "2.88MB" 4096 "4MB" 2> ${RISU}
	FLOPPY_SIZE=`cat ${RISU}`
	;;
    6) dialog --title "MFS bytes per inode:" --inputbox \
	"Enter MFS bytes per inode (typically 4096..65536). \
	A larger value means fewer inodes but more space on MFS" \
	10 70 2> ${RISU}
	MFS_INODES=`cat ${RISU}`
	;;
    7) dialog --title "Floppy bytes per inode:" --inputbox \
	"Enter floppy bytes per inode (typically 3072..65536). \
	A larger value means fewer inodes but more space on the floppy." \
	10 70 2> ${RISU}
	FLOPPY_INODES=`cat ${RISU}`
	;;
    n) ;;
    q) exit 0 ;;
    *) echo "Unknown option \"${ans}\". Try again."
	sleep 2
	clear
	;;
    esac
d380 2
a381 1

d386 6
a391 19
if [ "X$?" = "X0" ] ; then
FILENAME=picobsd.bin
    echo "The build process was completed successfuly."
    echo ""
    echo "Now we are going to install the image on the floppy."
    echo "Please insert a blank floppy in /dev/fd0."
    echo "WARNING: the contents of the floppy will be permanently erased!"
    echo "Your options:"
    echo "	* ^C to abort,"
    echo "	* Enter to install \"${FILENAME}\","
    echo "	* name of other file to install."
    echo ""
    read -p "Your choice: " junk
    if [ "X${junk}" != "X" ] ; then
	FILENAME=${junk}
    fi
    echo "Writing ${FILENAME}..."
    dd if=${FILENAME} of=/dev/rfd0
    echo "Done."
@


1.12.2.3
log
@MFC: cleanup in PicoBSD scripts, bump version to 0.445
@
text
@d4 1
a4 1
#	$Id: build,v 1.15 1999/08/23 08:33:07 luigi Exp $
d18 2
d36 1
a36 1
. ../Version
d39 1
a40 1
    TYPE=${TYPE:-dial} # PicoBSD type (isp, router, net, custom, ...
d97 1
a97 1
    ./stage1 2>&1 | tee stage1.out
d164 7
d172 2
a173 1
build_package() {
d198 1
a198 1
}
d202 1
a202 2
main_dialog() {
  while [ true ] ; do
d204 12
a215 14
    dialog --menu "PicoBSD build menu -- ver ${VER} (22aug1999)" 19 70 12 \
	N "No change, build it" \
	T "${MSG1}" \
	K "edit Kernel config file for ${TYPE}" \
	E "Edit crunch.conf file for ${TYPE}" \
	S "MFS Size: ${SIZE}kB" \
	L "Language: ${LANGUAGE}" \
	I "Init type: ${INIT}" \
	F "Floppy size: ${FLOPPY_SIZE}kB" \
	M "MFS bytes per inode: ${MFS_INODES}" \
	U "UFS bytes per inode: ${FLOPPY_INODES}" \
	$ "Site-info: ${SITE}" \
	Q "Quit" \
	2> ${RISU}
a216 1
    rm ${RISU}
d218 1
a218 1
    T)
d224 2
a225 2
	    custom "custom config (need pathname)" 2> ${RISU} || rm ${RISU}
	if [ -f ${RISU} ] ; then
d230 1
a230 1
    I)
d233 2
a234 2
	oinit "small init from TinyWare" 2> ${RISU} || rm ${RISU}
	if [ -f ${RISU} ] ; then
d239 3
a241 6
    K) ${EDITOR} ../${TYPE}/PICOBSD ;;

    E) ${EDITOR} ../${TYPE}/crunch1/crunch.conf ;;

    S)
	dialog --title "MFS Size setup" --inputbox \
d243 1
a243 1
ranges between 820kB (for very small bridge/router images) to \
d247 4
a250 6
this as small as possible. " 10 70 2> ${RISU} || rm ${RISU}
	if [ -f ${RISU} ] ; then
	    SIZE=`cat ${RISU}`
	    if [ "${SIZE}" = "" ] ; then
		eval SIZE=$"${TYPE}_DFLT_SIZE"
	    fi
d253 3
a255 7

    L)
	dialog --menu "Please choose language" \
	10 40 2 en English pl Polish 2> ${RISU} || rm ${RISU}
	if [ -f ${RISU} ] ; then
	    LANGUAGE=`cat ${RISU}`
	fi
d257 1
a257 3

    \$)
	dialog --title "Site info setup" --inputbox \
d262 2
a263 4
	10 70 2> ${RISU} || rm ${RISU}
	if [ -f ${RISU} ] ; then
	    SITE=`cat ${RISU}`
	fi
d265 1
a265 3

    F)
	dialog --menu "Set floppy size" 15 70 4 \
d267 2
a268 4
		2880 "2.88MB" 4096 "4MB" 2> ${RISU} || rm ${RISU}
	if [ -f ${RISU} ] ; then
	    FLOPPY_SIZE=`cat ${RISU}`
	fi
d270 1
a270 3

    M)
	dialog --title "MFS bytes per inode:" --inputbox \
d273 2
a274 7
	10 70 2> ${RISU} || rm ${RISU}
	if [ -f ${RISU} ] ; then
	    MFS_INODES=`cat ${RISU}`
	    if [ "${MFS_INODES}" = "" ] ; then
		eval MFS_INODES=$"${TYPE}_DFLT_MFS_INODES"
	    fi
	fi
d276 1
a276 3

    U)
	dialog --title "Floppy bytes per inode:" --inputbox \
d279 2
a280 10
	10 70 2> ${RISU} || rm ${RISU}
	if [ -f ${RISU} ] ; then
	    FLOPPY_INODES=`cat ${RISU}`
	    if [ "${FLOPPY_INODES}" = "" ] ; then
		eval FLOPPY_INODES=$"${TYPE}_DFLT_FLOPPY_INODES"
	    fi
	fi
	;;

    N) break 2
d282 3
a284 4

    Q) exit 0 ;;

    *) echo "Unknown option \"${ans}\". Try again."
d289 1
a289 2
  done
}
d292 18
a309 22
# Install image
do_install() {
    dialog --title "Build ${TYPE} completed" --inputbox \
"\nThe build process was completed successfuly.\n\
Now we are going to install the image on the floppy.\n\
Please insert a blank floppy in /dev/fd0.\\n
WARNING: the contents of the floppy will be permanently erased!\n\
\n\
Your options:\n\
	* ^C or [Cancel] to abort,\n\
	* Enter to install \"${FILENAME}\",\n\
	* name of other file to install.\n\
" 20 70 2> ${RISU}
    if [ "$?" = "0" ]; then
	FILENAME=`cat ${RISU}`
	if [ "${FILENAME}" = "" ] ; then
	    FILENAME=picobsd.bin
	fi
	echo "Writing ${FILENAME}..."
	dd if=${FILENAME} of=/dev/rfd0
    else
	echo "Ok, the image is in picobsd.bin"
d311 2
a313 21
}

#-------------------------------------------------------------------
# Main entry of the script

interactive="YES"
if [ "$1" = "-n" ] ; then
    interactive="NO"
    shift
fi
TYPE=$1
set_defaults
set_type

# If $1="package", it creates a neat set of floppies

if [ "$1" = "package" ] ; then
    build_package
fi
if [ "$interactive" = "YES" ] ; then
    main_dialog
a314 2
main	# build ${TYPE}
do_install
@


1.12.2.4
log
@$Id$ -> $FreeBSD$
@
text
@d4 1
a4 1
# $FreeBSD$
@


1.12.2.5
log
@Dialog-ify 'use custom directory' question.
@
text
@d4 1
a4 1
# $FreeBSD: src/release/picobsd/build/build,v 1.12.2.4 1999/08/29 15:52:25 peter Exp $
a109 4
# 
# Note that specifying an alternate directory is broken due to relative
# path assumptions during the kernel compilation phase of the build.
# For now just dialog-ify.
d116 7
a122 10
   
   CUSTOMLINK=`ls -l ../custom | awk -F\> '{ print $2 }' | awk '{ print $1 }'`
   if dialog --title "Custom directory setup" --yesno "A custom configuration\n ${CUSTOMLINK}\nalready exists. Would you like to use it?" 7 50 ; then 
       KEEP_CUSTOM=yes
   else 
       KEEP_CUSTOM=no
   fi

   # If custom is just a simple directory, assume the user wants it

@


1.12.2.6
log
@MFC: Take tee off of stage1 call.
@
text
@d4 1
a4 1
# $FreeBSD: src/release/picobsd/build/build,v 1.20 1999/08/29 19:16:29 dwhite Exp $
d95 1
a95 1
    ./stage1
@


1.12.2.7
log
@MFC: install floppy prep, misc. fixups.
@
text
@d4 1
a4 1
# $FreeBSD: src/release/picobsd/build/build,v 1.21 1999/10/08 03:59:58 dwhite Exp $
a35 4
# support symbolically linked custom directory
BUILDDIR=`pwd`
export BUILDDIR

a54 1
install		-S	2400	init	4096	4096
d92 1
a92 1
    (cd ../${TYPE}; make -f ${BUILDDIR}/Makefile.conf )
a123 1
       CUST_DIR=${CUSTOMLINK}
d339 1
a339 1
	* Enter to install \"picobsd.bin\",\n\
@


1.12.2.8
log
@MFC: sync Picobsd build structure with the one in -current.
This involves a cleanup of the build scripts, removing
common files from the individual trees and put them in a
common place, and remove unused stuff.
@
text
@d4 1
a4 1
# $FreeBSD$
d44 1
a44 11
    # build image list
    cat /dev/null > .image.list
    for i in ../* ; do
	if [ -d $i -a -f $i/PICOBSD ] ; then
	    a=`awk '/^#PicoBSD/ {print $2, $3, $4, $5, $6}' < $i/PICOBSD`
	    if [ "$a" != "" ]; then
		echo "`basename $i`  $a" >>.image.list
	    fi
	fi
    done
    while read name sz init mfs_in floppy_in ; do
d46 1
d52 10
a61 1
    done < .image.list
d71 1
a71 1
\t2.  MFS size: ${MFS_SIZE} kB\n\t3.  Language: ${LANGUAGE}\n\
a78 5
    if [ "X${TYPE}" = "X" ] ; then
	echo "-> wrong floppy type"
	exit 10
    fi
	
d91 1
a91 1
    export MFS_SIZE LANGUAGE TYPE SRC NO_DEVFS INIT
d94 6
d155 2
a156 1
    eval MFS_SIZE=$"${TYPE}_DFLT_SIZE"
d160 1
a160 6
    suffix="-${TYPE}"
    if [ "${MFS_SIZE}" = "" ] ; then
	echo "TYPE $TYPE not found!"
	sleep 2
	TYPE=""
    fi
d188 1
a188 1
	    echo "Building TYPE=${z}, LANGUAGE=${y}, SIZE=${MFS_SIZE}" >>build.status
d196 1
a196 1
	    echo "Calling ./clean for ${TYPE}, ${LANGUAGE}, ${MFS_SIZE}">>build.status
d213 1
a213 1
	S "MFS Size: ${MFS_SIZE}kB" \
d227 5
a231 2
	    `awk '{ print $1, $1 }' < .image.list` \
		2> ${RISU} || rm ${RISU}
d259 3
a261 3
	    MFS_SIZE=`cat ${RISU}`
	    if [ "${MFS_SIZE}" = "" ] ; then
		eval MFS_SIZE=$"${TYPE}_DFLT_SIZE"
a338 1
`cat .build.reply` \
d347 1
a347 1
" 20 80 2> ${RISU}
a369 1
SITE=$2
@


1.11
log
@Make transition to ELF kernel. Fix the userconfig_script handling.
@
text
@d4 1
a4 1
#	$Id: build,v 1.10 1998/09/23 14:54:46 abial Exp $
d16 2
a17 2
NET_DFLT_SIZE=2200
ISP_DFLT_SIZE=2200
d19 1
a19 1
# SET THIS if you're not using DEVFS
@


1.10
log
@Correct comment in the "build" script about aout/ELF.
@
text
@d4 1
a4 1
#	$Id: build,v 1.9 1998/09/22 15:40:00 abial Exp $
a9 4


# Set this if your crunchgen and kzip don't support ELF.
#OBJFORMAT=aout; export OBJFORMAT
@


1.9
log
@All PicoBSD userland is now ELF. This buys us extra 15-30kB on the floppy.

NOTIE: If you don't use /usr/obj (or you wiped it), remember to clean also
the source tree of stale .depend and *.o files...
@
text
@d4 1
a4 1
#	$Id: build,v 1.8 1998/09/20 00:46:07 abial Exp $
d12 1
a12 1
# Set this until the tools are fixed...
@


1.8
log
@Hmm... Let's make the switch to non-DEVFS actually work. :-/
@
text
@d4 1
a4 1
#	$Id: build,v 1.7 1998/09/19 21:44:42 abial Exp $
d13 1
a13 1
OBJFORMAT=aout; export OBJFORMAT
@


1.7
log
@Kill the remnants of DEVFS, since it's broken without the SLICE code...
Pity - it was _very_ handy.

This also required increasing of MFS size, so that PicoBSD consumes more
memory now...
@
text
@d4 1
a4 1
#	$Id: build,v 1.6 1998/09/15 11:12:13 abial Exp $
d25 1
a25 1
# NO_DEVFS=yes
@


1.6
log
@Update ucd-snmp to version 3.5. It's slightly bigger, so also increase
the MFS size of net and isp floppies.

Add comment to crunch.conf on how to prepare the ucd-snmp port to work
with the build process.

Submitted by:	Jim Flowers <jflowers@@ezo.net>
@
text
@d4 1
a4 1
#	$Id: build,v 1.5 1998/09/07 06:46:25 abial Exp $
d23 1
a23 1
# SET THIS if you're building on 2.2.x system
d25 1
a25 1
# RELENG_2_2=yes
d92 1
a92 1
export SIZE LANGUAGE TYPE SRC RELENG_2_2 INIT
d298 1
a298 1
			export TYPE SIZE LANGUAGE SRC RELENG_2_2 INIT
d363 1
a363 1
export LANGUAGE SIZE TYPE SRC RELENG_2_2 INIT
@


1.5
log
@Set the ${suffix} only once...
@
text
@d4 1
a4 1
#	$Id: build,v 1.4 1998/09/04 19:38:57 abial Exp $
d20 2
a21 2
NET_DFLT_SIZE=2100
ISP_DFLT_SIZE=2100
@


1.4
log
@Added special type of setup called 'custom'. It allows you to supply
your own config directory laid out exactly like the standard ones.

Suggested by:	Richard Wackerbarth <rkw@@dataplex.net>
@
text
@d4 1
a4 1
#	$Id: build,v 1.3 1998/09/04 08:08:05 abial Exp $
d68 1
@


1.3
log
@Set OBJFORMAT=aout to affect the whole build - for now, it seems that too
many tools needed to build the floppies are dependent on a.out...
@
text
@d4 1
a4 1
#	$Id: build,v 1.2 1998/09/03 10:40:27 abial Exp $
d64 4
d113 20
d185 3
d235 7
a241 1
	echo " E.g. if you define TYPE=dial, you'll end up having a floppy which is"
d254 5
@


1.2
log
@Minor fixes to 'clean' script.

Changed the 'build' script to use ../${TYPE}/conf/Makefile in order to
have true dependency of kernel image on the kernel config file.
@
text
@d4 1
a4 1
#	$Id: build,v 1.1.1.1 1998/08/27 17:38:42 abial Exp $
d10 4
@


1.1
log
@Initial revision
@
text
@d4 1
a4 1
#	$Id: build,v 1.8 1998/08/10 19:06:48 abial Exp $
d36 3
a38 9
	echo "-> We must make the PICOBSD${suffix}.${SIZE} kernel first..."
	pwd=`pwd`
	cat ../${TYPE}/conf/PICOBSD | grep -v "MFS_ROOT">${CONF}/PICOBSD${suffix}.${SIZE}
	echo "options	\"MFS_ROOT=${SIZE}\"" >>${CONF}/PICOBSD${suffix}.${SIZE}
	cd ${CONF}
	config PICOBSD${suffix}.${SIZE}
	cd ../../compile/PICOBSD${suffix}.${SIZE}
	make depend && make
	cd ${pwd}
a60 2
CONF="${SRC}/sys/i386/conf"

d80 2
a81 9
# Now check if we must build the kernel first

if [ ! -f ${SRC}/sys/i386/conf/PICOBSD${suffix}.${SIZE} ]
then
	build_kernel
elif [ ! -f ${SRC}/sys/compile/PICOBSD${suffix}.${SIZE}/kernel ]
then
	build_kernel
fi
@


1.1.1.1
log
@Initial import of PicoBSD v0.4 tree.
@
text
@@
