Date: Sun, 12 Feb 2012 17:13:48 +1030 From: "Daniel O'Connor" <doconnor@gsoft.com.au> To: Joe Holden <lists@rewt.org.uk> Cc: FreeBSD Stable Mailing List <freebsd-stable@freebsd.org>, Alex Samorukov <ml@os2.kiev.ua> Subject: Re: New BSD Installer Message-ID: <4F7A77DF-BA0B-4A75-A5EF-3CCDA314AD93@gsoft.com.au> In-Reply-To: <4F3577C9.6050401@rewt.org.uk> References: <4F355A5B.9080007@rewt.org.uk> <4F35743B.4020302@os2.kiev.ua> <4F35762D.60908@rewt.org.uk> <4F3577C9.6050401@rewt.org.uk>
next in thread | previous in thread | raw e-mail | index | archive | help
On 11/02/2012, at 6:32, Joe Holden wrote: > On a related note - does the new installer have any kind of config = file for unattended installs a la sysinstall? No it doesn't, that said since the new release CD is a live file system = (vs the old MFS on a CD kludge) it is much much easier to script your = own install. Especially with gpart it is fairly easy to setup a working system. I use this at work - image.txz.?? is created from a chroot where I = pre-build rather than using packages since it is a lot faster. The original also does things like put certain settings in sysctl.conf, = loader.conf and rc.conf. I found it was a lot simpler to set this up vs doing something similar = with sysinstall because sysinstall's environment was so restrictive. Currently the user selects shell and then runs the script, but I am = looking at modifying the release rc.local to add a menu option to make = it simpler. #!/bin/sh PATH=3D/bin:/usr/bin:/sbin:/usr/sbin export PATH BLOCKSIZE=3D10240 ROSINST=3D"/ros-install.sh" if [ $# -ne 1 ]; then devs=3D`camcontrol devlist | sed -nEe 's,<(.*)> +at = scbus.*\((.*)\,(.*)\),\1|\2 \3,p' | sed -Ee 's,pass[0-9]+,,' | sed -Ee = 's,(.*)\| ?(.*),/dev/\2 \\\"\1\\\",' | xargs echo` eval dialog --backtitle \"FreeBSD Installer\" --title \"Device = selection\" --menu \"Select device to install onto\" 20 50 40 $devs = 2>/tmp/devselection if [ $? -ne 0 ]; then echo echo "Aborting installation" exit 1 fi DEV=3D`cat /tmp/devselection` rm -f /tmp/devselection else DEV=3D"${1}" fi if [ ! -c "${DEV}" ]; then echo "${DEV} isn't a device" exit 1 fi set -e echo "Installing to ${DEV}" echo echo "Please enter the fully qualified hostname" echo "If you just press enter default values for networking will be = used" read hostname if [ -z "$hostname" ]; then hostname=3D"newradar.local" ifconfig=3D"DHCP" else echo "Please enter the ifconfig line (DHCP or a static IP)" read ifconfig=20 if [ "$ifconfig" !=3D "DHCP" ]; then echo "Please enter the default router" read defrouter echo "Please enter the DNS search domain" read dnssearch echo "Please enter the DNS server" read dnsserver fi fi echo "WARNING WARNING WARNING WARNING WARNING WARNING" echo "Continuing will destroy all data on ${DEV}" echo "WARNING WARNING WARNING WARNING WARNING WARNING" echo "Do you wish to continue? (y/n)" read answer if [ $answer !=3D "y" ]; then echo "Aborting" exit 0 fi TMPDIR=3D`mktemp -d -q /tmp/installos.XXXXXX` if [ $? -ne 0 ]; then echo "Unable to create temporary directory" exit 1 fi mkdir "${TMPDIR}/mnt" gpart destroy -F ${DEV} || echo -n gpart create -s GPT ${DEV} gpart add -t freebsd-boot -s 64K ${DEV} gpart bootcode -b ${SRC}/boot/pmbr -p ${SRC}/boot/gptboot -i 1 ${DEV} gpart add -t freebsd-ufs -s 1G -l slash ${DEV} gpart add -t freebsd-swap -s 4G -l swap ${DEV} gpart add -t freebsd-ufs -s 1G -l var ${DEV} gpart add -t freebsd-ufs -s 20G -l usr ${DEV} gpart add -t freebsd-ufs -l local0 ${DEV} for d in 2 4 5 6; do newfs -j "${DEV}p${d}" done mount "${DEV}p2" "${TMPDIR}/mnt" mkdir "${TMPDIR}/mnt/var" "${TMPDIR}/mnt/usr" "${TMPDIR}/mnt/local0" mount "${DEV}p4" "${TMPDIR}/mnt/var" mount "${DEV}p5" "${TMPDIR}/mnt/usr" mount "${DEV}p6" "${TMPDIR}/mnt/local0" for d in base doc games kernel lib32 src; do echo "Extracting $d" tar -C "${TMPDIR}/mnt" -pxf /usr/freebsd-dist/${d}.txz done echo "Extracting port image" # Disable exit on error because tar will complain about chflag'd stuff set +e cat /image.txz.* | tar -C "${TMPDIR}/mnt" -pUxf - if [ $? -ne 0 ]; then echo "Warning unpack return an error" fi set -e echo "# Device Mountpoint FStype Options Dump Pass#" = >${TMPDIR}/mnt/etc/fstab echo '/dev/gpt/slash / ufs rw 1 1' = >>${TMPDIR}/mnt/etc/fstab echo '/dev/gpt/swap none swap sw 0 0' = >>${TMPDIR}/mnt/etc/fstab echo '/dev/gpt/var /var ufs rw 2 2' = >>${TMPDIR}/mnt/etc/fstab echo '/dev/gpt/usr /usr ufs rw 2 2' = >>${TMPDIR}/mnt/etc/fstab echo '/dev/gpt/local0 /local0 ufs rw 2 2' = >>${TMPDIR}/mnt/etc/fstab echo '/dev/cd0 /cdrom cd9660 ro,noauto 0 0' = >>${TMPDIR}/mnt/etc/fstab echo 'linprocfs /compat/linux/proc linprocfs rw 0 0' = >>${TMPDIR}/mnt/etc/fstab echo 'procfs /proc procfs rw,noauto 0 0' = >>${TMPDIR}/mnt/etc/fstab # Put your customisation stuff here if [ "$ifconfig" !=3D "DHCP" ]; then cat >${TMPDIR}/mnt/etc/resolv.conf <<EOF search $dnssearch nameserver $dnsserver EOF fi cat >>${TMPDIR}/mnt/etc/aliases <<EOF root: sysmail@gsoft.com.au radar: gs_radar@gsoft.com.au EOF chroot "${TMPDIR}/mnt" newaliases mkdir -p "${TMPDIR}/mnt/compat/linux/proc" echo "Enter root password:" chroot "${TMPDIR}/mnt" passwd rm -rf "${TMPDIR}/mnt/tmp" "${TMPDIR}/mnt/var/tmp" = "${TMPDIR}/mnt/usr/tmp" mkdir "${TMPDIR}/mnt/local0/tmp" chmod 1777 "${TMPDIR}/mnt/local0/tmp" ln -s "/local0/tmp" "${TMPDIR}/mnt/var/tmp" ln -s "/local0/tmp" "${TMPDIR}/mnt/usr/tmp" ln -s "/local0/tmp" "${TMPDIR}/mnt/tmp" sync umount "${TMPDIR}/mnt/local0" umount "${TMPDIR}/mnt/usr" umount "${TMPDIR}/mnt/var" umount "${TMPDIR}/mnt" rm -rf "${TMPDIR}" echo "Reboot now" -- Daniel O'Connor software and network engineer for Genesis Software - http://www.gsoft.com.au "The nice thing about standards is that there are so many of them to choose from." -- Andrew Tanenbaum GPG Fingerprint - 5596 B766 97C0 0E94 4347 295E E593 DC20 7B3F CE8C
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4F7A77DF-BA0B-4A75-A5EF-3CCDA314AD93>