2019-03-22 17:44:48 +00:00
|
|
|
#!/usr/bin/env nix-shell
|
|
|
|
#!nix-shell -i bash -p curl libxslt
|
|
|
|
|
|
|
|
set -e
|
|
|
|
|
|
|
|
die() {
|
|
|
|
echo "$1" >&2
|
|
|
|
exit 1
|
|
|
|
}
|
|
|
|
|
|
|
|
fetch() {
|
|
|
|
local url="https://dl.google.com/android/repository/$1"
|
|
|
|
echo "$url -> $2"
|
|
|
|
curl -s "$url" -o "$2" || die "Failed to fetch $url"
|
|
|
|
}
|
|
|
|
|
|
|
|
pushd "$(dirname "$0")" &>/dev/null || exit 1
|
|
|
|
|
|
|
|
mkdir -p xml
|
2018-11-27 19:36:27 +00:00
|
|
|
|
|
|
|
# Convert base packages
|
2019-03-22 17:44:48 +00:00
|
|
|
fetch repository2-1.xml xml/repository2-1.xml
|
2018-11-27 19:36:27 +00:00
|
|
|
xsltproc convertpackages.xsl xml/repository2-1.xml > generated/packages.nix
|
|
|
|
|
|
|
|
# Convert system images
|
|
|
|
for img in android android-tv android-wear android-wear-cn google_apis google_apis_playstore
|
|
|
|
do
|
2019-03-22 17:44:48 +00:00
|
|
|
fetch sys-img/$img/sys-img2-1.xml xml/$img-sys-img2-1.xml
|
2018-11-27 19:36:27 +00:00
|
|
|
xsltproc --stringparam imageType $img convertsystemimages.xsl xml/$img-sys-img2-1.xml > generated/system-images-$img.nix
|
|
|
|
done
|
|
|
|
|
|
|
|
# Convert system addons
|
2019-03-22 17:44:48 +00:00
|
|
|
fetch addon2-1.xml xml/addon2-1.xml
|
2018-11-27 19:36:27 +00:00
|
|
|
xsltproc convertaddons.xsl xml/addon2-1.xml > generated/addons.nix
|
2019-03-22 17:44:48 +00:00
|
|
|
|
|
|
|
popd &>/dev/null
|