3 # setup script that is only run once at boot time
4 # set up an FAI install server
14 # regenerate ssh_host keys
15 ls /etc
/ssh
/ssh_host_
* > /dev
/null
17 dpkg-reconfigure
-fnoninteractive openssh-server
20 [ -x /etc
/init.d
/nscd
] && /etc
/init.d
/nscd restart
22 echo "=================================" >/dev
/console
23 echo "Setting up the FAI install server" >/dev
/console
24 echo "This will take a few minutes" >/dev
/console
25 echo "=================================" >/dev
/console
28 .
/etc
/fai
/nfsroot.conf
30 # copy the simple examples and pimp my config space
31 if [ ! -d "$FAI_CONFIGDIR/class" ]; then
32 mkdir
-p $FAI_CONFIGDIR
33 cp -a /usr
/share
/doc
/fai-doc
/examples
/simple
/* $FAI_CONFIGDIR
34 ainsl
/srv
/fai
/config
/class
/FAIBASE.var
"^LOGUSER=fai"
35 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)
36 echo "APTPROXY=http://$myip:3142" >> /srv
/fai
/config
/class
/DEBIAN.var
38 # set the LOGUSER, wo we get all the logs from our install clients
39 ainsl
/etc
/fai
/fai.conf
"^LOGUSER=fai"
41 # make index, then import the packages from the CD mirror
43 curl
-fs 'http://127.0.0.1:3142/acng-report.html?doImport=Start+Import&calcSize=cs&asNeeded=an#bottom' >/dev
/null
45 # setup the FAI server, including creating the nfsroot, use my own proxy
46 export APTPROXY
="http://127.0.0.1:3142"
47 if [ -f /var
/tmp
/base.
tar.xz
]; then
48 fai-setup
-fvB /var
/tmp
/base.
tar.xz
2>&1
53 rm /var
/tmp
/base.
tar.xz
55 echo "================================================" >/dev
/console
56 echo -e "Setting up the FAI server was ${GREEN}successful${NORMAL}" >/dev
/console
57 echo "================================================" >/dev
/console
62 echo "==================================================" >/dev
/console
63 echo -e "${RED}ERROR${NORMAL}: Setting up the FAI install server ${RED}FAILED${NORMAL}!" >/dev
/console
64 echo "Read /var/log/fai/fai-setup.log for more debugging" >/dev
/console
65 echo "==================================================" >/dev
/console
71 cat <<EOF >> /srv/fai/nfsroot/etc/fai/fai.conf
72 # use short hostname instead of FQDN
73 export HOSTNAME=\${HOSTNAME%%.*}
74 echo \$HOSTNAME > /proc/sys/kernel/hostname
77 # create default pxelinux boot configuration
80 # create a template for booting the installation
81 fai-chboot
-Iv -f verbose
,sshd
,createvt
,menu
-u nfs
://faiserver
/srv
/fai
/config jessie.tmpl
83 # Since we do not know the MAC address, our DHCP cannot provide the hostname.
84 # Therefore we do explicitly set the hostname
85 fai-chboot
-Iv -f verbose
,sshd
,createvt
,menu
-u nfs
://faiserver
/srv
/fai
/config
-k hostname
=xfcehost xfcehost
86 fai-chboot
-Iv -f verbose
,sshd
,createvt
,menu
-u nfs
://faiserver
/srv
/fai
/config
-k hostname
=demohost demohost
88 fai-chboot
-Iv -f verbose
,sshd
,createvt
,menu
-u nfs
://faiserver
/srv
/fai
/config
-k hostname
=client
$c client
$c
91 fai-monitor
> /var
/log
/fai
/fai-monitor.log
&
96 # create new rc.local for next reboot
97 echo '#! /bin/bash' > /etc
/rc.
local
98 echo 'fai-monitor > /var/log/fai/fai-monitor.log &' >> /etc
/rc.
local
99 chmod a
+rx
/etc
/rc.
local