Skip to content

Instantly share code, notes, and snippets.

@greyltc
Last active April 9, 2023 16:28
Show Gist options
  • Save greyltc/8a93d417a052e00372984ff8ec224703 to your computer and use it in GitHub Desktop.
Save greyltc/8a93d417a052e00372984ff8ec224703 to your computer and use it in GitHub Desktop.
builds an Arch package from files given in a (curl glob formatted) URL
#!/usr/bin/env bash
# builds an Arch package from files given in a (curl glob formatted) URL
# example usage; (re)build and install the aurutils package:
# bash <(curl -sL https://gist.github.com/greyltc/8a93d417a052e00372984ff8ec224703/raw) "https://aur.archlinux.org/cgit/aur.git/plain/{PKGBUILD,aurutils.changelog,aurutils.install}?h=aurutils" -if
set -e
TMPDIR=$(mktemp -p /var/tmp --directory)
touch "${TMPDIR}/.deleteme"
main() {
trap clean_up EXIT
URL="$1"; shift
pushd "${TMPDIR}" > /dev/null
curl --silent --remote-name "${URL}"
makepkg --clean "$@"
popd > /dev/null
}
clean_up () {
CODE=$?
# echo "Cleaning up ${TMPDIR}"
if test -f "${TMPDIR}/.deleteme"; then
rm --force --recursive "${TMPDIR}"
else
echo "Not cleaning up."
fi
exit ${CODE}
}
main "$@"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment