From b4ba8c86e19533882a261c89de4d49fb5da6ccd2 Mon Sep 17 00:00:00 2001 From: Ian Kelling Date: Fri, 2 Sep 2016 03:16:01 -0700 Subject: [PATCH] fix stretch, upgrade from jessie broke --- fai-revm | 7 +-- fai/config/basefiles/mk-basefile | 15 +++++- fai/config/class/50-host-classes | 74 +++++++++----------------- fai/config/scripts/DEBIAN/30-interface | 40 ++++++++------ faiserver-setup | 14 +++-- 5 files changed, 75 insertions(+), 75 deletions(-) diff --git a/fai-revm b/fai-revm index 6271a36..b10d6e6 100755 --- a/fai-revm +++ b/fai-revm @@ -14,7 +14,6 @@ # 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. -set -x # Note, sometimes shutting down the existing demohost vm # fails. Just run again if that happens. @@ -104,9 +103,11 @@ if [[ $SSH_CLIENT ]]; then fi sleep 30 -while ! timeout -s 9 10 ssh root@$name /bin/true; do sleep 5; done +while ! timeout -s 9 10 ssh root@$name /bin/true; do + e sleep 5 +done cleanup() { :; } -pxe-server : +e pxe-server : if is_arch_revm; then ./arch-init-remote $name fi diff --git a/fai/config/basefiles/mk-basefile b/fai/config/basefiles/mk-basefile index 591a878..3f539d8 100755 --- a/fai/config/basefiles/mk-basefile +++ b/fai/config/basefiles/mk-basefile @@ -20,8 +20,8 @@ # Define your local mirros here # For the first stage, set the CentOS/SLC mirror in /etc/rinse/rinse.conf -MIRROR_DEBIAN=http://httpredir.debian.org/debian/ -MIRROR_DEBIAN=http://localmirror/debian/ +MIRROR_DEBIAN=http://http.us.debian.org/debian +#MIRROR_DEBIAN=http://localmirror/debian/ MIRROR_UBUNTU=http://mirror.netcologne.de/ubuntu/ MIRROR_CENTOS=http://mirror.netcologne.de/ #MIRROR_CENTOS=http://localmirror @@ -188,6 +188,16 @@ jessie() { tarit } +stretch() { + + local arch=$1 + + check + debootstrap --arch $arch --exclude=${EXCLUDE_JESSIE} --include=${INCLUDE_DEBIAN} stretch $xtmp ${MIRROR_DEBIAN} + cleanup-deb + tarit +} + trusty() { local arch=$1 @@ -275,6 +285,7 @@ case "$target" in WHEEZY64) wheezy amd64 ;; JESSIE32) jessie i386 ;; JESSIE64) jessie amd64 ;; + STRETCH64) stretch amd64 ;; *) unknown ;; esac diff --git a/fai/config/class/50-host-classes b/fai/config/class/50-host-classes index b623f88..6f32a08 100755 --- a/fai/config/class/50-host-classes +++ b/fai/config/class/50-host-classes @@ -17,62 +17,38 @@ # do not use this if a menu will be presented [ "$flag_menu" ] && exit 0 + +# For multi-boot system. +# Check that we aren't in a pxe boot environment. +# There is probably a better way to do this. +# We check the reverse condition in 51-multi-boot, +# and set what os we are installing, but don't check it +# into git since it changes regularly. Each host needs +# to have a class of either STABLE or STRETCH64. +# +# It's shell looks like this: +# if [[ ! -e /a/bin/fai/fai-wrapper ]]; then +# case $HOSTNAME in +# tp) STABLE ;; +# # add more multi-boot hostnames here +# esac +# fi +# +if [[ -e /a/bin/fai/fai-wrapper ]] && isdebian-stable; then + echo "STABLE" +fi + # use a list of classes for our demo machine -echo "FAIBASE DEBIAN" +echo "FAIBASE DEBIAN PARTITION_PROMPT" case $HOSTNAME in - demohost) - echo "DESKTOP" ;; - tp) - echo "DESKTOP PARTITION_PROMPT" - # For multi-boot system. - # Check that we aren't in a pxe boot environment. - # There is probably a better way to do this. - # We check the reverse condition in 51-multi-boot, - # and set what os we are installing, but don't check it - # into git since it changes regularly. - # It's shell looks like this: - # if [[ ! -e /a/bin/fai/fai-wrapper ]]; then - # case $HOSTNAME in - # tp) : ;; - # # add more multi-boot hostnames here - # esac - # fi - # - if [[ -e /a/bin/fai/fai-wrapper ]] && isdebian-stable; then - echo "STABLE" - fi - ;; x2|frodo|treetowl) echo "NON_FREE" if [[ -e /a/bin/fai/fai-wrapper ]] && isdebian-stable; then - echo "STABLE STABLE_NON_FREE" + echo "STABLE_NON_FREE" fi ;; - lj) - echo "LINODESTABLE PARTITION_PROMPT" ;; - li) - echo "LINODESTABLE PARTITION_PROMPT" ;; - do) - echo "STABLE PARTITION_PROMPT" ;; - # faiserver) - # echo "DEMO FAISERVER" ;; - # xfcehost) - # echo "DEMO XORG XFCE LVM";; - # gnomehost) - # echo "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 "DESKTOP" ;; + lj|lj) + echo "LINODESTABLE" ;; esac if grep ^52:54:00: /sys/class/net/eth0/address &>/dev/null; then diff --git a/fai/config/scripts/DEBIAN/30-interface b/fai/config/scripts/DEBIAN/30-interface index 6f2251a..a962049 100755 --- a/fai/config/scripts/DEBIAN/30-interface +++ b/fai/config/scripts/DEBIAN/30-interface @@ -3,24 +3,30 @@ # modified from upstream fai example error=0; trap 'error=$(($?>$error?$?:$error))' ERR # save maximum error code -if ! ifclass VM && ! ifclass STABLE; then - # get persistent interface name. Note, these class conditions - # will need to get modified for new oses. testing vm doesn't use - # it right now, but other vms do I'm sure. - for field in ID_NET_NAME_FROM_DATABASE \ - ID_NET_NAME_ONBOARD \ - ID_NET_NAME_SLOT \ - ID_NET_NAME_PATH \ - ID_NET_NAME_MAC; do - name=$(udevadm info /sys/class/net/$NIC1 | sed -rn "s/^E: $field=(.+)/\1/p") - if [[ $name ]]; then - NIC1=$name - break +if ! ifclass STABLE; then + if ifclass VM; then + # For a vm, we only get ID_NET_NAME_MAC from below, + # but when it reboots, it uses ID_NET_NAME_SLOT. + NIC1=ens3 + else + # get persistent interface name. Note, these class conditions + # will need to get modified for new oses. testing vm doesn't use + # it right now, but other vms do I'm sure. + for field in ID_NET_NAME_FROM_DATABASE \ + ID_NET_NAME_ONBOARD \ + ID_NET_NAME_SLOT \ + ID_NET_NAME_PATH \ + ID_NET_NAME_MAC; do + name=$(udevadm info /sys/class/net/$NIC1 | sed -rn "s/^E: $field=(.+)/\1/p") + if [[ $name ]]; then + NIC1=$name + break + fi + done + if [[ ! $name ]]; then + echo "$0: error: could not find systemd predictable network name" + exit 1 fi - done - if [[ ! $name ]]; then - echo "$0: error: could not find systemd predictable network name" - exit 1 fi fi diff --git a/faiserver-setup b/faiserver-setup index 724a09c..aa83685 100755 --- a/faiserver-setup +++ b/faiserver-setup @@ -15,10 +15,13 @@ # 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 -# Requires changing dns to point faiserver and running fai-redep +# 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 @@ -27,7 +30,10 @@ trap 'echo "$0:$LINENO:error: \"$BASH_COMMAND\" returned $?" >&2' ERR e() { echo "$@"; "$@"; } -base=${1:-jessie} +# 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. +base=jessie sed="sed -ri --follow-symlinks" @@ -37,6 +43,7 @@ if [[ $base == jessie ]]; then 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 @@ -65,7 +72,6 @@ r=http://http.us.debian.org/debian dd of=/etc/fai/apt/sources.list <