Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 10 Aug 2005 11:07:30 -0400
From:      John Baldwin <jhb@FreeBSD.org>
To:        freebsd-hackers@freebsd.org
Cc:        iv gan <devif0@gmail.com>, Glenn Dawson <glenn@antimatter.net>
Subject:   Re: howto make sysintall
Message-ID:  <200508101107.31917.jhb@FreeBSD.org>
In-Reply-To: <356446ef050810061832003965@mail.gmail.com>
References:  <356446ef0508100239320d2bf0@mail.gmail.com> <6.1.0.6.2.20050810032350.078f3eb0@cobalt.antimatter.net> <356446ef050810061832003965@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Wednesday 10 August 2005 09:18 am, iv gan wrote:
> I am not so sure because the script cannot detect different devices.
> It can be ad or ar or whatever but it cannot chechk for it. And what I
> would like to do is more to detect the device and then to do something
> like 10% to /, 20% to /tmp 35% to /var and 35% to /usr or something
> like it.
> Any suggestion?

You can run a command to generate a config file that you then include.  I use 
this with shell scripts that invoke 'dialog' to provide the user with custom 
menus.  A sample is something like this:

install.cfg:

# select media
command=sh /stand/setmedia.sh
system
configFile=/stand/setmedia.cfg
loadConfig

setmedia.sh:

#!/bin/sh
#
# Set the installation media based on kernel environment variables.

config=/stand/setmedia.cfg

case `kenv media` in
        FTP)
                iface=`kenv iface`
                server=`kenv server`

                echo "abort" > ${config}
                if [ -z "${iface}" -o -z "${server}" ]; then
                        dialog --title "Missing Settings" --msgbox "The 
network interface and FTP server must be specified\nvia the 'iface' and 
'server' variables in loader.conf." -1 -1
                        exit 1
                fi
                found=0
                for ifn in `ifconfig -l`; do
                        if [ "${ifn}" = "${iface}" ]; then
                                found=1
                        fi
                done
                if [ ${found} -eq 0 ]; then
                        dialog --title "Invalid Interface" --msgbox "The 
network interface ${iface} is not present." -1 -1
                        exit 1
                fi
                echo "# Setup for FTP install"                  > ${config}
                echo "command=/stand/dhclient ${iface}"         >> ${config}
                echo "system"                                   >> ${config}
                echo "hostname=localhost"                       >> ${config}
                echo "netDev=${iface}"                          >> ${config}
                echo "_ftpPath=ftp://${server}/pub/FreeBSD"     >> ${config}
                echo "ifconfig_${iface}=DHCP"                   >> ${config}
                echo "mediaSetFTP"                              >> ${config}
                ;;
        *)
                # Default to CD
                echo "# select CDROM media"                     > ${config}
                echo "mediaSetCDROM"                            >> ${config}
esac


This is just the part to setup the install media.  What I do here is share the 
same mfsroot across both CD installs and installs over PXE, but in 
the /usr/nfsroot on the PXE server I have a boot/loader.conf that looks like:

boot/loader.conf:
# NFS install
media=FTP
iface=fxp0
server=10.1.2.3

I also use a similar approach to use different disk layouts for different 
configurations, etc.  In my case I patched the release sources to include 
kenv and dialog in the crunch for the mfsroot and added my custom scripts to 
stand/ in the mfsroot.

-- 
John Baldwin <jhb@FreeBSD.org>  <><  http://www.FreeBSD.org/~jhb/
"Power Users Use the Power to Serve"  =  http://www.FreeBSD.org



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