From a24f92df987d13b61a1bac518fe86dac5a1493c0 Mon Sep 17 00:00:00 2001 From: richdex14 Date: Mon, 4 Sep 2017 12:18:57 -0600 Subject: [PATCH] Update setup.bash to use portable `$sudo_cmd` syntax --- setup.bash | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/setup.bash b/setup.bash index d86f9fb..b6ce0d6 100644 --- a/setup.bash +++ b/setup.bash @@ -12,6 +12,10 @@ # curl -fsSL https://example.com/setup-min.bash | bash # wget -nv https://example.com/setup-min.bash -O - | bash +# Not every platform has or needs sudo, gotta save them O(1)s... +sudo_cmd="" +((EUID)) && [[ -z "$ANDROID_ROOT" ]] && sudo_cmd="sudo" + dont_install_deps="$1" set -e set -u @@ -287,7 +291,7 @@ if [ -n "${NODEJS_VER}" ]; then bash "/tmp/${INSTALL_FILE}" "${NODEJS_VER}" fi -sudo chown -R $(whoami) $node_install_path/lib/node_modules +$sudo_cmd chown -R $(whoami) $node_install_path/lib/node_modules echo ""