rpcd: adapt defaults for changed ubus.sock path
authorDaniel Golle <daniel@makrotopia.org>
Thu, 22 Oct 2020 14:02:58 +0000 (15:02 +0100)
committerDaniel Golle <daniel@makrotopia.org>
Thu, 22 Oct 2020 14:13:38 +0000 (15:13 +0100)
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
package/system/rpcd/Makefile
package/system/rpcd/files/50-migrate-rpcd-ubus-sock.sh [new file with mode: 0755]
package/system/rpcd/files/rpcd.config

index 051e4c5..917ad6f 100644 (file)
@@ -8,7 +8,7 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=rpcd
-PKG_RELEASE:=1
+PKG_RELEASE:=2
 
 PKG_SOURCE_PROTO:=git
 PKG_SOURCE_URL=$(PROJECT_GIT)/project/rpcd.git
@@ -63,6 +63,8 @@ define Package/rpcd/install
        $(INSTALL_DATA) $(PKG_BUILD_DIR)/unauthenticated.json $(1)/usr/share/rpcd/acl.d/unauthenticated.json
        $(INSTALL_DIR) $(1)/etc/config
        $(INSTALL_CONF) ./files/rpcd.config $(1)/etc/config/rpcd
+       $(INSTALL_DIR) $(1)/etc/uci-defaults
+       $(INSTALL_BIN) ./files/50-migrate-rpcd-ubus-sock.sh $(1)/etc/uci-defaults
 endef
 
 
diff --git a/package/system/rpcd/files/50-migrate-rpcd-ubus-sock.sh b/package/system/rpcd/files/50-migrate-rpcd-ubus-sock.sh
new file mode 100755 (executable)
index 0000000..1365aed
--- /dev/null
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+[ "$(uci get rpcd.@rpcd[0].socket)" = "/var/run/ubus.sock" ] && {
+       uci set rpcd.@rpcd[0].socket='/var/run/ubus/ubus.sock'
+       uci commit rpcd
+}
index faaed7f..176c643 100644 (file)
@@ -1,5 +1,5 @@
 config rpcd
-       option socket /var/run/ubus.sock
+       option socket /var/run/ubus/ubus.sock
        option timeout 30
 
 config login