socsvn commit: r272230 - in soc2014/kczekirda/pxe-fai-head/tools/mfsbsd: conf customfiles/etc
kczekirda at FreeBSD.org
kczekirda at FreeBSD.org
Mon Aug 11 19:59:14 UTC 2014
Author: kczekirda
Date: Mon Aug 11 19:59:13 2014
New Revision: 272230
URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=272230
Log:
fai is ready
Added:
soc2014/kczekirda/pxe-fai-head/tools/mfsbsd/customfiles/etc/dhclient.conf
Modified:
soc2014/kczekirda/pxe-fai-head/tools/mfsbsd/conf/rc.local.sample
soc2014/kczekirda/pxe-fai-head/tools/mfsbsd/customfiles/etc/installerconfig
Modified: soc2014/kczekirda/pxe-fai-head/tools/mfsbsd/conf/rc.local.sample
==============================================================================
--- soc2014/kczekirda/pxe-fai-head/tools/mfsbsd/conf/rc.local.sample Mon Aug 11 18:57:22 2014 (r272229)
+++ soc2014/kczekirda/pxe-fai-head/tools/mfsbsd/conf/rc.local.sample Mon Aug 11 19:59:13 2014 (r272230)
@@ -1,13 +1,6 @@
#!/bin/sh
# $FreeBSD: head/release/rc.local 259686 2013-12-21 16:43:40Z dteske $
-: ${DIALOG_OK=0}
-: ${DIALOG_CANCEL=1}
-: ${DIALOG_HELP=2}
-: ${DIALOG_EXTRA=3}
-: ${DIALOG_ITEM_HELP=4}
-: ${DIALOG_ESC=255}
-
MACHINE=`uname -m`
kbdcontrol -d >/dev/null 2>&1
@@ -49,14 +42,62 @@
fi
export TERM
-if [ -f /etc/installerconfig ]; then
- if bsdinstall script /etc/installerconfig; then
- dialog --backtitle "FreeBSD Installer" --title "Complete" --no-cancel --ok-label "Reboot" --pause "Installation of FreeBSD complete! Rebooting in 10 seconds" 10 30 10
- reboot
- else
- dialog --backtitle "FreeBSD Installer" --title "Error" --textbox /tmp/bsdinstall_log 0 0
- fi
- exit
+echo "FAI FreeBSD installer"
+
+file="/etc/installerconfig"
+
+if [ -f "$file" ] && [ `head -n 1 "$file"` == "#!fai" ]; then
+ method="installerconfig"
+fi
+
+preseed=`cat /var/db/dhclient.leases.* | grep bootfile-name | head -n 1 | awk '{print $3}' | tr -d '";'`
+
+if [ ! -z "$preseed" ]; then
+ input="/tmp/fai.conf"
+
+ # default config
+
+ fetch "$preseed"/default -o "$input".default
+ if [ `head -n "$input".default` == "#!fai" ]; then
+ method="default";
+ fi
+
+ # mac based config
+
+ macs=`ifconfig | grep ether | awk '{print $2}'`
+
+ for mac in $macs
+ do
+ fetch "$preseed"/"$mac" -o "$input".$mac
+ if [ `head -n 1 "$input"."$mac"` == "#!fai" ]; then
+ method="mac"
+ rightmac="$mac"
+ break
+ fi
+ done
fi
+case "$method" in
+ installerconfig)
+ input="$file"
+ ;;
+ default)
+ input="$input".default
+ ;;
+ mac)
+ input="$input"."$rightmac"
+ ;;
+ *)
+ echo "No installation method detected, run bsdinstall manually"
+ exit
+ ;;
+esac
+
+if bsdinstall script "$input"; then
+ dialog --backtitle "FreeBSD Installer" --title "Complete" --no-cancel --ok-label "Reboot" --pause "Installation of FreeBSD complete! Rebooting in 10 seconds" 10 30 10
+ reboot
+else
+ dialog --backtitle "FreeBSD Installer" --title "Error" --textbox /tmp/bsdinstall_log 0 0
+fi
+exit
Added: soc2014/kczekirda/pxe-fai-head/tools/mfsbsd/customfiles/etc/dhclient.conf
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ soc2014/kczekirda/pxe-fai-head/tools/mfsbsd/customfiles/etc/dhclient.conf Mon Aug 11 19:59:13 2014 (r272230)
@@ -0,0 +1,2 @@
+request bootfile-name subnet-mask, broadcast-address, time-offset, routers,
+ domain-search, domain-name, domain-name-servers, host-name;
Modified: soc2014/kczekirda/pxe-fai-head/tools/mfsbsd/customfiles/etc/installerconfig
==============================================================================
--- soc2014/kczekirda/pxe-fai-head/tools/mfsbsd/customfiles/etc/installerconfig Mon Aug 11 18:57:22 2014 (r272229)
+++ soc2014/kczekirda/pxe-fai-head/tools/mfsbsd/customfiles/etc/installerconfig Mon Aug 11 19:59:13 2014 (r272230)
@@ -1,3 +1,5 @@
+#!fai
+
PARTITIONS="ada0 { auto freebsd-ufs /}"
DISTRIBUTIONS="kernel.txz base.txz"
MIRROR="ftp://dell740"
More information about the svn-soc-all
mailing list