diff options
author | Cameron Katri <me@cameronkatri.com> | 2021-05-21 09:21:42 -0400 |
---|---|---|
committer | Cameron Katri <me@cameronkatri.com> | 2021-05-21 09:21:42 -0400 |
commit | f06784df5a44c2aeb450ff88346a96f0bc9eb732 (patch) | |
tree | 49e9923a65f7cf572a6f0833737b72848299b1c8 /download.sh | |
parent | 0e3bb24ea8cde1573760b88ad56c1cc00be15cc8 (diff) | |
parent | 8d788054a62508f8d1b93067be16fb73f987ca8e (diff) | |
download | apple_cmds-f06784df5a44c2aeb450ff88346a96f0bc9eb732.tar.gz apple_cmds-f06784df5a44c2aeb450ff88346a96f0bc9eb732.tar.zst apple_cmds-f06784df5a44c2aeb450ff88346a96f0bc9eb732.zip |
Merge branch 'apple'
Diffstat (limited to 'download.sh')
-rwxr-xr-x | download.sh | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/download.sh b/download.sh new file mode 100755 index 0000000..38c7d48 --- /dev/null +++ b/download.sh @@ -0,0 +1,14 @@ +#!/bin/sh +version="$(basename $(curl -s https://opensource.apple.com/tarballs/${1}/ | \ + pup 'table tbody tr td a:not([href="./../"]) text{}' -c | \ + sort -V | tail -n 1) .tar.gz | \ + rev | cut -d- -f 1 | rev)" +if [ "$( echo -e "${version}\n$(cat ${1}/.apple_version)" | sort -V | tail -n 1)" = "$(cat ${1}/.apple_version)" ]; then + echo "${1} - $(cat ${1}/.apple_version)" +else + echo "${1} - $(cat ${1}/.apple_version) -> ${version}" + TEMP=$(mktemp -d) + wget -q -P${TEMP} https://opensource.apple.com/tarballs/${1}/${1}-${version}.tar.gz + tar xf ${TEMP}/${1}-${version}.tar.gz -C ${1} --strip-components=1 + echo "${version}" > ${1}/.apple_version +fi |