Skip to content

Commit 9aa0206

Browse files
committed
scripts/bootstrap-prefix: shellcheck
Signed-off-by: Fabian Groffen <[email protected]>
1 parent 081349d commit 9aa0206

File tree

1 file changed

+23
-23
lines changed

1 file changed

+23
-23
lines changed

scripts/bootstrap-prefix.sh

+23-23
Original file line numberDiff line numberDiff line change
@@ -1980,8 +1980,8 @@ bootstrap_stage2() {
19801980
fi
19811981
elif ! is-rap ; then
19821982
# make sure the EPREFIX gcc shared libraries are there
1983-
mkdir -p "${ROOT}"/usr/${CHOST}/lib/gcc
1984-
cp "${ROOT}"/tmp/usr/${CHOST}/lib/gcc/* "${ROOT}"/usr/${CHOST}/lib/gcc
1983+
mkdir -p "${ROOT}/usr/${CHOST}/lib/gcc"
1984+
cp "${ROOT}/tmp/usr/${CHOST}/lib/gcc"/* "${ROOT}/usr/${CHOST}/lib/gcc"
19851985
fi
19861986

19871987
estatus "stage2 finished"
@@ -2326,10 +2326,10 @@ bootstrap_stage3() {
23262326
export USE="-git -crypt -http2"
23272327

23282328
# Portage should figure out itself what it needs to do, if anything.
2329-
eflags="--deep --update --changed-use @system"
2330-
einfo "running emerge ${eflags}"
2331-
estatus "stage3: emerge ${eflags}"
2332-
emerge --color n -v ${eflags} || return 1
2329+
local eflags=( "--deep" "--update" "--changed-use" "@system" )
2330+
einfo "running emerge ${eflags[*]}"
2331+
estatus "stage3: emerge ${eflags[*]}"
2332+
emerge --color n -v "${eflags[@]}" || return 1
23332333

23342334
# Remove anything that we don't need (compilers most likely)
23352335
einfo "running emerge --depclean"
@@ -2462,10 +2462,10 @@ EOF
24622462
# note that this code is so complex because it handles both
24632463
# C-shell as well as *sh
24642464
dvar="echo \"((${flag}=\${${flag}}))\""
2465-
dvar="$(echo "${dvar}" | env -i HOME=$HOME $SHELL -l 2>/dev/null)"
2465+
dvar="$(echo "${dvar}" | env -i HOME="${HOME}" "$SHELL" -l 2>/dev/null)"
24662466
if [[ ${dvar} == *"((${flag}="?*"))" ]] ; then
24672467
badflags="${badflags} ${flag}"
2468-
dvar=${dvar#*((${flag}=}
2468+
dvar=${dvar#*"((${flag}="}
24692469
dvar=${dvar%%))*}
24702470
echo " uh oh, ${flag}=${dvar} :("
24712471
else
@@ -2616,7 +2616,7 @@ necessary to add to PATH for me to find a compiler. I start off with
26162616
PATH=${PATH} and will add anything you give me here.
26172617
EOF
26182618
[[ ${TODO} == 'noninteractive' ]] && ans="${usergcc%/gcc}" ||
2619-
read -p "Where can I find your compiler? [] " ans
2619+
read -r -p "Where can I find your compiler? [] " ans
26202620
case "${ans}" in
26212621
"")
26222622
: ;;
@@ -2707,7 +2707,7 @@ clue what this means, you should go with my excellent default I've
27072707
chosen below, really!
27082708
EOF
27092709
[[ ${TODO} == 'noninteractive' ]] && ans="" ||
2710-
read -p "How many parallel make jobs do you want? [${tcpu}] " ans
2710+
read -r -p "How many parallel make jobs do you want? [${tcpu}] " ans
27112711
case "${ans}" in
27122712
"")
27132713
MAKEOPTS="-j${tcpu}"
@@ -2794,11 +2794,11 @@ EOF
27942794
case "${CHOST}" in
27952795
x86_64-*|sparcv9-*) # others can't do multilib, so don't bother
27962796
# 64-bits native
2797-
read -p "How many bits do you want your Prefix to target? [64] " ans
2797+
read -r -p "How many bits do you want your Prefix to target? [64] " ans
27982798
;;
27992799
*)
28002800
# 32-bits native
2801-
read -p "How many bits do you want your Prefix to target? [32] " ans
2801+
read -r -p "How many bits do you want your Prefix to target? [32] " ans
28022802
;;
28032803
esac
28042804
case "${ans}" in
@@ -2833,7 +2833,7 @@ really a Gentoo lover, aren't you? Me too! By leveraging the existing
28332833
portage, we can save a lot of time."
28342834
EOF
28352835
[[ ${TODO} == 'noninteractive' ]] && ans=no ||
2836-
read -p " Do you want me to take the shortcut? [yN] " ans
2836+
read -r -p " Do you want me to take the shortcut? [yN] " ans
28372837
case "${ans}" in
28382838
[Yy][Ee][Ss]|[Yy])
28392839
echo "Good!"
@@ -2864,7 +2864,7 @@ by default. Of course, you can still enable testing ~amd64 for
28642864
the packages you want, when the need arises.
28652865
EOF
28662866
[[ ${TODO} == 'noninteractive' ]] && ans=yes ||
2867-
read -p " Do you want to use stable Prefix? [Yn] " ans
2867+
read -r -p " Do you want to use stable Prefix? [Yn] " ans
28682868
case "${ans}" in
28692869
[Yy][Ee][Ss]|[Yy]|"")
28702870
echo "Okay, I'll disable ~amd64 by default."
@@ -2901,7 +2901,7 @@ EOF
29012901
fi
29022902
echo
29032903
[[ ${TODO} == 'noninteractive' ]] && ans= ||
2904-
read -p "What do you want EPREFIX to be? [$EPREFIX] " ans
2904+
read -r -p "What do you want EPREFIX to be? [$EPREFIX] " ans
29052905
case "${ans}" in
29062906
"")
29072907
: ;;
@@ -2987,7 +2987,7 @@ happen.
29872987
EOF
29882988
echo
29892989
[[ ${TODO} == 'noninteractive' ]] && ans="" ||
2990-
read -p "Type here what you want to wish me [luck] " ans
2990+
read -r -p "Type here what you want to wish me [luck] " ans
29912991
if [[ -n ${ans} && ${ans} != "luck" ]] ; then
29922992
echo "Huh? You're not serious, are you?"
29932993
sleep 3
@@ -3004,7 +3004,7 @@ EOF
30043004
[[ -n ${SETUP_ENV_ONLY} ]] && return 0
30053005

30063006
if [[ -d ${HOST_GENTOO_EROOT} ]]; then
3007-
if ! [[ -x ${EPREFIX}/tmp/usr/lib/portage/bin/emerge ]] && ! ${BASH} ${BASH_SOURCE[0]} "${EPREFIX}" stage_host_gentoo ; then
3007+
if ! [[ -x ${EPREFIX}/tmp/usr/lib/portage/bin/emerge ]] && ! ${BASH} "${BASH_SOURCE[0]}" "${EPREFIX}" stage_host_gentoo ; then
30083008
# stage host gentoo fail
30093009
cat << EOF
30103010
@@ -3060,7 +3060,7 @@ EOF
30603060

30613061
local https_needed=no
30623062
if ! [[ -e ${EPREFIX}/.stage2-finished ]] \
3063-
&& ! ${BASH} ${BASH_SOURCE[0]} "${EPREFIX}" stage2_log ; then
3063+
&& ! ${BASH} "${BASH_SOURCE[0]}" "${EPREFIX}" stage2_log ; then
30643064
# stage 2 fail
30653065
cat << EOF
30663066
@@ -3101,7 +3101,7 @@ EOF
31013101
hash -r
31023102

31033103
if ! [[ -e ${EPREFIX}/.stage3-finished ]] \
3104-
&& ! bash ${BASH_SOURCE[0]} "${EPREFIX}" stage3_log ; then
3104+
&& ! bash "${BASH_SOURCE[0]}" "${EPREFIX}" stage3_log ; then
31053105
# stage 3 fail
31063106
hash -r # previous cat (tmp/usr/bin/cat) may have been removed
31073107
cat << EOF
@@ -3181,7 +3181,7 @@ EOF
31813181
exit 1
31823182
fi
31833183

3184-
if ! bash ${BASH_SOURCE[0]} "${EPREFIX}" startscript ; then
3184+
if ! bash "${BASH_SOURCE[0]}" "${EPREFIX}" startscript ; then
31853185
# startscript fail?
31863186
cat << EOF
31873187
@@ -3326,7 +3326,7 @@ if [[ ${CHOST} == *-linux-* ]] ; then
33263326
done
33273327

33283328
platform=${CHOST#*-}; platform=${platform%%-*}
3329-
platform=$(rapx rap ${platform})
3329+
platform=$(rapx rap "${platform}")
33303330
CHOST_IDENTIFY=${CHOST%%-*}-${platform}-linux-${dist,,}${rel}
33313331
fi
33323332

@@ -3442,7 +3442,7 @@ einfo "ident: ${CHOST_IDENTIFY}"
34423442
einfo "prefix: ${ROOT}"
34433443

34443444
TODO=${2}
3445-
if [[ ${TODO} != "noninteractive" && $(type -t bootstrap_${TODO}) != "function" ]];
3445+
if [[ ${TODO} != "noninteractive" && $(type -t "bootstrap_${TODO}") != "function" ]];
34463446
then
34473447
eerror "bootstrap target ${TODO} unknown"
34483448
exit 1
@@ -3477,7 +3477,7 @@ fi
34773477

34783478
# call the appropriate function,
34793479
# beware noninteractive is just a mode of interactive
3480-
bootstrap_${TODO#non} || exit 1
3480+
bootstrap_"${TODO#non}" || exit 1
34813481

34823482
# Local Variables:
34833483
# sh-indentation: 4

0 commit comments

Comments
 (0)