From 5912206b8335956f244c4139542549d92f30163a Mon Sep 17 00:00:00 2001 From: Roland Osborne Date: Wed, 3 Apr 2024 11:58:17 -0700 Subject: [PATCH] databag: add package Signed-off-by: Roland Osborne --- net/databag/Makefile | 67 ++++++++++++++++++++++++++++++++ net/databag/files/databag.config | 12 ++++++ net/databag/files/databag.init | 24 ++++++++++++ 3 files changed, 103 insertions(+) create mode 100644 net/databag/Makefile create mode 100644 net/databag/files/databag.config create mode 100644 net/databag/files/databag.init diff --git a/net/databag/Makefile b/net/databag/Makefile new file mode 100644 index 0000000000..2430db98ba --- /dev/null +++ b/net/databag/Makefile @@ -0,0 +1,67 @@ +include $(TOPDIR)/rules.mk + +PKG_NAME:=databag +PKG_VERSION:=1.1.11 +PKG_RELEASE:=1 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=https://github.com/balzack/databag/releases/download/v$(PKG_VERSION)/server.tar.gz? +PKG_HASH:=b4f9b46ffc9810156c6b8e50216ee4b703b5967a3a88acd982e0ce9ee42098e4 + +PKG_MAINTAINER:=Roland Osborne +PKG_LICENSE:=Apache-2.0 +PKG_LICENSE_FILES:=LICENSE + +PKG_BUILD_DEPENDS:=golang/host +PKG_BUILD_PARALLEL:=1 +PKG_BUILD_FLAGS:=no-mips16 + +GO_PKG:=databag + +include $(INCLUDE_DIR)/package.mk +include ../../lang/golang/golang-package.mk + +TAR_CMD=$(HOST_TAR) -C $(1) $(TAR_OPTIONS) + +define Package/databag + SECTION:=net + CATEGORY:=Network + SUBMENU:=Instant Messaging + TITLE:=Federated Messaging Service + URL:=https://github.com/balzack/databag + DEPENDS:=$(GO_ARCH_DEPENDS) +endef + +define Package/databag/description + Databag is a federated messaging service with browser and mobile clients. +endef + +define Package/databag/conffiles +/etc/config/databag +endef + +define Download/static_web + URL:=https://github.com/balzack/databag/releases/download/v$(PKG_VERSION) + URL_FILE:=webapp.tar.gz + FILE:=$(PKG_NAME)-$(PKG_VERSION)-webapp.tar.gz + HASH:=9a9a4332a4837e356b3815fec3aacf5099d8a11dfcdad83847790d235101fa05 +endef + +TARGET_CFLAGS += "-D_LARGEFILE64_SOURCE" + +define Package/databag/install + $(call GoPackage/Package/Install/Bin,$(1)) + $(INSTALL_DIR) $(1)/usr/share/databag + $(INSTALL_DATA) $(PKG_BUILD_DIR)/databag.db $(1)/usr/share/databag/ + $(INSTALL_DIR) $(1)/usr/share/databag/web + gzip -dc $(DL_DIR)/$(PKG_NAME)-$(PKG_VERSION)-webapp.tar.gz | $(HOST_TAR) -C $(1)/usr/share/databag/web/ $(TAR_OPTIONS) + + $(INSTALL_DIR) $(1)/etc/init.d + $(INSTALL_BIN) files/databag.init $(1)/etc/init.d/databag + $(INSTALL_DIR) $(1)/etc/config + $(INSTALL_CONF) files/databag.config $(1)/etc/config/databag +endef + +$(eval $(call Download,static_web)) +$(eval $(call GoBinPackage,databag)) +$(eval $(call BuildPackage,databag)) diff --git a/net/databag/files/databag.config b/net/databag/files/databag.config new file mode 100644 index 0000000000..1b71f157d7 --- /dev/null +++ b/net/databag/files/databag.config @@ -0,0 +1,12 @@ +## +## Databag is a federated messaging service +## + +config databag 'config' + + ## path where database and assets are store + option store_path '/tmp/databag/store' + + ## listening port for the service + option service_port '7001' + diff --git a/net/databag/files/databag.init b/net/databag/files/databag.init new file mode 100644 index 0000000000..d6e6e0f145 --- /dev/null +++ b/net/databag/files/databag.init @@ -0,0 +1,24 @@ +#!/bin/sh /etc/rc.common + +USE_PROCD=1 +START=50 +STOP=51 + +start_service() { + # load config + config_load databag + config_get store_path "config" "store_path" "/tmp/databag/store" + config_get service_port "config" "service_port" "7001" + + # init store + mkdir -p "${store_path}" + cp -n "/usr/share/databag/databag.db" "${store_path}" + + # setup serice + procd_open_instance + procd_set_param command "/usr/bin/databag" + procd_append_param command -p "${service_port}" + procd_append_param command -s "${store_path}" + procd_append_param command -w "/usr/share/databag/web/build" + procd_close_instance +} -- 2.30.2