Skip to content

Commit

Permalink
🏹 mommy can now point to individual commits~
Browse files Browse the repository at this point in the history
  • Loading branch information
FWDekker authored Nov 29, 2023
1 parent 175653c commit d0df3bc
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions update.sh
Original file line number Diff line number Diff line change
@@ -1,18 +1,24 @@
#!/bin/sh

# Usage:
# `./update.sh v1.2.3` points the build instructions to the tag `v1.2.3`
# `./update.sh 0c72a50` points the build instructions to the commit `0c72a50`
#
# The difference is detected based on whether the target starts with `v`.

set -e
cd -P -- "$(dirname -- "$0")"

VERSION="${1:?Version not specified}"

if [ "$VERSION" = "dev" ]; then
VERSION="dev"
URL="git+https://github.com/FWDekker/mommy.git#branch=dev"
REL="$(grep "pkgrel=" PKGBUILD)"
REL="${REL##*=}"
else
if [ "${VERSION::1}" = "v" ]; then
VERSION="${VERSION##v}"
URL="git+https://github.com/FWDekker/mommy.git#tag=v\$pkgver"
REL="1"
else
URL="git+https://github.com/FWDekker/mommy.git#commit=$VERSION"
REL="$(grep "pkgrel=" PKGBUILD)"
REL="${REL##*=}"
fi

sed -i -E "s|pkgver=.*|pkgver=$VERSION|; s|pkgrel=.*|pkgrel=$REL|; s|source=.*|source=(\"$URL\")|;" PKGBUILD
Expand Down

0 comments on commit d0df3bc

Please sign in to comment.