]> git.cameronkatri.com Git - apple_cmds.git/blob - download.sh
adv_cmds: Update to 176.100.1
[apple_cmds.git] / download.sh
1 #!/bin/sh
2 version="$(basename $(curl -s https://opensource.apple.com/tarballs/${1}/ | \
3 pup 'table tbody tr td a:not([href="./../"]) text{}' -c | \
4 sort -V | tail -n 1) .tar.gz | \
5 rev | cut -d- -f 1 | rev)"
6 if [ "$( echo -e "${version}\n$(cat ${1}/.apple_version)" | sort -V | tail -n 1)" = "$(cat ${1}/.apple_version)" ]; then
7 echo "${1} - $(cat ${1}/.apple_version)"
8 else
9 echo "${1} - $(cat ${1}/.apple_version) -> ${version}"
10 TEMP=$(mktemp -d)
11 wget -q -P${TEMP} https://opensource.apple.com/tarballs/${1}/${1}-${version}.tar.gz
12 tar xf ${TEMP}/${1}-${version}.tar.gz -C ${1} --strip-components=1
13 echo "${version}" > ${1}/.apple_version
14 fi