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_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
15 PKG_SOURCE_URL:=ftp://ftp.openbsd.org/pub/OpenBSD/OpenSSH/portable/ \
16 ftp://openbsd.wiretapped.net/pub/OpenBSD/OpenSSH/portable/ \
17 ftp://ftp.belnet.be/packages/openbsd/OpenSSH/portable/ \
18 ftp://ftp.de.openbsd.org/pub/unix/OpenBSD/OpenSSH/portable/
19 PKG_MD5SUM:=13563dbf61f36ca9a1e4254260131041
21 PKG_BUILD_DEPENDS:=libopenssl
23 include $(INCLUDE_DIR)/package.mk
25 define Package/openssh-client
28 DEPENDS:=+libopenssl +zlib
30 URL:=http://www.openssh.com/
34 define Package/openssh-client/description
38 define Package/openssh-client/conffiles
42 define Package/openssh-client-utils
45 DEPENDS:=openssh-client
46 TITLE:=OpenSSH client utilities
47 URL:=http://www.openssh.com/
51 define Package/openssh-client-utils/description
52 OpenSSH client utilities.
55 define Package/openssh-server
58 DEPENDS:=+libopenssl +zlib
60 URL:=http://www.openssh.com/
64 define Package/openssh-server/description
68 define Package/openssh-server/conffiles
72 define Package/openssh-sftp-client
75 DEPENDS:=+libopenssl +zlib
76 TITLE:=OpenSSH SFTP client
77 URL:=http://www.openssh.com/
81 define Package/openssh-sftp-client/description
85 define Package/openssh-sftp-server
89 TITLE:=OpenSSH SFTP server
90 URL:=http://www.openssh.com/
94 define Package/openssh-sftp-server/description
99 $(DISABLE_LARGEFILE) \
101 --sysconfdir=/etc/ssh \
106 --disable-etc-default-login \
113 --without-kerberos5 \
117 ifneq ($(CONFIG_SSP_SUPPORT),y)
119 --without-stackprotect
122 CONFIGURE_VARS += LD="$(TARGET_CC)"
125 rm -rf $(PKG_INSTALL_DIR)
126 mkdir -p $(PKG_INSTALL_DIR)
127 $(MAKE) -C $(PKG_BUILD_DIR) \
128 DESTDIR="$(PKG_INSTALL_DIR)" \
131 $(MAKE) -C $(PKG_BUILD_DIR) \
132 DESTDIR="$(PKG_INSTALL_DIR)" \
137 define Package/openssh-client/install
138 $(INSTALL_DIR) $(1)/etc/ssh
139 chmod 0700 $(1)/etc/ssh
140 $(CP) $(PKG_INSTALL_DIR)/etc/ssh/ssh_config $(1)/etc/ssh/
141 $(INSTALL_DIR) $(1)/usr/bin
142 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/ssh $(1)/usr/bin/
143 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/scp $(1)/usr/bin/
146 define Package/openssh-client-utils/install
147 $(INSTALL_DIR) $(1)/usr/bin
148 $(INSTALL_BIN) $(foreach bin,add agent keyscan keysign,$(PKG_BUILD_DIR)/ssh-$(bin)) $(1)/usr/bin/
151 define Package/openssh-server/install
152 $(INSTALL_DIR) $(1)/etc/ssh
153 chmod 0700 $(1)/etc/ssh
154 $(CP) $(PKG_INSTALL_DIR)/etc/ssh/sshd_config $(1)/etc/ssh/
155 $(INSTALL_DIR) $(1)/etc/init.d
156 $(INSTALL_BIN) ./files/sshd.init $(1)/etc/init.d/sshd
157 $(INSTALL_DIR) $(1)/usr/bin
158 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/ssh-keygen $(1)/usr/bin/
159 $(INSTALL_DIR) $(1)/usr/sbin
160 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/sshd $(1)/usr/sbin/
163 define Package/openssh-server/postinst
169 # do not change below
170 # check if we are on real system
171 if [ -z "$${IPKG_INSTROOT}" ]; then
172 # create copies of passwd and group, if we use squashfs
173 rootfs=`mount |awk '/root/ { print $$5 }'`
174 if [ "$$rootfs" = "squashfs" ]; then
175 if [ -h /etc/group ]; then
177 cp /rom/etc/group /etc/group
179 if [ -h /etc/passwd ]; then
181 cp /rom/etc/passwd /etc/passwd
187 if [ -z "$$(grep ^\\$${name}: $${IPKG_INSTROOT}/etc/group)" ]; then
188 echo "adding group $$name to /etc/group"
189 echo "$${name}:x:$${id}:" >> $${IPKG_INSTROOT}/etc/group
192 if [ -z "$$(grep ^\\$${name}: $${IPKG_INSTROOT}/etc/passwd)" ]; then
193 echo "adding user $$name to /etc/passwd"
194 echo "$${name}:x:$${id}:$${id}:$${name}:/var/empty/.$${name}:/bin/false" >> $${IPKG_INSTROOT}/etc/passwd
197 grep -q '^ssh[[:space:]]*22/tcp' $${IPKG_INSTROOT}/etc/services 2>/dev/null
198 if [ $$? -ne 0 ]; then
199 echo "ssh 22/tcp" >>$${IPKG_INSTROOT}/etc/services
203 define Package/openssh-sftp-client/install
204 $(INSTALL_DIR) $(1)/usr/bin
205 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/sftp $(1)/usr/bin/
208 define Package/openssh-sftp-server/install
209 $(INSTALL_DIR) $(1)/usr/lib
210 $(CP) $(PKG_INSTALL_DIR)/usr/lib/sftp-server $(1)/usr/lib/
211 $(INSTALL_DIR) $(1)/usr/libexec
212 ln -sf ../lib/sftp-server $(1)/usr/libexec/sftp-server
215 $(eval $(call BuildPackage,openssh-client))
216 $(eval $(call BuildPackage,openssh-client-utils))
217 $(eval $(call BuildPackage,openssh-server))
218 $(eval $(call BuildPackage,openssh-sftp-client))
219 $(eval $(call BuildPackage,openssh-sftp-server))