Skip to content

Commit

Permalink
Swift: fix update-codeql
Browse files Browse the repository at this point in the history
Also require sudo at the start of the script if updating.
  • Loading branch information
redsun82 committed Jun 22, 2022
1 parent 4377fb0 commit e0784e0
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions .devcontainer/swift/update-codeql.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,15 @@ URL=https://github.com/github/codeql-cli-binaries/releases
LATEST_VERSION=$(curl -L -s -H 'Accept: application/json' $URL/latest | sed -e 's/.*"tag_name":"\([^"]*\)".*/\1/')
CURRENT_VERSION=v$(codeql version 2>/dev/null | sed -ne 's/.*release \([0-9.]*\)\./\1/p')
if [[ $CURRENT_VERSION != $LATEST_VERSION ]]; then
curl -fSqL -o /tmp/codeql.zip $URL/download/$LATEST_VERSION/codeql-linux64.zip
unzip /tmp/codeql.zip -qd /opt
rm /tmp/codeql.zip
if [[ $UID != 0 ]]; then
echo "update required, please run this script with sudo:"
echo " sudo $0"
exit 1
fi
ZIP=$(mktemp codeql.XXXX.zip)
curl -fSqL -o $ZIP $URL/download/$LATEST_VERSION/codeql-linux64.zip
unzip -q $ZIP -d /opt
rm $ZIP
ln -sf /opt/codeql/codeql /usr/local/bin/codeql
echo installed version $LATEST_VERSION
else
Expand Down

0 comments on commit e0784e0

Please sign in to comment.