Tizen 2.0 Release
[external/openssh.git] / packaging / openssh.spec
1 #sbs-git:slp/pkgs/o/openssh openssh 5.3p1 6697e2ccd917ab2ce8628f7b246b4bb90c93dd02
2 Summary: The OpenSSH implementation of SSH protocol versions 1 and 2
3 Name: openssh
4 Version: 5.3p1
5 Release: 2
6 URL: http://www.openssh.com/portable.html
7 Source0: openssh-%{version}.tar.gz
8 Source1: ssh-argv0
9 Source2: ssh-argv0.1
10 Source3: openssh-server.default
11 Source4: openssh-server.if-up
12 Source5: openssh-server.init
13 Source6: sshd_config
14 License: BSD
15 Group: Applications/Internet
16 BuildRequires: pkgconfig(zlib)
17 BuildRequireS: pkgconfig(openssl)
18 BuildRequireS: pkgconfig(libcrypto)
19
20
21 %package client
22 Summary: secure shell (SSH) client, for secure access to remote machines
23 Group: Applications/Internet
24 Requires: openssl >= 0.9.8
25 Provides: rsh-client, ssh-client
26
27
28 %package server
29 Summary: secure shell (SSH) server, for secure access from remote machines
30 Group: System/Daemons
31 Requires: openssh-client = %{version}-%{release}
32 Requires: lsb, procps
33 Provides: ssh-server
34
35
36 %description
37 SSH (Secure SHell) is a program for logging into and executing
38 commands on a remote machine. SSH is intended to replace rlogin and
39 rsh, and to provide secure encrypted communications between two
40 untrusted hosts over an insecure network. X11 connections and
41 arbitrary TCP/IP ports can also be forwarded over the secure channel.
42
43 OpenSSH is OpenBSD's version of the last free version of SSH, bringing
44 it up to date in terms of security and features, as well as removing
45 all patented algorithms to separate libraries.
46
47 This package includes the core files necessary for both the OpenSSH
48 client and server. To make this package useful, you should also
49 install openssh-clients, openssh-server, or both.
50
51 %description client
52 OpenSSH is a free version of SSH (Secure SHell), a program for logging
53 into and executing commands on a remote machine. This package includes
54 the clients necessary to make encrypted connections to SSH servers.
55 You'll also need to install the openssh package on OpenSSH clients.
56
57 %description server
58 OpenSSH is a free version of SSH (Secure SHell), a program for logging
59 into and executing commands on a remote machine. This package contains
60 the secure shell daemon (sshd). The sshd daemon allows SSH clients to
61 securely connect to your SSH server. You also need to have the openssh
62 package installed.
63
64
65 %prep
66 %setup -q
67
68 %build
69
70 mkdir -p build-tmp
71 cd build-tmp 
72
73 ../configure \
74         --prefix=/usr --sysconfdir=/etc/ssh \
75         --libexecdir=/usr/lib/openssh \
76         --mandir=/usr/share/man \
77         --disable-strip --with-mantype=doc --with-4in6 \
78         --with-privsep-path=/var/run/sshd --without-rand-helper \
79         --without-xauth \
80         --with-default-path=/usr/local/bin:/usr/bin:/bin:/usr/bin/X11:/usr/games \
81         --with-superuser-path=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/bin/X11 \
82         --with-cflags='-O2   -DLOGIN_PROGRAM=\"/bin/login\" -DLOGIN_NO_ENDOPT ' \
83         --with-ldflags='-Wl,--as-needed'
84
85 make -C . -j 2 ASKPASS_PROGRAM='/usr/bin/ssh-askpass'
86
87
88
89 %install
90 rm -rf %{buildroot}
91
92 make -C build-tmp DESTDIR=%{buildroot} install-nokeys
93 rm -f %{buildroot}/etc/ssh/sshd_config
94 rm -f %{buildroot}/usr/share/Ssh.bin
95
96 mkdir -p %{buildroot}/etc/init.d
97 mkdir -p %{buildroot}/etc/default
98 mkdir -p %{buildroot}/etc/network/if-up.d
99
100 install -m 755 contrib/ssh-copy-id %{buildroot}/usr/bin/ssh-copy-id
101 install -m 644 -c contrib/ssh-copy-id.1 %{buildroot}/usr/share/man/man1/ssh-copy-id.1
102 install -m 755 %{_sourcedir}/ssh-argv0 %{buildroot}/usr/bin/ssh-argv0
103 install -m 644 %{_sourcedir}/ssh-argv0.1 %{buildroot}/usr/share/man/man1/ssh-argv0.1
104 install  %{_sourcedir}/openssh-server.init %{buildroot}/etc/init.d/ssh
105 install -m 644 %{_sourcedir}/openssh-server.default %{buildroot}/etc/default/ssh
106 install  %{_sourcedir}/openssh-server.if-up %{buildroot}/etc/network/if-up.d/openssh-server
107
108 sed -i '/\$$OpenBSD:/d' \
109         %{buildroot}/etc/ssh/moduli \
110         %{buildroot}/etc/ssh/ssh_config
111
112 mkdir -p %{buildroot}/etc/rc.d/init.d/
113 ln -s ../../init.d/ssh %{buildroot}/etc/rc.d/init.d/opensshd
114
115 install -m 600 %{_sourcedir}/sshd_config %{buildroot}/etc/ssh/sshd_config
116
117
118 %remove_docs
119
120 %pre server
121
122 %post server
123 create_key() {
124         msg="$1"
125         shift
126         hostkeys="$1"
127         shift
128         file="$1"
129         shift
130
131         if echo "$hostkeys" | grep "^$file\$" >/dev/null && \
132            [ ! -f "$file" ] ; then
133                 echo -n $msg
134                 ssh-keygen -q -f "$file" -N '' "$@"
135                 echo
136                 if which restorecon >/dev/null 2>&1; then
137                         restorecon "$file.pub"
138                 fi
139         fi
140 }
141
142
143 create_keys() {
144         hostkeys="$(host_keys_required)"
145
146         create_key "Creating SSH1 key; this may take some time ..." \
147                 "$hostkeys" /etc/ssh/ssh_host_key -t rsa1
148
149         create_key "Creating SSH2 RSA key; this may take some time ..." \
150                 "$hostkeys" /etc/ssh/ssh_host_rsa_key -t rsa
151         create_key "Creating SSH2 DSA key; this may take some time ..." \
152                 "$hostkeys" /etc/ssh/ssh_host_dsa_key -t dsa
153 }
154
155 create_keys
156
157
158 %postun server
159
160 %preun server
161
162
163
164 %files client
165 /etc/ssh/moduli
166 /etc/ssh/ssh_config
167 %{_bindir}/scp
168 %{_bindir}/sftp
169 %{_bindir}/slogin
170 %{_bindir}/ssh
171 %{_bindir}/ssh-*
172 %{_libdir}/openssh/ssh-keysign
173
174
175 %files server
176 /etc/default/ssh
177 /etc/init.d/ssh
178 /etc/network/if-up.d/openssh-server
179 /etc/rc.d/init.d/opensshd
180 /etc/ssh/sshd_config
181 %{_libdir}/openssh/sftp-server
182 %{_prefix}/sbin/sshd
183