Skip to content

Commit

Permalink
install latest autopkg version
Browse files Browse the repository at this point in the history
  • Loading branch information
jworkmanjc committed Apr 28, 2021
1 parent 326eacb commit aa338d8
Showing 1 changed file with 14 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,21 @@ mac
```
#!/bin/bash
# curl AutoPkg 1.2 into /tmp/
curl -L -o /tmp/autopkg-1.2.pkg "https://github.com/autopkg/autopkg/releases/download/v1.2/autopkg-1.2.pkg" >/dev/null
# Get latest pkg release url from GitHub
url=$(curl -s https://api.github.com/repos/autopkg/autopkg/releases/latest | python -c 'import json,sys;obj=json.load(sys.stdin);print obj["assets"][0]["browser_download_url"];')
# Regex match the version from the URL
if [[ $url =~ \/v(.+)\/ ]]; then
# echo ${BASH_REMATCH[1]} ;
version=${BASH_REMATCH[1]}
else
echo "Not proper format";
fi
# curl AutoPkg into /tmp/
curl -L -o /tmp/autopkg-$version.pkg $url >/dev/null
# run installer command to install AutoPkg
installer -pkg /tmp/autopkg-1.2.pkg -target /
exit 0
installer -pkg /tmp/autopkg-$version.pkg -target /
```

#### Description
Expand Down

0 comments on commit aa338d8

Please sign in to comment.