Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 51 additions & 0 deletions libs/libqb/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# Copyright (C) 2025-2026 S Shaikh <sshaikh@hotmail.com>
# Copyright (C) 2026 Sven Kirmess <sven.kirmess@kzone.ch>

include $(TOPDIR)/rules.mk

PKG_NAME:=libqb
PKG_VERSION:=2.0.10
PKG_RELEASE:=1

PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
PKG_SOURCE_URL:=https://github.com/ClusterLabs/libqb/releases/download/v$(PKG_VERSION)/
PKG_HASH:=326a69fb5b2ee4479f0db4f98d10d670ad0798b5ded8c4cfd585b765fd8941e8
PKG_FIXUP:=autoreconf
PKG_INSTALL:=1

PKG_MAINTAINER:=S Shaikh <sshaikh@hotmail.com>, Sven Kirmess <sven.kirmess@kzone.ch>
PKG_LICENSE:=LGPL-2.1-or-later
PKG_LICENSE_FILES:=COPYING

include $(INCLUDE_DIR)/package.mk

define Package/libqb
SECTION:=libs
CATEGORY:=Libraries
TITLE:=High performance client server reusable library
URL:=https://github.com/ClusterLabs/libqb
endef

define Package/libqb/description
libqb provides high-performance, reusable features for client/server
architecture, including IPC, logging, and ringbuffer. Used by Corosync
and other cluster software.
endef

CONFIGURE_ARGS += --disable-man

define Build/InstallDev
Comment thread
skirmess marked this conversation as resolved.
$(INSTALL_DIR) $(1)/usr/include/qb
$(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/include/qb/* $(1)/usr/include/qb
$(INSTALL_DIR) $(1)/usr/lib
$(CP) $(PKG_INSTALL_DIR)/usr/lib/lib*.so* $(1)/usr/lib/
$(INSTALL_DIR) $(1)/usr/lib/pkgconfig
$(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/*.pc $(1)/usr/lib/pkgconfig
endef

define Package/libqb/install
$(INSTALL_DIR) $(1)/usr/lib
$(CP) $(PKG_INSTALL_DIR)/usr/lib/lib*.so.* $(1)/usr/lib/
endef

$(eval $(call BuildPackage,libqb))
15 changes: 15 additions & 0 deletions libs/libqb/test-version.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/sh

# shellcheck shell=busybox

case "$PKG_NAME" in
libqb)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: parity — if libqb needs this because it ships no executable, the same is true of libcorosync (net/corosync/Makefile, Package/libcorosync/install ships only lib*.so.*), kronosnet, and the nine kronosnet-compress-* / kronosnet-crypto-* plugin subpackages, none of which have a test.sh or test-version.sh in this PR. Is the generic check known to pass for those (e.g. it skips packages with zero executables, which would make this file unnecessary too), or were they just not hit in CI yet?


Generated by Claude Code

# Shared libraries, no executable to check
exit 0
;;

*)
echo "Untested package: $PKG_NAME" >&2
exit 1
;;
esac
66 changes: 66 additions & 0 deletions net/corosync-qdevice/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
# Copyright (C) 2025-2026 S Shaikh <sshaikh@hotmail.com>
# Copyright (C) 2026 Sven Kirmess <sven.kirmess@kzone.ch>

include $(TOPDIR)/rules.mk

PKG_NAME:=corosync-qdevice
PKG_VERSION:=3.0.4
PKG_RELEASE:=1

PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=https://github.com/corosync/corosync-qdevice/releases/download/v$(PKG_VERSION)/
PKG_HASH:=c2821329ed1efd6bf8f82e2878f75ca66889439d27c788785fd0ccc972ac307c
PKG_FIXUP:=autoreconf
PKG_INSTALL:=1

PKG_MAINTAINER:=S Shaikh <sshaikh@hotmail.com>, Sven Kirmess <sven.kirmess@kzone.ch>
PKG_LICENSE:=BSD-3-Clause
PKG_LICENSE_FILES:=LICENSE

include $(INCLUDE_DIR)/package.mk

define Package/corosync-qdevice
SECTION:=net
CATEGORY:=Network
TITLE:=Corosync QNetd - quorum device daemon
URL:=https://github.com/corosync/corosync-qdevice
DEPENDS:=+libcorosync +libnss +nss-utils +bash

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With --disable-qdevices now set, the only things built are corosync-qnetd, corosync-qnetd-tool and the corosync-qnetd-certutil shell script — and none of them link against corosync. In the 3.0.4 tarball, qdevices/Makefile.am:86-87 has corosync_qnetd_CFLAGS/LDADD = $(nss_CFLAGS)/$(nss_LIBS) plus libsystemd only, corosync_qnetd_tool has no LDADD at all, and the cmap/votequorum/corosync_common pkg-config variables are referenced exclusively by corosync_qdevice_CFLAGS/LDADD (Makefile.am:157-160), which is now inside the disabled BUILD_QDEVICES conditional. None of the qnetd sources include corosync/* or qb/* headers either.

So +libcorosync looks like it now only pulls libcorosync → kronosnet → libqb → libnl onto the device at runtime for nothing, which matches the commit message ("the qdevice client side is meant to run on the cluster nodes, not on the qnetd host").

Note this can't just be deleted: configure.ac:100-102 still does PKG_CHECK_MODULES for libcorosync_common/libcmap/libvotequorum unconditionally, so the corosync headers are still needed at build time — dropping it from DEPENDS means bringing back PKG_BUILD_DEPENDS:=corosync, which this commit removes. Is the runtime dependency intentional?


Generated by Claude Code

endef

define Package/corosync-qdevice/description
corosync-qnetd daemon providing an additional vote to Corosync/Proxmox
clusters, allowing a 2-node cluster to maintain quorum when one node fails.

NOTE: Proxmox VE users need openssh-sftp-server installed on this
OpenWrt device before running 'pvecm qdevice setup' on the Proxmox node.
It can be removed afterwards.
endef

CONFIGURE_ARGS += \
--with-bash=/bin/bash \
--disable-qdevices

define Build/InstallDev
$(INSTALL_DIR) $(1)/usr/share/pkgconfig
$(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/share/pkgconfig/corosync-qdevice.pc $(1)/usr/share/pkgconfig
Comment thread
skirmess marked this conversation as resolved.
endef
Comment on lines +43 to +46

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Build/InstallDev copies target runtime binaries (and the shell scripts in usr/bin) into the staging dir. Nothing links against corosync-qdevice — it's a leaf package — so the staging tree only ever needs the .pc file at most. This is the same change you already made for net/corosync after review feedback ("Removed the binary install from Build/InstallDev").

Suggested change
define Build/InstallDev
$(INSTALL_DIR) $(1)/usr/share/pkgconfig
$(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/share/pkgconfig/corosync-qdevice.pc $(1)/usr/share/pkgconfig
$(INSTALL_DIR) $(1)/usr/bin
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/* $(1)/usr/bin
$(INSTALL_DIR) $(1)/usr/sbin
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/* $(1)/usr/sbin
endef
define Build/InstallDev
$(INSTALL_DIR) $(1)/usr/share/pkgconfig
$(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/share/pkgconfig/corosync-qdevice.pc $(1)/usr/share/pkgconfig
endef

Generated by Claude Code


define Package/corosync-qdevice/install
$(INSTALL_DIR) $(1)/usr/bin
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/corosync-qnetd $(1)/usr/bin/
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/corosync-qnetd-tool $(1)/usr/bin/
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/corosync-qnetd-certutil $(1)/usr/bin/
$(INSTALL_DIR) $(1)/etc/init.d
$(INSTALL_BIN) ./files/corosync-qdevice.init $(1)/etc/init.d/corosync-qdevice
$(INSTALL_DIR) $(1)/etc/uci-defaults
$(INSTALL_DATA) ./files/corosync-qdevice.uci-defaults $(1)/etc/uci-defaults/corosync-qdevice
endef

define Package/corosync-qdevice/postinst
#!/bin/sh
if [ -z "$${IPKG_INSTROOT}" ] && [ ! -f "/etc/corosync/qnetd/nssdb/cert9.db" ]; then
/usr/bin/corosync-qnetd-certutil -i || true
fi
endef
Comment on lines +59 to +64

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The NSS DB is only ever created when the package is installed on a running system. When corosync-qdevice is baked into an image (ImageBuilder / make image), postinst runs with IPKG_INSTROOT set, the branch is skipped, and nothing re-runs it on first boot — so /etc/corosync/qnetd/nssdb/cert9.db never exists and corosync-qnetd fails to start. Certificate generation also can't sensibly happen in the build root anyway.

Two options that cover both install paths: install an /etc/uci-defaults/ script that does the same check on first boot, or do the check in start_service() in the init script before launching the daemon.

Separately, the script's exit status is corosync-qnetd-certutil's, so a certutil failure leaves the package in an unconfigured state; an explicit exit 0 (or || true) is the usual guard.


Generated by Claude Code

Comment on lines +59 to +64

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: with the uci-defaults script added, this block is now unreachable in practice. default_postinst executes the package's /etc/uci-defaults/ entries (and rms them) before it sources postinst-pkg — see functions.sh:384-398, wired up by package-pack.mk:546-547. So on a live install the uci-defaults script has already created cert9.db by the time this runs, and on a baked image the IPKG_INSTROOT guard skips it anyway. The uci-defaults script covers both paths on its own; keeping two copies of the same check just means two places to update.


Generated by Claude Code


$(eval $(call BuildPackage,corosync-qdevice))
12 changes: 12 additions & 0 deletions net/corosync-qdevice/files/corosync-qdevice.init
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/sh /etc/rc.common

START=99
STOP=99
USE_PROCD=1

start_service() {
procd_open_instance
procd_set_param command /usr/bin/corosync-qnetd -f
Comment thread
skirmess marked this conversation as resolved.
procd_set_param respawn
procd_close_instance
}
5 changes: 5 additions & 0 deletions net/corosync-qdevice/files/corosync-qdevice.uci-defaults
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/sh

[ -f /etc/corosync/qnetd/nssdb/cert9.db ] || /usr/bin/corosync-qnetd-certutil -i

exit 0
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
From 9946ee9e065dbcaddc3b5a0b33859a25569b1526 Mon Sep 17 00:00:00 2001
From: Sven Kirmess <sven.kirmess@kzone.ch>
Date: Fri, 8 May 2026 10:17:15 +0200
Subject: [PATCH] configure: add --with-bash option

... for cross-compilation

AC_PATH_PROG finds bash on the build host, which differs from the
target system path in cross-compilation environments. Add
--with-bash=PATH to allow explicitly specifying the bash path on
the target system.

When not specified, the existing auto-detection behaviour is
unchanged.

Signed-off-by: Sven Kirmess <sven.kirmess@kzone.ch>
Reviewed-by: Jan Friesse <jfriesse@redhat.com>
---
configure.ac | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)

--- a/configure.ac
+++ b/configure.ac
@@ -79,7 +79,11 @@ AC_PROG_LN_S
AC_PROG_INSTALL
AC_PROG_MAKE_SET
PKG_PROG_PKG_CONFIG
-AC_PATH_PROG([BASHPATH], [bash])
+AC_ARG_WITH([bash],
+ [AS_HELP_STRING([--with-bash=PATH],
+ [path to bash on the target system @<:@default=auto-detect@:>@])],
+ [BASHPATH="$withval"],
+ [AC_PATH_PROG([BASHPATH], [bash])])
AC_CHECK_PROGS([GROFF], [groff])

# Checks for typedefs.
39 changes: 39 additions & 0 deletions net/corosync-qdevice/patches/0002-initialize-ca.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
From 2d1989d27da618a40e6340c7c9ffe8708f1cc067 Mon Sep 17 00:00:00 2001
From: Sven Kirmess <sven.kirmess@kzone.ch>
Date: Fri, 8 May 2026 00:00:00 +0200
Subject: [PATCH] fix CA initialization for musl/busybox compatibility

- chown --reference=: GNU coreutils only, not available in Busybox; the
target directory is always owned by root on OpenWrt, so this is a no-op
- ps -elf / w: GNU ps flags and the w command are not available on
Busybox/OpenWrt; seed the noise file from /dev/urandom instead
- sha1sum: not compiled into Busybox by default; use sha256sum which is
available in Busybox by default instead

Signed-off-by: Sven Kirmess <sven.kirmess@kzone.ch>
---
qdevices/corosync-qnetd-certutil.sh | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)

--- a/qdevices/corosync-qnetd-certutil.sh
+++ b/qdevices/corosync-qnetd-certutil.sh
@@ -62,9 +62,7 @@ usage() {
}

chown_ref_cfgdir() {
- if [ "$UID" == "0" ];then
- chown --reference="$CONFIG_DIR" "$@" 2>/dev/null || chown "$(stat -f "%u:%g" "$CONFIG_DIR")" "$@" 2>/dev/null || return $?
- fi
+ : # All files owned by root on OpenWrt, nothing to do
}

# get_perm [directory]
@@ -83,7 +81,7 @@ create_new_noise_file() {
if [ ! -e "$noise_file" ];then
echo "Creating new noise file $noise_file"

- (ps -elf; date; w) | sha1sum | (read sha_sum rest; echo $sha_sum) > "$noise_file"
+ dd if=/dev/urandom bs=1024 count=1 2>/dev/null | sha256sum | (read sha_sum rest; echo $sha_sum) > "$noise_file"

chown_ref_cfgdir "$noise_file"
chmod "$(get_perm)" "$noise_file"
7 changes: 7 additions & 0 deletions net/corosync-qdevice/test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/sh

case "$1" in
corosync-qdevice)
corosync-qnetd -v 2>&1 | grep -F "$2"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is done by the generic tests already. Was this not working?

@skirmess skirmess May 10, 2026

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the error from CI:

corosync-qdevice: No executables in the package provided version 3.0.4
corosync-qdevice: Generic tests failed

But only libqb and corosync-qdevice had a failure. I've removed the two test.sh files that weren't needed.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one still has the problem you fixed for libs/libqb: test.sh runs in addition to the generic tests, it doesn't replace them — only test-version.sh makes "the generic version detection … skipped entirely".

The generic probe is exactly what failed for this package in the CI run you linked earlier (corosync-qdevice: No executables in the package provided version 3.0.4 / Generic tests failed), and nothing since then changes that: corosync-qnetd only accepts the short flag — getopt(argc, argv, "46dfhvc:l:m:p:S:s:") in qdevices/corosync-qnetd.c, no long_options table — so a generic --version/-V probe still comes back empty, and -h/unknown options print usage without the version string. corosync-qnetd-tool and corosync-qnetd-certutil don't report a version at all.

Renaming this to test-version.sh and switching to the env-var interface (case "$PKG_NAME" / grep -F "$PKG_VERSION" instead of $1/$2) is what actually silences the generic check.


Generated by Claude Code

;;
esac
74 changes: 74 additions & 0 deletions net/corosync/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
# Copyright (C) 2025-2026 S Shaikh <sshaikh@hotmail.com>
# Copyright (C) 2026 Sven Kirmess <sven.kirmess@kzone.ch>

include $(TOPDIR)/rules.mk

PKG_NAME:=corosync
PKG_VERSION:=3.1.10
PKG_RELEASE:=1

PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=https://github.com/corosync/corosync/releases/download/v$(PKG_VERSION)/
PKG_HASH:=be361c827f99b215b3bd3fa2fb071c03dac6831c2a351963d938caef62604bc8
PKG_FIXUP:=autoreconf
PKG_INSTALL:=1

PKG_MAINTAINER:=S Shaikh <sshaikh@hotmail.com>, Sven Kirmess <sven.kirmess@kzone.ch>
PKG_LICENSE:=BSD-3-Clause
PKG_LICENSE_FILES:=LICENSE

include $(INCLUDE_DIR)/package.mk

define Package/libcorosync
SECTION:=libs
CATEGORY:=Libraries
TITLE:=Corosync cluster libraries
URL:=https://corosync.github.io/corosync/
DEPENDS:=+kronosnet +libqb
endef

define Package/libcorosync/description
Shared libraries for Corosync cluster engine, including libcorosync_common,
libcfg, libcmap, libcpg, libquorum, libsam, and libvotequorum.
endef

define Package/corosync
SECTION:=net
CATEGORY:=Network
TITLE:=Corosync cluster engine
URL:=https://corosync.github.io/corosync/
DEPENDS:=+libcorosync
endef

define Package/corosync/description
Corosync cluster engine daemon and management tools, providing reliable
messaging, membership, and quorum for high-availability clusters.
endef

define Build/InstallDev
$(INSTALL_DIR) $(1)/usr/include/corosync
$(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/include/corosync/* $(1)/usr/include/corosync/
$(INSTALL_DIR) $(1)/usr/lib
$(CP) $(PKG_INSTALL_DIR)/usr/lib/lib*.so* $(1)/usr/lib/
$(INSTALL_DIR) $(1)/usr/lib/pkgconfig
$(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/*.pc $(1)/usr/lib/pkgconfig
endef

define Package/libcorosync/install
$(INSTALL_DIR) $(1)/usr/lib
$(CP) $(PKG_INSTALL_DIR)/usr/lib/lib*.so.* $(1)/usr/lib/
endef

define Package/corosync/install
$(INSTALL_DIR) $(1)/usr/sbin
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/corosync $(1)/usr/sbin/
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/corosync-cfgtool $(1)/usr/sbin/
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/corosync-cmapctl $(1)/usr/sbin/
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/corosync-cpgtool $(1)/usr/sbin/
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/corosync-keygen $(1)/usr/sbin/
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/corosync-notifyd $(1)/usr/sbin/
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/corosync-quorumtool $(1)/usr/sbin/
endef

$(eval $(call BuildPackage,libcorosync))
$(eval $(call BuildPackage,corosync))
Loading