Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rewrite setup.sh to be POSIX-compatible #289

Open
bartekpacia opened this issue Mar 31, 2024 · 1 comment
Open

Rewrite setup.sh to be POSIX-compatible #289

bartekpacia opened this issue Mar 31, 2024 · 1 comment

Comments

@bartekpacia
Copy link
Collaborator

bartekpacia commented Mar 31, 2024

$ shellcheck -s sh ./setup.sh | pbcopy

In ./setup.sh line 35:
	if [[ "$OS_NAME" == windows ]]; then
           ^-------------------------^ SC3010 (warning): In POSIX sh, [[ ]] is undefined.


In ./setup.sh line 51:
	if [[ "$archive_name" == *zip ]]; then
           ^---------------------------^ SC3010 (warning): In POSIX sh, [[ ]] is undefined.


In ./setup.sh line 91:
[[ -z $ARCH ]] && ARCH="$ARCH_NAME"
^------------^ SC3010 (warning): In POSIX sh, [[ ]] is undefined.


In ./setup.sh line 93:
ARR_CHANNEL=("${@:$OPTIND:1}")
            ^----------------^ SC3030 (warning): In POSIX sh, arrays are undefined.
              ^------------^ SC3057 (warning): In POSIX sh, string indexing is undefined.


In ./setup.sh line 94:
CHANNEL="${ARR_CHANNEL[0]}"
         ^---------------^ SC3054 (warning): In POSIX sh, array references are undefined.


In ./setup.sh line 96:
[[ -z $CHANNEL ]] && CHANNEL=stable
^---------------^ SC3010 (warning): In POSIX sh, [[ ]] is undefined.


In ./setup.sh line 97:
[[ -z $VERSION ]] && VERSION=any
^---------------^ SC3010 (warning): In POSIX sh, [[ ]] is undefined.


In ./setup.sh line 98:
[[ -z $ARCH ]] && ARCH=x64
^------------^ SC3010 (warning): In POSIX sh, [[ ]] is undefined.


In ./setup.sh line 99:
[[ -z $CACHE_PATH ]] && CACHE_PATH="$RUNNER_TEMP/flutter/:channel:-:version:-:arch:"
^------------------^ SC3010 (warning): In POSIX sh, [[ ]] is undefined.


In ./setup.sh line 100:
[[ -z $CACHE_KEY ]] && CACHE_KEY="flutter-:os:-:channel:-:version:-:arch:-:hash:"
^-----------------^ SC3010 (warning): In POSIX sh, [[ ]] is undefined.


In ./setup.sh line 101:
[[ -z $PUB_CACHE_KEY ]] && PUB_CACHE_KEY="flutter-pub-:os:-:channel:-:version:-:arch:-:hash:"
^---------------------^ SC3010 (warning): In POSIX sh, [[ ]] is undefined.


In ./setup.sh line 102:
[[ -z $PUB_CACHE_PATH ]] && PUB_CACHE_PATH="default"
^----------------------^ SC3010 (warning): In POSIX sh, [[ ]] is undefined.


In ./setup.sh line 113:
	elif [ "$OS_NAME" == "windows" ]; then
                          ^-- SC3014 (warning): In POSIX sh, == in place of = is undefined.


In ./setup.sh line 120:
if [[ "$TEST_MODE" == true ]]; then
   ^------------------------^ SC3010 (warning): In POSIX sh, [[ ]] is undefined.


In ./setup.sh line 121:
	RELEASE_MANIFEST=$(cat "$(dirname -- "${BASH_SOURCE[0]}")/test/$MANIFEST_JSON_PATH")
                                              ^---------------^ SC3028 (warning): In POSIX sh, BASH_SOURCE is undefined.
                                              ^---------------^ SC3054 (warning): In POSIX sh, array references are undefined.


In ./setup.sh line 126:
if [[ "$CHANNEL" == "master" || "$CHANNEL" == "main" ]]; then
   ^-- SC3010 (warning): In POSIX sh, [[ ]] is undefined.


In ./setup.sh line 132:
if [[ "$VERSION_MANIFEST" == *null* ]]; then
   ^-- SC3010 (warning): In POSIX sh, [[ ]] is undefined.


In ./setup.sh line 144:
	expanded_key="${1/:channel:/$version_channel}"
                      ^-----------------------------^ SC3060 (warning): In POSIX sh, string replacement is undefined.


In ./setup.sh line 145:
	expanded_key="${expanded_key/:version:/$version_version}"
                      ^-- SC3060 (warning): In POSIX sh, string replacement is undefined.


In ./setup.sh line 146:
	expanded_key="${expanded_key/:arch:/$version_arch}"
                      ^-- SC3060 (warning): In POSIX sh, string replacement is undefined.


In ./setup.sh line 147:
	expanded_key="${expanded_key/:hash:/$version_hash}"
                      ^-- SC3060 (warning): In POSIX sh, string replacement is undefined.


In ./setup.sh line 148:
	expanded_key="${expanded_key/:sha256:/$version_sha_256}"
                      ^-- SC3060 (warning): In POSIX sh, string replacement is undefined.


In ./setup.sh line 149:
	expanded_key="${expanded_key/:os:/$OS_NAME}"
                      ^---------------------------^ SC3060 (warning): In POSIX sh, string replacement is undefined.


In ./setup.sh line 158:
if [[ "$PRINT_ONLY" == true ]]; then
   ^-------------------------^ SC3010 (warning): In POSIX sh, [[ ]] is undefined.


In ./setup.sh line 165:
	if [[ "$TEST_MODE" == true ]]; then
           ^------------------------^ SC3010 (warning): In POSIX sh, [[ ]] is undefined.


In ./setup.sh line 189:
if [[ ! -x "$CACHE_PATH/bin/flutter" ]]; then
   ^-- SC3010 (warning): In POSIX sh, [[ ]] is undefined.


In ./setup.sh line 190:
	if [[ "$CHANNEL" == "master" || "$CHANNEL" == "main" ]]; then
           ^-- SC3010 (warning): In POSIX sh, [[ ]] is undefined.


In ./setup.sh line 192:
		if [[ "$VERSION" != "any" ]]; then
                   ^-----------------------^ SC3010 (warning): In POSIX sh, [[ ]] is undefined.

For more information:
  https://www.shellcheck.net/wiki/SC3010 -- In POSIX sh, [[ ]] is undefined.
  https://www.shellcheck.net/wiki/SC3014 -- In POSIX sh, == in place of = is ...
  https://www.shellcheck.net/wiki/SC3028 -- In POSIX sh, BASH_SOURCE is undef...

@bartekpacia
Copy link
Collaborator Author

This doesn't necessarily make sense since bash is a dependency of Flutter (link)

Screenshot 2024-04-01 at 13 16 18

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant