minor fixes and documentation
authorIan Kelling <ian@iankelling.org>
Thu, 9 Feb 2017 22:21:11 +0000 (14:21 -0800)
committerIan Kelling <ian@iankelling.org>
Thu, 9 Feb 2017 22:21:11 +0000 (14:21 -0800)
README
devbyid
dsfull
fai-wrapper
fai/config/basefiles/mk-basefile
fai/config/files/boot/chboot/DEFAULT
fai/config/scripts/DEBIAN/30-interface
faiserver-setup
live-kexec

diff --git a/README b/README
index 5e09791e75d4c320ecb0a752f7090c9fa8e6a475..d579feb4c001a6deefaddc9b40b5f8f80edada92 100644 (file)
--- a/README
+++ b/README
@@ -44,26 +44,38 @@ Some of the scripts have dependencies for some simple obvious utility
 scripts from https://iankelling.org/git, and of course there are some
 hostnames that are specific to my network.
 
 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)
 
 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)
 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
 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.
 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
 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
 
 License stuff:
 The license for the project is GPLv2 or later, mostly because fai is
diff --git a/devbyid b/devbyid
index ecf498817c9664f55b8e38e1a4118de06929c28f..e3443898795c52d5c8569c02e538b8765c23ecf2 100755 (executable)
--- a/devbyid
+++ b/devbyid
@@ -3,7 +3,7 @@
 # input eg: /dev/sda1 or /dev/sda
 # output: /dev/disk/by-id/model+serial, or if no link exists, the same as input
 
 # 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.
 
 # devices are identified by model+serial num,
 # and wwn. model+serial gives me more info, so use that.
diff --git a/dsfull b/dsfull
index 06af7f8f68e2ac0cd0f5fb768e83fcaf93dde284..54ee3661a8a5d3c5569c6d89ed1cc55d1f5c7e7e 100755 (executable)
--- a/dsfull
+++ b/dsfull
@@ -26,7 +26,11 @@ fi
 usage() {
     cat <<EOF
 Usage: ${0##*/} [OPTIONS] HOST
 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
 
 --no-r     Don't ssh to host and reboot.
 -k         ssh to host and kexec, don't use pxe. implies --no-r
@@ -56,7 +60,7 @@ host=$1
 
 ##### end command line parsing ########
 
 
 ##### end command line parsing ########
 
-
+e ser stop btrbk.timer
 if [[ ! $host ]]; then
     echo "$0: error: expected 1 arg of hostname"
     exit 1
 if [[ ! $host ]]; then
     echo "$0: error: expected 1 arg of hostname"
     exit 1
@@ -92,4 +96,8 @@ if $error; then
     echo "$0: error: timeout"
     exit 1
 fi
     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
 e dsremote $host
index c3cc4f2279f231833225a702d9c6fdb5fd09e709..04625fd2063e4ba3fa3e5a2cfb6f8a0875652b43 100644 (file)
@@ -16,6 +16,8 @@
 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 
 # For using some fai commands outside of fai.
 # 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_}
 # to set fai classes, export CLASS_CLASSNAME=true
 ifclass() {
     local var=${1/#/CLASS_}
index 15fbf768fc3be6feae23a6dbdcfda1136f5f4216..b4d790c94dae2d760e258d3deae28d7e15387afa 100755 (executable)
@@ -246,6 +246,7 @@ if [ $? -eq 1 ]; then
     echo "mktemp failed. Aborting."
     exit 2
 fi
     echo "mktemp failed. Aborting."
     exit 2
 fi
+chmod 755 $xtmp
 
 target=$1 # also the name of the output file
 
 
 target=$1 # also the name of the output file
 
index 021c74d42d4764d1391bc75f19c1a4c3c695134b..4dda460dbae5d3117860495dc940159b8ccdfe54 100755 (executable)
@@ -113,8 +113,7 @@ e grub-bios-setup -d $mount_point/grub/i386-pc -s -m $mount_point/grub/device.ma
 
 e umount $mount_point
 
 
 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
 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
index 832461cbb7d6a7083d4153bedf85151355f2d971..92292074a8b521d475c0c67d49771047cdd23711 100755 (executable)
@@ -24,10 +24,10 @@ newnicnames() {
            break
        fi
     done
            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 [[ ! $name ]]; then
        echo "$0: error: could not find systemd predictable network name. Using $NIC1."
     fi
@@ -38,7 +38,6 @@ CIDR=$(ip -o -f inet addr show $NIC1 | awk '{print $4}')
 if ifclass DHCPC && [ $FAI_ACTION = "install" -o $FAI_ACTION = "dirinstall" ]; then
 
     if ifclass VM; then
 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
         # 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
index 2ecf45b69fe0b4d813d7520aaa04704047e3097f..3db726547136c4fba7d636c1a8097c72c18c5a1c 100755 (executable)
@@ -30,21 +30,24 @@ trap 'echo "$0:$LINENO:error: \"$BASH_COMMAND\" returned $?" >&2' ERR
 
 e() { echo "$@"; "$@"; }
 
 
 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"
 
 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
 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:
 fi
 
 # for ubuntu:
@@ -54,14 +57,11 @@ fi
 
 
 apt-get update
 
 
 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
 
 # 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.
 
 r=http://http.us.debian.org/debian
 # like default, but scrap httpredir, and nonfree.
index 01e8f72eb7d44000acf7d7bbf298d9e47206e0b3..651dad7bcf1424f00ccbfd42a4bfd7a25b07c427 100644 (file)
@@ -1,7 +1,8 @@
 #!/bin/bash
 #
 #!/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
 # 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.
 #
 #
 # This has been tested on trisquel belanos and ubuntu xenial.
 #