howto make sysintall
John Baldwin
jhb at FreeBSD.org
Wed Aug 10 17:49:22 GMT 2005
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 at FreeBSD.org> <>< http://www.FreeBSD.org/~jhb/
"Power Users Use the Power to Serve" = http://www.FreeBSD.org
More information about the freebsd-hackers
mailing list