From b0a1a5867d0795cb3c8adf0ea2dd57d73332abf1 Mon Sep 17 00:00:00 2001 From: nospoonuser Date: Tue, 13 Nov 2018 10:47:50 +0100 Subject: [PATCH] Config for Arch live system. Script output to strerr --- scripts/defaults.conf | 5 ++++- scripts/functions.sh | 14 +++++++++++--- scripts/menufunction.sh | 16 ++++++++++++---- 3 files changed, 27 insertions(+), 8 deletions(-) diff --git a/scripts/defaults.conf b/scripts/defaults.conf index 2a59764..2bd79ac 100644 --- a/scripts/defaults.conf +++ b/scripts/defaults.conf @@ -1,5 +1,8 @@ MEMTEST_BIN="/boot/memtest86+.bin" UBUNTU_INSTALL_NETBOOT="http://de.archive.ubuntu.com/ubuntu/dists/bionic/main/installer-amd64/current/images/netboot/netboot.tar.gz" DEBIAN_INSTALL_NETBOOT="http://ftp.nl.debian.org/debian/dists/stretch/main/installer-amd64/current/images/netboot/netboot.tar.gz" -ARCH_BASEDIR="arch/arch" +ARCH_BASEDIR="archiso/arch" +PXE_HTTP_PORT=80 +ARCHISO_HTTP_PORT=80 LIVE_SSH_ROOTLOGIN="yes" + diff --git a/scripts/functions.sh b/scripts/functions.sh index d9086bb..abef776 100644 --- a/scripts/functions.sh +++ b/scripts/functions.sh @@ -6,6 +6,10 @@ LGRAY='\033[0;37m' NC='\033[0m' +[ -z "$ARCHISO_SERVER" ] && ARCHISO_SERVER=${PXE_SERVER} +[ -z "$ARCHISO_HTTP_BASE" ] && ARCHISO_HTTP_BASE=${PXE_HTTP_BASE} + + requiredir() { [ -n "$1" ] || exit 1 [ -e $1 ] || mkdir $1 @@ -31,15 +35,19 @@ endstage() { echo -n "done" > ${WORKDIR}/stage/_$1 } +edebug() { + [ "$MKLIVE_DEBUG" == "true" ] && echo "[dd] $1" 1>&2 +} + eok() { - echo -e "${GREEN}[++] $1${NC}" + echo -e "${GREEN}[++] $1${NC}" 1>&2 } einfo() { - echo -e "${BLUE}[ii] ${1}${NC}" + echo -e "${BLUE}[ii] ${1}${NC}" 1>&2 } eerr(){ - echo -e "${RED}[--] ${1}${NC}" + echo -e "${RED}[--] ${1}${NC}" 1>&2 } diff --git a/scripts/menufunction.sh b/scripts/menufunction.sh index b81fe97..a9af7da 100644 --- a/scripts/menufunction.sh +++ b/scripts/menufunction.sh @@ -221,14 +221,22 @@ then -n -e '/arch64_http/,/^$/p' \ ${localarchpath}${archbasedir}/boot/syslinux/archiso_pxe.cfg else - #echo "http://${PXE_SERVER}${PXE_HTTP_BASE}/${archbasedir}/boot/syslinux/archiso_pxe.cfg" 1>&2 - curl -s http://${PXE_SERVER}${PXE_HTTP_BASE}/${archbasedir}/boot/syslinux/archiso_pxe.cfg | sed -r \ + #echo "http://${ARCHISO_SERVER}${ARCHISO_HTTP_BASE}/${archbasedir}/boot/syslinux/archiso_pxe.cfg" 1>&2 + archiso_pxe_url=http://${ARCHISO_SERVER}:${ARCHISO_HTTP_PORT}${ARCHISO_HTTP_BASE}/${archbasedir}/boot/syslinux/archiso_pxe.cfg + edebug "Try to download $archiso_pxe_url" + + curl -s $archiso_pxe_url | sed -r \ -e "s~boot~/${archbasedir}/boot~g" \ - -e "s~basedir=arch~basedir=${PXE_HTTP_BASE}/${ARCH_BASEDIR}~g" \ - -e "s/\\$\{pxeserver\}/${PXE_SERVER}/g" \ + -e "s~basedir=arch~basedir=${ARCHISO_HTTP_BASE}/${ARCH_BASEDIR}~g" \ + -e "s/\\$\{pxeserver\}/${ARCHISO_SERVER}:${ARCHISO_HTTP_PORT}/g" \ -e 's/^(APPEND .*)$/\1 ip=dhcp/g' \ -e "s/^SYSAPPEND [0-9]+/SYSAPPEND 2/g" \ -n -e '/arch64_http/,/^$/p' + + if [ "${PIPESTATUS[0]}" -ne 0 ]; + then + eerr "Failed to download archiso_pxe.cfg" + fi fi }