X-Git-Url: https://iankelling.org/git/?a=blobdiff_plain;f=fai%2Fconfig%2Ffiles%2Fetc%2Frc.local%2FFAISERVER;h=2c255cced71b0a12ee807b48ea7c75cdce854852;hb=4abbc67ed68213ec94fcf5970d3e34661967a87c;hp=dffa360eb4d42bcbb0bddb1caabc8e14c735be1d;hpb=7f77555b3d92709034fe41919358053c650c71e1;p=automated-distro-installer diff --git a/fai/config/files/etc/rc.local/FAISERVER b/fai/config/files/etc/rc.local/FAISERVER index dffa360..2c255cc 100755 --- a/fai/config/files/etc/rc.local/FAISERVER +++ b/fai/config/files/etc/rc.local/FAISERVER @@ -10,19 +10,22 @@ GREEN='\E[32m' set -o pipefail # setup network -ifup eth0 +nic=$(cat /etc/network/interfaces /etc/network/interfaces.d/* 2>/dev/null | awk '$1 == "iface" && $2 != "lo" {print $2; exit}') +if [ -n "$nic" ]; then + ifup $nic +fi # regenerate ssh_host keys ls /etc/ssh/ssh_host_* > /dev/null if [ $? -ne 0 ]; then dpkg-reconfigure -fnoninteractive openssh-server fi sleep 8 -[ -x /etc/init.d/nscd ] && /etc/init.d/nscd restart +[ -x /etc/init.d/nscd ] && invoke-rc.d nscd restart -echo "=================================" >/dev/console -echo "Setting up the FAI install server" >/dev/console -echo "This will take a few minutes" >/dev/console -echo "=================================" >/dev/console +echo "=================================" +echo "Setting up the FAI install server" +echo "This will take a few minutes" +echo "=================================" . /etc/fai/fai.conf . /etc/fai/nfsroot.conf @@ -32,37 +35,39 @@ if [ ! -d "$FAI_CONFIGDIR/class" ]; then mkdir -p $FAI_CONFIGDIR cp -a /usr/share/doc/fai-doc/examples/simple/* $FAI_CONFIGDIR ainsl /srv/fai/config/class/FAIBASE.var "^LOGUSER=fai" - 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) + _nic=$(ip route | awk '/^default/ {print $5}'|head -1) + myip=$(ip -br ad sh $_nic | awk '{print $3}') + myip=${myip%/*} echo "APTPROXY=http://$myip:3142" >> /srv/fai/config/class/DEBIAN.var fi # set the LOGUSER, wo we get all the logs from our install clients ainsl /etc/fai/fai.conf "^LOGUSER=fai" # make index, then import the packages from the CD mirror -apt-get update +apt-get update >/dev/null curl -fs 'http://127.0.0.1:3142/acng-report.html?doImport=Start+Import&calcSize=cs&asNeeded=an#bottom' >/dev/null # setup the FAI server, including creating the nfsroot, use my own proxy export APTPROXY="http://127.0.0.1:3142" if [ -f /var/tmp/base.tar.xz ]; then - fai-setup -fvB /var/tmp/base.tar.xz 2>&1 + fai-setup -fvB /var/tmp/base.tar.xz > /var/log/fai/fai-setup.log 2>&1 else - fai-setup -fv 2>&1 + fai-setup -fv > /var/log/fai/fai-setup.log 2>&1 fi if [ $? -eq 0 ]; then rm /var/tmp/base.tar.xz echo "" - echo "================================================" >/dev/console - echo -e "Setting up the FAI server was ${GREEN}successful${NORMAL}" >/dev/console - echo "================================================" >/dev/console + echo "================================================" + echo -e "Setting up the FAI server was ${GREEN}successful${NORMAL}" + echo "================================================" echo "" sleep 10 else echo "" - echo "==================================================" >/dev/console - echo -e "${RED}ERROR${NORMAL}: Setting up the FAI install server ${RED}FAILED${NORMAL}!" >/dev/console - echo "Read /var/log/fai/fai-setup.log for more debugging" >/dev/console - echo "==================================================" >/dev/console + echo "==================================================" + echo -e "${RED}ERROR${NORMAL}: Setting up the FAI install server ${RED}FAILED${NORMAL}!" + echo "Read /var/log/fai/fai-setup.log for more debugging" + echo "==================================================" echo "" sleep 10 exit 99 @@ -78,7 +83,7 @@ EOF fai-chboot -o default # create a template for booting the installation -fai-chboot -Iv -f verbose,sshd,createvt,menu -u nfs://faiserver/srv/fai/config jessie.tmpl +fai-chboot -Iv -f verbose,sshd,createvt,menu -u nfs://faiserver/srv/fai/config bullseye.tmpl # Since we do not know the MAC address, our DHCP cannot provide the hostname. # Therefore we do explicitly set the hostname