samba.spec 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244
  1. ##
  2. ## samba.spec -- OpenPKG RPM Package Specification
  3. ## Copyright (c) 2000-2007 OpenPKG Foundation e.V. <http://openpkg.net/>
  4. ## Copyright (c) 2000-2007 Ralf S. Engelschall <http://engelschall.com/>
  5. ##
  6. ## Permission to use, copy, modify, and distribute this software for
  7. ## any purpose with or without fee is hereby granted, provided that
  8. ## the above copyright notice and this permission notice appear in all
  9. ## copies.
  10. ##
  11. ## THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
  12. ## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
  13. ## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
  14. ## IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
  15. ## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  16. ## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  17. ## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
  18. ## USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  19. ## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  20. ## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
  21. ## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  22. ## SUCH DAMAGE.
  23. ##
  24. # package information
  25. Name: samba
  26. Summary: SMB/CIFS Server
  27. URL: http://www.samba.org/
  28. Vendor: Andrew Tridgell
  29. Packager: OpenPKG Foundation e.V.
  30. Distribution: OpenPKG Community
  31. Class: BASE
  32. Group: Filesystem
  33. License: GPL
  34. Version: 3.0.24
  35. Release: 20070211
  36. # package options
  37. %option with_pam no
  38. %option with_swat no
  39. %option with_acl no
  40. %option with_ldap no
  41. %option with_ads no
  42. # option sanity
  43. %if "%{with_ads}" == "yes"
  44. %undefine with_ldap
  45. %define with_ldap yes
  46. %endif
  47. # list of sources
  48. Source0: http://us1.samba.org/samba/ftp/samba-%{version}.tar.gz
  49. Source1: smb.conf
  50. Source2: smb.hosts
  51. Source3: rc.samba
  52. Patch0: samba.patch
  53. # build information
  54. Prefix: %{l_prefix}
  55. BuildRoot: %{l_buildroot}
  56. BuildPreReq: OpenPKG, openpkg >= 20060823
  57. PreReq: OpenPKG, openpkg >= 20060823
  58. BuildPreReq: openssl, popt, perl
  59. PreReq: openssl, popt, perl
  60. %if "%{with_pam}" == "yes"
  61. BuildPreReq: PAM
  62. PreReq: PAM
  63. %endif
  64. %if "%{with_ldap}" == "yes"
  65. BuildPreReq: openldap
  66. PreReq: openldap
  67. %endif
  68. %if "%{with_ads}" == "yes"
  69. BuildPreReq: kerberos
  70. PreReq: kerberos
  71. %endif
  72. AutoReq: no
  73. AutoReqProv: no
  74. %description
  75. Samba is an open source software suite that provides seamless file
  76. and print services to SMB/CIFS clients plus name resolution services
  77. to NetBIOS clients. The Samba software suite is a collection of
  78. programs that implements the Server Message Block (SMB) protocol
  79. for UNIX systems. This protocol is sometimes also referred to as
  80. the Common Internet File System (CIFS) and is the network protocol
  81. which provides filesharing and printing services to MSCLIENT 3.0 for
  82. DOS, Windows for Workgroups (LanManager), Windows 95/98/ME, Windows
  83. NT/2000/XP/2003, OS/2, MacOS DAVE and Linux smbfs clients.
  84. %track
  85. prog samba = {
  86. version = %{version}
  87. url = http://download.samba.org/samba/ftp/
  88. regex = samba-(__VER__)\.tar\.gz
  89. }
  90. %prep
  91. %setup -q
  92. %patch -p0
  93. %{l_shtool} subst \
  94. -e '/WINBINDD_SOCKET_DIR/s;/tmp/\.winbindd;%{l_prefix}/var/samba/tmp/.winbindd;' \
  95. source/nsswitch/winbindd_nss.h
  96. %build
  97. cd source
  98. CC="%{l_cc}"
  99. CFLAGS="%{l_cflags -O}"
  100. CPPFLAGS="%{l_cppflags openssl} -DOPENSSL_DISABLE_OLD_DES_SUPPORT"
  101. LDFLAGS="%{l_ldflags}"
  102. LIBS=""
  103. %if "%{with_pam}" == "yes"
  104. CPPFLAGS="$CPPFLAGS -I`%{l_rc} --query pam_incdir`"
  105. LDFLAGS="$LDFLAGS -L`%{l_rc} --query pam_libdir`"
  106. %endif
  107. %if "%{with_ldap}" == "yes"
  108. LIBS="$LIBS -lssl -lcrypto"
  109. %endif
  110. options=""
  111. case "%{l_platform -t}" in
  112. *-linux2.[46]* ) options="--with-smbmount" ;;
  113. esac
  114. export CC
  115. export CFLAGS
  116. export CPPFLAGS
  117. export LDFLAGS
  118. export LIBS
  119. ./configure \
  120. --cache-file=./config.cache \
  121. --prefix=%{l_prefix} \
  122. --mandir=%{l_prefix}/man \
  123. --libexecdir=%{l_prefix}/libexec/samba \
  124. --localstatedir=%{l_prefix}/var/samba/run \
  125. --sysconfdir=%{l_prefix}/etc/samba \
  126. --with-libdir=%{l_prefix}/lib/samba \
  127. --with-privatedir=%{l_prefix}/etc/samba \
  128. --with-configdir=%{l_prefix}/etc/samba \
  129. --with-lockdir=%{l_prefix}/var/samba/run/locks \
  130. --with-piddir=%{l_prefix}/var/samba/run \
  131. --with-privatedir=%{l_prefix}/var/samba/run/private \
  132. --with-swatdir=%{l_prefix}/share/samba \
  133. --without-included-popt \
  134. --with-winbind \
  135. %if "%{with_acl}" == "yes"
  136. --with-acl-support \
  137. %else
  138. --without-acl-support \
  139. %endif
  140. %if "%{with_pam}" == "yes"
  141. --with-pam \
  142. %else
  143. --without-pam \
  144. %endif
  145. %if "%{with_ldap}" == "yes"
  146. --with-ldap \
  147. %else
  148. --without-ldap \
  149. %endif
  150. %if "%{with_ads}" == "yes"
  151. --with-ads \
  152. --with-krb5=%{l_prefix} \
  153. %else
  154. --without-ads \
  155. %endif
  156. --with-vfs \
  157. --disable-pie \
  158. $options
  159. %{l_make} %{l_mflags}
  160. %install
  161. rm -rf $RPM_BUILD_ROOT
  162. %{l_shtool} mkdir -f -p -m 755 \
  163. $RPM_BUILD_ROOT%{l_prefix} \
  164. $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d \
  165. $RPM_BUILD_ROOT%{l_prefix}/etc/samba \
  166. $RPM_BUILD_ROOT%{l_prefix}/var/samba/spool \
  167. $RPM_BUILD_ROOT%{l_prefix}/var/samba/netlogon \
  168. $RPM_BUILD_ROOT%{l_prefix}/var/samba/tmp \
  169. $RPM_BUILD_ROOT%{l_prefix}/var/samba/profiles
  170. ( cd source
  171. %{l_make} %{l_mflags} \
  172. DESTDIR=$RPM_BUILD_ROOT \
  173. LIBDIR=%{l_prefix}/lib/samba \
  174. installbin installservers installman installscripts installdat installmodules
  175. %if "%{with_swat}" == "yes"
  176. %{l_make} %{l_mflags} installswat DESTDIR=$RPM_BUILD_ROOT
  177. %endif
  178. ) || exit $?
  179. l_hostname=`%{l_shtool} echo -e %h`
  180. l_domainname=`%{l_shtool} echo -e %d`
  181. %{l_shtool} install -c -m 644 %{l_value -s -a} \
  182. -e "s;@l_hostname@;$l_hostname;g" \
  183. -e "s;@l_domainname@;$l_domainname;g" \
  184. %{SOURCE smb.conf} \
  185. %{SOURCE smb.hosts} \
  186. $RPM_BUILD_ROOT%{l_prefix}/etc/samba/
  187. %{l_shtool} install -c -m 755 %{l_value -s -a} \
  188. %{SOURCE rc.samba} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
  189. strip $RPM_BUILD_ROOT%{l_prefix}/bin/* >/dev/null 2>&1 || true
  190. strip $RPM_BUILD_ROOT%{l_prefix}/sbin/* >/dev/null 2>&1 || true
  191. %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
  192. %{l_files_std} \
  193. '%config %{l_prefix}/etc/samba/*' \
  194. '%attr(1777,%{l_musr},%{l_mgrp}) %{l_prefix}/var/samba/spool' \
  195. '%attr(1777,%{l_musr},%{l_mgrp}) %{l_prefix}/var/samba/profiles'
  196. %files -f files
  197. %clean
  198. rm -rf $RPM_BUILD_ROOT
  199. %pre
  200. # before upgrade, save status and stop service
  201. [ $1 -eq 2 ] || exit 0
  202. eval `%{l_rc} samba status 2>/dev/null | tee %{l_tmpfile}`
  203. %{l_rc} samba stop 2>/dev/null
  204. exit 0
  205. %post
  206. %if "%{with_pam}" == "yes"
  207. if [ $1 -eq 1 ]; then
  208. # after install, add PAM configuration entry
  209. $RPM_INSTALL_PREFIX/sbin/pamtool --add --smart --name=smbd
  210. fi
  211. %endif
  212. if [ $1 -eq 2 ]; then
  213. # after upgrade, restore status
  214. { eval `cat %{l_tmpfile}`; rm -f %{l_tmpfile}; true; } >/dev/null 2>&1
  215. [ ".$samba_active" = .yes ] && %{l_rc} samba start
  216. fi
  217. exit 0
  218. %preun
  219. # before erase, stop service and remove log files
  220. [ $1 -eq 0 ] || exit 0
  221. %{l_rc} samba stop 2>/dev/null
  222. rm -f $RPM_INSTALL_PREFIX/var/samba/run/log.[sn]mbd* >/dev/null 2>&1 || true
  223. %if "%{with_pam}" == "yes"
  224. # remove PAM configuration entry
  225. $RPM_INSTALL_PREFIX/sbin/pamtool --remove --smart --name=smbd
  226. %endif
  227. exit 0