3 # setup script that is only run once at boot time
4 # set up an FAI install server
15 [ -x /etc
/init.d
/nscd
] && /etc
/init.d
/nscd restart
17 echo "=================================" >/dev
/console
18 echo "Setting up the FAI install server" >/dev
/console
19 echo "This will take a few minutes" >/dev
/console
20 echo "=================================" >/dev
/console
23 .
/etc
/fai
/nfsroot.conf
25 # copy the simple examples and pimp my config space
26 if [ ! -d "$FAI_CONFIGDIR/class" ]; then
27 mkdir
-p $FAI_CONFIGDIR
28 cp -a /usr
/share
/doc
/fai-doc
/examples
/simple
/* $FAI_CONFIGDIR
29 ainsl
/srv
/fai
/config
/class
/FAIBASE.var
"^LOGUSER=fai"
30 myip
=$
(ip addr show up|
grep -w inet | cut
-d t
-f 2 | cut
-d ' ' -f 2 | cut
-d / -f 1 |
grep -v 127.0.0.1)
31 echo "APTPROXY=http://$myip:3142" >> /srv
/fai
/config
/class
/DEBIAN.var
32 # determine a fast mirror for Ubuntu
33 list
=$
(curl
-s http
://mirrors.ubuntu.com
/mirrors.txt
)
34 mirror
=$
(netselect
$list |
awk '{print $2}')
35 sed -i -e "s#MIRRORURL#$mirror#" /srv
/fai
/config
/files
/etc
/apt
/sources.list
/UBUNTU
37 # set the LOGUSER, wo we get all the logs from our install clients
38 ainsl
/etc
/fai
/fai.conf
"^LOGUSER=fai"
40 # make index, then import the packages from the CD mirror
42 curl
-fs 'http://127.0.0.1:3142/acng-report.html?doImport=Start+Import&calcSize=cs&asNeeded=an#bottom' >/dev
/null
44 # setup the FAI server, including creating the nfsroot, use my own proxy
45 export APTPROXY
="http://127.0.0.1:3142"
46 fai-setup
-fvB /var
/tmp
/base.
tar.xz
2>&1
48 rm /var
/tmp
/base.
tar.xz
50 echo "================================================" >/dev
/console
51 echo -e "Setting up the FAI server was ${GREEN}successful${NORMAL}" >/dev
/console
52 echo "================================================" >/dev
/console
57 echo "==================================================" >/dev
/console
58 echo -e "${RED}ERROR${NORMAL}: Setting up the FAI install server ${RED}FAILED${NORMAL}!" >/dev
/console
59 echo "Read /var/log/fai/fai-setup.log for more debugging" >/dev
/console
60 echo "==================================================" >/dev
/console
66 cat <<EOF >> /srv/fai/nfsroot/etc/fai/fai.conf
67 # use short hostname instead of FQDN
68 export HOSTNAME=\${HOSTNAME%%.*}
69 echo \$HOSTNAME > /proc/sys/kernel/hostname
72 # create default pxelinux boot configuration
75 # create a template for booting the installation
76 fai-chboot
-Iv -f verbose
,sshd
,createvt
,menu
-u nfs
://faiserver
/srv
/fai
/config jessie.tmpl
78 # Since we do not know the MAC address, our DHCP cannot provide the hostname.
79 # Therefore we do explicitly set the hostname
80 fai-chboot
-Iv -f verbose
,sshd
,createvt
,menu
-u nfs
://faiserver
/srv
/fai
/config
-k hostname
=xfcehost xfcehost
81 fai-chboot
-Iv -f verbose
,sshd
,createvt
,menu
-u nfs
://faiserver
/srv
/fai
/config
-k hostname
=demohost demohost
83 fai-chboot
-Iv -f verbose
,sshd
,createvt
,menu
-u nfs
://faiserver
/srv
/fai
/config
-k hostname
=client
$c client
$c
86 fai-monitor
> /var
/log
/fai
/fai-monitor.log
&