dotfiles/.local/bin/scripts/git-aur

29 lines
788 B
Plaintext
Raw Normal View History

#!/bin/sh -e
2021-09-20 19:34:00 +00:00
aurdir="$DATA/2-standards/dev/aur"
test $# -eq 0 && cd "$aurdir" && exec $SHELL
command=$1
shift
2021-09-20 19:34:00 +00:00
url="ssh://aur@aur.archlinux.org/${1:-$(basename $PWD)}.git"
case $command in
2021-09-20 19:34:00 +00:00
(origin)
2021-09-29 16:38:57 +00:00
test "$(git rev-parse --git-dir)" = ".git" && git remote set-url origin "$url"
git remote -v;;
(clone)
2021-09-20 19:34:00 +00:00
cd "$aurdir"
git -c init.defaultBranch=master clone "$url"
cd "$1"
test -f PKGBUILD || sed "s/PKG/${1%%-git}/" ../PKGBUILD > PKGBUILD
test -f .gitignore || echo '*' > .gitignore
exec $SHELL;;
(create)
git add -f .gitignore PKGBUILD
git commit -m "Create package" "$@"
git aur push --amend;;
(push)
makepkg --printsrcinfo > .SRCINFO
git add -f .SRCINFO *.install >/dev/null || true
git commit -v -a "$@"
git push;;
esac