# Scripts to setup the environment for the install
+sudo fai-cd grub.cfg.autodiscover -f -A $BASEFILE_DIR/autodiscover.iso # create autodiscover cd
+mymk-basefile # Create basefiles for various distros
arch-pxe # Setup arch pxe boot server from an arch base image
fai-redep # Deploy fai configuration to host "faiserver"
-faiserver-revm # using pxe & preseed, create a vm which is a fai server
faiserver-uninstall # uninstall fai-server
faiserver-setup # install fai-server on the current machine
myfai-chboot # setup fai tftp and nfs. useful for doing pxe-kexec
# Script to do a distro install
+faiserver-revm # using pxe & preseed, create a vm which is a fai server
dsfull # install & post-install a new fai distro
arch-init-remote # install arch after it's been booted into it's setup env
fai-kexec # Kexec this or a remote machine using host faiserver
# use it, so look it up just to avoid the warning spam.
faiserver_host=$(chost $host) || faiserver_host=$host
-rsync -rlp --delete --relative --exclude /fai/config/basefiles/ fai/config root@$faiserver_host:/srv
+rsync -rlpt --delete --relative --exclude /fai/config/basefiles/ fai/config root@$faiserver_host:/srv
scp -q ~/.ssh/home.pub \
ssh root@$faiserver_host dd of=/srv/fai/config/package_config/DESKTOP 2>/dev/null ||: # broken pipe
-rsync -rplt --delete /a/bin/fai-basefiles/basefiles root@$faiserver_host:/srv/fai/config
+rsync -rplt --delete $BASEFILE_DIR/*.gz root@$faiserver_host:/srv/fai/config/basefiles/
ssh root@$faiserver_host bash <<'EOF'
set -eE -o pipefail
-set -x
# make it the root because pxe-kexec only looks there.
# It wouldn't be too hard to change if we needed.
# We could also just dump things in /srv/tftp, but fai
sleep 2
else
fai-monitor&
- boot_arg="--cdrom /a/bin/fai-basefiles/autodiscover.iso"
+ if [[ $BASEFILE_DIR ]]; then
+ BASEFILE_DIR=/tmp
+ fi
+ if [[ ! -e $BASEFILE_DIR/autodiscover.iso ]]; then
+ fai-cd grub.cfg.autodiscover -f -A $BASEFILE_DIR/autodiscover.iso
+ fi
+ boot_arg="--cdrom $BASEFILE_DIR/autodiscover.iso"
e fai-redep
e myfai-chboot default
fi
e sleep 5
done
unset _errcatch_cleanup
-e pxe-server
+e ./pxe-server $dhcp_arg
if is_arch_revm; then
./arch-init-remote $name
fi
#! /bin/bash
-set -x
# mk-basefile, create basefiles for some distributions
#
# Thomas Lange, Uni Koeln, 2011-2017
Separate from running this, faiserver needs to be setup in dns
to point to whatever host this is run on.
-For running on arm, it expects Ian's fai-basefiles repository at
-/a/bin/fai-basefiles
+It expects $BASEFILE_DIR/STRETCH64.tar.gz to exist.
EOF
exit $1
if armhf; then
cd /srv/fai
rm -rf nfsroot
- tar Jxf /a/bin/fai-basefiles/basefiles/STRETCH64.tar.xz
+ tar Jxf $BASEFILE_DIR/STRETCH64.tar.xz
# background: Can't build the nfsroot on my arm system now. First,
# fai-make-nfsroot won't work out of the box. One idea to make it work
# is by installing qemu-user-static, then copying qemu-x86_64-static
else # not armhf
# note, this copies the -B arg to
# /srv/fai/nfsroot/var/tmp/base.tar.xz
- e fai-setup -evf -B /a/bin/fai-basefiles/basefiles/STRETCH64.tar.gz
+ e fai-setup -evf -B $BASEFILE_DIR/STRETCH64.tar.gz
# fai-setup expert mode avoids writing to /var/log/fai/variables
# at least config_src is needed for autodiscover
$sed '/^FAI_CONFIGDIR|^FAI_CONFIG_SRC|^LOGUSER/d' /var/log/fai/variables
--- /dev/null
+## grub2 configuration
+set default="FAI server via dns"
+set timeout=2
+set resolution=1024x768
+
+if loadfont /boot/grub/unicode.pf2 ; then
+ insmod png
+ set gfxmode=640x480
+ insmod gfxterm
+ insmod vbe
+ terminal_output gfxterm
+fi
+
+if background_image /boot/grub/fai.png ; then
+ set color_normal=black/black
+ set color_highlight=red/black
+ set menu_color_normal=black/black
+ set menu_color_highlight=black/yellow
+else
+ set menu_color_normal=white/black
+ set menu_color_highlight=black/yellow
+fi
+
+# make sure we can access partitions
+insmod part_msdos
+insmod part_gpt
+
+if [ ${iso_path} ] ; then
+ set loopback="findiso=${iso_path}"
+fi
+
+menuentry "" --unrestricted {
+ set gfxpayload=$resolution
+}
+menuentry " +------------------------------------------------------+" --unrestricted {
+ set gfxpayload=$resolution
+}
+
+menuentry " | Fully Automatic Installation |" --unrestricted {
+ set gfxpayload=$resolution
+
+}
+menuentry " | _VERSIONSTRING_ |" --unrestricted {
+ set gfxpayload=$resolution
+
+}
+menuentry " | (c) Thomas Lange lange@debian.org |" --unrestricted {
+ set gfxpayload=$resolution
+}
+menuentry " +------------------------------------------------------+" --unrestricted {
+ set gfxpayload=$resolution
+}
+}
+menuentry "" --unrestricted {
+ set gfxpayload=$resolution
+}
+
+menuentry "Autodiscover the FAI server" {
+ set gfxpayload=$resolution
+ linux /boot/vmlinuz FAI_FLAGS="menu,verbose,createvt" fai.discover aufs rootovl root=/dev/nfs ip=dhcp quiet
+ initrd /boot/initrd.img
+}
+
+# ian: Added this from fai
+# note, we could replace faiserver with an ip if we didn't want to mess with dns.
+# args are copied from myfai-chboot-local
+menuentry "FAI server via dns" {
+ set gfxpayload=$resolution
+ linux /boot/vmlinuz FAI_FLAGS=verbose,sshd,createvt,reboot FAI_CONFIG_SRC=nfs://faiserver/srv/fai/config root=/dev/nfs rw nfsroot=faiserver:/srv/fai/nfsroot,vers=3,nolock aufs rootovl ip=dhcp FAI_FLAGS=verbose,sshd,createvt,reboot
+ initrd /boot/initrd.img
+}
+
+
+menuentry "Boot OS of first partition on first disk" --unrestricted {
+ if [ -d (cd) ]; then
+ chainloader (hd0)+1
+ fi
+
+ if [ "$root" = "hd1" ]; then
+ chainloader (hd0)+1
+ fi
+
+ if [ "$root" = "hd0" ]; then
+ set root=(hd1)
+ chainloader (hd1)+1
+ fi
+}
EOF
exit $1
}
-if [[ ! $1 ]]; then
- usage 1
-fi
case $1 in
-h|--help) usage ;;
esac
host=$1
+rm -f /srv/tftp/fai/pxelinux.cfg/*
+if [[ ! $1 ]]; then
+ exit 0
+fi
+
# assuming ipv4, or else we might need to deal with multiple addresses
# in an ipv4 + ipv6 network.
my_ip=$(ip -4 route get 8.8.8.8 | sed -nr 's,^.*src\s+(\S+).*,\1,p')
EOF
fi
-rm -f /srv/tftp/fai/pxelinux.cfg/*
-if [[ ! $1 ]]; then
- exit 0
-fi
# man page doesn't explain this, but this deletes & thus disables
--- /dev/null
+#!/bin/bash
+
+x="$(readlink -f "$BASH_SOURCE")"; source "${x%/*}/bash-trace"
+script_dir="${x%/*}"
+
+usage() {
+ cat <<EOF
+Usage: ${0##*/} [-h|--help] [mk-basefile_args]
+Wrap fai's mk-basefile so output dir is $BASEFILE_DIR if it exists.
+
+And fix things for trisquel. mk-basefile has a trisquel mirror added.
+
+fai-project maintains ubuntu and debian basefiles, but it doesn't update
+them often. Better to build our all our own.
+
+
+Args I've used before:
+
+-z STRETCH64
+-z XENIAL64
+-z FLIDAS64
+-z BELENOS64
+
+-h|--help Print help and exit.
+
+Note: Uses GNU getopt options parsing style
+EOF
+ $script_dir/fai/config/basefiles/mk-basefile -h
+ exit $1
+}
+
+case $1 in
+ -h|--help)
+ usage
+ ;;
+esac
+
+if [[ $EUID != 0 ]]; then
+ s=sudo
+fi
+
+cd /usr/share/debootstrap/scripts
+for d in belenos flidas; do
+ if [[ ! -L $d && ! -e $d ]]; then
+ $s ln -sf gutsy $d;
+ fi
+done
+
+if [[ $BASEFILE_DIR ]]; then
+ cd $BASEFILE_DIR
+fi
+
+$s $script_dir/fai/config/basefiles/mk-basefile "$@"