summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorJan2019-12-07 14:21:18 +0100
committerJan2019-12-07 14:21:18 +0100
commit4560eb52e83bc310842f4e9c70686e952e58e63f (patch)
treee277f68e0b38795826574af259dbe72c113baebe
parent10c51cb97e5fc62fcd578ec9fdd41614d79c56dc (diff)
downloadaur-4560eb52e83bc310842f4e9c70686e952e58e63f.tar.gz
Improvements to PKGBUILD and preparation script
-rw-r--r--.SRCINFO2
-rw-r--r--PKGBUILD15
-rwxr-xr-xprepare_update.sh38
-rwxr-xr-xupdate_aur.sh35
4 files changed, 47 insertions, 43 deletions
diff --git a/.SRCINFO b/.SRCINFO
index 23c3b8741e2c..40b543342d80 100644
--- a/.SRCINFO
+++ b/.SRCINFO
@@ -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
diff --git a/PKGBUILD b/PKGBUILD
index 40e2929387e6..3d0dc7136e89 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -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