openssh: provide an avahi service file
authorMichael Heimpold <mhei@heimpold.de>
Mon, 8 Dec 2014 22:08:05 +0000 (23:08 +0100)
committerMichael Heimpold <mhei@heimpold.de>
Mon, 8 Dec 2014 22:15:25 +0000 (23:15 +0100)
As discussed in #543, we can announce the SFTP service via Avahi
when sftp-server is installed.

Signed-off-by: Michael Heimpold <mhei@heimpold.de>
net/openssh/Makefile
net/openssh/files/sftp-ssh.service [new file with mode: 0644]

index d4930f855abd76cc76c1410f134d4827f3110b78..055b0030e01b33161d384f3394fb421989a611ef 100644 (file)
@@ -1,5 +1,5 @@
 #
-# Copyright (C) 2006-2011 OpenWrt.org
+# Copyright (C) 2006-2014 OpenWrt.org
 #
 # This is free software, licensed under the GNU General Public License v2.
 # See /LICENSE for more information.
@@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
 
 PKG_NAME:=openssh
 PKG_VERSION:=6.7p1
-PKG_RELEASE:=2
+PKG_RELEASE:=3
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
 PKG_SOURCE_URL:=http://ftp.openbsd.org/pub/OpenBSD/OpenSSH/portable/ \
@@ -131,6 +131,21 @@ define Package/openssh-sftp-server/description
 OpenSSH SFTP server.
 endef
 
+define Package/openssh-sftp-avahi-service
+       $(call Package/openssh/Default)
+       TITLE+= (SFTP Avahi service)
+       DEPENDS:=+openssh-sftp-server +avahi-daemon
+endef
+
+define Package/openssh-sftp-avahi-service/description
+ This package contains the service definition for announcing
+ SFTP support via mDNS/DNS-SD.
+endef
+
+define Package/openssh-sftp-avahi-service/conffiles
+/etc/avahi/services/sftp-ssh.service
+endef
+
 CONFIGURE_ARGS+= \
        $(DISABLE_NLS) \
        --sysconfdir=/etc/ssh \
@@ -259,6 +274,11 @@ define Package/openssh-sftp-server/install
        ln -sf ../lib/sftp-server $(1)/usr/libexec/sftp-server
 endef
 
+define Package/openssh-sftp-avahi-service/install
+       $(INSTALL_DIR) $(1)/etc/avahi/services
+       $(INSTALL_DATA) ./files/sftp-ssh.service $(1)/etc/avahi/services/
+endef
+
 $(eval $(call BuildPackage,openssh-client))
 $(eval $(call BuildPackage,openssh-moduli))
 $(eval $(call BuildPackage,openssh-client-utils))
@@ -267,3 +287,4 @@ $(eval $(call BuildPackage,openssh-server))
 $(eval $(call BuildPackage,openssh-server-pam))
 $(eval $(call BuildPackage,openssh-sftp-client))
 $(eval $(call BuildPackage,openssh-sftp-server))
+$(eval $(call BuildPackage,openssh-sftp-avahi-service))
diff --git a/net/openssh/files/sftp-ssh.service b/net/openssh/files/sftp-ssh.service
new file mode 100644 (file)
index 0000000..17e0927
--- /dev/null
@@ -0,0 +1,9 @@
+<?xml version="1.0" standalone='no'?><!--*-nxml-*-->
+<!DOCTYPE service-group SYSTEM "avahi-service.dtd">
+<service-group>
+ <name replace-wildcards="yes">%h</name>
+  <service>
+   <type>_sftp-ssh._tcp</type>
+   <port>22</port>
+  </service>
+</service-group>