diff options
author | Jan | 2019-12-07 14:21:18 +0100 |
---|---|---|
committer | Jan | 2019-12-07 14:21:18 +0100 |
commit | 4560eb52e83bc310842f4e9c70686e952e58e63f (patch) | |
tree | e277f68e0b38795826574af259dbe72c113baebe | |
parent | 10c51cb97e5fc62fcd578ec9fdd41614d79c56dc (diff) | |
download | aur-4560eb52e83bc310842f4e9c70686e952e58e63f.tar.gz |
Improvements to PKGBUILD and preparation script
-rw-r--r-- | .SRCINFO | 2 | ||||
-rw-r--r-- | PKGBUILD | 15 | ||||
-rwxr-xr-x | prepare_update.sh | 38 | ||||
-rwxr-xr-x | update_aur.sh | 35 |
4 files changed, 47 insertions, 43 deletions
@@ -1,7 +1,7 @@ pkgbase = mcsctl-git pkgdesc = Manage multiple minecraft servers with a simple bash script and systemd unit template. pkgver = master - pkgrel = 8 + pkgrel = 9 url = https://github.com/Hetsh/mcsctl install = mcsctl-git.install arch = any @@ -3,7 +3,7 @@ pkgname=mcsctl-git pkgver=master commit=('d0729f6eca367a3b36ca8dbca7c62b28c4636ca8') -pkgrel=8 +pkgrel=9 pkgdesc='Manage multiple minecraft servers with a simple bash script and systemd unit template.' arch=('any') url='https://github.com/Hetsh/mcsctl' @@ -16,12 +16,13 @@ source=("$url/archive/$commit.tar.gz") sha256sums=('11dc0e82d0106e2cdd1ae57b054c88fc3d7163f8d95358ac84d6ee87776b8487') package() { - install -Dm 644 "${pkgname%-git}-$commit/mcs@.service" "$pkgdir/usr/lib/systemd/system/mcs@.service" - install -Dm 755 "${pkgname%-git}-$commit/mcsctl.sh" "$pkgdir/usr/bin/mcsctl" - install -Dm 644 "${pkgname%-git}-$commit/mcs-update@.timer" "$pkgdir/usr/lib/systemd/system/mcs-update@.timer" - install -Dm 644 "${pkgname%-git}-$commit/mcs-update@.service" "$pkgdir/usr/lib/systemd/system/mcs-update@.service" + work_dir="${pkgname%-git}-$commit" + install -Dm 644 "$work_dir/mcs@.service" "$pkgdir/usr/lib/systemd/system/mcs@.service" + install -Dm 755 "$work_dir/mcsctl.sh" "$pkgdir/usr/bin/mcsctl" + install -Dm 644 "$work_dir/mcs-update@.timer" "$pkgdir/usr/lib/systemd/system/mcs-update@.timer" + install -Dm 644 "$work_dir/mcs-update@.service" "$pkgdir/usr/lib/systemd/system/mcs-update@.service" # Generate an example config file from default options inside the mcsctl script - sed -n '/\# Mutable config/,/\# \/Mutable config/p' "${pkgname%-git}-$commit/mcsctl.sh" | head -n -1 | tail -n +2 > "${pkgname%-git}-$commit/mcsctl.conf.bak" - install -Dm 644 "${pkgname%-git}-$commit/mcsctl.conf.bak" "$pkgdir/etc/mcsctl.conf.bak" + sed -n '/\# Mutable config/,/\# \/Mutable config/p' "$work_dir/mcsctl.sh" | head -n -1 | tail -n +2 > "$work_dir/mcsctl.conf.bak" + install -Dm 644 "$work_dir/mcsctl.conf.bak" "$pkgdir/etc/mcsctl.conf.bak" }
\ No newline at end of file diff --git a/prepare_update.sh b/prepare_update.sh new file mode 100755 index 000000000000..e33dbfdd2cc3 --- /dev/null +++ b/prepare_update.sh @@ -0,0 +1,38 @@ +#!/usr/bin/env bash + +if [ ! -d ".git" ] +then + echo "Not a git repository!" + exit 1 +fi + +BUILD_FILE="PKGBUILD" +if [ ! -e "$BUILD_FILE" ] +then + echo "Not an AUR repository!" + exit 2 +fi +source "$BUILD_FILE" + +if [ "$1" == "--aur-only" ] +then + echo "Only updating \$pkgrel!" +else + # Replace with latest commit to master branch + LATEST_COMMIT=$(git ls-remote "$url" master | cut -f 1) + if [ "$commit" = "$LATEST_COMMIT" ] + then + echo "Already on latest commit!" + exit 3 + fi + sed -i "s|commit\=.*|commit\=('$LATEST_COMMIT')|" "$BUILD_FILE" + + # Update package checksum + PKG_SHA=$(curl -L -s "$url/archive/$LATEST_COMMIT.tar.gz" | sha256sum | cut -d " " -f 1) + sed -i "s|sha256sums\=.*|sha256sums\=('$PKG_SHA')|" "$BUILD_FILE" +fi + +# Increment pkgrel on every "release" +sed -i "s|pkgrel\=.*|pkgrel\=$((pkgrel+1))|" "$BUILD_FILE" + +makepkg --printsrcinfo > .SRCINFO diff --git a/update_aur.sh b/update_aur.sh deleted file mode 100755 index f428bdfffa1a..000000000000 --- a/update_aur.sh +++ /dev/null @@ -1,35 +0,0 @@ -#!/usr/bin/env bash - -# Change to the AUR repo -if [ -n "$1" ]; then - cd "$1" -fi - -if [ ! -d ".git" ]; then - echo "Not a git repository!" - exit 1 -fi - -BUILD_FILE="PKGBUILD" -if [ ! -e "$BUILD_FILE" ]; then - echo "Not an AUR repository!" - exit 2 -fi -source "$BUILD_FILE" - -# Replace with latest commit to master branch -LATEST_COMMIT=$(git ls-remote "$url" master | cut -f 1) -if [ "$commit" = "$LATEST_COMMIT" ]; then - echo "Already on latest commit!" - exit 3 -fi -sed -i "s%commit\=.*%commit\=('$LATEST_COMMIT')%" "$BUILD_FILE" - -# Increment pkgrel on every "release" -sed -i "s%pkgrel\=.*%pkgrel\=$((pkgrel+1))%" "$BUILD_FILE" - -# Update package checksum -PKG_SHA=$(curl -L -s "$url/archive/$LATEST_COMMIT.tar.gz" | sha256sum | cut -d " " -f 1) -sed -i "s%sha256sums\=.*%sha256sums\=('$PKG_SHA')%" "$BUILD_FILE" - -makepkg --printsrcinfo > .SRCINFO |