rsync.spec 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157
  1. ##
  2. ## rsync.spec -- OpenPKG RPM Package Specification
  3. ## Copyright (c) 2000-2008 OpenPKG Foundation e.V. <http://openpkg.net/>
  4. ##
  5. ## Permission to use, copy, modify, and distribute this software for
  6. ## any purpose with or without fee is hereby granted, provided that
  7. ## the above copyright notice and this permission notice appear in all
  8. ## copies.
  9. ##
  10. ## THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
  11. ## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
  12. ## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
  13. ## IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
  14. ## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  15. ## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  16. ## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
  17. ## USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  18. ## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  19. ## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
  20. ## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  21. ## SUCH DAMAGE.
  22. ##
  23. # package information
  24. Name: rsync
  25. Summary: Remote Filesystem Synchronization
  26. URL: http://rsync.samba.org/
  27. Vendor: Andrew Tridgell & Paul Mackerras
  28. Packager: OpenPKG Foundation e.V.
  29. Distribution: OpenPKG Community
  30. Class: CORE
  31. Group: Filesystem
  32. License: GPL
  33. Version: 3.0.5
  34. Release: 20081229
  35. # package options
  36. %option with_iconv no
  37. # list of sources
  38. Source0: http://rsync.samba.org/ftp/rsync/rsync-%{version}.tar.gz
  39. Source1: rsync.conf
  40. Source2: rc.rsync
  41. Patch0: rsync.patch
  42. # build information
  43. Prefix: %{l_prefix}
  44. BuildRoot: %{l_buildroot}
  45. BuildPreReq: OpenPKG, openpkg >= 20060823
  46. PreReq: OpenPKG, openpkg >= 20060823
  47. %if "%{with_iconv}" == "yes"
  48. BuildPreReq: libiconv
  49. PreReq: libiconv
  50. %endif
  51. AutoReq: no
  52. AutoReqProv: no
  53. %description
  54. Rsync is a replacement for rcp(1) that has many more features.
  55. Rsync uses the "rsync algorithm" which provides a very fast method
  56. for bringing remote files into sync. It does this by sending just
  57. the differences in the files across the link, without requiring
  58. that both sets of files are present at one of the ends of the link
  59. beforehand. At first glance this may seem impossible because the
  60. calculation of differences between two files normally requires local
  61. access to both files.
  62. %track
  63. prog rsync = {
  64. version = %{version}
  65. url = http://rsync.samba.org/ftp/rsync/
  66. regex = rsync-(\d+\.\d+\.\d+)\.tar\.gz
  67. }
  68. %prep
  69. # unpack vendor sources
  70. %setup -q
  71. %patch -p0
  72. %build
  73. # configure vendor sources
  74. CC="%{l_cc}" \
  75. CFLAGS="%{l_cflags -O} %{l_cppflags}" \
  76. CPPFLAGS="%{l_cppflags}" \
  77. LDFLAGS="%{l_ldflags}" \
  78. GREP="grep" \
  79. ./configure \
  80. --prefix=%{l_prefix} \
  81. --mandir=%{l_prefix}/man \
  82. --with-rsync-path="rsync" \
  83. --with-rsyncd-conf=%{l_prefix}/etc/rsync/rsync.conf \
  84. --disable-debug \
  85. --disable-locale \
  86. %if "%{with_iconv}" == "yes"
  87. --enable-iconv \
  88. %else
  89. --disable-iconv \
  90. %endif
  91. --with-included-popt \
  92. --with-rsh="ssh"
  93. # build vendor sources
  94. %{l_make} %{l_mflags -O} PERL="%{l_miniperl}"
  95. %install
  96. # perform vendor installation
  97. rm -rf $RPM_BUILD_ROOT
  98. %{l_make} %{l_mflags} install DESTDIR=$RPM_BUILD_ROOT
  99. # post-adjust vendor installation
  100. strip $RPM_BUILD_ROOT%{l_prefix}/bin/* >/dev/null 2>&1 || true
  101. mv $RPM_BUILD_ROOT%{l_prefix}/man/man5/rsyncd.conf.5 \
  102. $RPM_BUILD_ROOT%{l_prefix}/man/man5/rsync.conf.5
  103. # provide default (deamon) configuration
  104. %{l_shtool} mkdir -f -p -m 755 \
  105. $RPM_BUILD_ROOT%{l_prefix}/etc/rsync
  106. %{l_shtool} install -c -m 644 %{l_value -s -a} \
  107. -e 's;@version@;%{version};g' \
  108. %{SOURCE rsync.conf} $RPM_BUILD_ROOT%{l_prefix}/etc/rsync/
  109. %{l_shtool} install -c -m 644 /dev/null \
  110. $RPM_BUILD_ROOT%{l_prefix}/etc/rsync/rsync.passwd
  111. %{l_shtool} mkdir -f -p -m 755 \
  112. $RPM_BUILD_ROOT%{l_prefix}/var/rsync
  113. # provide run-command script
  114. %{l_shtool} mkdir -f -p -m 755 \
  115. $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d
  116. %{l_shtool} install -c -m 755 %{l_value -s -a} \
  117. %{SOURCE rc.rsync} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
  118. # determine binary package files
  119. %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
  120. %{l_files_std} \
  121. '%config %{l_prefix}/etc/rsync/rsync.*' \
  122. '%config %attr(600,%{l_susr},%{l_mgrp}) %{l_prefix}/etc/rsync/rsync.passwd'
  123. %files -f files
  124. %clean
  125. rm -rf $RPM_BUILD_ROOT
  126. %post
  127. # after upgrade, restart service
  128. [ $1 -eq 2 ] || exit 0
  129. eval `%{l_rc} rsync status 2>/dev/null`
  130. [ ".$rsync_active" = .yes ] && %{l_rc} rsync restart
  131. exit 0
  132. %preun
  133. # before erase, stop service and remove log files
  134. [ $1 -eq 0 ] || exit 0
  135. %{l_rc} rsync stop 2>/dev/null
  136. rm -f $RPM_INSTALL_PREFIX/var/rsync/rsync.log* >/dev/null 2>&1 || true
  137. exit 0