nut: Reorganize nut-server to clarify nut-driver

Clarify the different between the common nut-driver portions of
nut-server and the nut-server (upsd) proper.  nut-driver can't
be used without nut-server so there is no compelling reason
to split into a separate package, but the reorganization makes
such a move easier and makes it clear what each bit is for.

While we continue to use a single initscript, it's a properly
procdified one which handles the upsd daemon as a different
instance than the driver instances.  This resolves a race
condition in which upsd and drivers fail to start do to
a degree of interdepedence.

Also properly 'procd'ifies the nut-server initscript.

Signed-off-by: Daniel F. Dickinson <cshored@thecshore.com>
This commit is contained in:
Daniel F. Dickinson
2018-08-27 09:50:34 -04:00
parent 5790053eba
commit ceff68837d
3 changed files with 168 additions and 64 deletions
+8 -5
View File
@@ -63,6 +63,7 @@ define Package/nut/install
endef
define Package/nut-server/install
# Server portion
$(INSTALL_DIR) $(1)/etc/nut
$(INSTALL_DIR) $(1)/usr/sbin
$(INSTALL_DIR) $(1)/etc/init.d
@@ -70,14 +71,15 @@ define Package/nut-server/install
$(INSTALL_DIR) $(1)/etc/init.d
$(INSTALL_BIN) ./files/nut-server.init $(1)/etc/init.d/nut-server
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/upsd $(1)/usr/sbin
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/upsdrvctl $(1)/usr/sbin
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/share/nut/cmdvartab $(1)/usr/share/nut/
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/share/nut/driver.list $(1)/usr/share/nut/
$(INSTALL_DIR) $(1)/etc/config
$(INSTALL_CONF) ./files/nut_server $(1)/etc/config/nut_server
ln -sf /var/etc/nut/ups.conf $(1)/etc/nut/ups.conf
ln -sf /var/etc/nut/upsd.users $(1)/etc/nut/upsd.users
ln -sf /var/etc/nut/upsd.conf $(1)/etc/nut/upsd.conf
# Driver common portion
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/upsdrvctl $(1)/usr/sbin
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/share/nut/driver.list $(1)/usr/share/nut/
ln -sf /var/etc/nut/ups.conf $(1)/etc/nut/ups.conf
endef
define Package/nut-common
@@ -110,6 +112,7 @@ define Package/nut-server
$(call Package/nut/Default)
TITLE+= (server)
DEPENDS:=nut +nut-common
USERID:=nut=113:nut=113
endef
define Package/nut-server/description
@@ -123,9 +126,9 @@ endef
define Package/nut-server/conffiles
/etc/config/nut_server
/etc/nut/ups.conf
/etc/nut/upsd.conf
/etc/nut/upsd.users
/etc/nut/ups.conf
endef
define Package/nut-upsmon
@@ -349,7 +352,7 @@ define DriverPackage
define Package/nut-driver-$(2)
$(call Package/nut/Default)
TITLE:=$(2) (NUT $(1) driver)
DEPENDS:=nut +nut-common
DEPENDS:=nut +nut-server
$(if $(filter $(1),snmp),DEPENDS+= @NUT_DRIVER_SNMP)
$(if $(filter $(1),usb),DEPENDS+= @NUT_DRIVER_USB)
$(if $(filter $(1),serial),DEPENDS+= @NUT_DRIVER_SERIAL)