# mk-basefile, create basefiles for some distributions
#
-# Thomas Lange, Uni Koeln, 2011-2016
+# Thomas Lange, Uni Koeln, 2011-2017
# based on the Makefile implementation of Michael Goetze
# Supported distributions (each i386/amd64):
echo "mktemp failed. Aborting."
exit 2
fi
+chmod 755 $xtmp
target=$1 # also the name of the output file
-deb http://httpredir.debian.org/debian jessie main contrib non-free
-deb http://security.debian.org/debian-security jessie/updates main contrib non-free
+deb http://httpredir.debian.org/debian stretch main contrib non-free
+deb http://security.debian.org/debian-security stretch/updates main contrib non-free
-# repository that may contain newer fai packages for jessie
-deb [trusted=yes] http://fai-project.org/download jessie koeln
+# repository that may contain newer fai packages for stretch
+deb [trusted=yes] http://fai-project.org/download stretch koeln
set -o pipefail
# setup network
-ifup eth0
+nic=$(grep iface /etc/network/interfaces| awk '{print $2}'|egrep -v ^lo)
+ifup $nic
# regenerate ssh_host keys
ls /etc/ssh/ssh_host_* > /dev/null
if [ $? -ne 0 ]; then
sleep 8
[ -x /etc/init.d/nscd ] && /etc/init.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
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
fi
fi
- usedm=$(dmsetup ls | egrep -v '^live-rw|^live-base|^No devices found' | wc -l)
+ usedm=$(dmsetup ls 2>/dev/null | egrep -v '^live-rw|^live-base|^No devices found' | wc -l)
if [ $usedm -ne 0 ]; then
if [ ! -d $target/etc/lvm ]; then
echo ERROR: Found lvm devices, but the lvm2 package was not installed
return
fi
- dists="jessie stretch xenial trusty"
+ dists="jessie stretch buster xenial trusty"
for d in $dists; do
if grep -iq $d $target/etc/os-release; then
release=$d