# 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
chboot # Set grub to boot into a different distro (installed earlier)
install-chboot # reinstall chboot to /boot subvols, for chboot updates.
eboot # reboot without automatic disk decryption
-fai-wrapper # Evaluate and use fai classes outside of fai.
+fai-wrapper # use fai classes outside of fai. sourced, not called.
fresize # resize swap or boot partitions in a host
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+set -x
+
+set -eE -o pipefail
+trap 'echo "$0:$LINENO:error: \"$BASH_COMMAND\" returned $?" >&2' ERR
+
usage() {
cat <<EOF
-Usage: ${0##*/} HOSTNAME
+Usage: ${0##*/} [-h|--help] HOSTNAME
+install arch after it's been booted into it's setup env
EOF
exit $1
}
-
-set -x
-
-set -eE -o pipefail
-trap 'echo "$0:$LINENO:error: \"$BASH_COMMAND\" returned $?" >&2' ERR
+case $1 in
+ -h|--help) usage ;;
+esac
if [[ ! $1 ]]; then
echo "error: expect a hostname in \$1 "
#!/bin/bash
+# Copyright (C) 2017 Ian Kelling
+
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+
+
+usage() {
+ cat <<EOF
+Usage: ${0##*/} [-h|--help]
+reboot and keep disks encrypted
+EOF
+ exit $1
+}
+case $1 in
+ -h|--help) usage ;;
+esac
-# reboot and keep disks encrypted.
touch /tmp/keyscript-off
[[ $EUID == 0 ]] || s=sudo
$s reboot "$@"
EOF
exit $1
}
-
case $1 in
-h|--help) usage ;;
esac
exit $1
}
-
new_disk=false
temp=$(getopt -l help hnr "$@") || usage 1
eval set -- "$temp"
exit 1
fi
+# ssh host keys
+# note, $BASH_SOURCE is not defined here under fai.
+src=$(dirname "$0")/p/c/machine_specific/$HOSTNAME/filesystem/etc/ssh
+dst=$target/etc/ssh
+if [[ -e $src && -e $dst ]]; then
+ # outside of fai context, we skip this
+ cp -rT $src $dst
+fi
+
+if ifclass VOL_STABLE_BOOTSTRAP; then
+ exit 0
+fi
+
TPW=/q/root/shadow/traci-simple
if ifclass tp; then
ROOTPW="$TPW"
echo "$line" >> $f
fi
-# ssh host keys
-# note, $BASH_SOURCE is not defined here under fai.
-src=$(dirname "$0")/p/c/machine_specific/$HOSTNAME/filesystem/etc/ssh
-dst=$target/etc/ssh
-if [[ -e $src && -e $dst ]]; then
- # outside of fai context, we skip this
- cp -rT $src $dst
-fi
-
-
dir=/p/c/machine_specific/$HOSTNAME/.unison
$ROOTCMD mkdir -p $dir
if ! $ROOTCMD test -L /root/.unison; then
mount -o bind $src $dst
fi
+$FAI/distro-install-common/end
if ifclass VOL_STABLE_BOOTSTRAP; then
fcopy -ri /etc/systemd/system
chroot $FAI_ROOT bash <<'EOFOUTER'
systemctl enable fai_check.service
EOFOUTER
- exit 0
+ exit 0 # avoid unnecessary stuff in bootstrap vol
fi
-$FAI/distro-install-common/end
-
# these get copied in an earlier stage by fai, but leaving it here since
# I run this as a single post-fai script to update things that have changed.
fcopy -riB /etc/apt
#!/bin/bash -l
-# Usage: faiserver-revm
-# Create a vm which is a fai server.
-#
-# This assumes you've set the dhcp server to make
-# 52:54:00:56:09:f9 be faiserver.
set -x
set -eE -o pipefail
x="$(readlink -f "$BASH_SOURCE")"; cd ${x%/*}
+usage() {
+ cat <<EOF
+usage: ${0##*/} [-h|--help]
+Create a vm which is a fai server.
+
+This assumes you've set the dhcp server to make 52:54:00:56:09:f9 be
+faiserver. That mac is a randomly generated one in the libvirt range.
+EOF
+ exit $1
+}
+case $1 in
+ -h|--help) usage ;;
+esac
+
cleanup() { pxe-server :; }
./debian-pxe-preseed -i 192.168.1.1 -u ian -g vda
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-# Usage: faiserver-setup
-#
-# Initial setup of a fai server on debian. works on localhost.
-# Set's the current ip as the tftp server. I vaguely remember
-# that using a hostname does not work.
-# Separate from running this, faiserver needs to be setup in dns
-# to point to whatever host this is run on.
-
set -eE -o pipefail
trap 'echo "$0:$LINENO:error: \"$BASH_COMMAND\" returned $?" >&2' ERR
[[ $EUID == 0 ]] || exec sudo "${BASH_SOURCE}" "$@"
+usage() {
+ cat <<EOF
+usage: ${0##*/} [-h|--help]
+install fai-server on the current machine
+
+Initial setup of a fai server on debian. works on localhost.
+Set's the current ip as the tftp server. I vaguely remember
+that using a hostname does not work.
+Separate from running this, faiserver needs to be setup in dns
+to point to whatever host this is run on.
+EOF
+ exit $1
+}
+case $1 in
+ -h|--help) usage ;;
+esac
+
+
e() { echo "$@"; "$@"; }
# When stretch becomes stable, change this to stretch.
[[ $EUID == 0 ]] || exec sudo "${BASH_SOURCE}" "$@"
+usage() {
+ cat <<EOF
+usage: ${0##*/} [-h|--help]
+uninstall fai-server
+EOF
+ exit $1
+}
+case $1 in
+ -h|--help) usage ;;
+esac
-apt-get -y purge $(< /etc/fai/fai-manually-installed-packages)
+
+apt-get -y remove --purge --auto-remove fai-doc nfs-kernel-server \
+ tftpd-hpa tar reprepro squashfs-tools binutils fai-server
set -eE -o pipefail
trap 'echo "$0:$LINENO:error: \"$BASH_COMMAND\" returned $?" >&2' ERR
-# usage install-chboot: isntalls chboot to all /boot subvols,
-# in case there is an issue booting and it is needed.
-# Run this when chboot changes.
x=$(readlink -f "$BASH_SOURCE"); cd ${x%/*}
+usage() {
+ cat <<EOF
+Usage: ${0##*/} [-h|--help]
+reinstall chboot to /boot subvols, for chboot updates.
+
+We install to /boot in case there is an issue booting and only the /boot
+vol is readily available. For the bootstrap subvol, this is the normal
+case.
+EOF
+ exit $1
+}
+case $1 in
+ -h|--help) usage ;;
+esac
+
+
e() { echo "$@"; "$@"; }
boot_dev=$(mount | sed -rn "s#^(\S+) on /boot .*#\1#p")
#!/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
-# curl is sometimes not preinstalled on a live cd.
-#
-# This has been tested on trisquel belanos and ubuntu xenial.
-#
-# If the screen just sits in a weird color inverted, corrupted looking state,
-# it's probably nothing wrong with the computer, but a problem
-# with the fai server. If you can do this from a virtual terminal,
-# it will print out more info (I know from running it on a vm).
+# Copyright (C) 2016 Ian Kelling
+
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+
+usage() {
+ cat <<EOF
+Usage: ${0##*/} [-h|--help]
+fai kexec from upstream live cds, i.e. curl|bash
+
+You can copy this to a http server, then wget -O- url|sudo bash
+curl is sometimes not preinstalled on a live cd.
+
+This has been tested on trisquel belanos and ubuntu xenial.
+
+If the screen just sits in a weird color inverted, corrupted looking state,
+it's probably nothing wrong with the computer, but a problem
+with the fai server. If you can do this from a virtual terminal,
+it will print out more info (I know from running it on a vm).
+EOF
+ exit $1
+}
+case $1 in
+ -h|--help) usage ;;
+esac
+
set -ex
if grep -q ID=ubuntu /etc/os-release; then
EOF
exit $1
}
-
-
case $1 in
-h|--help) usage ;;
esac
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-# Usage: wrt-setup-remote
-
set -eE -o pipefail
trap 'echo "$0:$LINENO:error: \"$BASH_COMMAND\" returned $?" >&2' ERR
x="$(readlink -f "$BASH_SOURCE")"; cd ${x%/*}
+usage() {
+ cat <<EOF
+usage: ${0##*/} [-h|--help]
+setup my router in general: dhcp, dns, etc.
+EOF
+ exit $1
+}
+case $1 in
+ -h|--help) usage ;;
+esac
+
+
h=root@192.168.1.1
scp /a/bin/fai/wrt-setup /a/bin/cedit/cedit $h:/usr/bin
ssh $h <<EOF