shairport: Update to latest version and switch to procd
authorFlorian Fainelli <florian@openwrt.org>
Tue, 20 May 2014 04:51:19 +0000 (04:51 +0000)
committerFlorian Fainelli <florian@openwrt.org>
Tue, 20 May 2014 04:51:19 +0000 (04:51 +0000)
Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
[florian: fix subject and message]
Signed-off-by: Florian Fainelli <florian@openwrt.org>
SVN-Revision: 40785

multimedia/shairport/Makefile
multimedia/shairport/files/shairport.config
multimedia/shairport/files/shairport.init

index b722dd429762e3012d9fd8d12aeed1c67f0432ba..c66a9daf7f4ae85b7ef064daf56e8bf05595ecd3 100644 (file)
@@ -8,13 +8,13 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=shairport
-PKG_VERSION:=2013-10-26
+PKG_VERSION:=2014-05-08
 PKG_RELEASE:=$(PKG_SOURCE_VERSION)
 
 PKG_SOURCE_PROTO:=git
 PKG_SOURCE_URL:=git://github.com/abrasive/shairport.git
 PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
-PKG_SOURCE_VERSION:=b2c7bf111c1446739af9411d8a35acd9b6581b06
+PKG_SOURCE_VERSION:=078b21043cdcef6ffad7452db27f036770b23b0c
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
 
 include $(INCLUDE_DIR)/package.mk
@@ -51,7 +51,7 @@ define Package/shairport/install
        $(INSTALL_DIR) $(1)/etc/init.d/
        $(INSTALL_BIN) files/shairport.init $(1)/etc/init.d/shairport
        $(INSTALL_DIR) $(1)/etc/config
-       $(INSTALL_DATA) files/shairport.config $(1)/etc/config/shairport
+       $(INSTALL_CONF) files/shairport.config $(1)/etc/config/shairport
 endef
 
 $(eval $(call BuildPackage,shairport))
index 83ba69299c56930602a2ecc037ba3554141f6776..74e67cb9c419e8d2a22306cc0b96a7bc0ab3fee4 100644 (file)
@@ -1,3 +1,11 @@
 config shairport
-       option name     'AirPort'
-       option buffer   '256'
+       option name 'AirPort'
+       option password ''
+       option port '5002'
+       option buffer '256'
+       option log '/var/log/shairport'
+       option cmd_start ''
+       option cmd_stop ''
+       option cmd_wait '0'
+       option audio_output ''
+       option mdns ''
index f05f7d6d06565f01983c429cf79c65dcf696e85d..2136bc26c4d27b5b911b2b9257153492a3a05d09 100644 (file)
@@ -1,34 +1,53 @@
 #!/bin/sh /etc/rc.common
-START=80
+# Copyright (C) 2013-2014 OpenWrt.org
 
-DAEMON="/usr/sbin/shairport"
+START=50
+USE_PROCD=1
 
 config_shairport() {
        local cfg="$1"
-       local args=""
 
-       config_get name "$cfg" name
-       config_get port "$cfg" port
-       config_get buffer "$cfg" buffer
-
-       [ -z $name ] && name="AirPort"
-       args="$args -a $name"
-
-       [ ! -z "$port" ] && args="$args -p $port"
-
-       [ -z $buffer ] && buffer="256"
-       args="$args -b $buffer"
-
-       args="$args -d"
-
-       service_start $DAEMON $args
+       local cfg_name
+       local cfg_password
+       local cfg_port
+       local cfg_buffer
+       local cfg_log
+       local cfg_cmd_start
+       local cfg_cmd_stop
+       local cfg_cmd_wait
+       local cfg_audio_output
+       local cfg_mdns
+
+       config_get cfg_name $cfg 'name' 'AirPort'
+       config_get cfg_password $cfg 'password' ''
+       config_get cfg_port $cfg 'port' '5002'
+       config_get cfg_buffer $cfg 'buffer' '256'
+       config_get cfg_log $cfg 'log' '/var/log/shairport'
+       config_get cfg_cmd_start $cfg 'cmd_start' ''
+       config_get cfg_cmd_stop $cfg 'cmd_stop' ''
+       config_get_bool cfg_cmd_wait $cfg 'cmd_wait' '0'
+       config_get cfg_audio_output $cfg 'audio_output' ''
+       config_get cfg_mdns $cfg 'mdns' ''
+
+       procd_open_instance
+
+       procd_set_param command /usr/sbin/shairport
+       procd_append_param command -a "$cfg_name"
+       [ ! -z "$cfg_password" ] && procd_append_param command -k "$cfg_password"
+       procd_append_param command -p $cfg_port
+       procd_append_param command -b $cfg_buffer
+       procd_append_param command -l $cfg_log
+       [ ! -z "$cfg_cmd_start" ] && procd_append_param command -B "$cfg_cmd_start"
+       [ ! -z "$cfg_cmd_stop" ] && procd_append_param command -E "$cfg_cmd_stop"
+       [ "$cfg_cmd_wait" -eq 1 ] && procd_append_param command -w
+       [ ! -z "$cfg_audio_output" ] && procd_append_param command -o "$cfg_audio_output"
+       [ ! -z "$cfg_mdns" ] && procd_append_param command -m "$cfg_mdns"
+
+       procd_set_param respawn
+       procd_close_instance
 }
 
-start() {
+start_service() {
        config_load shairport
        config_foreach config_shairport shairport
 }
-
-stop() {
-       service_stop $DAEMON
-}