gmediaserver: migrate configuration to UCI
authorOliver Ertl <oliver@ertl-net.net>
Tue, 18 Sep 2007 17:08:11 +0000 (17:08 +0000)
committerOliver Ertl <oliver@ertl-net.net>
Tue, 18 Sep 2007 17:08:11 +0000 (17:08 +0000)
SVN-Revision: 8834

net/gmediaserver/Makefile
net/gmediaserver/files/gmediaserver.config [new file with mode: 0644]
net/gmediaserver/files/gmediaserver.default [deleted file]
net/gmediaserver/files/gmediaserver.init

index d463f55..a108bcf 100644 (file)
@@ -52,8 +52,8 @@ MAKE_FLAGS += \
 define Package/gmediaserver/install
        $(INSTALL_DIR) $(1)/usr/sbin
        $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/$(PKG_NAME) $(1)/usr/sbin/
 define Package/gmediaserver/install
        $(INSTALL_DIR) $(1)/usr/sbin
        $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/$(PKG_NAME) $(1)/usr/sbin/
-       $(INSTALL_DIR) $(1)/etc/default
-       $(INSTALL_DATA) ./files/$(PKG_NAME).default $(1)/etc/default/$(PKG_NAME)
+       $(INSTALL_DIR) $(1)/etc/config
+       $(INSTALL_DATA) ./files/$(PKG_NAME).config $(1)/etc/config/$(PKG_NAME)
        $(INSTALL_DIR) $(1)/etc/init.d
        $(INSTALL_BIN) ./files/$(PKG_NAME).init $(1)/etc/init.d/$(PKG_NAME)
 endef
        $(INSTALL_DIR) $(1)/etc/init.d
        $(INSTALL_BIN) ./files/$(PKG_NAME).init $(1)/etc/init.d/$(PKG_NAME)
 endef
diff --git a/net/gmediaserver/files/gmediaserver.config b/net/gmediaserver/files/gmediaserver.config
new file mode 100644 (file)
index 0000000..ba1fc9f
--- /dev/null
@@ -0,0 +1,3 @@
+config gmediaserver
+       option content_directory '/tmp'
+       option interface         'br-lan'
diff --git a/net/gmediaserver/files/gmediaserver.default b/net/gmediaserver/files/gmediaserver.default
deleted file mode 100644 (file)
index aef2f01..0000000
+++ /dev/null
@@ -1 +0,0 @@
-OPTIONS="--background --interface=br-lan --pid-file=$PID_F"
index dba14e4..4fc6067 100644 (file)
@@ -8,8 +8,17 @@ RUN_D=/var/run
 PID_F=$RUN_D/$BIN.pid
 
 start() {
 PID_F=$RUN_D/$BIN.pid
 
 start() {
-       [ -f $DEFAULT ] && . $DEFAULT
-       $BIN $OPTIONS
+       mkdir -p $RUN_D
+       config_load gmediaserver
+       config_foreach start_service gmediaserver
+}
+
+start_service() {
+       local cfg="$1"
+       config_get content_directory "$cfg" content_directory
+       config_get interface         "$cfg" interface
+
+       $BIN --background --interface=${interface:-br-lan} --pid-file=$PID_F ${content_directory:-/tmp}
 }
 
 stop() {
 }
 
 stop() {