samba.spec 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208
  1. ##
  2. ## samba.spec -- OpenPKG RPM Specification
  3. ## Copyright (c) 2000-2004 The OpenPKG Project <http://www.openpkg.org/>
  4. ## Copyright (c) 2000-2004 Ralf S. Engelschall <rse@engelschall.com>
  5. ## Copyright (c) 2000-2004 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: samba
  27. Summary: SMB/CIFS Server
  28. URL: http://www.samba.org/
  29. Vendor: Andrew Tridgell
  30. Packager: The OpenPKG Project
  31. Distribution: OpenPKG
  32. Class: BASE
  33. Group: Filesystem
  34. License: GPL
  35. Version: 3.0.4
  36. Release: 20040701
  37. # package options
  38. %option with_pam no
  39. %option with_swat no
  40. %option with_acl no
  41. %option with_ldap no
  42. # list of sources
  43. Source0: http://download.samba.org/samba/ftp/samba-%{version}.tar.gz
  44. Source1: smb.conf
  45. Source2: smb.hosts
  46. Source3: rc.samba
  47. # build information
  48. Prefix: %{l_prefix}
  49. BuildRoot: %{l_buildroot}
  50. BuildPreReq: OpenPKG, openpkg >= 20040130
  51. PreReq: OpenPKG, openpkg >= 20040130
  52. BuildPreReq: openssl, popt, perl
  53. PreReq: openssl, popt, perl
  54. %if "%{with_pam}" == "yes"
  55. BuildPreReq: PAM
  56. PreReq: PAM
  57. %endif
  58. %if "%{with_ldap}" == "yes"
  59. BuildPreReq: openldap
  60. PreReq: openldap
  61. %endif
  62. AutoReq: no
  63. AutoReqProv: no
  64. %description
  65. Samba is an open source software suite that provides seamless file
  66. and print services to SMB/CIFS clients plus name resolution services
  67. to NetBIOS clients. The Samba software suite is a collection of
  68. programs that implements the Server Message Block (SMB) protocol
  69. for UNIX systems. This protocol is sometimes also referred to as
  70. the Common Internet File System (CIFS) and is the network protocol
  71. which provides filesharing and printing services to MSCLIENT 3.0 for
  72. DOS, Windows for Workgroups (LanManager), Windows 95/98/ME, Windows
  73. NT/2000/XP/2003, OS/2, MacOS DAVE and Linux smbfs clients.
  74. %track
  75. prog samba = {
  76. version = %{version}
  77. url = http://download.samba.org/samba/ftp/
  78. regex = samba-(__VER__)\.tar\.gz
  79. }
  80. %prep
  81. %setup -q
  82. %{l_patch} -p1 <packaging/Mandrake/samba-3.0-smbmount-sbin.patch
  83. %build
  84. cd source
  85. CC="%{l_cc}"
  86. CFLAGS="%{l_cflags -O}"
  87. CPPFLAGS="%{l_cppflags openssl} -DOPENSSL_DISABLE_OLD_DES_SUPPORT"
  88. LDFLAGS="%{l_ldflags}"
  89. %if "%{with_pam}" == "yes"
  90. CPPFLAGS="$CPPFLAGS -I`%{l_prefix}/etc/rc --query pam_incdir`"
  91. LDFLAGS="$LDFLAGS -L`%{l_prefix}/etc/rc --query pam_libdir`"
  92. %endif
  93. options=""
  94. case "%{l_platform -t}" in
  95. *-linux2.[46]* ) options="--with-smbmount" ;;
  96. esac
  97. export CC
  98. export CFLAGS
  99. export CPPFLAGS
  100. export LDFLAGS
  101. ./configure \
  102. --prefix=%{l_prefix} \
  103. --libexecdir=%{l_prefix}/libexec/samba \
  104. --localstatedir=%{l_prefix}/var/samba/run \
  105. --sysconfdir=%{l_prefix}/etc/samba \
  106. --with-libdir=%{l_prefix}/lib/samba \
  107. --with-privatedir=%{l_prefix}/etc/samba \
  108. --with-configdir=%{l_prefix}/etc/samba \
  109. --with-lockdir=%{l_prefix}/var/samba/run/locks \
  110. --with-piddir=%{l_prefix}/var/samba/run \
  111. --with-privatedir=%{l_prefix}/var/samba/run/private \
  112. --with-swatdir=%{l_prefix}/share/samba \
  113. --without-included-popt \
  114. %if "%{with_acl}" == "yes"
  115. --with-acl-support \
  116. %endif
  117. %if "%{with_pam}" == "yes"
  118. --with-pam \
  119. %endif
  120. %if "%{with_ldap}" == "yes"
  121. --with-ldap \
  122. %endif
  123. --with-vfs \
  124. $options
  125. %{l_make} %{l_mflags}
  126. %install
  127. rm -rf $RPM_BUILD_ROOT
  128. %{l_shtool} mkdir -f -p -m 755 \
  129. $RPM_BUILD_ROOT%{l_prefix} \
  130. $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d \
  131. $RPM_BUILD_ROOT%{l_prefix}/etc/samba \
  132. $RPM_BUILD_ROOT%{l_prefix}/var/samba/spool \
  133. $RPM_BUILD_ROOT%{l_prefix}/var/samba/netlogon \
  134. $RPM_BUILD_ROOT%{l_prefix}/var/samba/profiles
  135. ( cd source
  136. %{l_make} %{l_mflags} \
  137. DESTDIR=$RPM_BUILD_ROOT \
  138. LIBDIR=%{l_prefix}/lib/samba \
  139. installbin installman installscripts installdat installmodules
  140. %if "%{with_swat}" == "yes"
  141. %{l_make} %{l_mflags} installswat DESTDIR=$RPM_BUILD_ROOT
  142. %endif
  143. ) || exit $?
  144. l_hostname=`%{l_shtool} echo -e %h`
  145. l_domainname=`%{l_shtool} echo -e %d`
  146. %{l_shtool} install -c -m 644 %{l_value -s -a} \
  147. -e "s;@l_hostname@;$l_hostname;g" \
  148. -e "s;@l_domainname@;$l_domainname;g" \
  149. %{SOURCE smb.conf} \
  150. %{SOURCE smb.hosts} \
  151. $RPM_BUILD_ROOT%{l_prefix}/etc/samba/
  152. %{l_shtool} install -c -m 755 %{l_value -s -a} \
  153. %{SOURCE rc.samba} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
  154. strip $RPM_BUILD_ROOT%{l_prefix}/bin/* >/dev/null 2>&1 || true
  155. strip $RPM_BUILD_ROOT%{l_prefix}/sbin/* >/dev/null 2>&1 || true
  156. %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
  157. %{l_files_std} \
  158. '%config %{l_prefix}/etc/samba/*' \
  159. '%attr(1777,%{l_musr},%{l_mgrp}) %{l_prefix}/var/samba/spool' \
  160. '%attr(1777,%{l_musr},%{l_mgrp}) %{l_prefix}/var/samba/profiles'
  161. %files -f files
  162. %clean
  163. rm -rf $RPM_BUILD_ROOT
  164. %pre
  165. # before upgrade, save status and stop service
  166. [ $1 -eq 2 ] || exit 0
  167. eval `%{l_rc} samba status 2>/dev/null | tee %{l_tmpfile}`
  168. %{l_rc} samba stop 2>/dev/null
  169. exit 0
  170. %post
  171. %if "%{with_pam}" == "yes"
  172. if [ $1 -eq 1 ]; then
  173. # after install, add PAM configuration entry
  174. $RPM_INSTALL_PREFIX/sbin/pamtool --add --smart --name=smbd
  175. fi
  176. %endif
  177. if [ $1 -eq 2 ]; then
  178. # after upgrade, restore status
  179. { eval `cat %{l_tmpfile}`; rm -f %{l_tmpfile}; true; } >/dev/null 2>&1
  180. [ ".$samba_active" = .yes ] && %{l_rc} samba start
  181. fi
  182. exit 0
  183. %preun
  184. # before erase, stop service and remove log files
  185. [ $1 -eq 0 ] || exit 0
  186. %{l_rc} samba stop 2>/dev/null
  187. rm -f $RPM_INSTALL_PREFIX/var/samba/run/log.[sn]mbd* >/dev/null 2>&1 || true
  188. %if "%{with_pam}" == "yes"
  189. # remove PAM configuration entry
  190. $RPM_INSTALL_PREFIX/sbin/pamtool --remove --smart --name=smbd
  191. %endif
  192. exit 0