From e48dbb9ab8f78b876c0bccf7618f17a899aab06c Mon Sep 17 00:00:00 2001 From: nyyu Date: Sun, 9 Apr 2023 09:51:46 +0200 Subject: [PATCH] fix: build sh --- .util.sh | 2 +- build.sh | 21 +++++++++++++-------- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/.util.sh b/.util.sh index 8452054..044549c 100644 --- a/.util.sh +++ b/.util.sh @@ -7,7 +7,7 @@ update_github_tag() { update_pkg() { - if [ $(git diff . | wc -l) -ne 0 ]; then + if [[ $(git diff . | wc -l) -ne 0 ]]; then sed -i 's/pkgrel=.*/pkgrel=1/' PKGBUILD if updpkgsums; then diff --git a/build.sh b/build.sh index e7a6183..979e51f 100755 --- a/build.sh +++ b/build.sh @@ -1,12 +1,17 @@ #!/bin/bash -# shellcheck disable=SC3044,SC3009 +# shellcheck disable=SC3044,SC3009,SC2312 . .util.sh build() { + local upd=$1 + if grep -c 'git+' PKGBUILD >/dev/null && ! grep -c '#tag=' PKGBUILD >/dev/null; then makepkg --noprepare --nodeps --nobuild --skippgpcheck --noconfirm makepkg --printsrcinfo >.SRCINFO + if [[ "${upd}" = true ]]; then + update_pkg + fi fi name=$(grep -m1 'pkgname' .SRCINFO | cut -d'=' -f2 | tr -d ' ') ver=$(grep 'pkgver' .SRCINFO | cut -d'=' -f2 | tr -d ' ') @@ -16,7 +21,7 @@ build() { epoch=${epoch}: fi - if pacman -Si "${name}" 2> /dev/null | grep -v nyyu | grep -c -E '^Repository' &>/dev/null; then + if pacman -Si "${name}" 2>/dev/null | grep -v nyyu | grep -c -E '^Repository' &>/dev/null; then echo "WARN: Found ${name} in arch repo" fi @@ -40,20 +45,20 @@ git config credential.helper '!f() { sleep 1; echo "username=drone"; echo "passw for d in */; do cd "${d}" || continue - if [ -f PKGBUILD ]; then + if [[ -f PKGBUILD ]]; then echo "--> ${d}" - if [ -f update.sh ]; then + if [[ -f update.sh ]]; then ./update.sh fi if ! grep -c 'pkgver()' PKGBUILD >/dev/null; then repo=$(grep -oPm 1 'github\.com\/\K(\w|-)+\/(\w|-)+' .SRCINFO) - if [ -n "${repo}" ]; then + if [[ -n "${repo}" ]]; then update_github_tag "${repo}" fi fi update_pkg - build + build true fi cd .. done @@ -61,12 +66,12 @@ done while read -r p; do git clone https://aur.archlinux.org/"${p}".git || continue cd "${p}" || continue - build + build false cd .. done