Skip to content

Commit 6b83669

Browse files
committed
Check for existence of curl, ps, and tar before running script
1 parent fe5af9d commit 6b83669

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

swiftly-install

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,17 @@
1515
set -eu
1616
# Install script for Swiftly
1717
# Usage: curl -fsSL https://swift.org/swiftly-install | sh
18+
19+
if ! command -v curl >/dev/null 2>&1 || ! command -v ps >/dev/null 2>&1 || ! command -v tar >/dev/null 2>&1 ; then
20+
echo "Missing one of more of the following programs: curl, ps, tar" >&2
21+
exit 1
22+
fi
23+
1824
OS_NAME=$(uname -s)
1925
OS_ARCH=$(uname -m)
20-
TMPDIR=$(mktemp -d)
26+
TEMP_DIR=$(mktemp -d)
2127

22-
cd "${TMPDIR}"
28+
cd "${TEMP_DIR}"
2329

2430
case "$OS_NAME" in
2531
"Linux")

0 commit comments

Comments
 (0)