Last active
October 6, 2022 10:38
-
-
Save LevitatingBusinessMan/4a418bdb396b1aefbdfa02be470bccc6 to your computer and use it in GitHub Desktop.
AUR/makepkg automation script
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
| #!/bin/bash | |
| set -e | |
| DSTDIR="/tmp" | |
| if [[ -z $1 ]]; then | |
| echo No package specified >&2 | |
| exit 1 | |
| fi | |
| package=$1 | |
| tempdir=`mktemp -d` | |
| cd $tempdir | |
| chown $USER:nogroup $tempdir | |
| chmod g+wx $tempdir | |
| export DSTDIR | |
| export package | |
| su nobody -s /bin/bash <<'end_build' | |
| git clone "https://aur.archlinux.org/${package}.git" | |
| cd "$package" | |
| makepkg -o | |
| source "PKGBUILD" | |
| version=$(pkgver)-${pkgrel} | |
| filename="${package}-${version}-x86_64.pkg.tar.zst" | |
| if [[ -f "$DSTDIR/$filename" ]]; then | |
| echo "File $filename already exists, aborting" | |
| exit | |
| fi | |
| makepkg | |
| cp "$filename" .. | |
| end_build | |
| file="$package"-*.pkg.tar.zst | |
| if test -f $file; then | |
| gpg -v --detach-sign --no-armor $file | |
| cp -v $file{,.sig} "$DSTDIR" | |
| cd "$DSTDIR" | |
| repo-add -s -n -R levitating.db.tar.gz $file | |
| fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment