--- feeds/jlars/sound/shairport/Makefile.orig	2011-08-10 18:30:45.000000000 +0200
+++ feeds/jlars/sound/shairport/Makefile	2011-08-10 18:32:10.000000000 +0200
@@ -32,7 +32,7 @@

 define Package/shairport
   $(Package/shairport/Default)
-  DEPENDS:= +libopenssl +libao +avahi-daemon-dbus +avahi-utils
+  DEPENDS:= +libopenssl +libao +avahi-utils
 endef

 define Package/shairport/description
@@ -64,12 +64,20 @@
 define Package/shairport/install
 	$(INSTALL_DIR) $(1)/usr/bin
 	$(INSTALL_BIN) $(PKG_BUILD_DIR)/{hairtunes,shairport} $(1)/usr/bin/
+	$(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
 
 
 define Package/shairport-perl/install
 	$(INSTALL_DIR) $(1)/usr/bin
 	$(INSTALL_BIN) $(PKG_BUILD_DIR)/shairport.pl $(1)/usr/bin/
+	$(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
 
 
--- /dev/null	2011-07-03 02:34:29.163655238 +0200
+++ feeds/jlars/sound/shairport/files/shairport.config	2011-08-10 18:27:00.000000000 +0200
@@ -0,0 +1,3 @@
+config 'shairport'
+	option apname		'@HOSTNAME@'
+	option enabled		'1'
--- /dev/null	2011-07-03 02:34:29.163655238 +0200
+++ feeds/jlars/sound/shairport/files/shairport-perl.config	2011-08-10 18:27:00.000000000 +0200
@@ -0,0 +1,3 @@
+config 'shairport'
+	option apname		'@HOSTNAME@'
+	option enabled		'1'
--- /dev/null	2011-07-03 02:34:29.163655238 +0200
+++ feeds/jlars/sound/shairport/files/shairport.init	2011-08-10 18:29:21.000000000 +0200
@@ -0,0 +1,29 @@
+#!/bin/sh /etc/rc.common
+# Copyright (C) 2008 OpenWrt.org
+START=75
+
+NAME=shairport
+PROG=/usr/bin/$NAME
+
+start_service() {
+	local section="$1"
+	local apname
+	config_get apname "$section" apname
+	config_get_bool "enabled" "$section" "enabled" '1'
+
+	myap=`echo "$apname" | tr "a-z" "A-Z"`
+	if [ $myap == "@HOSTNAME@" ] ; then
+		apname=`cat /proc/sys/kernel/hostname`
+	fi
+
+	[ "$enabled" -gt 0 ] && $PROG -a $apname -d
+}
+start() {
+	config_load "shairport"
+	config_foreach start_service "shairport"
+}
+
+stop() {
+	killall avahi-publish-service
+	killall $NAME
+}
--- /dev/null	2011-07-03 02:34:29.163655238 +0200
+++ feeds/jlars/sound/shairport/files/shairport-perl.init	2011-08-10 18:33:10.000000000 +0200
@@ -0,0 +1,29 @@
+#!/bin/sh /etc/rc.common
+# Copyright (C) 2008 OpenWrt.org
+START=75
+
+NAME=shairport.pl
+PROG=/usr/bin/$NAME
+
+start_service() {
+	local section="$1"
+	local apname
+	config_get apname "$section" apname
+	config_get_bool "enabled" "$section" "enabled" '1'
+
+	myap=`echo "$apname" | tr "a-z" "A-Z"`
+	if [ $myap == "@HOSTNAME@" ] ; then
+		apname=`cat /proc/sys/kernel/hostname`
+	fi
+
+	[ "$enabled" -gt 0 ] && $PROG -a $apname -d
+}
+start() {
+	config_load "shairport"
+	config_foreach start_service "shairport"
+}
+
+stop() {
+	killall avahi-publish-service
+	killall $NAME
+}
--- /dev/null	2011-07-03 02:34:29.163655238 +0200
+++ feeds/jlars/sound/shairport/patches/101-ipv4only.patch	2011-08-10 18:33:10.000000000 +0200
@@ -0,0 +1,11 @@
+--- a/socketlib.c.orig    2012-12-31 15:31:53.736583787 +0000
++++ b/socketlib.c 2012-12-31 13:11:15.682191450 +0000
+@@ -159,7 +159,7 @@
+     int tFamily = AF_INET;
+     #ifdef AF_INET6
+     //printf("Listening on IPv6 Socket\n");
+-    tFamily = AF_INET6;
++    //tFamily = AF_INET6;
+     #else
+     //printf("Listening on IPv4 Socket");
+     #endif
