2 # Copyright (C) 2006,2008 OpenWrt.org
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
8 include $(TOPDIR)/rules.mk
14 PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
15 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
16 PKG_SOURCE_URL:=ftp://ftp.openbsd.org/pub/OpenBSD/OpenSSH/portable/ \
17 ftp://openbsd.wiretapped.net/pub/OpenBSD/OpenSSH/portable/ \
18 ftp://ftp.belnet.be/packages/openbsd/OpenSSH/portable/ \
19 ftp://ftp.de.openbsd.org/pub/unix/OpenBSD/OpenSSH/portable/
20 PKG_MD5SUM:=1f1dfaa775f33dd3328169de9bdc292a
22 PKG_BUILD_DEPENDS:=libopenssl
24 include $(INCLUDE_DIR)/package.mk
26 define Package/openssh-client
29 DEPENDS:=+libopenssl +zlib
31 URL:=http://www.openssh.com/
35 define Package/openssh-client/description
39 define Package/openssh-client/conffiles
43 define Package/openssh-client-utils
46 DEPENDS:=openssh-client
47 TITLE:=OpenSSH client utilities
48 URL:=http://www.openssh.com/
52 define Package/openssh-client-utils/description
53 OpenSSH client utilities.
56 define Package/openssh-server
59 DEPENDS:=+libopenssl +zlib
61 URL:=http://www.openssh.com/
65 define Package/openssh-server/description
69 define Package/openssh-server/conffiles
73 define Package/openssh-sftp-client
76 DEPENDS:=+libopenssl +zlib
77 TITLE:=OpenSSH SFTP client
78 URL:=http://www.openssh.com/
82 define Package/openssh-sftp-client/description
86 define Package/openssh-sftp-server
90 TITLE:=OpenSSH SFTP server
91 URL:=http://www.openssh.com/
95 define Package/openssh-sftp-server/description
100 $(DISABLE_LARGEFILE) \
102 --sysconfdir=/etc/ssh \
107 --disable-etc-default-login \
114 --without-kerberos5 \
118 ifneq ($(CONFIG_SSP_SUPPORT),y)
120 --without-stackprotect
123 CONFIGURE_VARS += LD="$(TARGET_CC)"
126 rm -rf $(PKG_INSTALL_DIR)
127 mkdir -p $(PKG_INSTALL_DIR)
128 $(MAKE) -C $(PKG_BUILD_DIR) \
129 DESTDIR="$(PKG_INSTALL_DIR)" \
132 $(MAKE) -C $(PKG_BUILD_DIR) \
133 DESTDIR="$(PKG_INSTALL_DIR)" \
138 define Package/openssh-client/install
139 $(INSTALL_DIR) $(1)/etc/ssh
140 chmod 0700 $(1)/etc/ssh
141 $(CP) $(PKG_INSTALL_DIR)/etc/ssh/ssh_config $(1)/etc/ssh/
142 $(INSTALL_DIR) $(1)/usr/bin
143 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/ssh $(1)/usr/bin/
144 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/scp $(1)/usr/bin/
147 define Package/openssh-client-utils/install
148 $(INSTALL_DIR) $(1)/usr/bin
149 $(INSTALL_BIN) $(foreach bin,add agent keyscan keysign,$(PKG_BUILD_DIR)/ssh-$(bin)) $(1)/usr/bin/
152 define Package/openssh-server/install
153 $(INSTALL_DIR) $(1)/etc/ssh
154 chmod 0700 $(1)/etc/ssh
155 $(CP) $(PKG_INSTALL_DIR)/etc/ssh/sshd_config $(1)/etc/ssh/
156 $(INSTALL_DIR) $(1)/etc/init.d
157 $(INSTALL_BIN) ./files/sshd.init $(1)/etc/init.d/sshd
158 $(INSTALL_DIR) $(1)/usr/bin
159 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/ssh-keygen $(1)/usr/bin/
160 $(INSTALL_DIR) $(1)/usr/sbin
161 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/sshd $(1)/usr/sbin/
164 define Package/openssh-server/postinst
170 # do not change below
171 # check if we are on real system
172 if [ -z "$${IPKG_INSTROOT}" ]; then
173 # create copies of passwd and group, if we use squashfs
174 rootfs=`mount |awk '/root/ { print $$5 }'`
175 if [ "$$rootfs" = "squashfs" ]; then
176 if [ -h /etc/group ]; then
178 cp /rom/etc/group /etc/group
180 if [ -h /etc/passwd ]; then
182 cp /rom/etc/passwd /etc/passwd
188 if [ -z "$$(grep ^\\$${name}: $${IPKG_INSTROOT}/etc/group)" ]; then
189 echo "adding group $$name to /etc/group"
190 echo "$${name}:x:$${id}:" >> $${IPKG_INSTROOT}/etc/group
193 if [ -z "$$(grep ^\\$${name}: $${IPKG_INSTROOT}/etc/passwd)" ]; then
194 echo "adding user $$name to /etc/passwd"
195 echo "$${name}:x:$${id}:$${id}:$${name}:/var/empty/.$${name}:/bin/false" >> $${IPKG_INSTROOT}/etc/passwd
198 grep -q '^ssh[[:space:]]*22/tcp' $${IPKG_INSTROOT}/etc/services 2>/dev/null
199 if [ $$? -ne 0 ]; then
200 echo "ssh 22/tcp" >>$${IPKG_INSTROOT}/etc/services
204 define Package/openssh-sftp-client/install
205 $(INSTALL_DIR) $(1)/usr/bin
206 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/sftp $(1)/usr/bin/
209 define Package/openssh-sftp-server/install
210 $(INSTALL_DIR) $(1)/usr/lib
211 $(CP) $(PKG_INSTALL_DIR)/usr/lib/sftp-server $(1)/usr/lib/
212 $(INSTALL_DIR) $(1)/usr/libexec
213 ln -sf ../lib/sftp-server $(1)/usr/libexec/sftp-server
216 $(eval $(call BuildPackage,openssh-client))
217 $(eval $(call BuildPackage,openssh-client-utils))
218 $(eval $(call BuildPackage,openssh-server))
219 $(eval $(call BuildPackage,openssh-sftp-client))
220 $(eval $(call BuildPackage,openssh-sftp-server))