From b117cb02bf01f1db7244db5b569cc9d7d32ca866 Mon Sep 17 00:00:00 2001 From: Fabian Groffen Date: Sat, 30 Mar 2024 12:46:31 +0100 Subject: scripts/bootstrap-prefix: shellcheck Signed-off-by: Fabian Groffen --- scripts/bootstrap-prefix.sh | 69 ++++++++++++++++++++++++--------------------- 1 file changed, 37 insertions(+), 32 deletions(-) diff --git a/scripts/bootstrap-prefix.sh b/scripts/bootstrap-prefix.sh index 351cf89f20..6276ccb8d6 100755 --- a/scripts/bootstrap-prefix.sh +++ b/scripts/bootstrap-prefix.sh @@ -1250,7 +1250,7 @@ bootstrap_zlib_core() { [[ ${PV} == 1.2.5 ]] || read -a makeopts <<< "${MAKEOPTS}" einfo "Compiling ${A%.tar.*}" - CHOST= ${CONFIG_SHELL} ./configure --prefix="${ROOT}"/tmp/usr || return 1 + CHOST='' ${CONFIG_SHELL} ./configure --prefix="${ROOT}"/tmp/usr || return 1 MAKEOPTS='' emake "${makeopts[@]}" || return 1 @@ -2022,7 +2022,7 @@ bootstrap_stage3() { get_libdir() { local l - l="$(portageq envvar LIBDIR_$(portageq envvar ABI) 2>/dev/null)" + l="$(portageq envvar "LIBDIR_$(portageq envvar ABI)" 2>/dev/null)" [[ -z ${l} ]] && l=lib echo "${l}" } @@ -2092,6 +2092,8 @@ bootstrap_stage3() { cp -a "${ROOT}"{/tmp,}/usr/share/portage fi + read -a linker_pkgs <<< "${linker}" + if is-rap ; then # We need ${ROOT}/usr/bin/perl to merge glibc. if [[ ! -x "${ROOT}"/usr/bin/perl ]]; then @@ -2156,10 +2158,10 @@ bootstrap_stage3() { pkgs=( sys-devel/binutils-config sys-libs/zlib - ${linker} + "${linker_pkgs[@]}" ) # use the new dynamic linker in place of rpath from now on. - RAP_DLINKER=$(echo "${ROOT}"/$(get_libdir)/ld*.so.[0-9] | sed s"!${ROOT}/$(get_libdir)/ld-lsb.*!!") + RAP_DLINKER=$(echo "${ROOT}/$(get_libdir)"/ld*.so.[0-9] | sed s"!${ROOT}/$(get_libdir)/ld-lsb.*!!") export CPPFLAGS="--sysroot=${ROOT}" export LDFLAGS="-Wl,--dynamic-linker=${RAP_DLINKER}" # make sure these flags are used even in places that ignore/strip CPPFLAGS/LDFLAGS @@ -2189,7 +2191,7 @@ bootstrap_stage3() { sys-devel/flex sys-devel/binutils-config sys-libs/zlib - ${linker} + "${linker_pkgs[@]}" ) pre_emerge_pkgs --nodeps "${pkgs[@]}" || return 1 @@ -2209,9 +2211,9 @@ bootstrap_stage3() { # setup for a scenario where python doesn't live in the target # prefix and no helpers are available ( cd "${ROOT}"/usr/bin && test ! -e python && \ - ln -s "${ROOT}"/tmp/usr/bin/python$(python_ver) ) + ln -s "${ROOT}/tmp/usr/bin/python$(python_ver)" "python$(python_ver)" ) # in addition, avoid collisions - rm -Rf "${ROOT}"/tmp/usr/lib/python$(python_ver)/site-packages/clang + rm -Rf "${ROOT}/tmp/usr/lib/python$(python_ver)/site-packages/clang" # Try to get ourself out of the mud, bug #575324 EXTRA_ECONF="--disable-compiler-version-checks $(rapx '--disable-lto --disable-bootstrap')" \ @@ -2229,7 +2231,7 @@ bootstrap_stage3() { # need special care, it depends on texinfo, #717786 pre_emerge_pkgs --nodeps sys-apps/gawk || return 1 - ( cd "${ROOT}"/usr/bin && test ! -e python && rm -f python$(python_ver) ) + ( cd "${ROOT}"/usr/bin && test ! -e python && rm -f "python$(python_ver)" ) # Use $ROOT tools where possible from now on. if [[ $(readlink "${ROOT}"/bin/sh) == "${ROOT}/tmp/"* ]] ; then rm -f "${ROOT}"/bin/sh @@ -2342,7 +2344,6 @@ set_helper_vars() { GENTOO_MIRRORS=${GENTOO_MIRRORS:="http://distfiles.gentoo.org"} SNAPSHOT_HOST=$(rapx http://distfiles.gentoo.org http://rsync.prefix.bitzolder.nl) SNAPSHOT_URL=${SNAPSHOT_URL:-"${SNAPSHOT_HOST}/snapshots"} - GCC_APPLE_URL="http://www.opensource.apple.com/darwinsource/tarballs/other" export MAKE CONFIG_SHELL } @@ -2656,7 +2657,7 @@ EOF *-solaris*) ncpu=$(/usr/sbin/psrinfo | wc -l) ;; *-linux-gnu*) - ncpu=$(cat /proc/cpuinfo | grep processor | wc -l) ;; + ncpu=$(grep -c processor /proc/cpuinfo) ;; *) ncpu=1 ;; esac @@ -2792,7 +2793,8 @@ EOF # Figure out if we are bootstrapping from an existing Gentoo # It can be forced by setting HOST_GENTOO_EROOT manually - local t_GENTOO_EROOT=$(env -u EPREFIX portageq envvar EROOT 2> /dev/null) + local t_GENTOO_EROOT + t_GENTOO_EROOT=$(env -u EPREFIX portageq envvar EROOT 2> /dev/null) if [[ ! -d ${HOST_GENTOO_EROOT} && -d ${t_GENTOO_EROOT} ]]; then cat < /dev/null ; then - MAKE=gmake + MAKE="gmake" else - MAKE=make + MAKE="make" fi ;; *) - MAKE=make + MAKE="make" ;; esac -- cgit v1.2.3-65-gdbad