From df43aa9126c704dfde08fd1eb5f771e79e99f34b Mon Sep 17 00:00:00 2001 From: Franco Fichtner Date: Thu, 27 Apr 2017 19:14:36 +0200 Subject: [PATCH] build: fix argument scrubbing, remove obsolete gettext-tools from core --- build/base.sh | 2 +- build/boot.sh | 4 ++-- build/chroot.sh | 4 ++-- build/clean.sh | 2 +- build/common.sh | 33 ++------------------------------- build/core.sh | 6 +++--- build/distfiles.sh | 2 +- build/dvd.sh | 2 +- build/info.sh | 4 ++-- build/kernel.sh | 2 +- build/nano.sh | 4 ++-- build/plugins.sh | 2 +- build/ports.sh | 2 +- build/prefetch.sh | 2 +- build/print.sh | 4 ++-- build/rebase.sh | 4 ++-- build/release.sh | 4 ++-- build/rename.sh | 2 +- build/serial.sh | 4 ++-- build/sign.sh | 4 ++-- build/skim.sh | 2 +- build/test.sh | 2 +- build/update.sh | 2 +- build/verify.sh | 2 +- build/vga.sh | 4 ++-- build/vm.sh | 4 ++-- build/xtools.sh | 2 +- 27 files changed, 41 insertions(+), 70 deletions(-) diff --git a/build/base.sh b/build/base.sh index 0c3259f..920bdab 100644 --- a/build/base.sh +++ b/build/base.sh @@ -29,7 +29,7 @@ set -e SELF=base -. ./common.sh && $(${SCRUB_ARGS}) +. ./common.sh BASE_SET=$(find ${SETSDIR} -name "base-*-${PRODUCT_ARCH}.txz") diff --git a/build/boot.sh b/build/boot.sh index fa5aa81..59dee56 100644 --- a/build/boot.sh +++ b/build/boot.sh @@ -1,6 +1,6 @@ #!/bin/sh -# Copyright (c) 2016 Franco Fichtner +# Copyright (c) 2016-2107 Franco Fichtner # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions @@ -29,7 +29,7 @@ set -e SELF=boot -. ./common.sh && $(${SCRUB_ARGS}) +. ./common.sh if [ -z "${1}" ]; then echo ">> No image given." diff --git a/build/chroot.sh b/build/chroot.sh index f1e070c..881f535 100644 --- a/build/chroot.sh +++ b/build/chroot.sh @@ -1,6 +1,6 @@ #!/bin/sh -# Copyright (c) 2016 Franco Fichtner +# Copyright (c) 2016-2017 Franco Fichtner # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions @@ -29,7 +29,7 @@ set -e SELF=chroot -. ./common.sh && $(${SCRUB_ARGS}) +. ./common.sh echo ">>> chroot'ing into ${STAGEDIR}/${1}..." diff --git a/build/clean.sh b/build/clean.sh index f481b4f..a2f0169 100644 --- a/build/clean.sh +++ b/build/clean.sh @@ -29,7 +29,7 @@ set -e SELF=clean -. ./common.sh && $(${SCRUB_ARGS}) +. ./common.sh for ARG in ${@}; do case ${ARG} in diff --git a/build/common.sh b/build/common.sh index f21e33c..302f3e0 100644 --- a/build/common.sh +++ b/build/common.sh @@ -29,7 +29,6 @@ set -e OPTS="a:B:b:C:c:d:E:e:F:f:G:g:K:k:L:l:m:n:o:P:p:R:S:s:T:t:U:u:v:V:" -SCRUB_ARGS=":" while getopts ${OPTS} OPT; do case ${OPT} in @@ -37,123 +36,96 @@ while getopts ${OPTS} OPT; do export PRODUCT_TARGET=${OPTARG%%:*} export PRODUCT_ARCH=${OPTARG##*:} export PRODUCT_HOST=$(uname -p) - SCRUB_ARGS=${SCRUB_ARGS};shift;shift ;; B) export PORTSBRANCH=${OPTARG} - SCRUB_ARGS=${SCRUB_ARGS};shift;shift ;; b) export SRCBRANCH=${OPTARG} - SCRUB_ARGS=${SCRUB_ARGS};shift;shift ;; C) export COREDIR=${OPTARG} - SCRUB_ARGS=${SCRUB_ARGS};shift;shift ;; c) export PRODUCT_SPEED=${OPTARG} - SCRUB_ARGS=${SCRUB_ARGS};shift;shift ;; d) export PRODUCT_DEVICE=${OPTARG} - SCRUB_ARGS=${SCRUB_ARGS};shift;shift ;; E) export COREBRANCH=${OPTARG} - SCRUB_ARGS=${SCRUB_ARGS};shift;shift ;; e) export PLUGINSBRANCH=${OPTARG} - SCRUB_ARGS=${SCRUB_ARGS};shift;shift ;; F) export PRODUCT_KERNEL=${OPTARG} - SCRUB_ARGS=${SCRUB_ARGS};shift;shift ;; f) export PRODUCT_FLAVOUR=${OPTARG} - SCRUB_ARGS=${SCRUB_ARGS};shift;shift ;; G) export PORTSREFBRANCH=${OPTARG} - SCRUB_ARGS=${SCRUB_ARGS};shift;shift ;; g) export TOOLSBRANCH=${OPTARG} - SCRUB_ARGS=${SCRUB_ARGS};shift;shift ;; K) if [ -n "${OPTARG}" ]; then export PRODUCT_PUBKEY=${OPTARG} fi - SCRUB_ARGS=${SCRUB_ARGS};shift;shift ;; k) if [ -n "${OPTARG}" ]; then export PRODUCT_PRIVKEY=${OPTARG} fi - SCRUB_ARGS=${SCRUB_ARGS};shift;shift ;; L) if [ -n "${OPTARG}" ]; then export PRODUCT_SIGNCMD=${OPTARG} fi - SCRUB_ARGS=${SCRUB_ARGS};shift;shift ;; l) if [ -n "${OPTARG}" ]; then export PRODUCT_SIGNCHK=${OPTARG} fi - SCRUB_ARGS=${SCRUB_ARGS};shift;shift ;; m) export PRODUCT_MIRROR=${OPTARG} - SCRUB_ARGS=${SCRUB_ARGS};shift;shift ;; n) export PRODUCT_NAME=${OPTARG} - SCRUB_ARGS=${SCRUB_ARGS};shift;shift ;; o) if [ -n "${OPTARG}" ]; then export STAGEDIRPREFIX=${OPTARG} fi - SCRUB_ARGS=${SCRUB_ARGS};shift;shift ;; P) export PORTSDIR=${OPTARG} - SCRUB_ARGS=${SCRUB_ARGS};shift;shift ;; p) export PLUGINSDIR=${OPTARG} - SCRUB_ARGS=${SCRUB_ARGS};shift;shift ;; R) export PORTSREFDIR=${OPTARG} - SCRUB_ARGS=${SCRUB_ARGS};shift;shift ;; S) export SRCDIR=${OPTARG} - SCRUB_ARGS=${SCRUB_ARGS};shift;shift ;; s) export PRODUCT_SETTINGS=${OPTARG} - SCRUB_ARGS=${SCRUB_ARGS};shift;shift ;; T) export TOOLSDIR=${OPTARG} - SCRUB_ARGS=${SCRUB_ARGS};shift;shift ;; t) export PRODUCT_TYPE=${OPTARG} - SCRUB_ARGS=${SCRUB_ARGS};shift;shift ;; U) case "${OPTARG}" in ''|-devel) export PRODUCT_SUFFIX=${OPTARG} - SCRUB_ARGS=${SCRUB_ARGS};shift;shift ;; *) echo "SUFFIX wants empty string or '-devel'" >&2 @@ -165,15 +137,12 @@ while getopts ${OPTS} OPT; do if [ "${OPTARG}" = "yes" ]; then export PRODUCT_UEFI=${OPTARG} fi - SCRUB_ARGS=${SCRUB_ARGS};shift;shift ;; v) export PRODUCT_VERSION=${OPTARG} - SCRUB_ARGS=${SCRUB_ARGS};shift;shift ;; V) export PRODUCT_ADDITIONS=${OPTARG} - SCRUB_ARGS=${SCRUB_ARGS};shift;shift ;; *) echo "${0}: Unknown argument '${OPT}'" >&2 @@ -182,6 +151,8 @@ while getopts ${OPTS} OPT; do esac done +shift $((${OPTIND} - 1)) + if [ -z "${PRODUCT_NAME}" -o \ -z "${PRODUCT_TYPE}" -o \ -z "${PRODUCT_ARCH}" -o \ diff --git a/build/core.sh b/build/core.sh index 15057e8..b794553 100644 --- a/build/core.sh +++ b/build/core.sh @@ -1,6 +1,6 @@ #!/bin/sh -# Copyright (c) 2014-2016 Franco Fichtner +# Copyright (c) 2014-2017 Franco Fichtner # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions @@ -29,7 +29,7 @@ set -e SELF=core -. ./common.sh && $(${SCRUB_ARGS}) +. ./common.sh check_packages ${SELF} ${@} @@ -40,7 +40,7 @@ setup_chroot ${STAGEDIR} extract_packages ${STAGEDIR} remove_packages ${STAGEDIR} ${@} # register persistent packages to avoid bouncing -install_packages ${STAGEDIR} pkg git gettext-tools +install_packages ${STAGEDIR} pkg git lock_packages ${STAGEDIR} for BRANCH in master ${COREBRANCH}; do diff --git a/build/distfiles.sh b/build/distfiles.sh index 6795952..5b7e035 100644 --- a/build/distfiles.sh +++ b/build/distfiles.sh @@ -29,7 +29,7 @@ set -e SELF=distfiles -. ./common.sh && $(${SCRUB_ARGS}) +. ./common.sh PORTS_LIST=$( cat ${CONFIGDIR}/skim.conf ${CONFIGDIR}/ports.conf | \ diff --git a/build/dvd.sh b/build/dvd.sh index 09d5f12..9059076 100644 --- a/build/dvd.sh +++ b/build/dvd.sh @@ -29,7 +29,7 @@ set -e SELF=dvd -. ./common.sh && $(${SCRUB_ARGS}) +. ./common.sh check_images ${SELF} ${@} diff --git a/build/info.sh b/build/info.sh index 3457a54..31db183 100644 --- a/build/info.sh +++ b/build/info.sh @@ -1,6 +1,6 @@ #!/bin/sh -# Copyright (c) 2016 Franco Fichtner +# Copyright (c) 2016-2017 Franco Fichtner # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions @@ -29,7 +29,7 @@ set -e SELF=info -. ./common.sh && $(${SCRUB_ARGS}) +. ./common.sh TAGNAME= if [ -n "${1}" ]; then diff --git a/build/kernel.sh b/build/kernel.sh index cae95a8..7847367 100644 --- a/build/kernel.sh +++ b/build/kernel.sh @@ -29,7 +29,7 @@ set -e SELF=kernel -. ./common.sh && $(${SCRUB_ARGS}) +. ./common.sh KERNEL_SET=$(find ${SETSDIR} -name "kernel-*-${PRODUCT_ARCH}.txz") diff --git a/build/nano.sh b/build/nano.sh index 4a5f346..260cc8a 100644 --- a/build/nano.sh +++ b/build/nano.sh @@ -1,6 +1,6 @@ #!/bin/sh -# Copyright (c) 2015-2016 Franco Fichtner +# Copyright (c) 2015-2017 Franco Fichtner # Copyright (c) 2004-2009 Scott Ullrich # # Redistribution and use in source and binary forms, with or without @@ -30,7 +30,7 @@ set -e SELF=nano -. ./common.sh && $(${SCRUB_ARGS}) +. ./common.sh check_images ${SELF} ${@} diff --git a/build/plugins.sh b/build/plugins.sh index 29509c6..70cc456 100644 --- a/build/plugins.sh +++ b/build/plugins.sh @@ -29,7 +29,7 @@ set -e SELF=plugins -. ./common.sh && $(${SCRUB_ARGS}) +. ./common.sh PLUGINS_LIST=$( cat ${CONFIGDIR}/plugins.conf | while read PLUGIN_ORIGIN PLUGIN_IGNORE; do diff --git a/build/ports.sh b/build/ports.sh index ee1f09a..eea901d 100644 --- a/build/ports.sh +++ b/build/ports.sh @@ -29,7 +29,7 @@ set -e SELF=ports -. ./common.sh && $(${SCRUB_ARGS}) +. ./common.sh PORTS_LIST=$( cat ${CONFIGDIR}/ports.conf | while read PORT_ORIGIN PORT_IGNORE; do diff --git a/build/prefetch.sh b/build/prefetch.sh index f3f3fee..fad57de 100644 --- a/build/prefetch.sh +++ b/build/prefetch.sh @@ -29,7 +29,7 @@ set -e SELF=prefetch -. ./common.sh && $(${SCRUB_ARGS}) +. ./common.sh # XXX does not adapt to FreeBSD version used ABI="FreeBSD:11:${PRODUCT_ARCH}/${PRODUCT_SETTINGS}" diff --git a/build/print.sh b/build/print.sh index 2280ca3..8819cb9 100644 --- a/build/print.sh +++ b/build/print.sh @@ -1,6 +1,6 @@ #!/bin/sh -# Copyright (c) 2016 Franco Fichtner +# Copyright (c) 2016-2017 Franco Fichtner # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions @@ -29,7 +29,7 @@ set -e SELF=print -. ./common.sh && $(${SCRUB_ARGS}) +. ./common.sh for ARG in ${@}; do echo ${ARG}=\"$(printenv ${ARG})\" diff --git a/build/rebase.sh b/build/rebase.sh index 4a061c2..d3611f5 100644 --- a/build/rebase.sh +++ b/build/rebase.sh @@ -1,6 +1,6 @@ #!/bin/sh -# Copyright (c) 2015 Franco Fichtner +# Copyright (c) 2015-2017 Franco Fichtner # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions @@ -29,7 +29,7 @@ set -e SELF=rebase -. ./common.sh && $(${SCRUB_ARGS}) +. ./common.sh BASE_OBSOLETE=$(find ${SETSDIR} -name "base-*-${PRODUCT_ARCH}.obsolete") BASE_SET=$(find ${SETSDIR} -name "base-*-${PRODUCT_ARCH}.txz") diff --git a/build/release.sh b/build/release.sh index 656200d..6d96d80 100644 --- a/build/release.sh +++ b/build/release.sh @@ -1,6 +1,6 @@ #!/bin/sh -# Copyright (c) 2015-2016 Franco Fichtner +# Copyright (c) 2015-2017 Franco Fichtner # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions @@ -29,7 +29,7 @@ set -e SELF=release -. ./common.sh && $(${SCRUB_ARGS}) +. ./common.sh RELEASE_SET="${SETSDIR}/release-${PRODUCT_VERSION}-${PRODUCT_FLAVOUR}-${PRODUCT_ARCH}.tar" diff --git a/build/rename.sh b/build/rename.sh index 00b0b0b..ae7a595 100644 --- a/build/rename.sh +++ b/build/rename.sh @@ -29,7 +29,7 @@ set -e SELF=rename -. ./common.sh && $(${SCRUB_ARGS}) +. ./common.sh for ARG in ${@}; do case ${ARG} in diff --git a/build/serial.sh b/build/serial.sh index 128e9c2..9e51486 100644 --- a/build/serial.sh +++ b/build/serial.sh @@ -1,6 +1,6 @@ #!/bin/sh -# Copyright (c) 2014-2016 Franco Fichtner +# Copyright (c) 2014-2017 Franco Fichtner # Copyright (c) 2010-2011 Scott Ullrich # # Redistribution and use in source and binary forms, with or without @@ -30,7 +30,7 @@ set -e SELF=serial -. ./common.sh && $(${SCRUB_ARGS}) +. ./common.sh check_images ${SELF} ${@} diff --git a/build/sign.sh b/build/sign.sh index 91def40..7d09a97 100644 --- a/build/sign.sh +++ b/build/sign.sh @@ -1,6 +1,6 @@ #!/bin/sh -# Copyright (c) 2016 Franco Fichtner +# Copyright (c) 2016-2017 Franco Fichtner # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions @@ -29,7 +29,7 @@ set -e SELF=sign -. ./common.sh && $(${SCRUB_ARGS}) +. ./common.sh BASE_SET=$(find ${SETSDIR} -name "base-*-${PRODUCT_ARCH}.txz") if [ -f "${BASE_SET}" ]; then diff --git a/build/skim.sh b/build/skim.sh index 815938a..8f7aec7 100644 --- a/build/skim.sh +++ b/build/skim.sh @@ -29,7 +29,7 @@ set -e SELF=skim -. ./common.sh && $(${SCRUB_ARGS}) +. ./common.sh setup_stage ${STAGEDIR} diff --git a/build/test.sh b/build/test.sh index d1a8e79..d9e61f1 100644 --- a/build/test.sh +++ b/build/test.sh @@ -29,7 +29,7 @@ set -e SELF=test -. ./common.sh && $(${SCRUB_ARGS}) +. ./common.sh git_branch ${COREDIR} ${COREBRANCH} COREBRANCH git_branch ${PLUGINSDIR} ${PLUGINSBRANCH} PLUGINSBRANCH diff --git a/build/update.sh b/build/update.sh index 5bd2e36..f960ee5 100644 --- a/build/update.sh +++ b/build/update.sh @@ -29,7 +29,7 @@ set -e SELF=update -. ./common.sh && $(${SCRUB_ARGS}) +. ./common.sh for ARG in ${@}; do case ${ARG} in diff --git a/build/verify.sh b/build/verify.sh index e7962f2..a24b196 100644 --- a/build/verify.sh +++ b/build/verify.sh @@ -29,7 +29,7 @@ set -e SELF=verify -. ./common.sh && $(${SCRUB_ARGS}) +. ./common.sh setup_stage ${STAGEDIR} setup_base ${STAGEDIR} diff --git a/build/vga.sh b/build/vga.sh index 30eeb58..b3b4644 100644 --- a/build/vga.sh +++ b/build/vga.sh @@ -1,6 +1,6 @@ #!/bin/sh -# Copyright (c) 2014-2016 Franco Fichtner +# Copyright (c) 2014-2017 Franco Fichtner # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions @@ -29,7 +29,7 @@ set -e SELF=vga -. ./common.sh && $(${SCRUB_ARGS}) +. ./common.sh check_images ${SELF} ${@} diff --git a/build/vm.sh b/build/vm.sh index 552b965..84f5ac8 100644 --- a/build/vm.sh +++ b/build/vm.sh @@ -1,6 +1,6 @@ #!/bin/sh -# Copyright (c) 2016 Franco Fichtner +# Copyright (c) 2016-2017 Franco Fichtner # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions @@ -29,7 +29,7 @@ set -e SELF=vm -. ./common.sh && $(${SCRUB_ARGS}) +. ./common.sh check_images ${SELF} ${@} diff --git a/build/xtools.sh b/build/xtools.sh index f4c5545..517b368 100644 --- a/build/xtools.sh +++ b/build/xtools.sh @@ -29,7 +29,7 @@ set -e SELF=xtools -. ./common.sh && $(${SCRUB_ARGS}) +. ./common.sh if [ ${PRODUCT_HOST} = ${PRODUCT_ARCH} ]; then echo ">>> No need to build xtools on native build"