11#! /bin/sh -x
22
3- . $( dirname " $0 " ) /functions
3+ . " $( dirname " $0 " ) " /functions
44. detect-environment
55. compile-options
66
77SOURCE_TARBALL=" $BASEDIR /output/tarballs/cfengine-3.*.tar.gz"
8- MASTERFILES_TARBALL=$( ls $BASEDIR /output/tarballs/cfengine-masterfiles* .tar.gz | grep -v ' pkg.tar.gz$' )
8+ # shellcheck disable=SC2010
9+ # > Don't use ls | grep. Use a glob or a for loop with a condition to allow non-alphanumeric filenames.
10+ # TODO: CFE-4587
11+ MASTERFILES_TARBALL=$( ls " $BASEDIR " /output/tarballs/cfengine-masterfiles* .tar.gz | grep -v ' pkg.tar.gz$' )
912
1013# DELETE the git-checked-out directories, they are tainted with
1114# ./configure artifacts anyway. The tarballs are unpacked and symlinked
@@ -23,17 +26,23 @@ if [ -e "$BASEDIR/core/" ] || [ -e "$BASEDIR/masterfiles/" ]; then
2326 exit 1
2427fi
2528
26- if [ x $PROJECT = xcommunity ]; then
29+ if [ " $PROJECT " = community ]; then
2730 sudo rm -rf " $BASEDIR /enterprise" " $BASEDIR /nova" " $BASEDIR /mission-portal"
2831fi
2932
3033# NATIVE TAR is being used on purpose, and *not* GNU TAR.
3134
3235echo " UNPACKING SOURCE TARBALL AND SYMLINKING core"
33- cd $BASEDIR
36+ cd " $BASEDIR "
37+ # shellcheck disable=SC2086
38+ # > Double quote to prevent globbing and word splitting.
39+ # We want globbing here
3440gzip -dc $SOURCE_TARBALL | tar -xf -
3541ln -s cfengine-3* core
3642
3743echo " UNPACKING MASTERFILES TARBALL AND SYMLINKING masterfiles/"
44+ # shellcheck disable=SC2086
45+ # > Double quote to prevent globbing and word splitting.
46+ # We want globbing here
3847gzip -dc $MASTERFILES_TARBALL | tar -xf -
3948ln -s cfengine-masterfiles-* masterfiles
0 commit comments