proftpd/proftpd.spec

Wed, 08 Aug 2012 20:36:32 +0200

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 08 Aug 2012 20:36:32 +0200
changeset 494
fd1de0c7bc20
parent 182
42a8c8d745e6
permissions
-rw-r--r--

Modernize packaging and use parallel make.

michael@182 1 ##
michael@182 2 ## proftpd.spec -- OpenPKG RPM Package Specification
michael@182 3 ## Copyright (c) 2000-2009 OpenPKG Foundation e.V. <http://openpkg.net/>
michael@182 4 ##
michael@182 5 ## Permission to use, copy, modify, and distribute this software for
michael@182 6 ## any purpose with or without fee is hereby granted, provided that
michael@182 7 ## the above copyright notice and this permission notice appear in all
michael@182 8 ## copies.
michael@182 9 ##
michael@182 10 ## THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
michael@182 11 ## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
michael@182 12 ## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
michael@182 13 ## IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
michael@182 14 ## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
michael@182 15 ## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
michael@182 16 ## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
michael@182 17 ## USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
michael@182 18 ## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
michael@182 19 ## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
michael@182 20 ## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
michael@182 21 ## SUCH DAMAGE.
michael@182 22 ##
michael@182 23
michael@182 24 # package version
michael@182 25 %define V_proftpd 1.3.2
michael@182 26 %define V_mod_exec 0.9.6
michael@182 27 %define V_mod_otp 0.9.1
michael@182 28 %define V_mod_shaper 0.6.5
michael@182 29 %define V_mod_sql_sqlite 0.2
michael@182 30 %define V_mod_sql_odbc 0.3.2
michael@182 31 %define V_mod_time 2.2.1
michael@182 32 %define V_mod_vroot 0.8.5
michael@182 33 %define V_mod_gss 1.3.2
michael@182 34 %define V_mod_sftp 0.9.6
michael@182 35 %define V_mod_sftp_sql 0.1
michael@182 36 %define V_mod_md5 0.3.3
michael@182 37
michael@182 38 # package information
michael@182 39 Name: proftpd
michael@182 40 Summary: Professional FTP Daemon
michael@182 41 URL: http://www.proftpd.org/
michael@182 42 Vendor: The ProFTPD Project
michael@182 43 Packager: OpenPKG Foundation e.V.
michael@182 44 Distribution: OpenPKG Community
michael@182 45 Class: BASE
michael@182 46 Group: FTP
michael@182 47 License: GPL
michael@182 48 Version: %{V_proftpd}
michael@183 49 Release: 20090418
michael@182 50
michael@182 51 # package options
michael@182 52 %option with_ifsession no
michael@182 53 %option with_ctrls no
michael@182 54 %option with_radius no
michael@182 55 %option with_pam no
michael@182 56 %option with_mysql no
michael@182 57 %option with_pgsql no
michael@182 58 %option with_sqlite no
michael@182 59 %option with_odbc no
michael@182 60 %option with_ldap no
michael@182 61 %option with_skey no
michael@182 62 %option with_opie no
michael@182 63 %option with_kerberos no
michael@182 64 %option with_ssl no
michael@182 65 %option with_sftp no
michael@182 66 %option with_md5 no
michael@182 67
michael@182 68 # checking option conflicts
michael@182 69 %if "%{with_mysql}" == "yes" && "%{with_pgsql}" == "yes"
michael@182 70 %{error:build-time options 'with_mysql' and 'with_pgsql' conflict}
michael@182 71 %endif
michael@182 72
michael@182 73 # list of sources
michael@182 74 Source0: ftp://ftp.proftpd.org/distrib/source/proftpd-%{V_proftpd}.tar.bz2
michael@182 75 Source1: http://www.castaglia.net/proftpd/modules/proftpd-mod-exec-%{V_mod_exec}.tar.gz
michael@182 76 Source2: http://www.castaglia.net/proftpd/modules/proftpd-mod-otp-%{V_mod_otp}.tar.gz
michael@182 77 Source3: http://www.castaglia.net/proftpd/modules/proftpd-mod-shaper-%{V_mod_shaper}.tar.gz
michael@182 78 Source4: http://www.castaglia.net/proftpd/modules/proftpd-mod-sql-sqlite-%{V_mod_sql_sqlite}.tar.gz
michael@182 79 Source5: http://www.castaglia.net/proftpd/modules/proftpd-mod-sql-odbc-%{V_mod_sql_odbc}.tar.gz
michael@182 80 Source6: http://www.castaglia.net/proftpd/modules/proftpd-mod-time-%{V_mod_time}.tar.gz
michael@182 81 Source7: http://www.castaglia.net/proftpd/modules/proftpd-mod-vroot-%{V_mod_vroot}.tar.gz
michael@182 82 Source8: http://switch.dl.sourceforge.net/gssmod/mod_gss-%{V_mod_gss}.tar.gz
michael@182 83 Source9: http://www.castaglia.net/proftpd/modules/proftpd-mod-sftp-%{V_mod_sftp}.tar.gz
michael@182 84 Source10: http://www.castaglia.net/proftpd/modules/proftpd-mod-sftp-sql-%{V_mod_sftp_sql}.tar.gz
michael@182 85 Source11: http://www.castaglia.net/proftpd/modules/proftpd-mod-md5-%{V_mod_md5}.tar.gz
michael@182 86 Source12: proftpd.conf
michael@182 87 Source13: proftpd.msg.goaway
michael@182 88 Source14: proftpd.msg.login
michael@182 89 Source15: rc.proftpd
michael@182 90 Patch0: proftpd.patch
michael@182 91
michael@182 92 # build information
michael@182 93 Prefix: %{l_prefix}
michael@182 94 BuildRoot: %{l_buildroot}
michael@182 95 BuildPreReq: OpenPKG, openpkg >= 20060823, make
michael@182 96 PreReq: OpenPKG, openpkg >= 20060823
michael@182 97 BuildPreReq: ncurses, getopt
michael@182 98 PreReq: ncurses, getopt
michael@182 99 %if "%{with_mysql}" == "yes"
michael@182 100 BuildPreReq: mysql
michael@182 101 PreReq: mysql
michael@182 102 %endif
michael@182 103 %if "%{with_pam}" == "yes"
michael@182 104 BuildPreReq: PAM
michael@182 105 PreReq: PAM
michael@182 106 %endif
michael@182 107 %if "%{with_pgsql}" == "yes"
michael@182 108 BuildPreReq: postgresql, openssl
michael@182 109 PreReq: postgresql, openssl
michael@182 110 %endif
michael@182 111 %if "%{with_sqlite}" == "yes"
michael@182 112 BuildPreReq: sqlite
michael@182 113 PreReq: sqlite
michael@182 114 %endif
michael@182 115 %if "%{with_odbc}" == "yes"
michael@182 116 BuildPreReq: ODBC
michael@182 117 PreReq: ODBC
michael@182 118 %endif
michael@182 119 %if "%{with_ldap}" == "yes"
michael@182 120 BuildPreReq: openldap, openssl
michael@182 121 PreReq: openldap, openssl
michael@182 122 %endif
michael@182 123 %if "%{with_skey}" == "yes"
michael@182 124 BuildPreReq: skey
michael@182 125 PreReq: skey
michael@182 126 %endif
michael@182 127 %if "%{with_opie}" == "yes"
michael@182 128 BuildPreReq: opie
michael@182 129 PreReq: opie
michael@182 130 %endif
michael@182 131 %if "%{with_kerberos}" == "yes"
michael@182 132 BuildPreReq: KERBEROS
michael@182 133 PreReq: KERBEROS
michael@182 134 %endif
michael@182 135 %if "%{with_ssl}" == "yes" || "%{with_sftp}" == "yes"
michael@182 136 BuildPreReq: openssl
michael@182 137 PreReq: openssl
michael@182 138 %endif
michael@182 139 AutoReq: no
michael@182 140 AutoReqProv: no
michael@182 141
michael@182 142 %description
michael@182 143 ProFTPD grew out of the desire to have a secure and configurable
michael@182 144 FTP server, and out of a significant admiration of the Apache web
michael@182 145 server. There are currently a very limited number of FTP servers
michael@182 146 running on unix (or unix-like) hosts. The most commonly used server
michael@182 147 is probably wu-ftpd. While wu-ftpd provides excellent performance
michael@182 148 and is generally a good product, it lacks numerous features found
michael@182 149 in newer Win32 FTP servers, and has a poor security history. Many
michael@182 150 people, including the developers who work on ProFTPD have spent a
michael@182 151 great deal of time fixing bugs and hacking features into wu-ftpd.
michael@182 152 Unfortunately, it quickly became clear that a complete redesign was
michael@182 153 necessary in order to implement the configurability and features
michael@182 154 desired. ProFTPD is not a hack based on any other server, it's an
michael@182 155 independent source tree from the ground up. Click here for a small
michael@182 156 list of some of the sites ProFTPD powers -- many of them handling
michael@182 157 large volumes of traffic on a daily basis.
michael@182 158
michael@182 159 %track
michael@182 160 prog proftpd = {
michael@182 161 version = %{V_proftpd}
michael@182 162 url = ftp://ftp.proftpd.org/distrib/source/
michael@182 163 regex = proftpd-(\d+\.\d+\.\d+(?:rc\d+|[a-z]?))\.tar\.bz2
michael@182 164 }
michael@182 165 prog proftpd:mod_exec = {
michael@182 166 version = %{V_mod_exec}
michael@182 167 url = http://www.castaglia.net/proftpd/
michael@182 168 regex = proftpd-mod-exec-(__VER__)\.tar\.gz
michael@182 169 }
michael@182 170 prog proftpd:mod_shaper = {
michael@182 171 version = %{V_mod_shaper}
michael@182 172 url = http://www.castaglia.net/proftpd/
michael@182 173 regex = proftpd-mod-shaper-(__VER__)\.tar\.gz
michael@182 174 }
michael@182 175 prog proftpd:mod_sql_sqlite = {
michael@182 176 version = %{V_mod_sql_sqlite}
michael@182 177 url = http://www.castaglia.net/proftpd/
michael@182 178 regex = proftpd-mod-sql-sqlite-(__VER__)\.tar\.gz
michael@182 179 }
michael@182 180 prog proftpd:mod_sql_odbc = {
michael@182 181 version = %{V_mod_sql_odbc}
michael@182 182 url = http://www.castaglia.net/proftpd/
michael@182 183 regex = proftpd-mod-sql-odbc-(__VER__)\.tar\.gz
michael@182 184 }
michael@182 185 prog proftpd:mod_time = {
michael@182 186 version = %{V_mod_time}
michael@182 187 url = http://www.castaglia.net/proftpd/
michael@182 188 regex = proftpd-mod-time-(__VER__)\.tar\.gz
michael@182 189 }
michael@182 190 prog proftpd:mod_vroot = {
michael@182 191 version = %{V_mod_vroot}
michael@182 192 url = http://www.castaglia.net/proftpd/
michael@182 193 regex = proftpd-mod-vroot-(__VER__)\.tar\.gz
michael@182 194 }
michael@182 195 prog proftpd:mod_gss = {
michael@182 196 version = %{V_mod_gss}
michael@182 197 url = http://prdownloads.sourceforge.net/gssmod/
michael@182 198 regex = mod_gss-(__VER__)\.tar\.gz
michael@182 199 }
michael@182 200 prog proftpd:mod_sftp = {
michael@182 201 version = %{V_mod_sftp}
michael@182 202 url = http://www.castaglia.net/proftpd/
michael@182 203 regex = proftpd-mod-sftp-(__VER__)\.tar\.gz
michael@182 204 }
michael@182 205 prog proftpd:mod_sftp_sql = {
michael@182 206 version = %{V_mod_sftp_sql}
michael@182 207 url = http://www.castaglia.net/proftpd/
michael@182 208 regex = proftpd-mod-sftp-sql-(__VER__)\.tar\.gz
michael@182 209 }
michael@182 210 prog proftpd:mod_md5 = {
michael@182 211 version = %{V_mod_md5}
michael@182 212 url = http://www.castaglia.net/proftpd/
michael@182 213 regex = proftpd-mod-md5-(__VER__)\.tar\.gz
michael@182 214 }
michael@182 215
michael@182 216 %prep
michael@182 217 %setup -q
michael@182 218 %setup -q -D -T -a 1
michael@182 219 %setup -q -D -T -a 2
michael@182 220 %setup -q -D -T -a 3
michael@182 221 %setup -q -D -T -a 4
michael@182 222 %setup -q -D -T -a 5
michael@182 223 %setup -q -D -T -a 6
michael@182 224 %setup -q -D -T -a 7
michael@182 225 %setup -q -D -T -a 8
michael@182 226 %setup -q -D -T -a 9
michael@182 227 %setup -q -D -T -a 10
michael@182 228 %setup -q -D -T -a 11
michael@182 229 %patch -p0
michael@182 230
michael@182 231 %{l_shtool} subst \
michael@182 232 -e '/LINENO: error: C[+]* preprocessor/{N;N;N;N;s/.*/:/;}' \
michael@182 233 configure
michael@182 234
michael@182 235 # utils require to link with getopt
michael@182 236 %{l_shtool} subst \
michael@182 237 -e 's;\(\$(BUILD_FTPCOUNT_OBJS).*\);\1 %{l_ldflags} -lgetopt;g' \
michael@182 238 -e 's;\(\$(BUILD_FTPSHUT_OBJS).*\);\1 %{l_ldflags} -lgetopt;g' \
michael@182 239 -e 's;\(\$(BUILD_FTPTOP_OBJS).*\);\1 %{l_ldflags} -lgetopt;g' \
michael@182 240 -e 's;\(\$(BUILD_FTPWHO_OBJS).*\);\1 %{l_ldflags} -lgetopt;g' \
michael@182 241 Makefile.in
michael@182 242 %if "%{with_mysql}" == "yes"
michael@182 243 libs=`mysql_config --libs`
michael@182 244 # libmysqlclient may require more libraries
michael@182 245 %{l_shtool} subst \
michael@182 246 -e "s;\(-lmysqlclient\);$libs;g" \
michael@182 247 contrib/mod_sql_mysql.c
michael@182 248 %endif
michael@182 249
michael@182 250 # libpq also requires openssl
michael@182 251 # postgresql also doesn't provide its own include subdirectory
michael@182 252 %{l_shtool} subst \
michael@182 253 -e 's;\(-lpq\);\1 -lssl -lcrypto;g' \
michael@182 254 -e 's;^\(#include <\)pgsql/\(libpq-fe.h>.*\)$;\1postgresql/\2;' \
michael@182 255 contrib/mod_sql_postgres.c
michael@182 256
michael@182 257 # libldap also requires openssl
michael@182 258 %{l_shtool} subst \
michael@182 259 -e 's;\(-llber\);\1 -lssl -lcrypto;g' \
michael@182 260 contrib/mod_ldap.c
michael@182 261
michael@182 262 # prepare mod_otp module
michael@182 263 %if "%{with_skey}" == "yes" || "%{with_opie}" == "yes"
michael@182 264 ( cd mod_otp
michael@182 265 CC="%{l_cc}" \
michael@182 266 CFLAGS="%{l_cflags -O}" \
michael@182 267 CPPFLAGS="%{l_cppflags}" \
michael@182 268 LDFLAGS="%{l_ldflags}" \
michael@182 269 ./configure \
michael@182 270 %if "%{with_skey}" == "yes"
michael@182 271 --with-skey \
michael@182 272 %endif
michael@182 273 %if "%{with_opie}" == "yes"
michael@182 274 --with-opie \
michael@182 275 %endif
michael@182 276 %{l_nil}
michael@182 277 cp mod_otp.[ch] ../contrib/
michael@182 278 ) || exit $?
michael@182 279 %endif
michael@182 280
michael@182 281 # prepare mod_sql_odbc module
michael@182 282 %if "%{with_odbc}" == "yes"
michael@182 283 ( cd mod_sql_odbc
michael@182 284 if [ -f %{l_prefix}/etc/unixodbc/odbc.ini ]; then
michael@182 285 ./configure --enable-unixodbc
michael@182 286 else
michael@182 287 ./configure --enable-iodbc
michael@182 288 fi
michael@182 289 ) || exit $?
michael@182 290 %endif
michael@182 291
michael@182 292 # prepare optional add-on modules
michael@182 293 cp mod_exec/mod_exec.c contrib/
michael@182 294 cp mod_sql_sqlite/mod_sql_sqlite.c contrib/
michael@182 295 cp mod_sql_odbc/mod_sql_odbc.[ch] contrib/
michael@182 296 cp mod_time/mod_time.c contrib/
michael@182 297 cp mod_vroot/mod_vroot.c contrib/
michael@182 298 %if "%{with_ctrls}" == "yes"
michael@182 299 cp mod_shaper/mod_shaper.c contrib/
michael@182 300 %endif
michael@182 301 %if "%{with_sftp}" == "yes"
michael@182 302 cp -r mod_sftp contrib/
michael@182 303 %if "%{with_mysql}" == "yes" || "%{with_pgsql}" == "yes" || "%{with_sqlite}" == "yes" || "%{with_odbc}" == "yes"
michael@182 304 cp mod_sftp_sql/mod_sftp_sql.c contrib/
michael@182 305 %endif
michael@182 306 %endif
michael@182 307 %if "%{with_md5}" == "yes"
michael@182 308 cp mod_md5/mod_md5.c contrib/
michael@182 309 %endif
michael@182 310
michael@182 311 # prepare mod_gss module
michael@182 312 %if "%{with_kerberos}" == "yes"
michael@182 313 ( cd mod_gss-*
michael@182 314 CC="%{l_cc}" \
michael@182 315 CFLAGS="%{l_cflags -O}" \
michael@182 316 CPPFLAGS="%{l_cppflags}" \
michael@182 317 LDFLAGS="%{l_ldflags}" \
michael@182 318 ./configure \
michael@182 319 --prefix=%{l_prefix} \
michael@182 320 `if [ -d %{l_prefix}/include/heimdal ]; then \
michael@182 321 echo "--enable-heimdal"; \
michael@182 322 else \
michael@182 323 echo "--enable-mit"; \
michael@182 324 fi`
michael@182 325 cp mod_gss.h ../include/
michael@182 326 cp mod_gss.c ../contrib/
michael@182 327 ) || exit $?
michael@182 328 %endif
michael@182 329
michael@182 330 %build
michael@182 331 # make non-standard "rundir" the same as standard "sysconfdir"
michael@182 332 %{l_shtool} subst \
michael@182 333 -e 's;^\(rundir=@localstatedir@\)/proftpd;\1;' \
michael@182 334 Make.rules.in
michael@182 335 %{l_shtool} subst \
michael@182 336 -e 's;^\(#define PR_RUN_DIR "`eval echo "${localstatedir}\)/proftpd;\1;' \
michael@182 337 configure
michael@182 338
michael@182 339 # write shutdown message file to OpenPKG instance, not outside
michael@182 340 %{l_shtool} subst \
michael@182 341 -e 's;\(#define PR_SHUTMSG_PATH.*"\)\(/etc/\)\(shutmsg\)";\1%{l_prefix}\2proftpd/\3";' \
michael@182 342 include/default_paths.h
michael@182 343
michael@182 344 # configure the ProFTPd source tree
michael@182 345 MOD="mod_ratio:mod_readme:mod_exec:mod_time:mod_vroot"
michael@182 346 MOD_INC="%{l_prefix}/include"
michael@182 347 MOD_LIB="%{l_prefix}/lib"
michael@182 348 %if "%{with_ifsession}" == "yes"
michael@182 349 MOD="$MOD:mod_ifsession"
michael@182 350 %endif
michael@182 351 %if "%{with_ctrls}" == "yes"
michael@182 352 MOD="$MOD:mod_shaper"
michael@182 353 MOD="$MOD:mod_ctrls_admin"
michael@182 354 %endif
michael@182 355 %if "%{with_radius}" == "yes"
michael@182 356 MOD="$MOD:mod_radius"
michael@182 357 %endif
michael@182 358 %if "%{with_mysql}" == "yes" || "%{with_pgsql}" == "yes" || "%{with_sqlite}" == "yes" || "%{with_odbc}" == "yes"
michael@182 359 MOD="$MOD:mod_sql"
michael@182 360 %if "%{with_mysql}" == "yes"
michael@182 361 MOD="$MOD:mod_sql_mysql"
michael@182 362 MOD_INC=":%{l_prefix}/include/mysql"
michael@182 363 %endif
michael@182 364 %if "%{with_pgsql}" == "yes"
michael@182 365 MOD="$MOD:mod_sql_postgres"
michael@182 366 MOD_INC=":%{l_prefix}/include/postgresql"
michael@182 367 %endif
michael@182 368 %if "%{with_sqlite}" == "yes"
michael@182 369 MOD="$MOD:mod_sql_sqlite"
michael@182 370 %endif
michael@182 371 %if "%{with_odbc}" == "yes"
michael@182 372 MOD="$MOD:mod_sql_odbc"
michael@182 373 %endif
michael@182 374 %endif
michael@182 375 %if "%{with_ldap}" == "yes"
michael@182 376 MOD="$MOD:mod_ldap"
michael@182 377 %endif
michael@182 378 %if "%{with_skey}" == "yes" || "%{with_opie}" == "yes"
michael@182 379 MOD="$MOD:mod_otp"
michael@182 380 %endif
michael@182 381 %if "%{with_kerberos}" == "yes"
michael@182 382 MOD="$MOD:mod_gss"
michael@182 383 %endif
michael@182 384 %if "%{with_ssl}" == "yes"
michael@182 385 MOD="$MOD:mod_tls"
michael@182 386 %endif
michael@182 387 %if "%{with_sftp}" == "yes"
michael@182 388 MOD="$MOD:mod_sftp"
michael@182 389 %if "%{with_mysql}" == "yes" || "%{with_pgsql}" == "yes" || "%{with_sqlite}" == "yes" || "%{with_odbc}" == "yes"
michael@182 390 MOD="$MOD:mod_sftp_sql"
michael@182 391 %endif
michael@182 392 %endif
michael@182 393 %if "%{with_md5}" == "yes"
michael@182 394 MOD="$MOD:mod_md5"
michael@182 395 %endif
michael@182 396 export CC="%{l_cc}"
michael@182 397 export CFLAGS="%{l_cflags -O}"
michael@182 398 export CPPFLAGS="%{l_cppflags ncurses}"
michael@182 399 export LDFLAGS="%{l_ldflags}"
michael@182 400 export LIBS="-lgetopt"
michael@182 401 %if "%{with_pam}" == "yes"
michael@182 402 CPPFLAGS="$CPPFLAGS -I`%{l_rc} --query pam_incdir`"
michael@182 403 LDFLAGS="$LDFLAGS -L`%{l_rc} --query pam_libdir`"
michael@182 404 %endif
michael@182 405 %if "%{with_kerberos}" == "yes"
michael@182 406 CPPFLAGS="$CPPFLAGS `krb5-config --cflags gssapi`"
michael@182 407 LIBS="$LIBS `krb5-config --libs gssapi`"
michael@182 408 %endif
michael@182 409 ./configure \
michael@182 410 --prefix=%{l_prefix} \
michael@182 411 --sysconfdir=%{l_prefix}/etc/proftpd \
michael@182 412 --localstatedir=%{l_prefix}/var/proftpd \
michael@183 413 --mandir=%{l_prefix}/man \
michael@182 414 --with-modules="$MOD" \
michael@182 415 --with-includes="$MOD_INC" \
michael@182 416 --with-libraries="$MOD_LIB" \
michael@182 417 --enable-buffer-size=1024 \
michael@182 418 %if "%{with_ctrls}" == "yes"
michael@182 419 --enable-ctrls \
michael@182 420 %endif
michael@182 421 %if "%{with_pam}" == "yes"
michael@182 422 --enable-auth-pam
michael@182 423 %else
michael@182 424 --disable-auth-pam
michael@182 425 %endif
michael@182 426
michael@182 427 # build ProFTPd programs
michael@182 428 %{l_make} %{l_mflags}
michael@182 429
michael@182 430 %install
michael@182 431 rm -rf $RPM_BUILD_ROOT
michael@182 432
michael@182 433 # make sure the "install" procedure does not try
michael@182 434 # to perform explicit ownership assignments
michael@182 435 %{l_shtool} subst -v \
michael@182 436 -e 's;-o $(INSTALL_USER) -g $(INSTALL_GROUP);;g' \
michael@182 437 -e 's;chown;true;g' \
michael@182 438 Makefile Make.rules
michael@182 439
michael@182 440 # perform the "install" procedure while redirecting
michael@182 441 # it to the temporarily install area
michael@182 442 %{l_make} %{l_mflags} \
michael@182 443 install-proftpd install-utils install-man \
michael@182 444 prefix=$RPM_BUILD_ROOT%{l_prefix} \
michael@182 445 bindir=$RPM_BUILD_ROOT%{l_prefix}/bin \
michael@182 446 sbindir=$RPM_BUILD_ROOT%{l_prefix}/sbin \
michael@182 447 sysconfdir=$RPM_BUILD_ROOT%{l_prefix}/etc/proftpd \
michael@182 448 localstatedir=$RPM_BUILD_ROOT%{l_prefix}/var/proftpd \
michael@183 449 mandir=$RPM_BUILD_ROOT%{l_prefix}/man \
michael@182 450 rundir=$RPM_BUILD_ROOT%{l_prefix}/var/proftpd
michael@182 451
michael@182 452 # strip installation
michael@182 453 rm -f $RPM_BUILD_ROOT%{l_prefix}/sbin/in.proftpd
michael@182 454
michael@182 455 # install more stuff manually
michael@182 456 %{l_shtool} mkdir -f -p -m 755 $RPM_BUILD_ROOT%{l_prefix}/share/proftpd
michael@182 457 %{l_shtool} install -c -m 644 doc/faq.html \
michael@182 458 $RPM_BUILD_ROOT%{l_prefix}/share/proftpd/faq.html
michael@182 459 %{l_shtool} install -c -m 644 doc/Configuration.html \
michael@182 460 $RPM_BUILD_ROOT%{l_prefix}/share/proftpd/cfg.html
michael@182 461
michael@182 462 # extended installation with own stuff
michael@182 463 l_pam="#"
michael@182 464 %if "%{with_pam}" == "yes"
michael@182 465 l_pam=""
michael@182 466 %endif
michael@182 467 %{l_shtool} install -c -m 644 %{l_value -s -a} \
michael@182 468 -e "s;@l_pam@;${l_pam};g" \
michael@182 469 %{SOURCE proftpd.conf} $RPM_BUILD_ROOT%{l_prefix}/etc/proftpd/
michael@182 470 %{l_shtool} install -c -m 644 \
michael@182 471 %{SOURCE proftpd.msg.goaway} \
michael@182 472 %{SOURCE proftpd.msg.login} \
michael@182 473 $RPM_BUILD_ROOT%{l_prefix}/etc/proftpd/
michael@182 474 %{l_shtool} install -c -m 644 \
michael@182 475 %{SOURCE proftpd.msg.login} \
michael@182 476 $RPM_BUILD_ROOT%{l_prefix}/share/proftpd/.msg.login
michael@182 477 %{l_shtool} install -c -m 644 \
michael@182 478 %{SOURCE proftpd.msg.goaway} \
michael@182 479 $RPM_BUILD_ROOT%{l_prefix}/share/proftpd/.msg.goaway
michael@182 480 %{l_shtool} mkdir -f -p -m 755 $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d
michael@182 481 %{l_shtool} install -c -m 755 %{l_value -s -a} \
michael@182 482 %{SOURCE rc.proftpd} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
michael@182 483
michael@182 484 # determine the package ingredients
michael@182 485 %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
michael@182 486 %{l_files_std} \
michael@182 487 '%config %attr(0600,%{l_susr},%{l_sgrp}) %{l_prefix}/etc/proftpd/proftpd.conf' \
michael@182 488 '%config %{l_prefix}/etc/proftpd/proftpd.msg.*'
michael@182 489
michael@182 490 %files -f files
michael@182 491
michael@182 492 %clean
michael@182 493 rm -rf $RPM_BUILD_ROOT
michael@182 494
michael@182 495 %post
michael@182 496 %if "%{with_pam}" == "yes"
michael@182 497 # add PAM configuration entry
michael@182 498 if [ $1 -eq 1 ]; then
michael@182 499 $RPM_INSTALL_PREFIX/sbin/pamtool --add --smart --name=proftpd
michael@182 500 fi
michael@182 501 %endif
michael@182 502
michael@182 503 # after upgrade, restart service
michael@182 504 [ $1 -eq 2 ] || exit 0
michael@182 505 eval `%{l_rc} proftpd status 2>/dev/null`
michael@182 506 [ ".$proftpd_active" = .yes ] && %{l_rc} proftpd restart
michael@182 507 exit 0
michael@182 508
michael@182 509 %preun
michael@182 510 # before erase, stop service and remove log files
michael@182 511 [ $1 -eq 0 ] || exit 0
michael@182 512 %{l_rc} proftpd stop 2>/dev/null
michael@182 513 rm -f $RPM_INSTALL_PREFIX/var/proftpd/*.log* >/dev/null 2>&1 || true
michael@182 514 rm -f $RPM_INSTALL_PREFIX/var/proftpd/*.pid >/dev/null 2>&1 || true
michael@182 515 %if "%{with_pam}" == "yes"
michael@182 516 # remove PAM configuration entry
michael@182 517 $RPM_INSTALL_PREFIX/sbin/pamtool --remove --smart --name=proftpd
michael@182 518 %endif
michael@182 519 exit 0
michael@182 520

mercurial