Last active
April 9, 2023 16:28
-
-
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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