From ef5b20d6a8e44006da940ac01fa44a067a83ea10 Mon Sep 17 00:00:00 2001 From: Benedikt Heine Date: Tue, 11 Oct 2016 17:41:56 +0200 Subject: [PATCH 01/17] fix ipxe enabled checks for right logic --- setup.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/setup.sh b/setup.sh index e061a95..0df80c9 100755 --- a/setup.sh +++ b/setup.sh @@ -170,17 +170,17 @@ case "$1" in "") step_system_install step_config_write - [ -n "$IPXE_ENABLED" ] && step_config_write_iPXE + [ "$IPXE_ENABLED" != 0 ] && step_config_write_iPXE step_integrate ;; system-install) step_system_install step_config_write - [ -n "$IPXE_ENABLED" ] && step_config_write_iPXE + [ "$IPXE_ENABLED" != 0 ] && step_config_write_iPXE ;; config-write) step_config_write - [ -n "$IPXE_ENABLED" ] && step_config_write_iPXE + [ "$IPXE_ENABLED" != 0 ] && step_config_write_iPXE ;; integrate) step_integrate From d247e8459baacda718c4590574fde46b5a8a4bfb Mon Sep 17 00:00:00 2001 From: Benedikt Heine Date: Sat, 19 Nov 2016 17:18:34 +0100 Subject: [PATCH 02/17] [recipes] add update function for installation data --- recipes/00skelleton/recipe | 26 +++++++++++------- recipes/archlinux-nfs/recipe | 26 +++++++++++------- recipes/local-harddrive/recipe | 24 ++++++++++------- recipes/memtest/recipe | 26 +++++++++++------- recipes/netboot.xyz/recipe | 26 +++++++++++------- recipes/ubuntu-14.04-desktop-rescue/recipe | 26 +++++++++++------- recipes/ubuntu-14.04-mini/recipe | 31 +++++++++++++--------- recipes/ubuntu-14.04-server-rescue/recipe | 26 +++++++++++------- recipes/ubuntu-14.04.3-desktop-live/recipe | 24 ++++++++++------- recipes/ubuntu-16.04-desktop-live/recipe | 24 ++++++++++------- recipes/ubuntu-16.04-desktop-rescue/recipe | 26 +++++++++++------- recipes/ubuntu-16.04-mini/recipe | 31 +++++++++++++--------- recipes/ubuntu-16.04-server-rescue/recipe | 26 +++++++++++------- 13 files changed, 209 insertions(+), 133 deletions(-) diff --git a/recipes/00skelleton/recipe b/recipes/00skelleton/recipe index 0b32b2c..236fded 100755 --- a/recipes/00skelleton/recipe +++ b/recipes/00skelleton/recipe @@ -84,13 +84,19 @@ installation(){ mkdir -p $BASE_SYSTEMS/$DISTRO_ID } -if [[ ! -d $BASE_SYSTEMS/$DISTRO_ID && -n "$1" && "x$1" == "xinstall" ]]; then - installation -fi - -if [[ -n "$1" && "x$1" == "xconfig" ]]; then - config -fi -if [[ -n "$1" && "x$1" == "xconfig_ipxe" ]]; then - config_ipxe -fi +update(){ + return +} + +case "$1" in + install) + [[ ! -d $BASE_SYSTEMS/$DISTRO_ID ]] && installation + update + ;; + config) + config + ;; + config_ipxe) + config_ipxe + ;; +esac diff --git a/recipes/archlinux-nfs/recipe b/recipes/archlinux-nfs/recipe index 779831f..ee57959 100755 --- a/recipes/archlinux-nfs/recipe +++ b/recipes/archlinux-nfs/recipe @@ -93,13 +93,19 @@ installation(){ chr ln -sf /run/systemd/resolve/resolv.conf /etc/resolv.conf } -if [[ ! -d $BASE_SYSTEMS/$DISTRO_ID && -n "$1" && "x$1" == "xinstall" ]]; then - installation -fi - -if [[ -n "$1" && "x$1" == "xconfig" ]]; then - config -fi -if [[ -n "$1" && "x$1" == "xconfig_ipxe" ]]; then - config_ipxe -fi +update(){ + return +} + +case "$1" in + install) + [[ ! -d $BASE_SYSTEMS/$DISTRO_ID ]] && installation + update + ;; + config) + config + ;; + config_ipxe) + config_ipxe + ;; +esac diff --git a/recipes/local-harddrive/recipe b/recipes/local-harddrive/recipe index 483c28d..2433b9a 100755 --- a/recipes/local-harddrive/recipe +++ b/recipes/local-harddrive/recipe @@ -19,13 +19,19 @@ installation(){ return 0 } -if [[ ! -d $BASE_SYSTEMS/$DISTRO_ID && -n "$1" && "x$1" == "xinstall" ]]; then - installation -fi +update(){ + return +} -if [[ -n "$1" && "x$1" == "xconfig" ]]; then - config -fi -if [[ -n "$1" && "x$1" == "xconfig_ipxe" ]]; then - config_ipxe -fi +case "$1" in + install) + [[ ! -d $BASE_SYSTEMS/$DISTRO_ID ]] && installation + update + ;; + config) + config + ;; + config_ipxe) + config_ipxe + ;; +esac diff --git a/recipes/memtest/recipe b/recipes/memtest/recipe index b0743e1..8cc2ff5 100755 --- a/recipes/memtest/recipe +++ b/recipes/memtest/recipe @@ -28,13 +28,19 @@ installation(){ cp /boot/memtest86+.bin $BASE_SYSTEMS/$DISTRO_ID/mt86plus } -if [[ ! -d $BASE_SYSTEMS/$DISTRO_ID && -n "$1" && "x$1" == "xinstall" ]]; then - installation -fi - -if [[ -n "$1" && "x$1" == "xconfig" ]]; then - config -fi -if [[ -n "$1" && "x$1" == "xconfig_ipxe" ]]; then - config_ipxe -fi +update(){ + return +} + +case "$1" in + install) + [[ ! -d $BASE_SYSTEMS/$DISTRO_ID ]] && installation + update + ;; + config) + config + ;; + config_ipxe) + config_ipxe + ;; +esac diff --git a/recipes/netboot.xyz/recipe b/recipes/netboot.xyz/recipe index 148c49d..ec9df04 100755 --- a/recipes/netboot.xyz/recipe +++ b/recipes/netboot.xyz/recipe @@ -33,13 +33,19 @@ installation(){ mkdir -p $BASE_SYSTEMS/$DISTRO_ID } -if [[ ! -d $BASE_SYSTEMS/$DISTRO_ID && -n "$1" && "x$1" == "xinstall" ]]; then - installation -fi - -if [[ -n "$1" && "x$1" == "xconfig" ]]; then - config -fi -if [[ -n "$1" && "x$1" == "xconfig_ipxe" ]]; then - config_ipxe -fi +update(){ + return +} + +case "$1" in + install) + [[ ! -d $BASE_SYSTEMS/$DISTRO_ID ]] && installation + update + ;; + config) + config + ;; + config_ipxe) + config_ipxe + ;; +esac diff --git a/recipes/ubuntu-14.04-desktop-rescue/recipe b/recipes/ubuntu-14.04-desktop-rescue/recipe index 0979511..6ecff2f 100755 --- a/recipes/ubuntu-14.04-desktop-rescue/recipe +++ b/recipes/ubuntu-14.04-desktop-rescue/recipe @@ -60,13 +60,19 @@ installation(){ END } -if [[ ! -d $BASE_SYSTEMS/$DISTRO_ID && -n "$1" && "x$1" == "xinstall" ]]; then - installation -fi - -if [[ -n "$1" && "x$1" == "xconfig" ]]; then - config -fi -if [[ -n "$1" && "x$1" == "xconfig_ipxe" ]]; then - config_ipxe -fi +update(){ + return +} + +case "$1" in + install) + [[ ! -d $BASE_SYSTEMS/$DISTRO_ID ]] && installation + update + ;; + config) + config + ;; + config_ipxe) + config_ipxe + ;; +esac diff --git a/recipes/ubuntu-14.04-mini/recipe b/recipes/ubuntu-14.04-mini/recipe index 438d0ba..3d35390 100755 --- a/recipes/ubuntu-14.04-mini/recipe +++ b/recipes/ubuntu-14.04-mini/recipe @@ -77,22 +77,27 @@ installation(){ wget http://archive.ubuntu.com/ubuntu/dists/trusty/main/installer-amd64/current/images/netboot/mini.iso -O $iso mount $iso $dir cp -r $dir $BASE_SYSTEMS/$DISTRO_ID - mkdir $BASE_SYSTEMS/$DISTRO_ID/preseeds - for seed in $RECIPE_BASE/preseeds/*; do - envsubst < $seed > $BASE_SYSTEMS/$DISTRO_ID/preseeds/$(basename $seed) - done umount $dir rmdir $dir rm $iso } -if [[ ! -d $BASE_SYSTEMS/$DISTRO_ID && -n "$1" && "x$1" == "xinstall" ]]; then - installation -fi +update(){ + [ ! -d $BASE_SYSTEMS/$DISTRO_ID/preseeds ] && mkdir $BASE_SYSTEMS/$DISTRO_ID/preseeds + for seed in $RECIPE_BASE/preseeds/*; do + envsubst < $seed > $BASE_SYSTEMS/$DISTRO_ID/preseeds/$(basename $seed) + done +} -if [[ -n "$1" && "x$1" == "xconfig" ]]; then - config -fi -if [[ -n "$1" && "x$1" == "xconfig_ipxe" ]]; then - config_ipxe -fi +case "$1" in + install) + [[ ! -d $BASE_SYSTEMS/$DISTRO_ID ]] && installation + update + ;; + config) + config + ;; + config_ipxe) + config_ipxe + ;; +esac diff --git a/recipes/ubuntu-14.04-server-rescue/recipe b/recipes/ubuntu-14.04-server-rescue/recipe index 2e8a2d9..3b0c721 100755 --- a/recipes/ubuntu-14.04-server-rescue/recipe +++ b/recipes/ubuntu-14.04-server-rescue/recipe @@ -62,13 +62,19 @@ installation(){ END } -if [[ ! -d $BASE_SYSTEMS/$DISTRO_ID && -n "$1" && "x$1" == "xinstall" ]]; then - installation -fi - -if [[ -n "$1" && "x$1" == "xconfig" ]]; then - config -fi -if [[ -n "$1" && "x$1" == "xconfig_ipxe" ]]; then - config_ipxe -fi +update(){ + return +} + +case "$1" in + install) + [[ ! -d $BASE_SYSTEMS/$DISTRO_ID ]] && installation + update + ;; + config) + config + ;; + config_ipxe) + config_ipxe + ;; +esac diff --git a/recipes/ubuntu-14.04.3-desktop-live/recipe b/recipes/ubuntu-14.04.3-desktop-live/recipe index f06af2a..123a6d7 100755 --- a/recipes/ubuntu-14.04.3-desktop-live/recipe +++ b/recipes/ubuntu-14.04.3-desktop-live/recipe @@ -35,13 +35,19 @@ installation(){ rm $iso } -if [[ ! -d $BASE_SYSTEMS/$DISTRO_ID && -n "$1" && "x$1" == "xinstall" ]]; then - installation -fi +update(){ + return +} -if [[ -n "$1" && "x$1" == "xconfig" ]]; then - config -fi -if [[ -n "$1" && "x$1" == "xconfig_ipxe" ]]; then - config_ipxe -fi +case "$1" in + install) + [[ ! -d $BASE_SYSTEMS/$DISTRO_ID ]] && installation + update + ;; + config) + config + ;; + config_ipxe) + config_ipxe + ;; +esac diff --git a/recipes/ubuntu-16.04-desktop-live/recipe b/recipes/ubuntu-16.04-desktop-live/recipe index 1664166..58bebe5 100755 --- a/recipes/ubuntu-16.04-desktop-live/recipe +++ b/recipes/ubuntu-16.04-desktop-live/recipe @@ -35,13 +35,19 @@ installation(){ rm $iso } -if [[ ! -d $BASE_SYSTEMS/$DISTRO_ID && -n "$1" && "x$1" == "xinstall" ]]; then - installation -fi +update(){ + return +} -if [[ -n "$1" && "x$1" == "xconfig" ]]; then - config -fi -if [[ -n "$1" && "x$1" == "xconfig_ipxe" ]]; then - config_ipxe -fi +case "$1" in + install) + [[ ! -d $BASE_SYSTEMS/$DISTRO_ID ]] && installation + update + ;; + config) + config + ;; + config_ipxe) + config_ipxe + ;; +esac diff --git a/recipes/ubuntu-16.04-desktop-rescue/recipe b/recipes/ubuntu-16.04-desktop-rescue/recipe index 3e9546c..da8f491 100755 --- a/recipes/ubuntu-16.04-desktop-rescue/recipe +++ b/recipes/ubuntu-16.04-desktop-rescue/recipe @@ -65,13 +65,19 @@ installation(){ END } -if [[ ! -d $BASE_SYSTEMS/$DISTRO_ID && -n "$1" && "x$1" == "xinstall" ]]; then - installation -fi - -if [[ -n "$1" && "x$1" == "xconfig" ]]; then - config -fi -if [[ -n "$1" && "x$1" == "xconfig_ipxe" ]]; then - config_ipxe -fi +update(){ + return +} + +case "$1" in + install) + [[ ! -d $BASE_SYSTEMS/$DISTRO_ID ]] && installation + update + ;; + config) + config + ;; + config_ipxe) + config_ipxe + ;; +esac diff --git a/recipes/ubuntu-16.04-mini/recipe b/recipes/ubuntu-16.04-mini/recipe index 465c7dc..db21810 100755 --- a/recipes/ubuntu-16.04-mini/recipe +++ b/recipes/ubuntu-16.04-mini/recipe @@ -77,22 +77,27 @@ installation(){ wget http://archive.ubuntu.com/ubuntu/dists/xenial/main/installer-amd64/current/images/netboot/mini.iso -O $iso mount $iso $dir cp -r $dir $BASE_SYSTEMS/$DISTRO_ID - mkdir $BASE_SYSTEMS/$DISTRO_ID/preseeds - for seed in $RECIPE_BASE/preseeds/*; do - envsubst < $seed > $BASE_SYSTEMS/$DISTRO_ID/preseeds/$(basename $seed) - done umount $dir rmdir $dir rm $iso } -if [[ ! -d $BASE_SYSTEMS/$DISTRO_ID && -n "$1" && "x$1" == "xinstall" ]]; then - installation -fi +update(){ + [ ! -d $BASE_SYSTEMS/$DISTRO_ID/preseeds ] && mkdir $BASE_SYSTEMS/$DISTRO_ID/preseeds + for seed in $RECIPE_BASE/preseeds/*; do + envsubst < $seed > $BASE_SYSTEMS/$DISTRO_ID/preseeds/$(basename $seed) + done +} -if [[ -n "$1" && "x$1" == "xconfig" ]]; then - config -fi -if [[ -n "$1" && "x$1" == "xconfig_ipxe" ]]; then - config_ipxe -fi +case "$1" in + install) + [[ ! -d $BASE_SYSTEMS/$DISTRO_ID ]] && installation + update + ;; + config) + config + ;; + config_ipxe) + config_ipxe + ;; +esac diff --git a/recipes/ubuntu-16.04-server-rescue/recipe b/recipes/ubuntu-16.04-server-rescue/recipe index 5584f8e..2e122c4 100755 --- a/recipes/ubuntu-16.04-server-rescue/recipe +++ b/recipes/ubuntu-16.04-server-rescue/recipe @@ -67,13 +67,19 @@ installation(){ END } -if [[ ! -d $BASE_SYSTEMS/$DISTRO_ID && -n "$1" && "x$1" == "xinstall" ]]; then - installation -fi - -if [[ -n "$1" && "x$1" == "xconfig" ]]; then - config -fi -if [[ -n "$1" && "x$1" == "xconfig_ipxe" ]]; then - config_ipxe -fi +update(){ + return +} + +case "$1" in + install) + [[ ! -d $BASE_SYSTEMS/$DISTRO_ID ]] && installation + update + ;; + config) + config + ;; + config_ipxe) + config_ipxe + ;; +esac From 947594bfabc300a4325e918dddc0e3ff7e9cb566 Mon Sep 17 00:00:00 2001 From: Benedikt Heine Date: Mon, 21 Nov 2016 14:28:16 +0100 Subject: [PATCH 03/17] add support for iso extraction via xorriso This is needed for docker support, cause docker does not support in-container mounting! --- recipes/ubuntu-14.04-mini/recipe | 18 +++++++++++++----- recipes/ubuntu-16.04-mini/recipe | 18 +++++++++++++----- 2 files changed, 26 insertions(+), 10 deletions(-) diff --git a/recipes/ubuntu-14.04-mini/recipe b/recipes/ubuntu-14.04-mini/recipe index 3d35390..e1330c1 100755 --- a/recipes/ubuntu-14.04-mini/recipe +++ b/recipes/ubuntu-14.04-mini/recipe @@ -71,14 +71,22 @@ config_ipxe(){ } +extract_iso(){ + if command -v osirrox >/dev/null 2>&1; then + osirrox -indev $1 -extract / $2 + else + dir=$(mktemp -d) + mount $1 $dir + cp -r $dir $2 + umount $dir + rmdir $dir + fi +} + installation(){ iso=$(mktemp) - dir=$(mktemp -d) wget http://archive.ubuntu.com/ubuntu/dists/trusty/main/installer-amd64/current/images/netboot/mini.iso -O $iso - mount $iso $dir - cp -r $dir $BASE_SYSTEMS/$DISTRO_ID - umount $dir - rmdir $dir + exctract_iso $iso $BASE_SYSTEMS/$DISTRO_ID rm $iso } diff --git a/recipes/ubuntu-16.04-mini/recipe b/recipes/ubuntu-16.04-mini/recipe index db21810..d678d2c 100755 --- a/recipes/ubuntu-16.04-mini/recipe +++ b/recipes/ubuntu-16.04-mini/recipe @@ -71,14 +71,22 @@ config_ipxe(){ END } +extract_iso(){ + if command -v osirrox >/dev/null 2>&1; then + osirrox -indev $1 -extract / $2 + else + dir=$(mktemp -d) + mount $1 $dir + cp -r $dir $2 + umount $dir + rmdir $dir + fi +} + installation(){ iso=$(mktemp) - dir=$(mktemp -d) wget http://archive.ubuntu.com/ubuntu/dists/xenial/main/installer-amd64/current/images/netboot/mini.iso -O $iso - mount $iso $dir - cp -r $dir $BASE_SYSTEMS/$DISTRO_ID - umount $dir - rmdir $dir + exctract_iso $iso $BASE_SYSTEMS/$DISTRO_ID rm $iso } From 49b9cfad0f1dfd6229313d9aab71d10ed32f6dd0 Mon Sep 17 00:00:00 2001 From: Benedikt Heine Date: Mon, 21 Nov 2016 14:30:44 +0100 Subject: [PATCH 04/17] add Dockerfile --- Dockerfile | 29 +++++++++++++++++++++++++++++ README.md | 13 +++++++++++++ docker.sh | 17 +++++++++++++++++ 3 files changed, 59 insertions(+) create mode 100644 Dockerfile create mode 100755 docker.sh diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..73ad859 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,29 @@ +FROM ubuntu:16.04 +MAINTAINER Benedikt Heine bebe@bebehei.de + +# ENVs are neccessary in docker.sh, too +ENV NFSHOST=127.0.0.1 +ENV SYSTEMS_ENABLED="local-harddrive netboot.xyz memtest ubuntu-14.04-mini ubuntu-16.04-mini" +ENV FILE_PXE_LINUX=/usr/lib/PXELINUX/pxelinux.0 +ENV FILE_DNSMASQ_CONFIG=/etc/dnsmasq.d/pixieboot.conf +ENV BASE=/srv/pixieboot + +RUN apt-get update \ + && apt-get install -y \ + dnsmasq \ + gettext-base \ + ipxe \ + memtest86+ \ + nginx \ + pxelinux \ + wget \ + xorriso \ + && rm -rf /var/lib/apt/lists/* + +ADD . $BASE + +RUN /srv/pixieboot/setup.sh + +EXPOSE 67/udp 80/tcp + +ENTRYPOINT ["/srv/pixieboot/docker.sh"] diff --git a/README.md b/README.md index 8f99128..32c4995 100644 --- a/README.md +++ b/README.md @@ -14,6 +14,7 @@ It's flexible and programmed modularly. It's easy to use it with existing setups - Fully customizable - via [`./config.sh`](./config.sh.example) - via [extra integration modules](./integrations) +- installable via [docker](#docker) ### Software used @@ -95,3 +96,15 @@ Most of the work, for adding new recipes, is just copy and paste. 2. Change in `config.sh` the value of `INTEGRATIONS_ENABLED` to include your new integration. 3. Execute `./setup.sh integrate`. + +# Docker Installation + +For best experience, simply forward the ports on the same ports as before and +set NFSHOST to the IP-Address of your hostmachine. + +docker run \ + -h pixieboot \ + --name pixieboot \ + --env NFSHOST= \ + -p 67:67/udp -p 80:80 \ + bebehei/pixieboot:latest diff --git a/docker.sh b/docker.sh new file mode 100755 index 0000000..9b716a1 --- /dev/null +++ b/docker.sh @@ -0,0 +1,17 @@ +#!/bin/bash + +# config.sh-entries +export NFSHOST=$(ip -4 addr show dev eth0 | awk '/inet/{print $2}' | cut -d / -f 1) +export FILE_PXE_LINUX=/usr/lib/PXELINUX/pxelinux.0 +export SYSTEMS_ENABLED="ubuntu-16.04-mini ubuntu-14.04-mini netboot.xyz memtest local-harddrive" +export FILE_DNSMASQ_CONFIG=/etc/dnsmasq.d/pixieboot.conf + +/srv/pixieboot/setup.sh config-write +/srv/pixieboot/setup.sh integrate + +echo "user=root" >> $FILE_DNSMASQ_CONFIG + +service dnsmasq start +service nginx start + +tailf /var/log/nginx/pixieboot-access.log From 8a408de63546b28945d620cc98e2553bb6f9cab5 Mon Sep 17 00:00:00 2001 From: Benedikt Heine Date: Mon, 21 Nov 2016 17:49:48 +0100 Subject: [PATCH 05/17] typo in recipes --- recipes/ubuntu-14.04-mini/recipe | 2 +- recipes/ubuntu-16.04-mini/recipe | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/recipes/ubuntu-14.04-mini/recipe b/recipes/ubuntu-14.04-mini/recipe index e1330c1..500eef1 100755 --- a/recipes/ubuntu-14.04-mini/recipe +++ b/recipes/ubuntu-14.04-mini/recipe @@ -86,7 +86,7 @@ extract_iso(){ installation(){ iso=$(mktemp) wget http://archive.ubuntu.com/ubuntu/dists/trusty/main/installer-amd64/current/images/netboot/mini.iso -O $iso - exctract_iso $iso $BASE_SYSTEMS/$DISTRO_ID + extract_iso $iso $BASE_SYSTEMS/$DISTRO_ID rm $iso } diff --git a/recipes/ubuntu-16.04-mini/recipe b/recipes/ubuntu-16.04-mini/recipe index d678d2c..b45022f 100755 --- a/recipes/ubuntu-16.04-mini/recipe +++ b/recipes/ubuntu-16.04-mini/recipe @@ -86,7 +86,7 @@ extract_iso(){ installation(){ iso=$(mktemp) wget http://archive.ubuntu.com/ubuntu/dists/xenial/main/installer-amd64/current/images/netboot/mini.iso -O $iso - exctract_iso $iso $BASE_SYSTEMS/$DISTRO_ID + extract_iso $iso $BASE_SYSTEMS/$DISTRO_ID rm $iso } From 73398fb46a15e9cbef8c23035231b2d7c2a090b6 Mon Sep 17 00:00:00 2001 From: Benedikt Heine Date: Mon, 21 Nov 2016 18:02:51 +0100 Subject: [PATCH 06/17] [docker] improve docs and improve ENV management --- Dockerfile | 17 ++++++++++++----- README.md | 21 ++++++++++++--------- docker.sh | 9 +++------ 3 files changed, 27 insertions(+), 20 deletions(-) diff --git a/Dockerfile b/Dockerfile index 73ad859..79e8765 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,12 +1,17 @@ FROM ubuntu:16.04 MAINTAINER Benedikt Heine bebe@bebehei.de -# ENVs are neccessary in docker.sh, too -ENV NFSHOST=127.0.0.1 -ENV SYSTEMS_ENABLED="local-harddrive netboot.xyz memtest ubuntu-14.04-mini ubuntu-16.04-mini" +ENV BASE=/srv/pixieboot + +# Vars, which would be usually defined in config.sh +ENV INTEGRATIONS_ENABLED="dnsmasq nginx pxebinaries" +ENV SYSTEMS_ENABLED="ubuntu-16.04-mini ubuntu-14.04-mini netboot.xyz memtest local-harddrive" ENV FILE_PXE_LINUX=/usr/lib/PXELINUX/pxelinux.0 ENV FILE_DNSMASQ_CONFIG=/etc/dnsmasq.d/pixieboot.conf -ENV BASE=/srv/pixieboot +# Set the reload commands to true, as normal service-commands would fail +# and docker.sh is starting the services anyway +ENV CMD_RELOAD_NGINX="true" +ENV CMD_RELOAD_DNSMASQ="true" RUN apt-get update \ && apt-get install -y \ @@ -22,7 +27,9 @@ RUN apt-get update \ ADD . $BASE -RUN /srv/pixieboot/setup.sh +# We have to define NFSHOST, as it is needed by setup.sh, +# but declaring it via ENV lets the container fail quietly. +RUN NFSHOST=127.0.0.1 /srv/pixieboot/setup.sh EXPOSE 67/udp 80/tcp diff --git a/README.md b/README.md index 32c4995..772b657 100644 --- a/README.md +++ b/README.md @@ -97,14 +97,17 @@ Most of the work, for adding new recipes, is just copy and paste. new integration. 3. Execute `./setup.sh integrate`. -# Docker Installation +# Docker -For best experience, simply forward the ports on the same ports as before and -set NFSHOST to the IP-Address of your hostmachine. +You have to use the docker host-network, as DHCP is not usable via port-forwarding. -docker run \ - -h pixieboot \ - --name pixieboot \ - --env NFSHOST= \ - -p 67:67/udp -p 80:80 \ - bebehei/pixieboot:latest +Also define the env-variable NFSHOST to match your local IP-Address. Additionally, +you must not run a service on port 80, 67 or 53 on your host system. + + docker run \ + -h pixieboot \ + --name pixieboot \ + --env NFSHOST= \ + --net=host \ + --detach \ + bebehei/pixieboot:latest diff --git a/docker.sh b/docker.sh index 9b716a1..2152ee7 100755 --- a/docker.sh +++ b/docker.sh @@ -1,13 +1,10 @@ #!/bin/bash # config.sh-entries -export NFSHOST=$(ip -4 addr show dev eth0 | awk '/inet/{print $2}' | cut -d / -f 1) -export FILE_PXE_LINUX=/usr/lib/PXELINUX/pxelinux.0 -export SYSTEMS_ENABLED="ubuntu-16.04-mini ubuntu-14.04-mini netboot.xyz memtest local-harddrive" -export FILE_DNSMASQ_CONFIG=/etc/dnsmasq.d/pixieboot.conf +export NFSHOST=${NFSHOST:-$(ip -4 addr show dev eth0 | awk '/inet/{print $2}' | cut -d / -f 1)} -/srv/pixieboot/setup.sh config-write -/srv/pixieboot/setup.sh integrate +/srv/pixieboot/setup.sh config-write || exit 1 +/srv/pixieboot/setup.sh integrate || exit 1 echo "user=root" >> $FILE_DNSMASQ_CONFIG From a41fd49a35c076cd92a291b009d4292665eaabd2 Mon Sep 17 00:00:00 2001 From: Benedikt Heine Date: Tue, 22 Nov 2016 01:10:53 +0100 Subject: [PATCH 07/17] [docker] update has to get called on container startup --- docker.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/docker.sh b/docker.sh index 2152ee7..d5bb6c7 100755 --- a/docker.sh +++ b/docker.sh @@ -3,8 +3,7 @@ # config.sh-entries export NFSHOST=${NFSHOST:-$(ip -4 addr show dev eth0 | awk '/inet/{print $2}' | cut -d / -f 1)} -/srv/pixieboot/setup.sh config-write || exit 1 -/srv/pixieboot/setup.sh integrate || exit 1 +/srv/pixieboot/setup.sh || exit 1 echo "user=root" >> $FILE_DNSMASQ_CONFIG From 6189c5646dfc6717d995018fa595b50d8441f63b Mon Sep 17 00:00:00 2001 From: Benedikt Heine Date: Tue, 22 Nov 2016 11:43:27 +0100 Subject: [PATCH 08/17] [preseed] export all neccessary variables --- recipes/ubuntu-14.04-mini/recipe | 1 + recipes/ubuntu-16.04-mini/recipe | 1 + 2 files changed, 2 insertions(+) diff --git a/recipes/ubuntu-14.04-mini/recipe b/recipes/ubuntu-14.04-mini/recipe index 500eef1..916f4af 100755 --- a/recipes/ubuntu-14.04-mini/recipe +++ b/recipes/ubuntu-14.04-mini/recipe @@ -91,6 +91,7 @@ installation(){ } update(){ + export DISTRO_ID DISTRO_NAME [ ! -d $BASE_SYSTEMS/$DISTRO_ID/preseeds ] && mkdir $BASE_SYSTEMS/$DISTRO_ID/preseeds for seed in $RECIPE_BASE/preseeds/*; do envsubst < $seed > $BASE_SYSTEMS/$DISTRO_ID/preseeds/$(basename $seed) diff --git a/recipes/ubuntu-16.04-mini/recipe b/recipes/ubuntu-16.04-mini/recipe index b45022f..37042d9 100755 --- a/recipes/ubuntu-16.04-mini/recipe +++ b/recipes/ubuntu-16.04-mini/recipe @@ -91,6 +91,7 @@ installation(){ } update(){ + export DISTRO_ID DISTRO_NAME [ ! -d $BASE_SYSTEMS/$DISTRO_ID/preseeds ] && mkdir $BASE_SYSTEMS/$DISTRO_ID/preseeds for seed in $RECIPE_BASE/preseeds/*; do envsubst < $seed > $BASE_SYSTEMS/$DISTRO_ID/preseeds/$(basename $seed) From 297fa272b6c80bb79944e3c864e64e5682b4236a Mon Sep 17 00:00:00 2001 From: Benedikt Heine Date: Tue, 22 Nov 2016 12:06:19 +0100 Subject: [PATCH 09/17] [docker] add dnsmasq to log output --- docker.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/docker.sh b/docker.sh index d5bb6c7..4f74bb8 100755 --- a/docker.sh +++ b/docker.sh @@ -6,8 +6,11 @@ export NFSHOST=${NFSHOST:-$(ip -4 addr show dev eth0 | awk '/inet/{print $2}' | /srv/pixieboot/setup.sh || exit 1 echo "user=root" >> $FILE_DNSMASQ_CONFIG +echo "log-facility=/var/log/dnsmasq.log" >> $FILE_DNSMASQ_CONFIG service dnsmasq start service nginx start -tailf /var/log/nginx/pixieboot-access.log +tailf /var/log/nginx/pixieboot-access.log & +tailf /var/log/dnsmasq.log & +wait From 0f12ea93adf9bfc7d3fc93a98770c3995c09110f Mon Sep 17 00:00:00 2001 From: Felix Buehler Date: Mon, 5 Dec 2016 18:31:08 +0100 Subject: [PATCH 10/17] fixed escape-key error (goto was wrong) --- setup.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/setup.sh b/setup.sh index 0df80c9..1591f15 100755 --- a/setup.sh +++ b/setup.sh @@ -115,17 +115,17 @@ step_config_write_iPXE(){ :menu-iso item --menu iso --key 0x08 back Back to top menu... - choose --menu iso selected || goto cancel + choose --menu iso selected || goto start goto \${selected} || goto :menu-iso :menu-ubu14 item --menu ubu14 --key 0x08 back Back to top menu... - choose --menu ubu14 selected || goto cancel + choose --menu ubu14 selected || goto start goto \${selected} || goto :menu-ubu14 :menu-ubu16 item --menu ubu16 --key 0x08 back Back to top menu... - choose --menu ubu16 selected || goto cancel + choose --menu ubu16 selected || goto start goto \${selected} || goto :menu-ubu16 :cancel From 9695c5112ce8ce54da3962a2b384e366d7111b9e Mon Sep 17 00:00:00 2001 From: Benedikt Heine Date: Mon, 26 Dec 2016 20:43:08 +0100 Subject: [PATCH 11/17] use bigger kpxe image --- integrations/pxebinaries | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/integrations/pxebinaries b/integrations/pxebinaries index 8abf819..e6dab66 100755 --- a/integrations/pxebinaries +++ b/integrations/pxebinaries @@ -4,11 +4,11 @@ FILE_PXE_LINUX=${FILE_PXE_LINUX:-/usr/lib/syslinux/pxelinux.0} FILE_PXE_MENU=${FILE_PXE_LINUX:-/usr/lib/syslinux/menu.c32} -FILE_PXE_UNDI=${FILE_PXE_LINUX:-/usr/lib/ipxe/undionly.kpxe} +FILE_PXE_UNDI=${FILE_PXE_LINUX:-/usr/lib/ipxe/undionly.kkpxe} cp $FILE_PXE_LINUX $NFSPREFIX/pxelinux.0 cp $FILE_PXE_MENU $NFSPREFIX/menu.c32 if [ "$IPXE_ENABLED" != 0 ]; then - cp $FILE_PXE_UNDI $NFSPREFIX/undionly.kpxe + cp $FILE_PXE_UNDI $NFSPREFIX/undionly.kpxe.0 fi From 0fa3a00422366428df82786ca0835b9560441c28 Mon Sep 17 00:00:00 2001 From: Benedikt Heine Date: Wed, 26 Apr 2017 11:56:08 +0200 Subject: [PATCH 12/17] bundle ENVs in dockerfile and use BASE-var --- Dockerfile | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/Dockerfile b/Dockerfile index 79e8765..a76ab05 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,17 +1,16 @@ FROM ubuntu:16.04 MAINTAINER Benedikt Heine bebe@bebehei.de -ENV BASE=/srv/pixieboot - +ENV BASE=/srv/pixieboot \ # Vars, which would be usually defined in config.sh -ENV INTEGRATIONS_ENABLED="dnsmasq nginx pxebinaries" -ENV SYSTEMS_ENABLED="ubuntu-16.04-mini ubuntu-14.04-mini netboot.xyz memtest local-harddrive" -ENV FILE_PXE_LINUX=/usr/lib/PXELINUX/pxelinux.0 -ENV FILE_DNSMASQ_CONFIG=/etc/dnsmasq.d/pixieboot.conf + INTEGRATIONS_ENABLED="dnsmasq nginx pxebinaries" \ + SYSTEMS_ENABLED="ubuntu-16.04-mini ubuntu-14.04-mini netboot.xyz memtest local-harddrive" \ + FILE_PXE_LINUX=/usr/lib/PXELINUX/pxelinux.0 \ + FILE_DNSMASQ_CONFIG=/etc/dnsmasq.d/pixieboot.conf \ # Set the reload commands to true, as normal service-commands would fail # and docker.sh is starting the services anyway -ENV CMD_RELOAD_NGINX="true" -ENV CMD_RELOAD_DNSMASQ="true" + CMD_RELOAD_NGINX="true" \ + CMD_RELOAD_DNSMASQ="true" RUN apt-get update \ && apt-get install -y \ @@ -29,8 +28,8 @@ ADD . $BASE # We have to define NFSHOST, as it is needed by setup.sh, # but declaring it via ENV lets the container fail quietly. -RUN NFSHOST=127.0.0.1 /srv/pixieboot/setup.sh +RUN NFSHOST=127.0.0.1 ${BASE}/setup.sh EXPOSE 67/udp 80/tcp -ENTRYPOINT ["/srv/pixieboot/docker.sh"] +ENTRYPOINT ["${BASE}/docker.sh"] From 1ce419743c387f1ac139773b2a60cb8b1db56153 Mon Sep 17 00:00:00 2001 From: Benedikt Heine Date: Wed, 26 Apr 2017 11:59:07 +0200 Subject: [PATCH 13/17] use DEBIAN_FRONTEND during installation --- Dockerfile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index a76ab05..e1080f3 100644 --- a/Dockerfile +++ b/Dockerfile @@ -12,7 +12,8 @@ ENV BASE=/srv/pixieboot \ CMD_RELOAD_NGINX="true" \ CMD_RELOAD_DNSMASQ="true" -RUN apt-get update \ +RUN export DEBIAN_FRONTEND=noninteractive \ + && apt-get update \ && apt-get install -y \ dnsmasq \ gettext-base \ From 3e928cdd2105611524643418e5414aa781b44b95 Mon Sep 17 00:00:00 2001 From: Benedikt Heine Date: Wed, 26 Apr 2017 14:38:16 +0200 Subject: [PATCH 14/17] add ldlinux.c32 to support native --- integrations/pxebinaries | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/integrations/pxebinaries b/integrations/pxebinaries index e6dab66..29a9609 100755 --- a/integrations/pxebinaries +++ b/integrations/pxebinaries @@ -3,11 +3,13 @@ # grab PXE files and put it into NFSPREFIX to make them bootable FILE_PXE_LINUX=${FILE_PXE_LINUX:-/usr/lib/syslinux/pxelinux.0} +FILE_PXE_LDLINUX=${FILE_PXE_LDLINUX:-/usr/lib/syslinux/modules/bios/ldlinux.c32} FILE_PXE_MENU=${FILE_PXE_LINUX:-/usr/lib/syslinux/menu.c32} FILE_PXE_UNDI=${FILE_PXE_LINUX:-/usr/lib/ipxe/undionly.kkpxe} -cp $FILE_PXE_LINUX $NFSPREFIX/pxelinux.0 -cp $FILE_PXE_MENU $NFSPREFIX/menu.c32 +cp $FILE_PXE_LINUX $NFSPREFIX/pxelinux.0 +cp $FILE_PXE_LDLINUX $NFSPREFIX/ldlinux.c32 +cp $FILE_PXE_MENU $NFSPREFIX/menu.c32 if [ "$IPXE_ENABLED" != 0 ]; then cp $FILE_PXE_UNDI $NFSPREFIX/undionly.kpxe.0 From e7dad1fe359bde0825795c6beabc4729dd29285a Mon Sep 17 00:00:00 2001 From: Benedikt Heine Date: Wed, 10 May 2017 19:23:34 +0200 Subject: [PATCH 15/17] fix: use menu.c32 from proper location --- Dockerfile | 1 + integrations/pxebinaries | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index e1080f3..d8f489e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -6,6 +6,7 @@ ENV BASE=/srv/pixieboot \ INTEGRATIONS_ENABLED="dnsmasq nginx pxebinaries" \ SYSTEMS_ENABLED="ubuntu-16.04-mini ubuntu-14.04-mini netboot.xyz memtest local-harddrive" \ FILE_PXE_LINUX=/usr/lib/PXELINUX/pxelinux.0 \ + FILE_PXE_MENU=/usr/lib/syslinux/modules/bios/menu.c32 \ FILE_DNSMASQ_CONFIG=/etc/dnsmasq.d/pixieboot.conf \ # Set the reload commands to true, as normal service-commands would fail # and docker.sh is starting the services anyway diff --git a/integrations/pxebinaries b/integrations/pxebinaries index 29a9609..9aa2b7c 100755 --- a/integrations/pxebinaries +++ b/integrations/pxebinaries @@ -4,8 +4,8 @@ FILE_PXE_LINUX=${FILE_PXE_LINUX:-/usr/lib/syslinux/pxelinux.0} FILE_PXE_LDLINUX=${FILE_PXE_LDLINUX:-/usr/lib/syslinux/modules/bios/ldlinux.c32} -FILE_PXE_MENU=${FILE_PXE_LINUX:-/usr/lib/syslinux/menu.c32} -FILE_PXE_UNDI=${FILE_PXE_LINUX:-/usr/lib/ipxe/undionly.kkpxe} +FILE_PXE_MENU=${FILE_PXE_MENU:-/usr/lib/syslinux/menu.c32} +FILE_PXE_UNDI=${FILE_PXE_UNDI:-/usr/lib/ipxe/undionly.kkpxe} cp $FILE_PXE_LINUX $NFSPREFIX/pxelinux.0 cp $FILE_PXE_LDLINUX $NFSPREFIX/ldlinux.c32 From 8e714bcfa2f3feed90523293b5ad359856d2fc06 Mon Sep 17 00:00:00 2001 From: Benedikt Heine Date: Thu, 11 May 2017 09:56:26 +0200 Subject: [PATCH 16/17] fix base usage in entrypoint --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index d8f489e..7d91fed 100644 --- a/Dockerfile +++ b/Dockerfile @@ -34,4 +34,4 @@ RUN NFSHOST=127.0.0.1 ${BASE}/setup.sh EXPOSE 67/udp 80/tcp -ENTRYPOINT ["${BASE}/docker.sh"] +ENTRYPOINT ${BASE}/docker.sh From 1cbb09788cf5df7c5e8c2663ad24ff6e51fa7a66 Mon Sep 17 00:00:00 2001 From: Benedikt Heine Date: Wed, 20 Sep 2017 18:09:41 +0200 Subject: [PATCH 17/17] Use libutil.c32 also during PXE/iPXE bootstrap --- integrations/pxebinaries | 2 ++ 1 file changed, 2 insertions(+) diff --git a/integrations/pxebinaries b/integrations/pxebinaries index 9aa2b7c..6524af4 100755 --- a/integrations/pxebinaries +++ b/integrations/pxebinaries @@ -5,10 +5,12 @@ FILE_PXE_LINUX=${FILE_PXE_LINUX:-/usr/lib/syslinux/pxelinux.0} FILE_PXE_LDLINUX=${FILE_PXE_LDLINUX:-/usr/lib/syslinux/modules/bios/ldlinux.c32} FILE_PXE_MENU=${FILE_PXE_MENU:-/usr/lib/syslinux/menu.c32} +FILE_PXE_UTIL=${FILE_PXE_UTIL:-/usr/lib/syslinux/modules/bios/libutil.c32} FILE_PXE_UNDI=${FILE_PXE_UNDI:-/usr/lib/ipxe/undionly.kkpxe} cp $FILE_PXE_LINUX $NFSPREFIX/pxelinux.0 cp $FILE_PXE_LDLINUX $NFSPREFIX/ldlinux.c32 +cp $FILE_PXE_UTIL $NFSPREFIX/libutil.c32 cp $FILE_PXE_MENU $NFSPREFIX/menu.c32 if [ "$IPXE_ENABLED" != 0 ]; then