proftpd.spec 9.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268
  1. ##
  2. ## proftpd.spec -- OpenPKG RPM Specification
  3. ## Copyright (c) 2000-2003 The OpenPKG Project <http://www.openpkg.org/>
  4. ## Copyright (c) 2000-2003 Ralf S. Engelschall <rse@engelschall.com>
  5. ## Copyright (c) 2000-2003 Cable & Wireless <http://www.cw.com/>
  6. ##
  7. ## Permission to use, copy, modify, and distribute this software for
  8. ## any purpose with or without fee is hereby granted, provided that
  9. ## the above copyright notice and this permission notice appear in all
  10. ## copies.
  11. ##
  12. ## THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
  13. ## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
  14. ## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
  15. ## IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
  16. ## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  17. ## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  18. ## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
  19. ## USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  20. ## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  21. ## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
  22. ## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  23. ## SUCH DAMAGE.
  24. ##
  25. # package information
  26. Name: proftpd
  27. Summary: Professional FTP Daemon
  28. URL: http://www.proftpd.net/
  29. Vendor: The ProFTPD Project
  30. Packager: The OpenPKG Project
  31. Distribution: OpenPKG [BASE]
  32. Group: FTP
  33. License: GPL
  34. Version: 1.2.8
  35. Release: 20030722
  36. # package options
  37. %option with_mysql no
  38. %option with_pam no
  39. %option with_pgsql no
  40. %option with_ldap no
  41. # checking option conflicts
  42. %if "%{with_mysql}" == "yes" && "%{with_pgsql}" == "yes"
  43. RPM ERROR: with_mysql conflicts with with_pgsql
  44. %endif
  45. # list of sources
  46. Source0: ftp://ftp.proftpd.net/distrib/source/proftpd-%{version}.tar.bz2
  47. Source1: proftpd.conf
  48. Source2: proftpd.msg.goaway
  49. Source3: proftpd.msg.login
  50. Source4: rc.proftpd
  51. Patch0: proftpd.patch
  52. # build information
  53. Prefix: %{l_prefix}
  54. BuildRoot: %{l_buildroot}
  55. BuildPreReq: OpenPKG, openpkg >= 20030718, make
  56. PreReq: OpenPKG, openpkg >= 20030718
  57. BuildPreReq: ncurses, getopt
  58. PreReq: ncurses, getopt
  59. %if "%{with_mysql}" == "yes"
  60. BuildPreReq: mysql
  61. PreReq: mysql
  62. %endif
  63. %if "%{with_pam}" == "yes"
  64. BuildPreReq: PAM
  65. PreReq: PAM
  66. %endif
  67. %if "%{with_pgsql}" == "yes"
  68. BuildPreReq: postgresql, openssl
  69. PreReq: postgresql, openssl
  70. %endif
  71. %if "%{with_ldap}" == "yes"
  72. BuildPreReq: openldap, openssl
  73. PreReq: openldap, openssl
  74. %endif
  75. AutoReq: no
  76. AutoReqProv: no
  77. %description
  78. ProFTPD grew out of the desire to have a secure and configurable FTP
  79. server, and out of a significant admiration of the Apache web server.
  80. There are currently a very limited number of FTP servers running on unix
  81. (or unix-like) hosts. The most commonly used server is probably wu-ftpd.
  82. While wu-ftpd provides excellent performance and is generally a good
  83. product, it lacks numerous features found in newer Win32 FTP servers, and
  84. has a poor security history. Many people, including the developers who
  85. work on ProFTPD have spent a great deal of time fixing bugs and hacking
  86. features into wu-ftpd. Unfortunately, it quickly became clear that a
  87. complete redesign was necessary in order to implement the configurability
  88. and features desired. ProFTPD is not a hack based on any other server,
  89. it's an independent source tree from the ground up. Click here for a small
  90. list of some of the sites ProFTPD powers -- many of them handling large
  91. volumes of traffic on a daily basis.
  92. %prep
  93. %setup -q
  94. %patch -p0
  95. # utils also require link with getopt
  96. %{l_shtool} subst \
  97. -e 's;\(\$(BUILD_FTPCOUNT_OBJS).*\);\1 %{l_ldflags} -lgetopt;g' \
  98. -e 's;\(\$(BUILD_FTPSHUT_OBJS).*\);\1 %{l_ldflags} -lgetopt;g' \
  99. -e 's;\(\$(BUILD_FTPTOP_OBJS).*\);\1 %{l_ldflags} -lgetopt;g' \
  100. -e 's;\(\$(BUILD_FTPWHO_OBJS).*\);\1 %{l_ldflags} -lgetopt;g' \
  101. Makefile.in
  102. %if "%{with_mysql}" == "yes"
  103. libs=`mysql_config --libs`
  104. # libmysqlclient may require more libraries
  105. %{l_shtool} subst \
  106. -e "s;\(-lmysqlclient\);$libs;g" \
  107. contrib/mod_sql_mysql.c
  108. %endif
  109. # libpq also requires openssl
  110. # postgresql also doesn't provide its own inlude subdirectory
  111. %{l_shtool} subst \
  112. -e 's;\(-lpq\);\1 -lssl -lcrypto;g' \
  113. -e 's;^\(#include <\)pgsql/\(libpq-fe.h>.*\)$;\1postgresql/\2;' \
  114. contrib/mod_sql_postgres.c
  115. # libldap also requires openssl
  116. %{l_shtool} subst \
  117. -e 's;\(-llber\);\1 -lssl -lcrypto;g' \
  118. contrib/mod_ldap.c
  119. %build
  120. # make non-standard "rundir" the same as standard "sysconfdir"
  121. %{l_shtool} subst \
  122. -e 's;^\(rundir=@localstatedir@\)/proftpd;\1;' \
  123. Make.rules.in
  124. # write shutdown message file to OpenPKG instance, not outside
  125. %{l_shtool} subst \
  126. -e 's;\(#define SHUTMSG_PATH.*"\)\(/etc/\)\(shutmsg\)";\1%{l_prefix}\2proftpd/\3";' \
  127. include/default_paths.h
  128. # configure the ProFTPd source tree
  129. MOD="mod_ratio:mod_readme"
  130. MOD_INC="%{l_prefix}/include"
  131. MOD_LIB="%{l_prefix}/lib"
  132. %if "%{with_mysql}" == "yes" || "%{with_pgsql}" == "yes"
  133. MOD="$MOD:mod_sql"
  134. %if "%{with_mysql}" == "yes"
  135. MOD="$MOD:mod_sql_mysql"
  136. %endif
  137. %if "%{with_pgsql}" == "yes"
  138. MOD="$MOD:mod_sql_postgres"
  139. %endif
  140. %endif
  141. %if "%{with_ldap}" == "yes"
  142. MOD="$MOD:mod_ldap"
  143. %endif
  144. CC="%{l_cc}" \
  145. CFLAGS="%{l_cflags -O}" \
  146. %if "%{with_pam}" == "yes"
  147. CPPFLAGS="%{l_cppflags ncurses} -I`%{l_prefix}/etc/rc --query pam_incdir`" \
  148. LDFLAGS="%{l_ldflags} -L`%{l_prefix}/etc/rc --query pam_libdir`" \
  149. %else
  150. CPPFLAGS="%{l_cppflags ncurses}" \
  151. LDFLAGS="%{l_ldflags}" \
  152. LIBS="-lgetopt" \
  153. %endif
  154. ./configure \
  155. --prefix=%{l_prefix} \
  156. --sysconfdir=%{l_prefix}/etc/proftpd \
  157. --localstatedir=%{l_prefix}/var/proftpd \
  158. --with-modules="$MOD" \
  159. --with-includes="$MOD_INC" \
  160. --with-libraries="$MOD_LIB" \
  161. --without-getopt \
  162. %if "%{with_pam}" == "yes"
  163. --enable-auth-pam
  164. %else
  165. --disable-auth-pam
  166. %endif
  167. # build ProFTPd programs
  168. %{l_make} %{l_mflags -O}
  169. %install
  170. rm -rf $RPM_BUILD_ROOT
  171. # make sure the "install" procedure does not try
  172. # to perform explicit ownership assignments
  173. %{l_shtool} subst -v \
  174. -e 's;-o $(INSTALL_USER) -g $(INSTALL_GROUP);;g' \
  175. -e 's;chown;true;g' \
  176. Makefile
  177. # perform the "install" procedure while redirecting
  178. # it to the temporarily install area
  179. %{l_make} %{l_mflags} \
  180. install-proftpd install-utils install-man \
  181. prefix=$RPM_BUILD_ROOT%{l_prefix} \
  182. sysconfdir=$RPM_BUILD_ROOT%{l_prefix}/etc/proftpd \
  183. localstatedir=$RPM_BUILD_ROOT%{l_prefix}/var/proftpd \
  184. rundir=$RPM_BUILD_ROOT%{l_prefix}/var/proftpd
  185. # strip installation
  186. rm -f $RPM_BUILD_ROOT%{l_prefix}/sbin/in.proftpd
  187. # install more stuff manually
  188. %{l_shtool} mkdir -f -p -m 755 $RPM_BUILD_ROOT%{l_prefix}/share/proftpd
  189. %{l_shtool} install -c -m 644 doc/faq.html \
  190. $RPM_BUILD_ROOT%{l_prefix}/share/proftpd/faq.html
  191. %{l_shtool} install -c -m 644 doc/Configuration.html \
  192. $RPM_BUILD_ROOT%{l_prefix}/share/proftpd/cfg.html
  193. # extended installation with own stuff
  194. l_pam="#"
  195. %if "%{with_pam}" == "yes"
  196. l_pam=""
  197. %endif
  198. %{l_shtool} install -c -m 644 %{l_value -s -a} \
  199. -e "s;@l_pam@;${l_pam};g" \
  200. %{SOURCE proftpd.conf} $RPM_BUILD_ROOT%{l_prefix}/etc/proftpd/
  201. %{l_shtool} install -c -m 644 \
  202. %{SOURCE proftpd.msg.goaway} \
  203. %{SOURCE proftpd.msg.login} \
  204. $RPM_BUILD_ROOT%{l_prefix}/etc/proftpd/
  205. %{l_shtool} install -c -m 644 \
  206. %{SOURCE proftpd.msg.login} \
  207. $RPM_BUILD_ROOT%{l_prefix}/share/proftpd/.msg.login
  208. %{l_shtool} install -c -m 644 \
  209. %{SOURCE proftpd.msg.goaway} \
  210. $RPM_BUILD_ROOT%{l_prefix}/share/proftpd/.msg.goaway
  211. %{l_shtool} mkdir -f -p -m 755 $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d
  212. %{l_shtool} install -c -m 755 %{l_value -s -a} \
  213. %{SOURCE rc.proftpd} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
  214. # determine the package ingredients
  215. %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
  216. %{l_files_std} \
  217. '%config %{l_prefix}/etc/proftpd/proftpd.conf'
  218. %files -f files
  219. %clean
  220. rm -rf $RPM_BUILD_ROOT
  221. %post
  222. %if "%{with_pam}" == "yes"
  223. # add PAM configuration entry
  224. if [ $1 -eq 1 ]; then
  225. $RPM_INSTALL_PREFIX/sbin/pamtool --add --smart --name=proftpd
  226. fi
  227. %endif
  228. # after upgrade, restart service
  229. [ $1 -eq 2 ] || exit 0
  230. eval `%{l_rc} proftpd status 2>/dev/null`
  231. [ ".$proftpd_active" = .yes ] && %{l_rc} proftpd restart
  232. exit 0
  233. %preun
  234. # before erase, stop service and remove log files
  235. [ $1 -eq 0 ] || exit 0
  236. %{l_rc} proftpd stop 2>/dev/null
  237. rm -f $RPM_INSTALL_PREFIX/var/proftpd/*.log* >/dev/null 2>&1 || true
  238. rm -f $RPM_INSTALL_PREFIX/var/proftpd/*.pid >/dev/null 2>&1 || true
  239. %if "%{with_pam}" == "yes"
  240. # remove PAM configuration entry
  241. $RPM_INSTALL_PREFIX/sbin/pamtool --remove --smart --name=proftpd
  242. %endif
  243. exit 0