setup: allow simple execution for machine list
Move the if-block that detects if we were running as a `source`
or direct invocation, so that the machine list can be obtained
more regularly.
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
Change-Id: Ica3dde8b3efba0affff3cf884f4059bb141dd802
diff --git a/setup b/setup
index a7a16a1..823cc1b 100755
--- a/setup
+++ b/setup
@@ -15,10 +15,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
-if [ -z "$ZSH_NAME" ] && [ "$(basename -- "$0")" = "setup" ]; then
- echo The script must be sourced, not executed
- exit 1
-fi
# Check if 'column' command is present
COLUMN_CMD=$(which column || true)
@@ -97,11 +93,16 @@
echo Target machine must be specified. Use one of:
echo
machine | sort | sed "s/qemu[^[:space:]]*//" | "${COLUMN[@]}"
-else
- bld_dir=$2
- if [ -z "$2" ]; then
- bld_dir="build/$1"
- fi
- machine "$1" "$bld_dir"
+ exit
fi
+if [ -z "$ZSH_NAME" ] && [ "$(basename -- "$0")" = "setup" ]; then
+ echo The script must be sourced, not executed
+ exit 1
+fi
+
+bld_dir=$2
+if [ -z "$2" ]; then
+ bld_dir="build/$1"
+fi
+machine "$1" "$bld_dir"