openssh: do not touch /etc/services
[openwrt/svn-archive/archive.git] / net / openssh / Makefile
1 #
2 # Copyright (C) 2006,2008 OpenWrt.org
3 #
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
6 #
7
8 include $(TOPDIR)/rules.mk
9
10 PKG_NAME:=openssh
11 PKG_VERSION:=5.8p1
12 PKG_RELEASE:=1
13
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:=86f5e1c23b4c4845f23b9b7b493fb53d
20
21 PKG_BUILD_DEPENDS:=libopenssl
22
23 include $(INCLUDE_DIR)/package.mk
24
25 define Package/openssh/Default
26 SECTION:=net
27 CATEGORY:=Network
28 DEPENDS:=+libopenssl +zlib +libgcc
29 TITLE:=OpenSSH
30 MAINTAINER:=Peter Wagner <tripolar@gmx.at>
31 URL:=http://www.openssh.com/
32 SUBMENU:=SSH
33 endef
34
35 define Package/openssh-client
36 $(call Package/openssh/Default)
37 TITLE+= client
38 endef
39
40 define Package/openssh-client/description
41 OpenSSH client.
42 endef
43
44 define Package/openssh-client/conffiles
45 /etc/ssh/ssh_config
46 endef
47
48 define Package/openssh-client-utils
49 $(call Package/openssh/Default)
50 DEPENDS+= +openssh-client +openssh-keygen
51 TITLE+= client utilities
52 endef
53
54 define Package/openssh-client-utils/description
55 OpenSSH client utilities.
56 endef
57
58 define Package/openssh-keygen
59 $(call Package/openssh/Default)
60 TITLE+= keygen
61 endef
62
63 define Package/openssh-keygen/description
64 OpenSSH keygen.
65 endef
66
67 define Package/openssh-server
68 $(call Package/openssh/Default)
69 DEPENDS+= +openssh-keygen
70 TITLE+= server
71 endef
72
73 define Package/openssh-server/description
74 OpenSSH server.
75 endef
76
77 define Package/openssh-server/conffiles
78 /etc/ssh/sshd_config
79 endef
80
81 define Package/openssh-sftp-client
82 $(call Package/openssh/Default)
83 TITLE+= SFTP client
84 endef
85
86 define Package/openssh-sftp-client/description
87 OpenSSH SFTP client.
88 endef
89
90 define Package/openssh-sftp-server
91 $(call Package/openssh/Default)
92 DEPENDS:=+libgcc
93 TITLE+= SFTP server
94 endef
95
96 define Package/openssh-sftp-server/description
97 OpenSSH SFTP server.
98 endef
99
100 CONFIGURE_ARGS+= \
101 $(DISABLE_NLS) \
102 --sysconfdir=/etc/ssh \
103 --enable-shared \
104 --disable-static \
105 --disable-debug \
106 --disable-strip \
107 --disable-etc-default-login \
108 --disable-lastlog \
109 --disable-utmp \
110 --disable-utmpx \
111 --disable-wtmp \
112 --disable-wtmpx \
113 --without-bsd-auth \
114 --without-kerberos5 \
115 --without-pam \
116 --without-x
117
118 ifneq ($(CONFIG_SSP_SUPPORT),y)
119 CONFIGURE_ARGS += \
120 --without-stackprotect
121 endif
122
123 CONFIGURE_VARS += LD="$(TARGET_CC)"
124
125 define Build/Compile
126 $(MAKE) -C $(PKG_BUILD_DIR) \
127 DESTDIR="$(PKG_INSTALL_DIR)" \
128 LIBS="" \
129 sftp-server
130 $(MAKE) -C $(PKG_BUILD_DIR) \
131 DESTDIR="$(PKG_INSTALL_DIR)" \
132 STRIP_OPT="" \
133 all install
134 endef
135
136 define Package/openssh-client/install
137 $(INSTALL_DIR) $(1)/etc/ssh
138 chmod 0700 $(1)/etc/ssh
139 $(CP) $(PKG_INSTALL_DIR)/etc/ssh/ssh_config $(1)/etc/ssh/
140 $(INSTALL_DIR) $(1)/usr/bin
141 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/ssh $(1)/usr/bin/
142 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/scp $(1)/usr/bin/
143 endef
144
145 define Package/openssh-client-utils/install
146 $(INSTALL_DIR) $(1)/usr/bin
147 $(INSTALL_BIN) $(foreach bin,add agent keyscan keysign,$(PKG_BUILD_DIR)/ssh-$(bin)) $(1)/usr/bin/
148 endef
149
150 define Package/openssh-keygen/install
151 $(INSTALL_DIR) $(1)/usr/bin
152 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/ssh-keygen $(1)/usr/bin/
153 endef
154
155
156 define Package/openssh-server/install
157 $(INSTALL_DIR) $(1)/etc/ssh
158 chmod 0700 $(1)/etc/ssh
159 $(CP) $(PKG_INSTALL_DIR)/etc/ssh/sshd_config $(1)/etc/ssh/
160 $(INSTALL_DIR) $(1)/etc/init.d
161 $(INSTALL_BIN) ./files/sshd.init $(1)/etc/init.d/sshd
162 $(INSTALL_DIR) $(1)/usr/sbin
163 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/sshd $(1)/usr/sbin/
164 endef
165
166 define Package/openssh-server/postinst
167 #!/bin/sh
168
169 name=sshd
170 id=22
171
172 if [ -z "$$(grep ^\\$${name}: $${IPKG_INSTROOT}/etc/group)" ]; then
173 echo "adding group $$name to /etc/group"
174 echo "$${name}:x:$${id}:" >> $${IPKG_INSTROOT}/etc/group
175 fi
176
177 if [ -z "$$(grep ^\\$${name}: $${IPKG_INSTROOT}/etc/passwd)" ]; then
178 echo "adding user $$name to /etc/passwd"
179 echo "$${name}:x:$${id}:$${id}:$${name}:/var/empty/.$${name}:/bin/false" >> $${IPKG_INSTROOT}/etc/passwd
180 fi
181 endef
182
183 define Package/openssh-sftp-client/install
184 $(INSTALL_DIR) $(1)/usr/bin
185 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/sftp $(1)/usr/bin/
186 endef
187
188 define Package/openssh-sftp-server/install
189 $(INSTALL_DIR) $(1)/usr/lib
190 $(CP) $(PKG_INSTALL_DIR)/usr/lib/sftp-server $(1)/usr/lib/
191 $(INSTALL_DIR) $(1)/usr/libexec
192 ln -sf ../lib/sftp-server $(1)/usr/libexec/sftp-server
193 endef
194
195 $(eval $(call BuildPackage,openssh-client))
196 $(eval $(call BuildPackage,openssh-client-utils))
197 $(eval $(call BuildPackage,openssh-keygen))
198 $(eval $(call BuildPackage,openssh-server))
199 $(eval $(call BuildPackage,openssh-sftp-client))
200 $(eval $(call BuildPackage,openssh-sftp-server))