From c0f3dbb3fa015ef2cd45e6e52cd45738396afddd Mon Sep 17 00:00:00 2001 From: Franco Fichtner Date: Thu, 5 May 2016 17:11:45 +0200 Subject: [PATCH] build: self-awareness for all scripts, needed for #30 --- build/base.sh | 4 +++- build/chroot.sh | 2 ++ build/clean.sh | 2 ++ build/core.sh | 8 ++++---- build/distfiles.sh | 2 ++ build/iso.sh | 4 +++- build/kernel.sh | 4 +++- build/nano.sh | 4 +++- build/plugins.sh | 8 ++++---- build/ports.sh | 11 ++++++----- build/prefetch.sh | 2 ++ build/rebase.sh | 2 ++ build/regress.sh | 2 ++ build/release.sh | 4 +++- build/serial.sh | 4 +++- build/skim.sh | 2 ++ build/vga.sh | 4 +++- 17 files changed, 49 insertions(+), 20 deletions(-) diff --git a/build/base.sh b/build/base.sh index bd2b7ba..c123a3c 100644 --- a/build/base.sh +++ b/build/base.sh @@ -27,6 +27,8 @@ set -e +SELF=base + . ./common.sh && $(${SCRUB_ARGS}) BASE_SET=$(find ${SETSDIR} -name "base-*-${ARCH}.txz") @@ -40,7 +42,7 @@ git_describe ${SRCDIR} BASE_SET=${SETSDIR}/base-${REPO_VERSION}-${ARCH} -sh ./clean.sh base +sh ./clean.sh ${SELF} MAKE_ARGS="SRCCONF=${CONFIGDIR}/src.conf COMPILER_TYPE=clang __MAKE_CONF=" ENV_FILTER="env -i USER=${USER} LOGNAME=${LOGNAME} HOME=${HOME} \ diff --git a/build/chroot.sh b/build/chroot.sh index dcd966d..bfd7d01 100644 --- a/build/chroot.sh +++ b/build/chroot.sh @@ -27,6 +27,8 @@ set -e +SELF=chroot + . ./common.sh && $(${SCRUB_ARGS}) echo ">>> chroot'ing into ${STAGEDIR}..." diff --git a/build/clean.sh b/build/clean.sh index ad656a5..f87a08b 100644 --- a/build/clean.sh +++ b/build/clean.sh @@ -27,6 +27,8 @@ set -e +SELF=clean + . ./common.sh && $(${SCRUB_ARGS}) for ARG in ${@}; do diff --git a/build/core.sh b/build/core.sh index 4d78291..9825d5f 100644 --- a/build/core.sh +++ b/build/core.sh @@ -27,11 +27,11 @@ set -e +SELF=core + . ./common.sh && $(${SCRUB_ARGS}) -CORE_MARKER="core" - -check_packages ${CORE_MARKER} ${@} +check_packages ${SELF} ${@} setup_stage ${STAGEDIR} setup_base ${STAGEDIR} @@ -67,4 +67,4 @@ for CORE_TAG in ${CORE_TAGS}; do custom_packages ${STAGEDIR} ${COREDIR} "${CORE_ARGS}" done -bundle_packages ${STAGEDIR} ${CORE_MARKER} +bundle_packages ${STAGEDIR} ${SELF} diff --git a/build/distfiles.sh b/build/distfiles.sh index f292fb4..be4e31b 100644 --- a/build/distfiles.sh +++ b/build/distfiles.sh @@ -27,6 +27,8 @@ set -e +SELF=distfiles + . ./common.sh && $(${SCRUB_ARGS}) PORTS_LIST="ports-mgmt/pkg diff --git a/build/iso.sh b/build/iso.sh index 1ce1f21..6abb2c0 100644 --- a/build/iso.sh +++ b/build/iso.sh @@ -27,6 +27,8 @@ set -e +SELF=iso + . ./common.sh && $(${SCRUB_ARGS}) CDROM="${IMAGESDIR}/${PRODUCT_RELEASE}-cdrom-${ARCH}.iso" @@ -34,7 +36,7 @@ CDROM="${IMAGESDIR}/${PRODUCT_RELEASE}-cdrom-${ARCH}.iso" # rewrite the disk label, because we're install media LABEL="${LABEL}_Install" -sh ./clean.sh iso +sh ./clean.sh ${SELF} setup_stage ${STAGEDIR} setup_base ${STAGEDIR} diff --git a/build/kernel.sh b/build/kernel.sh index 65a6420..b9c59ac 100644 --- a/build/kernel.sh +++ b/build/kernel.sh @@ -27,6 +27,8 @@ set -e +SELF=kernel + . ./common.sh && $(${SCRUB_ARGS}) KERNEL_SET=$(find ${SETSDIR} -name "kernel-*-${ARCH}.txz") @@ -40,7 +42,7 @@ git_describe ${SRCDIR} KERNEL_SET=${SETSDIR}/kernel-${REPO_VERSION}-${ARCH} -sh ./clean.sh kernel +sh ./clean.sh ${SELF} BUILD_KERNEL="SMP" diff --git a/build/nano.sh b/build/nano.sh index d35b91c..daaff51 100644 --- a/build/nano.sh +++ b/build/nano.sh @@ -29,11 +29,13 @@ set -e +SELF=nano + . ./common.sh && $(${SCRUB_ARGS}) NANOIMG="${IMAGESDIR}/${PRODUCT_RELEASE}-nano-${ARCH}.img" -sh ./clean.sh nano +sh ./clean.sh ${SELF} . ${SRCDIR}/tools/tools/nanobsd/FlashDevice.sub sub_FlashDevice generic 4g diff --git a/build/plugins.sh b/build/plugins.sh index 960614f..2998c93 100644 --- a/build/plugins.sh +++ b/build/plugins.sh @@ -27,11 +27,11 @@ set -e +SELF=plugins + . ./common.sh && $(${SCRUB_ARGS}) -PLUGINS_MARKER="plugins" - -check_packages ${PLUGINS_MARKER} ${@} +check_packages ${SELF} ${@} if [ -z "${*}" ]; then PLUGINS_LIST=$(make -C ${PLUGINSDIR} list) @@ -54,4 +54,4 @@ for PLUGIN in ${PLUGINS_LIST}; do custom_packages ${STAGEDIR} ${PLUGINSDIR}/${PLUGIN} done -bundle_packages ${STAGEDIR} ${PLUGINS_MARKER} +bundle_packages ${STAGEDIR} ${SELF} diff --git a/build/ports.sh b/build/ports.sh index 4326f9d..ef1dbad 100644 --- a/build/ports.sh +++ b/build/ports.sh @@ -27,12 +27,13 @@ set -e +SELF=ports + . ./common.sh && $(${SCRUB_ARGS}) PORTS_LIST=$(cat ${CONFIGDIR}/ports.conf) -PORTS_MARKER="ports" -check_packages ${PORTS_MARKER} ${@} +check_packages ${SELF} ${@} setup_stage ${STAGEDIR} setup_base ${STAGEDIR} @@ -55,7 +56,7 @@ fi # block SIGINT to allow for collecting port progress (use with care) trap : 2 -if ! chroot ${STAGEDIR} /bin/sh -es << EOF; then PORTS_MARKER=; fi +if ! chroot ${STAGEDIR} /bin/sh -es << EOF; then SELF=; fi # overwrites the ports tree variable, behaviour is unwanted... unset STAGEDIR # ...and this unbreaks the nmap build @@ -100,12 +101,12 @@ trap - 2 echo ">>> Creating binary packages..." -chroot ${STAGEDIR} /bin/sh -es << EOF && bundle_packages ${STAGEDIR} ${PORTS_MARKER} +chroot ${STAGEDIR} /bin/sh -es << EOF && bundle_packages ${STAGEDIR} ${SELF} pkg autoremove -y pkg create -nao ${PACKAGESDIR}/All -f txz EOF -if [ -z "${PORTS_MARKER}" ]; then +if [ -z "${SELF}" ]; then echo ">>> The ports build did not finish properly :(" exit 1 fi diff --git a/build/prefetch.sh b/build/prefetch.sh index a1b95aa..d72aab7 100644 --- a/build/prefetch.sh +++ b/build/prefetch.sh @@ -27,6 +27,8 @@ set -e +SELF=prefetch + . ./common.sh && $(${SCRUB_ARGS}) for ARG in ${@}; do diff --git a/build/rebase.sh b/build/rebase.sh index 4bb2ef4..765631f 100644 --- a/build/rebase.sh +++ b/build/rebase.sh @@ -27,6 +27,8 @@ set -e +SELF=rebase + . ./common.sh && $(${SCRUB_ARGS}) BASE_OBSOLETE=$(find ${SETSDIR} -name "base-*-${ARCH}.obsolete") diff --git a/build/regress.sh b/build/regress.sh index b918b8c..b163829 100644 --- a/build/regress.sh +++ b/build/regress.sh @@ -27,6 +27,8 @@ set -e +SELF=regress + . ./common.sh && $(${SCRUB_ARGS}) setup_stage ${STAGEDIR} diff --git a/build/release.sh b/build/release.sh index a50e864..7b7d2bc 100644 --- a/build/release.sh +++ b/build/release.sh @@ -27,6 +27,8 @@ set -e +SELF=release + . ./common.sh && $(${SCRUB_ARGS}) # make sure the all-encompassing package is a release, too @@ -38,7 +40,7 @@ if [ ! -f ${STAGEDIR}${PACKAGESDIR}/All/${PRODUCT_TYPE}-${PRODUCT_VERSION}.txz ] exit 1 fi -sh ./clean.sh release +sh ./clean.sh ${SELF} setup_stage ${STAGEDIR} diff --git a/build/serial.sh b/build/serial.sh index 692fd13..c484df6 100644 --- a/build/serial.sh +++ b/build/serial.sh @@ -28,6 +28,8 @@ set -e +SELF=serial + . ./common.sh && $(${SCRUB_ARGS}) SERIALIMG="${IMAGESDIR}/${PRODUCT_RELEASE}-serial-${ARCH}.img" @@ -35,7 +37,7 @@ SERIALIMG="${IMAGESDIR}/${PRODUCT_RELEASE}-serial-${ARCH}.img" # rewrite the disk label, because we're install media LABEL="${LABEL}_Install" -sh ./clean.sh serial +sh ./clean.sh ${SELF} setup_stage ${STAGEDIR} setup_base ${STAGEDIR} diff --git a/build/skim.sh b/build/skim.sh index a2c805e..9806341 100644 --- a/build/skim.sh +++ b/build/skim.sh @@ -27,6 +27,8 @@ set -e +SELF=skim + . ./common.sh && $(${SCRUB_ARGS}) export __MAKE_CONF=${CONFIGDIR}/make.conf diff --git a/build/vga.sh b/build/vga.sh index dcc5d14..b6f391c 100644 --- a/build/vga.sh +++ b/build/vga.sh @@ -27,6 +27,8 @@ set -e +SELF=vga + . ./common.sh && $(${SCRUB_ARGS}) VGAIMG="${IMAGESDIR}/${PRODUCT_RELEASE}-vga-${ARCH}.img" @@ -34,7 +36,7 @@ VGAIMG="${IMAGESDIR}/${PRODUCT_RELEASE}-vga-${ARCH}.img" # rewrite the disk label, because we're install media LABEL="${LABEL}_Install" -sh ./clean.sh vga +sh ./clean.sh ${SELF} setup_stage ${STAGEDIR} setup_base ${STAGEDIR}