88e4dbacdb
slice, partition, newfs, and install FreeBSD from a tarball on a remote server. Handy for doing mass-installs for server farms. Documentation following shortly.
113 lines
2.7 KiB
Bash
Executable File
113 lines
2.7 KiB
Bash
Executable File
#!/bin/sh
|
|
#
|
|
# PicoBSD installer script for FreeBSD
|
|
#
|
|
# Doug White
|
|
# $FreeBSD$
|
|
|
|
#### CONFIGURATION
|
|
|
|
# URL to image tarball, fed to fetch(1)
|
|
image_url="ftp://YOUR.SERVER.HERE/pub/fbsdimage.tgz"
|
|
|
|
# Target disk driver to fdisk -e
|
|
target_disk="wd0"
|
|
|
|
#### END CONFIGURATION
|
|
|
|
# Immediately abort on error
|
|
set -e
|
|
|
|
# Do the install
|
|
|
|
echo "==> Partitioning disk"
|
|
fdisk -e ${target_disk}
|
|
|
|
echo "==> Disklabeling disk"
|
|
/etc/prepdisk ${target_disk}
|
|
|
|
echo "==> Creating filesystem"
|
|
newfs /dev/r${target_disk}s1a > /dev/null
|
|
|
|
echo "==> Mounting new filesystem"
|
|
mount /dev/${target_disk}s1a /mnt
|
|
|
|
echo "==> Installing disk image"
|
|
if [ "X${image_url}" = "X" ] ; then
|
|
echo "No URL specified!"
|
|
else
|
|
echo "=====> From: ${image_url}"
|
|
cd /mnt
|
|
fetch -a -o - ${image_url} | gzip -d | cpio -idmu --quiet
|
|
fi
|
|
|
|
# Some examples of post-install tweaking
|
|
|
|
# The install floppy always DHCPs an address. If you want to make that
|
|
# address permanent on the system, use this code bit.
|
|
|
|
#echo "==> Saving IP address"
|
|
#set `ifconfig fxp0 | grep inet`
|
|
#echo "ifconfig_fxp0=\"inet $2 netmask $4\"" >> /mnt/etc/rc.conf
|
|
#echo "=====> IP Address is $2"
|
|
|
|
# If you enable different apps based on environment, here's an example.
|
|
# For 10.2.X.X networks, enable AMD.
|
|
|
|
#echo "==> Checking if amd should be enabled"
|
|
#IFS=.
|
|
#set $2
|
|
#if [ "X$1" = "X10" -a "X$2" = "X1" ] ; then
|
|
# echo "=====> Enabling amd"
|
|
# echo "amd_enable=\"YES\"" >> /mnt/etc/rc.conf
|
|
#fi
|
|
|
|
#echo "==> Setting default router"
|
|
#echo "defaultrouter=\"10.1.1.3\"" >> /mnt/etc/rc.conf
|
|
|
|
# Grab the DNS servers from the local DHCP configuration.
|
|
|
|
#echo "==> Configuring name resolution"
|
|
#cp /etc/resolv.conf /mnt/etc
|
|
|
|
# Prompt a menu to install a single or multiprocessor kernel. On our
|
|
# main image, we have two kernels, kernel-SMP and kernel-NOSMP. This
|
|
# menu drops a symlink that the bootblocks follow to the proper kernel.
|
|
# The user can enter a name for a different kernel if desired.
|
|
|
|
#echo "==> Linking kernel"
|
|
|
|
#DOKERN=0
|
|
#cd /mnt
|
|
#chflags noschg kernel
|
|
#rm -f kernel
|
|
#
|
|
#while [ "X$DOKERN" = "X0" ] ; do
|
|
#
|
|
# DOKERN=1
|
|
#
|
|
# echo " Please specify which kernel to use:"
|
|
# echo " 1. Uniprocessor"
|
|
# echo " 2. Multiprocessor (OK for SMP equipped systems with one CPU)"
|
|
# echo " Or type the name of the kernel you wish to use"
|
|
# read -p "Select >" KERN
|
|
#
|
|
#
|
|
# if [ "X$KERN" = "X1" ] ; then
|
|
# ln -s kernel-NOSMP kernel
|
|
# echo "=====> Uniprocessor kernel selected"
|
|
# elif [ "X$KERN" = "X2" ] ; then
|
|
# ln -s kernel-SMP kernel
|
|
# echo "=====> SMP kernel selected"
|
|
# elif [ -f $KERN ] ; then
|
|
# ln -s $KERN kernel
|
|
# echo "=====> User supplied kernel $KERN selected"
|
|
# else
|
|
# echo "*** Unknown kernel $KERN"
|
|
# KERN=0
|
|
# fi
|
|
#
|
|
#done
|
|
|
|
echo "==> Install complete!"
|