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
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.
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
+ -d) dhcp_arg=-d; shift ;;
-n) new_disk=true; shift ;;
-r) reboot_arg=--noreboot; shift ;;
-h|--help) usage ;;
esac
done
+
# change this to test different disk counts. 1 and > 1 should be the only
# important things to test.
disk_count=1
}
cleanup() {
- ./pxe-server
+ echo "doing cleanup"
+ e ./pxe-server $dhcp_arg
./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
- 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.
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
#! /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
error=0; trap 'error=$(($?>$error?$?:$error))' ERR # save maximum error code
+set -x
set -a
# do not set up grub during dirinstall
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)
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
#! /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
fi
ssh root@$(chost faiserver) bash <<'EOF'
+set -eE -o pipefail
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
# 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
+$ 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.
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
# 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"
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.
-
+-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.
##### begin command line parsing ########
+dhcp=true
redep=true
acks=2
wait=false
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 ;;
}
set-pxe() {
+ $dhcp || return 0
echo "$0: updating dnsmasq.conf:"
$type
${type:-:}|ssh wrt "cedit pxe /etc/dnsmasq.conf || /etc/init.d/dnsmasq restart