samba.spec 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173
  1. ##
  2. ## samba.spec -- OpenPKG RPM Specification
  3. ## Copyright (c) 2000-2002 Cable & Wireless Deutschland GmbH
  4. ## Copyright (c) 2000-2002 The OpenPKG Project <http://www.openpkg.org/>
  5. ## Copyright (c) 2000-2002 Ralf S. Engelschall <rse@engelschall.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 options
  26. %ifndef with_pam
  27. %define with_pam no
  28. %endif
  29. # package information
  30. Name: samba
  31. Summary: SMB/CIFS Server
  32. URL: http://www.samba.org/
  33. Vendor: Andrew Tridgell
  34. Packager: The OpenPKG Project
  35. Distribution: OpenPKG [BASE]
  36. Group: Filesystem
  37. License: GPL
  38. Version: 2.2.5
  39. Release: 20020916
  40. # list of sources
  41. Source0: http://download.samba.org/samba/ftp/samba-%{version}.tar.bz2
  42. Source1: smb.conf
  43. Source2: smb.hosts
  44. Source3: rc.samba
  45. # build information
  46. Prefix: %{l_prefix}
  47. BuildRoot: %{l_buildroot}
  48. BuildPreReq: OpenPKG, openpkg >= 20020206, openssl
  49. PreReq: OpenPKG, openpkg >= 20020206
  50. %if "%{with_pam}" == "yes"
  51. BuildPreReq: PAM
  52. PreReq: PAM
  53. %endif
  54. AutoReq: no
  55. AutoReqProv: no
  56. %description
  57. Samba is an open source software suite that provides seamless file
  58. and print services to SMB/CIFS clients.
  59. Options:
  60. --define 'with_pam %{with_pam}'
  61. %prep
  62. %setup -q
  63. %build
  64. ( cd source
  65. CC="%{l_cc}"
  66. CFLAGS="%{l_cflags -O}"
  67. CPPFLAGS="-I%{l_prefix}/include -I%{l_prefix}/include/openssl"
  68. LDFLAGS="-L%{l_prefix}/lib"
  69. %if "%{with_pam}" == "yes"
  70. CPPFLAGS="$CPPFLAGS -I`%{l_prefix}/etc/rc --query pam_incdir`" \
  71. LDFLAGS="$LDFLAGS -L`%{l_prefix}/etc/rc --query pam_libdir`" \
  72. %endif
  73. export CC
  74. export CFLAGS
  75. export LDFLAGS
  76. ./configure \
  77. --prefix=%{l_prefix} \
  78. --localstatedir=%{l_prefix}/var/samba/run \
  79. --sysconfdir=%{l_prefix}/etc/samba \
  80. --with-privatedir=%{l_prefix}/var/samba/run \
  81. --with-sambaconfdir=%{l_prefix}/etc/samba \
  82. --with-lockdir=%{l_prefix}/var/samba/run \
  83. --with-swatdir=%{l_prefix}/share/samba \
  84. --with-codepagedir=%{l_prefix}/share/samba \
  85. --with-ssl --with-sslinc=%{l_prefix}/include \
  86. %if "%{with_pam}" == "yes"
  87. --with-pam \
  88. %endif
  89. --with-vfs
  90. %{l_make} %{l_mflags -O} \
  91. CONFIGFILE=%{l_prefix}/etc/samba/smb.conf \
  92. LMHOSTSFILE=%{l_prefix}/etc/samba/smb.hosts
  93. )
  94. %install
  95. rm -rf $RPM_BUILD_ROOT
  96. %{l_shtool} mkdir -f -p -m 755 \
  97. $RPM_BUILD_ROOT%{l_prefix} \
  98. $RPM_BUILD_ROOT%{l_prefix}/etc/samba \
  99. $RPM_BUILD_ROOT%{l_prefix}/var/samba \
  100. $RPM_BUILD_ROOT%{l_prefix}/share/samba \
  101. $RPM_BUILD_ROOT%{l_prefix}/libexec/samba \
  102. $RPM_BUILD_ROOT%{l_prefix}/var/samba/run \
  103. $RPM_BUILD_ROOT%{l_prefix}/var/samba/spool \
  104. $RPM_BUILD_ROOT%{l_prefix}/var/samba/netlogon \
  105. $RPM_BUILD_ROOT%{l_prefix}/var/samba/profiles
  106. ( cd source
  107. %{l_make} %{l_mflags} install \
  108. prefix=$RPM_BUILD_ROOT%{l_prefix} \
  109. BASEDIR=$RPM_BUILD_ROOT%{l_prefix} \
  110. CONFIGDIR=$RPM_BUILD_ROOT%{l_prefix}/etc/samba \
  111. VARDIR=$RPM_BUILD_ROOT%{l_prefix}/var/samba/run \
  112. SWATDIR=$RPM_BUILD_ROOT%{l_prefix}/share/samba \
  113. CODEPAGEDIR=$RPM_BUILD_ROOT%{l_prefix}/share/samba \
  114. CONFIGFILE=%{l_prefix}/etc/samba/smb.conf \
  115. LMHOSTSFILE=%{l_prefix}/etc/samba/smb.hosts
  116. )
  117. l_hostname=`%{l_shtool} echo -e %h%d`
  118. %{l_shtool} install -c -m 644 \
  119. -e 's;@l_prefix@;%{l_prefix};g' \
  120. -e "s;@l_hostname@;$l_hostname;g" \
  121. %{SOURCE smb.conf} \
  122. %{SOURCE smb.hosts} \
  123. $RPM_BUILD_ROOT%{l_prefix}/etc/samba/
  124. for file in make_printerdef make_smbcodepage make_unicodemap \
  125. testparm testprns; do
  126. mv $RPM_BUILD_ROOT%{l_prefix}/bin/$file \
  127. $RPM_BUILD_ROOT%{l_prefix}/libexec/samba/$file
  128. done
  129. rm -rf $RPM_BUILD_ROOT%{l_prefix}/share/samba/using_samba
  130. rm -rf $RPM_BUILD_ROOT%{l_prefix}/share/samba/help
  131. rm -rf $RPM_BUILD_ROOT%{l_prefix}/share/samba/images
  132. rm -rf $RPM_BUILD_ROOT%{l_prefix}/share/samba/include
  133. strip $RPM_BUILD_ROOT%{l_prefix}/bin/* >/dev/null 2>&1 || true
  134. %{l_shtool} mkdir -f -p -m 755 $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d
  135. %{l_shtool} install -c -m 755 -e 's;@l_prefix@;%{l_prefix};g' \
  136. %{SOURCE rc.samba} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
  137. %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
  138. %{l_files_std} \
  139. '%config %{l_prefix}/etc/samba/*' \
  140. '%attr(1777,%{l_musr},%{l_mgrp}) %{l_prefix}/var/samba/spool' \
  141. '%attr(1777,%{l_musr},%{l_mgrp}) %{l_prefix}/var/samba/profiles'
  142. %files -f files
  143. %clean
  144. rm -rf $RPM_BUILD_ROOT
  145. %post
  146. %if "%{with_pam}" == "yes"
  147. # add PAM configuration entry
  148. if [ $1 -eq 1 ]; then
  149. $RPM_INSTALL_PREFIX/sbin/pamtool --add --smart --name=smbd
  150. fi
  151. %endif
  152. %preun
  153. %if "%{with_pam}" == "yes"
  154. # remove PAM configuration entry
  155. if [ $1 -eq 0 ]; then
  156. $RPM_INSTALL_PREFIX/sbin/pamtool --remove --smart --name=smbd
  157. fi
  158. %endif