diff options
author | Dany Marcoux | 2016-10-06 23:32:04 +0200 |
---|---|---|
committer | Dany Marcoux | 2016-10-06 23:32:04 +0200 |
commit | e1c02d998a78ff4cb0b21927896fbe739f35178a (patch) | |
tree | 87b15950c4bda95f4deacd165d7be67f6a052a87 /pre-commit.sh | |
download | aur-e1c02d998a78ff4cb0b21927896fbe739f35178a.tar.gz |
Pre-release nightly
Diffstat (limited to 'pre-commit.sh')
-rwxr-xr-x | pre-commit.sh | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/pre-commit.sh b/pre-commit.sh new file mode 100755 index 000000000000..2663b34cdba0 --- /dev/null +++ b/pre-commit.sh @@ -0,0 +1,27 @@ +#!/bin/bash +# git pre-commit hook: +# - Generate the sha256sums in the PKGBUILD file and add it to the commit if needed +# - Generate the .SRCINFO file and add it to the commit if needed + +# Generate the sha256sums in the PKGBUILD file +updpkgsums + +# Remove the archive downloaded by updpkgsums +rm *.tar.gz + +# Check if the sha256sums in the PKGBUILD file changed +if [ -n "$(git diff PKGBUILD | grep '^+sha256sums=(.*)$')" ]; then + printf "Updated the sha256sums in the PKGBUILD file\n" + git add PKGBUILD + printf "Added the PKGBUILD file to the commit\n" +fi + +# Generate the .SRCINFO file based on the PKGBUILD file +mksrcinfo + +# Check if the .SRCINFO file was created/changed +if [ -n "$(git status --short | grep ' .SRCINFO$')" ]; then + printf "Updated the .SRCINFO file\n" + git add .SRCINFO + printf "Added the .SRCINFO file to the commit\n" +fi |