add uci default

This commit is contained in:
janson
2024-02-23 19:02:51 +08:00
parent 2d08c15f14
commit 84af85cd2c
2 changed files with 22 additions and 1 deletions

View File

@@ -40,6 +40,13 @@ define Package/$(PKG_NAME)/conffiles
/etc/config/sunpanel
endef
define Package/$(PKG_NAME)/postinst
#!/bin/sh
if [ -z "$${IPKG_INSTROOT}" ]; then
[ -f /etc/uci-defaults/sunpanel ] && /etc/uci-defaults/sunpanel && rm -f /etc/uci-defaults/sunpanel
fi
endef
define Build/Configure
endef
@@ -47,12 +54,13 @@ define Build/Compile
endef
define Package/$(PKG_NAME)/install
$(INSTALL_DIR) $(1)/usr/sbin $(1)/etc/init.d $(1)/etc/config $(1)/usr/libexec/istorec $(1)/usr/share/sunpanel
$(INSTALL_DIR) $(1)/usr/sbin $(1)/etc/init.d $(1)/etc/config $(1)/usr/libexec/istorec $(1)/usr/share/sunpanel $(1)/etc/uci-defaults
$(INSTALL_BIN) $(PKG_BUILD_DIR)/sunpanelbin.$(PKG_ARCH_sunpanel) $(1)/usr/sbin/sunpanelbin
$(INSTALL_BIN) ./files/sunpanel.init $(1)/etc/init.d/sunpanel
$(CP) ./files/sunpanel_conf.lua $(1)/usr/libexec/istorec/
$(CP) ./files/conf.temp $(1)/usr/share/sunpanel/
$(INSTALL_CONF) ./files/sunpanel.config $(1)/etc/config/sunpanel
$(INSTALL_BIN) ./files/sunpanel.uci-default $(1)/etc/uci-defaults/sunpanel
endef
$(eval $(call BuildPackage,$(PKG_NAME)))

View File

@@ -0,0 +1,13 @@
#!/bin/sh
uci -q batch <<-EOF >/dev/null
delete ucitrack.@sunpanel[-1]
add ucitrack sunpanel
set ucitrack.@sunpanel[-1].init=sunpanel
commit ucitrack
EOF
/etc/init.d/sunpanel enable
exit 0