scripts from https://iankelling.org/git, and of course there are some
hostnames that are specific to my network.
-Main scripts meant to be called interactively:
+All scripts meant to be used directly are listed here:
+
+
+# Scripts to setup the environment for the install
+
+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 server for kexec, for use instead of "pxe-server"
+pxe-server # disable/enable fai or arch pxe boot server
+wrt-setup-remote # setup my router in general: dhcp, dns, etc.
+
+
+# Scripts to do a distro install
arch-init-remote # install arch (after it's been booted into it's setup env)
+dsfull # install & post-install a new fai distro
+fai-kexec # kexec to fai tftp server that pxe would normally point to
+arch-revm # test arch install on a fresh vm
+fai-revm # test fai install on a fresh vm
+live-kexec # fai kexec from upstream live cds, e.g. curl live-kexec|bash
+
+
+# Scripts to call after a distro install for various reasons
+
chboot # Set grub to boot into a different distro (installed earlier)
-install-chboot # reinstall chboot to /boot subvols, for when it changes
-dsfull # install & setup a new fai distro (if data partition already synced)
+install-chboot # reinstall chboot to /boot subvols, for chboot updates.
eboot # reboot without automatic disk decryption
-fai-kexec # kexec to fai tftp server that pxe would normally point to
-fai-redep # Deploy fai configuration to host "faiserver"
-fai-revm # test fai on a fresh vm
fai-wrapper # Evaluate and use fai classes outside of fai.
-faiserver-revm # create a vm which is a fai server using pxe & preseed file
-faiserver-uninstall # uninstall fai-server
-faiserver-setup # install fai-server on the current machine
fresize # resize swap or boot partitions in a host
-myfai-chboot # Sets up tftp pxe config on fai server
-pxe-server # temporarily enable (usually) fai or arch boot server
-wrt-setup-remote # setup my router
-ubuntu-xenial-live-fai-kexec # do fai install from xenial live cd using kexec
-myfai-chboot # use instead of pxe-server for fai kexec based install
+
License stuff:
The license for the project is GPLv2 or later, mostly because fai is
# input eg: /dev/sda1 or /dev/sda
# output: /dev/disk/by-id/model+serial, or if no link exists, the same as input
-short_dev=$1 # i.e.
+short_dev=$1
# devices are identified by model+serial num,
# and wwn. model+serial gives me more info, so use that.
usage() {
cat <<EOF
Usage: ${0##*/} [OPTIONS] HOST
-distro setup full using fai. (assuming we already synced data files to the host)
+"distro setup full" using fai.
+
+Note: relies on other repos and paths specific to Ian's system.
+Note: disables btrbk.timer. If it was active before, it should
+be manual reenabled after completion.
--no-r Don't ssh to host and reboot.
-k ssh to host and kexec, don't use pxe. implies --no-r
##### end command line parsing ########
-
+e ser stop btrbk.timer
if [[ ! $host ]]; then
echo "$0: error: expected 1 arg of hostname"
exit 1
echo "$0: error: timeout"
exit 1
fi
+while [[ $(ser is-active btrbk.service) == active ]]; do
+ sleep 5
+done
+e btrbk-run -t $host
e dsremote $host
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
# For using some fai commands outside of fai.
+# Usually this is sourced from another script. Note this has
+# paths specific to Ian's machine.
# to set fai classes, export CLASS_CLASSNAME=true
ifclass() {
local var=${1/#/CLASS_}
echo "mktemp failed. Aborting."
exit 2
fi
+chmod 755 $xtmp
target=$1 # also the name of the output file
e umount $mount_point
-# i don't change the default subvolid, so the arg here is just being cautious
-e mount -o subvolid=0 $boot_disk$grub_extn $mount_point
+e mount $boot_disk$grub_extn $mount_point
e grub-editenv $mount_point/grubenv set last_boot=/boot_$distro
e grub-editenv $mount_point/grubenv set did_fai_check=true
e umount $mount_point
break
fi
done
- if ifclass VM; then
- NIC1=ens3
- return
- fi
+ # This condition is only needed because the nfsroot I use
+ # is based on Jessie, which has an old udev which can't
+ # figure out the persistent interface name used in stretch.
+ if ifclass VM; then NIC1=ens3; return; fi
if [[ ! $name ]]; then
echo "$0: error: could not find systemd predictable network name. Using $NIC1."
fi
if ifclass DHCPC && [ $FAI_ACTION = "install" -o $FAI_ACTION = "dirinstall" ]; then
if ifclass VM; then
-
# note, this condition would apply to the elif below too,
# but I don't specify a static ip in fai, so not bothering
cat > $target/etc/network/interfaces <<-EOF
e() { echo "$@"; "$@"; }
-# tried with stretch at one point, but jessie works for everything,
-# so no point in changing it. Leaving some code to deal with
-# stretch hanging around as it will eventually become stable.
+# When stretch becomes stable, change this to stretch.
+# I've tested this with stretch, it works, but notably,
+# the automatic basefile getting will be for stretch
+# instead of jessie, so if you install jessie, you need
+# to setup the basefile and it's corresponding class.
base=jessie
sed="sed -ri --follow-symlinks"
-
-if [[ $base == jessie ]]; then
- wget -O - http://fai-project.org/download/074BCDE4.asc | apt-key add -
- cat >/etc/apt/sources.list.d/fai.list <<'EOF'
+if grep -xFq 'VERSION="9 (stretch)"' /etc/os-release; then
+ # if we use stretch, no need for fai-project repo.
+ # this will need to be updated when there is a codename
+ # for stretch+1
+ rm -f /etc/apt/sources.list.d/fai.list
+else
+ wget -O - http://fai-project.org/download/074BCDE4.asc | apt-key add -
+ cat >/etc/apt/sources.list.d/fai.list <<'EOF'
deb http://fai-project.org/download jessie koeln
EOF
-else
- # if we use stretch, no need for fai-project repo.
- rm -f /etc/apt/sources.list.d/fai.list
fi
# for ubuntu:
apt-get update
-# all the dependencies except the dhcp server
-deps="$(apt-cache show fai-quickstart | grep ^Depends: |head -n 1|\
- sed -r 's/^Depends:|,|\|[^,]+|isc-dhcp-server//g')"
# Relevant packages from fai-quickstart depends and fai-server recommends.
# I especially do not wait isc-dhcp-server or an inetd
apt-get install -y fai-doc nfs-kernel-server tftpd-hpa tar reprepro squashfs-tools binutils
-apt-get install -y --no-recommends fai-server
+apt-get install --no-install-recommends -y fai-server
r=http://http.us.debian.org/debian
# like default, but scrap httpredir, and nonfree.
#!/bin/bash
#
+# fai kexec from upstream live cds, i.e. curl|bash
# You can copy this to a http server, then wget -O- url|sudo bash
-# or curl|bash, if curl is installed.
+# curl is sometimes not preinstalled on a live cd.
#
# This has been tested on trisquel belanos and ubuntu xenial.
#