various fixes, improve flidas
authorIan Kelling <iank@fsf.org>
Tue, 24 Oct 2017 03:40:37 +0000 (20:40 -0700)
committerIan Kelling <iank@fsf.org>
Tue, 24 Oct 2017 03:40:37 +0000 (20:40 -0700)
12 files changed:
dsfull
fai-revm
fai/config/distro-install-common/end
fai/config/hooks/instsoft.DEBIAN
fai/config/scripts/GRUB_PC/10-setup
fai/config/scripts/GRUB_PC/11-iank [moved from fai/config/scripts/GRUB_PC/11-ian with 100% similarity]
fai/config/scripts/LAST/50-misc
fai/config/scripts/UBUNTU/90-apt [changed mode: 0644->0755]
faiserver-disable
faiserver-setup
myfai-chboot
pxe-server

diff --git a/dsfull b/dsfull
index 29946f39804b3cfccbc7378fba17656167d207a0..df9c398f2936f8b8f27c6708016982ff13428030 100755 (executable)
--- a/dsfull
+++ b/dsfull
@@ -101,4 +101,6 @@ while [[ $(ser is-active btrbk.service) == active ]]; do
 done
 e btrbk-run -t $host
 ssh $host /a/bin/distro-setup/distro-begin
 done
 e btrbk-run -t $host
 ssh $host /a/bin/distro-setup/distro-begin
+# this should be done instead of distro-begin, but
+# keeping it to 2 steps for now
 #e dsremote $host
 #e dsremote $host
index f7e45c9f97b960fa0af105fb9c4378f8c52c1f89..2dbae8fafe89c77c68746233f5d1a32f04c11741 100755 (executable)
--- a/fai-revm
+++ b/fai-revm
@@ -33,6 +33,7 @@ then start a virtual machine to test the config
 Note, sometimes shutting down the existing demohost vm
 fails. Just run again if that happens.
 
 Note, sometimes shutting down the existing demohost vm
 fails. Just run again if that happens.
 
+-d         Don't do dhcp setup for when we aren't on Ian's home network.
 -r         Do not boot after install is complete
 -n         Create new qcow2(s) for vm. Good for testing partitioning
            script, to ensure a blank disk.
 -r         Do not boot after install is complete
 -n         Create new qcow2(s) for vm. Good for testing partitioning
            script, to ensure a blank disk.
@@ -45,10 +46,11 @@ EOF
 
 orig_args=("$@")
 new_disk=false
 
 orig_args=("$@")
 new_disk=false
-temp=$(getopt -l help hnr "$@") || usage 1
+temp=$(getopt -l help dnrh "$@") || usage 1
 eval set -- "$temp"
 while true; do
     case $1 in
 eval set -- "$temp"
 while true; do
     case $1 in
+        -d) dhcp_arg=-d; shift ;;
         -n) new_disk=true; shift ;;
         -r) reboot_arg=--noreboot; shift ;;
         -h|--help) usage ;;
         -n) new_disk=true; shift ;;
         -r) reboot_arg=--noreboot; shift ;;
         -h|--help) usage ;;
@@ -57,6 +59,7 @@ while true; do
     esac
 done
 
     esac
 done
 
+
 # change this to test different disk counts. 1 and > 1 should be the only
 # important things to test.
 disk_count=1
 # change this to test different disk counts. 1 and > 1 should be the only
 # important things to test.
 disk_count=1
@@ -77,18 +80,19 @@ is_arch_revm() {
 }
 
 cleanup() {
 }
 
 cleanup() {
-    ./pxe-server
+    echo "doing cleanup"
+    e ./pxe-server $dhcp_arg
     ./faiserver-disable
 }
 _errcatch_cleanup=cleanup
 
 if is_arch_revm; then
     ./faiserver-disable
 }
 _errcatch_cleanup=cleanup
 
 if is_arch_revm; then
-    e ./pxe-server demohost arch
+    e ./pxe-server $dhcp_arg demohost arch
     sleep 2
     # via osinfo-query os. guessing arch is closest to latest fedora.
     variant=fedora22
 else
     sleep 2
     # via osinfo-query os. guessing arch is closest to latest fedora.
     variant=fedora22
 else
-    e ./pxe-server demohost fai
+    e ./pxe-server $dhcp_arg demohost fai
     sleep 2
     # I don't think these variants actually make a diff for us, but I
     # use the appropriate one when trying a new distro just in case.
     sleep 2
     # I don't think these variants actually make a diff for us, but I
     # use the appropriate one when trying a new distro just in case.
index cb953a4e8073a562e864dd12a075f1aef7e54215..d10b9497d11d3ac2b4f07098e780b0567e7c30ae 100755 (executable)
@@ -96,4 +96,4 @@ while true; do
     if [[ $dir == /p ]]; then break; fi
 done
 
     if [[ $dir == /p ]]; then break; fi
 done
 
-au -s /bin/false --home-dir /var/lib/bitcoind bitcoin
+au --system -s /bin/false --home-dir /var/lib/bitcoind bitcoin
index ebf7d8ac9ef28831efb4fbda4bd2793ddd884625..13c517a991ee6d73fa7edb7eed7c3ce6609a9739 100755 (executable)
@@ -1,5 +1,6 @@
 #! /bin/bash
 
 #! /bin/bash
 
+set -x
 # if package locales will be installed, then install it early, before
 #  other packages
 if [ $FAI_ACTION != "install" -a $FAI_ACTION != "dirinstall" ]; then
 # if package locales will be installed, then install it early, before
 #  other packages
 if [ $FAI_ACTION != "install" -a $FAI_ACTION != "dirinstall" ]; then
index 47b3ba49195db9c0978482e5e6350f5e71368ffb..00829e110a7ecc3acff8ab60f789c4a9c3e9481c 100755 (executable)
@@ -3,6 +3,7 @@
 
 error=0; trap 'error=$(($?>$error?$?:$error))' ERR # save maximum error code
 
 
 error=0; trap 'error=$(($?>$error?$?:$error))' ERR # save maximum error code
 
+set -x
 set -a
 
 # do not set up grub during dirinstall
 set -a
 
 # do not set up grub during dirinstall
@@ -39,11 +40,12 @@ if [[ $BOOT_DEVICE =~ '/dev/md' ]]; then
     done
 
 elif [[ $GROOT =~ 'hostdisk' ]]; then
     done
 
 elif [[ $GROOT =~ 'hostdisk' ]]; then
-    $ROOTCMD grub-install --no-floppy --modules=part_msdos $BOOT_DEVICE
-    if [ $? -eq 0 ]; then
-        echo "Grub installed on hostdisk $BOOT_DEVICE"
-    fi
-
+    for dev in $BOOT_DEVICE; do
+        $ROOTCMD grub-install --no-floppy --modules=part_msdos $dev
+        if [ $? -eq 0 ]; then
+            echo "Grub installed on hostdisk $BOOT_DEVICE"
+        fi
+    done
 else
     for dev in $BOOT_DEVICE; do
         GROOT=$($ROOTCMD grub-probe -tdrive -d $dev)
 else
     for dev in $BOOT_DEVICE; do
         GROOT=$($ROOTCMD grub-probe -tdrive -d $dev)
index 459b4de92aef13687a67174cbe2e927dda5a8fca..586c78720a7b5f6fd138b4d2b73533749def0801 100755 (executable)
@@ -15,13 +15,15 @@ else
     fi
   fi
 
     fi
   fi
 
-  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
-       error=1
-    fi
-  fi
+  # i use dm for crypt, not lvm, so this gives false positive. todo, send patch to remove this
+  # upstream.
+  # 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
+  #       error=1
+  #   fi
+  # fi
 fi
 
 # remove backup files from cfengine, but only if cfengine is installed
 fi
 
 # remove backup files from cfengine, but only if cfengine is installed
old mode 100644 (file)
new mode 100755 (executable)
index 5e2d1e3..682d572
@@ -1,9 +1,6 @@
 #! /bin/bash
 
 #! /bin/bash
 
-# note: the name of this scripts doesn't fit it's contents, but it's
-# because we are taking just part of the corresponding fai example
-# script, and it's easier to keep up with upstream changes if the file
-# name is the same.
+# ian: just taking part of the corresponding fai example script
 
 ainsl -v /etc/locale.gen '^en_US.UTF-8 UTF-8'
 $ROOTCMD locale-gen
 
 ainsl -v /etc/locale.gen '^en_US.UTF-8 UTF-8'
 $ROOTCMD locale-gen
index 3cb6da22ea45120a4ffb99410b98a94e35750d03..0a9ad8d02802a05340afac4e96f1335afc7824f2 100755 (executable)
@@ -16,8 +16,9 @@ if [[ $1 ]]; then
 fi
 
 ssh root@$(chost faiserver) bash <<'EOF'
 fi
 
 ssh root@$(chost faiserver) bash <<'EOF'
+set -eE -o pipefail
 if modprobe nfsd &>/dev/null; then
 if modprobe nfsd &>/dev/null; then
-  sed -ri --follow-symlinks '\%^/srv/fai/d' /etc/exports
+  sed -ri --follow-symlinks '\%^/srv/fai/%d' /etc/exports
   exportfs -ra
 else
   rm -f /etc/apache2/sites-enabled/faiserver.conf
   exportfs -ra
 else
   rm -f /etc/apache2/sites-enabled/faiserver.conf
index 3e805df9ca2fb5766c210f201fdcf286bfca07fc..78786c26dd35bbbe572cb74dd95379401618b013 100755 (executable)
@@ -157,8 +157,10 @@ fi
 # tried out a stretch base, doesn't work yet.
 #
 $sed -f - /etc/fai/nfsroot.conf <<EOF
 # tried out a stretch base, doesn't work yet.
 #
 $sed -f - /etc/fai/nfsroot.conf <<EOF
-$ a FAI_ROOTPW="$(</q/root/shadow/standard)"
+$ a FAI_ROOTPW='$(</q/root/shadow/standard)'
 /^\s*FAI_ROOTPW/d
 /^\s*FAI_ROOTPW/d
+$ a SSH_IDENTITY=/root/.ssh/home.pub
+/^\s*SSH_IDENTITY/d
 s,^( *FAI_DEBOOTSTRAP=).*,\1"$base $r",
 # add --arch amd64. this is needed on arm system which is
 # used to install amd64 clients. On amd64 servers, it's redundant.
 s,^( *FAI_DEBOOTSTRAP=).*,\1"$base $r",
 # add --arch amd64. this is needed on arm system which is
 # used to install amd64 clients. On amd64 servers, it's redundant.
index 452f8fa579cd3a45de80684a25db60d9b565fb52..d0c0a97323d89d02d9b7da9748f5b1d4ad0235c2 100755 (executable)
@@ -11,8 +11,8 @@ usage: ${0##*/} [-h|--help] [hostname|ip]
 
 Sets up tftp pxe config and nfs server on host "faiserver".
 
 
 Sets up tftp pxe config and nfs server on host "faiserver".
 
-If our kernel has no nfs support, uses apache, and depends on another
-repo of Ian Kelling, basic-https-conf, where the file is at
+If our kernel has no nfs support, uses apache intead of nfs, and depends
+on another repo of Ian Kelling, basic-https-conf, where the file is at
 /a/exe/web-conf.
 
 Usng this, you can boot into fai with pxe-kexec without changing
 /a/exe/web-conf.
 
 Usng this, you can boot into fai with pxe-kexec without changing
index c19f6d2eeadbe95449003b5f12543266aa4739c1..7fced849def066ca634f42b3ab20f27708c9bc94 100755 (executable)
 # along with this program; if not, write to the Free Software
 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 
 # along with this program; if not, write to the Free Software
 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 
-# Setup dhcp server to point to tftp server,
-# and depending on the type, setup the tftp server.
-
-# usage: $0 TYPE
-# default distro is the base debian/fedora type. others are fai & arch.
-# for no pxe server, use a no-op like : or true.
 
 
 x="$(readlink -f "$BASH_SOURCE")"; source "${x%/*}/bash-trace"
 
 
 x="$(readlink -f "$BASH_SOURCE")"; source "${x%/*}/bash-trace"
@@ -29,14 +23,15 @@ x="$(readlink -f "$BASH_SOURCE")"; source "${x%/*}/bash-trace"
 usage() {
     cat <<EOF
 Usage: ${0##*/} [OPTIONS] [HOST TYPE]
 usage() {
     cat <<EOF
 Usage: ${0##*/} [OPTIONS] [HOST TYPE]
-Configure dnsmasq pxe server options and fai-chboot if appropriate.
+Configure dnsmasq boot options and fai-chboot if appropriate.
 
 
-Without HOST TYPE, disable pxe server and fai server.
+Without HOST TYPE, disable  server and fai server.
 
 HOST       A hostname known to the dhcp server, or default for all.
 TYPE       One of arch, plain, fai.
 
 
 HOST       A hostname known to the dhcp server, or default for all.
 TYPE       One of arch, plain, fai.
 
-
+-d         Don't alter dhcp config. Only make sense for fai type, and on network
+           other than home network.
 -r         Don't redeploy fai config. For example, if there is a different host
            that is mid-install.
 
 -r         Don't redeploy fai config. For example, if there is a different host
            that is mid-install.
 
@@ -65,6 +60,7 @@ EOF
 
 ##### begin command line parsing ########
 
 
 ##### begin command line parsing ########
 
+dhcp=true
 redep=true
 acks=2
 wait=false
 redep=true
 acks=2
 wait=false
@@ -73,6 +69,7 @@ eval set -- "$temp"
 while true; do
     case $1 in
         -a) wait=true; set=false; shift ;;
 while true; do
     case $1 in
         -a) wait=true; set=false; shift ;;
+        -d) dhcp=false; shift ;;
         -r) redep=false; shift ;;
         -S) chboot_arg=-S; shift ;;
         -w) wait=true; set=true; shift ;;
         -r) redep=false; shift ;;
         -S) chboot_arg=-S; shift ;;
         -w) wait=true; set=true; shift ;;
@@ -143,6 +140,7 @@ ack-wait() {
 }
 
 set-pxe() {
 }
 
 set-pxe() {
+    $dhcp || return 0
     echo "$0: updating dnsmasq.conf:"
     $type
     ${type:-:}|ssh wrt "cedit pxe /etc/dnsmasq.conf || /etc/init.d/dnsmasq restart
     echo "$0: updating dnsmasq.conf:"
     $type
     ${type:-:}|ssh wrt "cedit pxe /etc/dnsmasq.conf || /etc/init.d/dnsmasq restart