s scp -r /q/root/luks root@faiserver:/srv/fai/config/distro-install-common
ssh root@faiserver chmod -R a+rX /srv/fai/config/distro-install-common
-s virshrm demohost ||:
-
-for f in /var/lib/libvirt/images/demohost{,b}; do
- [[ -e $f ]] || s qemu-img create -o preallocation=metadata -f qcow2 $f 30G
-done
-# osinfo-query os | gr jessie
-s virt-install --os-variant debian8 --cpu host -n demohost --pxe -r 2048 --vcpus 1 \
- --disk path=/var/lib/libvirt/images/demohost \
- --disk path=/var/lib/libvirt/images/demohostb -w bridge=br0,mac=52:54:00:9c:ef:ad
--- /dev/null
+#!/bin/bash -lx
+
+# Deploy fai configuration to faiserver,
+# then start a virtual machine to test the config.
+
+set -eE -o pipefail
+trap 'echo "$0:$LINENO:error: \"$BASH_COMMAND\" returned $?"' ERR
+
+cd "${BASH_SOURCE%/*}"
+
+./fai-redep
+
+s virshrm demohost ||:
+
+for f in /var/lib/libvirt/images/demohost{,b}; do
+ [[ -e $f ]] || s qemu-img create -o preallocation=metadata -f qcow2 $f 30G
+done
+# osinfo-query os | gr jessie
+s virt-install --os-variant debian8 --cpu host -n demohost --pxe -r 2048 --vcpus 1 \
+ --disk path=/var/lib/libvirt/images/demohost \
+ --disk path=/var/lib/libvirt/images/demohostb -w bridge=br0,mac=52:54:00:9c:ef:ad
# use a list of classes for our demo machine
case $HOSTNAME in
- faiserver)
- echo "FAIBASE DEBIAN DEMO FAISERVER" ;;
demohost)
- echo "FAIBASE DEBIAN" ;;
- xfcehost)
- echo "FAIBASE DEBIAN DEMO XORG XFCE LVM";;
- gnomehost)
- echo "FAIBASE DEBIAN DEMO XORG GNOME";;
- centos)
- echo "FAIBASE CENTOS" # you may want to add class XORG here
- ifclass I386 && echo CENTOS6_32 # AFAIK there's no 32bit C7
- ifclass AMD64 && echo CENTOS7_64
- exit 0 ;; # CentOS does not use the GRUB class
- slchost)
- # Scientific Linux Cern, is very similar to CentOS. SLC should alsways use the class CENTOS
- echo "FAIBASE CENTOS SLC" # you may want to add class XORG here
- ifclass I386 && echo SLC7_32
- ifclass AMD64 && echo SLC7_64
- exit 0 ;; # CentOS/SLC does not use the GRUB class
+ echo "FAIBASE DEBIAN DESKTOP" ;;
+ x2)
+ echo "FAIBASE DEBIAN DESKTOP ONE_DISK" ;;
+ tp)
+ echo "FAIBASE DEBIAN DESKTOP TWO_DISK" ;;
+ # faiserver)
+ # echo "FAIBASE DEBIAN DEMO FAISERVER" ;;
+ # xfcehost)
+ # echo "FAIBASE DEBIAN DEMO XORG XFCE LVM";;
+ # gnomehost)
+ # echo "FAIBASE DEBIAN DEMO XORG GNOME";;
+ # centos)
+ # echo "FAIBASE CENTOS" # you may want to add class XORG here
+ # ifclass I386 && echo CENTOS6_32 # AFAIK there's no 32bit C7
+ # ifclass AMD64 && echo CENTOS7_64
+ # exit 0 ;; # CentOS does not use the GRUB class
+ # slchost)
+ # # Scientific Linux Cern, is very similar to CentOS. SLC should alsways use the class CENTOS
+ # echo "FAIBASE CENTOS SLC" # you may want to add class XORG here
+ # ifclass I386 && echo SLC7_32
+ # ifclass AMD64 && echo SLC7_64
+ # exit 0 ;; # CentOS/SLC does not use the GRUB class
*)
- echo "FAIBASE DEBIAN" ;;
+ echo "FAIBASE DEBIAN DESKTOP" ;;
esac
if grep ^52:54:00: /sys/class/net/eth0/address &>/dev/null; then
--- /dev/null
+#!/bin/bash
+
+# exit for any vm which is not our test vm
+if ifclass VM && ! ifclass demohost; then
+ exit 0
+fi
+
+chattr -Rf +C /target
+++ /dev/null
-#!/bin/bash
-
-chattr -Rf +C /target
#!/bin/bash
+# exit for any vm which is not our test vm
+if ifclass VM && ! ifclass demohost; then
+ exit 0
+fi
+
f=$target/root/keyscript
cat > $f <<EOFOUTER
#!/bin/sh
# # fai's setup-storage won't do btrfs on luks,
# # so we do it ourself :)
-skiptask partition
-repartition=false
+partition=false
# keyfiles generated like:
# head -c 2048 /dev/urandom | od | s dd of=/q/root/luks/host-demohost
if ifclass VM; then
d=/dev/vd
- letters=(a b)
else
d=/dev/sd
fi
-devs=()
-for letter in ${letters[@]}; do
- devs+=($d$letter)
+
+if ifclass TWO_DISK; then
+ skiptask partition
+ devs=(${d}{a,b})
+ [[ -e /dev/md127 ]] || partition=true
+elif ifclass ONE_DISK; then
+ skiptask partition
+ devs=(${d}a)
+else
+ exit
+fi
+
+# somewhat crude detection of wehter to partition
+for dev in ${devs[@]}; do
+ for part in ${dev}{1,2,3,4}; do
+ [[ -e $part ]] || partition=true
+ done
done
swap_end=$(( $(grep ^MemTotal: /proc/meminfo| awk '{print $2}') * 3/(${#letters[@]} * 2 ) / 1000 + boot_end ))MiB
shopt -s nullglob
-if $repartition; then
+if $partition; then
mkdir -p /tmp/fai
for dev in ${devs[@]}; do
for x in /dev/md*; do [[ -d $x ]] || mdadm --stop $x; done