From 2676410b64d44b248acd037577de5658113b85ed Mon Sep 17 00:00:00 2001
From: Daniel Danzberger
Date: Mon, 18 Nov 2024 12:50:00 +0100
Subject: [PATCH] baresip: Use UCI for basic service configuration
The baresip init script is changed to use UCI instead of the debian
style /etc/default basic service configuration.
A uci-defaults script is added to create a basic UCI config:
--
config baresip main
option enable 0
option options ''
--
With this change an issues is also resolved, on which the baresip
service doesn't start due to the baresip user not being the owner of
the /etc/baresip configuration directory.
Additionally a reload_config trigger is added for baresip.
Signed-off-by: Daniel Danzberger
---
net/baresip/Makefile | 9 +++---
net/baresip/files/baresip.default | 10 -------
net/baresip/files/baresip.defaults | 12 ++++++++
net/baresip/files/baresip.init | 45 +++++++++++-------------------
4 files changed, 33 insertions(+), 43 deletions(-)
delete mode 100644 net/baresip/files/baresip.default
create mode 100644 net/baresip/files/baresip.defaults
diff --git a/net/baresip/Makefile b/net/baresip/Makefile
index 00028839c..66a0a4d5e 100644
--- a/net/baresip/Makefile
+++ b/net/baresip/Makefile
@@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=baresip
PKG_VERSION:=3.16.0
-PKG_RELEASE:=1
+PKG_RELEASE:=2
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=https://codeload.github.com/baresip/baresip/tar.gz/v$(PKG_VERSION)?
@@ -126,8 +126,8 @@ define Package/baresip/install
$(1)/usr/lib/baresip/modules \
$(1)/usr/share/baresip \
$(1)/etc/baresip \
- $(1)/etc/init.d \
- $(1)/etc/default
+ $(1)/etc/uci-defaults \
+ $(1)/etc/init.d
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/baresip $(1)/usr/bin
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/libbaresip.so* $(1)/usr/lib
$(INSTALL_DATA) \
@@ -137,7 +137,7 @@ define Package/baresip/install
$(SED) '/^#/!s/^/#/' $(PKG_BUILD_DIR)/docs/examples/accounts
$(SED) '/^#module_path/s|^#||;s|/local||' $(PKG_BUILD_DIR)/docs/examples/config
$(INSTALL_DATA) $(PKG_BUILD_DIR)/docs/examples/{accounts,config,contacts} $(1)/etc/baresip
- $(INSTALL_CONF) ./files/baresip.default $(1)/etc/default/baresip
+ $(INSTALL_DATA) ./files/baresip.defaults $(1)/etc/uci-defaults/90-baresip
$(INSTALL_BIN) ./files/baresip.init $(1)/etc/init.d/baresip
endef
@@ -145,7 +145,6 @@ define Package/baresip/conffiles
/etc/baresip/accounts
/etc/baresip/config
/etc/baresip/contacts
-/etc/default/baresip
endef
##################
diff --git a/net/baresip/files/baresip.default b/net/baresip/files/baresip.default
deleted file mode 100644
index b251c80e7..000000000
--- a/net/baresip/files/baresip.default
+++ /dev/null
@@ -1,10 +0,0 @@
-### bareSIP init configuration ###
-
-# Uncomment once you verified your configuration, otherwise the init script will
-# not start bareSIP.
-#ENABLE_BARESIP="yes"
-
-# The following is added to the command line when starting bareSIP:
-OPTIONS=""
-
-# The configuration for the daemon is done in /etc/baresip!
diff --git a/net/baresip/files/baresip.defaults b/net/baresip/files/baresip.defaults
new file mode 100644
index 000000000..7c1cd257b
--- /dev/null
+++ b/net/baresip/files/baresip.defaults
@@ -0,0 +1,12 @@
+CFGFILE=/etc/config/baresip
+
+if [ ! -f "$CFGFILE" ]; then
+ cat >$CFGFILE <