summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorEinar Arnason2022-07-06 12:59:04 +0000
committerEinar Arnason2022-07-06 12:59:04 +0000
commit6c62d97384ff7531626c6c225740c2efcee762ec (patch)
treebbef64df188f67efcf03b7e31ac3687a096df9fc
downloadaur-6c62d97384ff7531626c6c225740c2efcee762ec.tar.gz
Initial commit
-rw-r--r--.SRCINFO26
-rw-r--r--PKGBUILD68
-rw-r--r--emqx.install40
3 files changed, 134 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO
new file mode 100644
index 000000000000..9e0098e7e2d2
--- /dev/null
+++ b/.SRCINFO
@@ -0,0 +1,26 @@
+pkgbase = emqx-git
+ pkgdesc = EMQX, a distributed, massively scalable, highly extensible MQTT message broker.
+ pkgver = 5.0.2
+ pkgrel = 1
+ url = https://github.com/emqx/emqx
+ install = emqx.install
+ arch = x86_64
+ license = APACHE
+ makedepends = cmake
+ makedepends = coreutils
+ makedepends = erlang
+ makedepends = git
+ makedepends = unzip
+ depends = coreutils
+ depends = ncurses
+ depends = zlib
+ depends = erlang
+ provides = emqx
+ provides = emqx-git
+ conflicts = emqx
+ conflicts = emqx-bin
+ backup = etc/emqx/emqx.conf
+ source = git+https://github.com/emqx/emqx.git
+ sha256sums = SKIP
+
+pkgname = emqx-git
diff --git a/PKGBUILD b/PKGBUILD
new file mode 100644
index 000000000000..ddd3295415b4
--- /dev/null
+++ b/PKGBUILD
@@ -0,0 +1,68 @@
+# Maintainer: Einar Arnason einsiarna@gmail.com
+
+ORG_NAME=emqx
+REPO_NAME=emqx
+LATEST_INFO="$(curl -s https://api.github.com/repos/${ORG_NAME}/${REPO_NAME}/releases/latest)"
+TAG=$(echo "$LATEST_INFO" | grep "tag_name" | cut -d'"' -f4)
+
+pkgname=$REPO_NAME-git
+pkgver="${TAG//v/}"
+pkgrel=1
+pkgdesc="EMQX, a distributed, massively scalable, highly extensible MQTT message broker."
+arch=('x86_64')
+url="https://github.com/$ORG_NAME/$REPO_NAME"
+license=('APACHE')
+backup=("etc/emqx/emqx.conf")
+provides=("$REPO_NAME" "$REPO_NAME-git")
+conflicts=("$REPO_NAME" "$REPO_NAME-bin")
+source=(
+ "git+https://github.com/$ORG_NAME/$REPO_NAME.git"
+)
+sha256sums=(
+ 'SKIP'
+)
+depends=(coreutils ncurses zlib erlang)
+makedepends=(
+ cmake
+ coreutils
+ erlang
+ git
+ unzip
+)
+optdepends=()
+install=$REPO_NAME.install
+options=()
+
+pkgver() {
+ echo "${TAG//v/}"
+}
+
+prepare() {
+ cd "$srcdir/$REPO_NAME" || exit
+ git checkout "$TAG"
+}
+
+build() {
+ cd "$srcdir/$REPO_NAME" || exit
+ BUILD_WITHOUT_JQ=false make
+}
+
+package() {
+ install -d "$pkgdir"/usr/lib/emqx/bin
+ install -d "$pkgdir"/usr/lib/emqx/plugins
+ install -d "$pkgdir"/usr/lib/emqx/releases
+ install -d "$pkgdir"/etc/emqx
+ install -d "$pkgdir"/var/lib/emqx
+ install -d "$pkgdir"/var/run/emqx
+ install -d "$pkgdir"/var/log/emqx
+
+ local buildDir="$srcdir"/emqx/_build/emqx/rel/emqx
+ touch "$pkgdir"/usr/lib/emqx/plugins/.keep
+ find "$buildDir"/bin/ -type f -exec install -D -m 755 {} "$pkgdir/usr/lib/emqx/bin/$(basename "$1")" \;
+ find "$buildDir"/etc/ -type f -exec install -D -m 644 {} "$pkgdir/etc/emqx/$(basename "$1")" \;
+ find "$buildDir"/data/ -type f -exec install -D -m 644 {} "$pkgdir/var/lib/emqx/$(basename "$1")" \;
+ find "$buildDir"/lib/ -type f -exec install -D -m 644 {} "$pkgdir/usr/lib/emqx/$(basename "$1")" \;
+ find "$buildDir"/releases/ -type f -exec install -D -m 644 {} "$pkgdir/usr/lib/emqx/$(basename "$1")" \;
+ find "$buildDir"/erts*/ -type f -exec install -D -m 644 {} "$pkgdir/usr/lib/emqx/$(basename "$(dirname "$1")")/$(basename "$1")" \;
+ install -D -m 644 "$srcdir"/emqx/deploy/packages/emqx.service "$pkgdir"/usr/lib/systemd/system/emqx.service
+}
diff --git a/emqx.install b/emqx.install
new file mode 100644
index 000000000000..f85069f5b8ad
--- /dev/null
+++ b/emqx.install
@@ -0,0 +1,40 @@
+## arg 1: the new package version
+#pre_install() {
+# do something here
+#}
+
+## arg 1: the new package version
+post_install() {
+ useradd -r -s /usr/bin/nologin emqx
+
+ chown -R emqx:emqx /var/lib/emqx
+ chown -R emqx:emqx /var/run/emqx
+ chown -R emqx:emqx /var/log/emqx
+ systemctl daemon-reload
+}
+
+## arg 1: the new package version
+## arg 2: the old package version
+#pre_upgrade() {
+# do something here
+#}
+
+## arg 1: the new package version
+## arg 2: the old package version
+post_upgrade() {
+ chown -R emqx:emqx /var/lib/emqx
+ chown -R emqx:emqx /var/run/emqx
+ chown -R emqx:emqx /var/log/emqx
+ systemctl daemon-reload
+}
+
+## arg 1: the old package version
+pre_remove() {
+ systemctl stop emqx
+}
+
+## arg 1: the old package version
+post_remove() {
+ systemctl disable emqx
+ userdel emqx
+}