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

Install script improvements #48

Merged
merged 2 commits into from
Jul 16, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions scripts/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
PROGRAM_NAME="rokit"
REPOSITORY="rojo-rbx/rokit"

set -eo pipefail

# Make sure we have prerequisites installed: curl + unzip
if ! command -v curl >/dev/null 2>&1; then
echo "ERROR: 'curl' is not installed." >&2
Expand Down Expand Up @@ -82,12 +84,12 @@ fi
read RELEASE_ASSET_ID RELEASE_ASSET_NAME <<EOF
$(echo "$RELEASE_JSON_DATA" | awk -v repo="$REPOSITORY" -v pattern="$FILE_PATTERN" '
/"url":/ && $0 ~ "https://api.github.com/repos/" repo "/releases/assets/" {
gsub(/.*\/releases\/assets\/|\"|,/, "", $0)
gsub(/.*\/releases\/assets\/|"|,/, "", $0)
asset_number=$0
}
/"name":/ && asset_number && $0 ~ pattern {
# Remove quotes and trailing comma for clean output
gsub(/\"|,/, "", $2)
gsub(/"|,/, "", $2)
print asset_number, $2
exit
}
Expand Down Expand Up @@ -127,7 +129,7 @@ if [ ! -f "$BINARY_NAME" ]; then
fi

# Execute the file and remove it when done
echo "[3 / 3] Running $PROGRAM_NAME installation\n"
printf "[3 / 3] Running $PROGRAM_NAME installation\n\n"
if [ "$OS" != "windows" ]; then
chmod +x "$BINARY_NAME"
fi
Expand Down