rsync.spec 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  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.0
  34. Release: 20080302
  35. # package options
  36. %option with_timelimit no
  37. %option with_linkbyhash no
  38. # list of sources
  39. Source0: http://rsync.samba.org/ftp/rsync/rsync-%{version}.tar.gz
  40. Source1: rsync.conf
  41. Source2: rc.rsync
  42. Patch0: rsync.patch
  43. # build information
  44. Prefix: %{l_prefix}
  45. BuildRoot: %{l_buildroot}
  46. BuildPreReq: OpenPKG, openpkg >= 20060823
  47. PreReq: OpenPKG, openpkg >= 20060823
  48. AutoReq: no
  49. AutoReqProv: no
  50. %description
  51. Rsync is a replacement for rcp(1) that has many more features.
  52. Rsync uses the "rsync algorithm" which provides a very fast method
  53. for bringing remote files into sync. It does this by sending just
  54. the differences in the files across the link, without requiring
  55. that both sets of files are present at one of the ends of the link
  56. beforehand. At first glance this may seem impossible because the
  57. calculation of differences between two files normally requires local
  58. access to both files.
  59. %track
  60. prog rsync = {
  61. version = %{version}
  62. url = http://rsync.samba.org/ftp/rsync/
  63. regex = rsync-(\d+\.\d+\.\d+)\.tar\.gz
  64. }
  65. %prep
  66. # unpack vendor sources
  67. %setup -q
  68. %patch -p0
  69. %if "%{with_timelimit}" == "yes"
  70. %{l_patch} -p1 <patches/time-limit.diff
  71. %endif
  72. %if "%{with_linkbyhash}" == "yes"
  73. %{l_patch} -p1 <patches/link-by-hash.diff
  74. %endif
  75. %build
  76. # configure vendor sources
  77. CC="%{l_cc}" \
  78. CFLAGS="%{l_cflags -O}" \
  79. GREP="grep" \
  80. ./configure \
  81. --prefix=%{l_prefix} \
  82. --mandir=%{l_prefix}/man \
  83. --with-rsyncd-conf=%{l_prefix}/etc/rsync/rsync.conf \
  84. --disable-debug \
  85. --disable-locale \
  86. --with-included-popt \
  87. --with-rsh=ssh
  88. # build vendor sources
  89. %{l_make} %{l_mflags -O}
  90. %install
  91. # perform vendor installation
  92. rm -rf $RPM_BUILD_ROOT
  93. %{l_make} %{l_mflags} install DESTDIR=$RPM_BUILD_ROOT
  94. # post-adjust vendor installation
  95. strip $RPM_BUILD_ROOT%{l_prefix}/bin/* >/dev/null 2>&1 || true
  96. mv $RPM_BUILD_ROOT%{l_prefix}/man/man5/rsyncd.conf.5 \
  97. $RPM_BUILD_ROOT%{l_prefix}/man/man5/rsync.conf.5
  98. # provide default (deamon) configuration
  99. %{l_shtool} mkdir -f -p -m 755 \
  100. $RPM_BUILD_ROOT%{l_prefix}/etc/rsync
  101. %{l_shtool} install -c -m 644 %{l_value -s -a} \
  102. -e 's;@version@;%{version};g' \
  103. %{SOURCE rsync.conf} $RPM_BUILD_ROOT%{l_prefix}/etc/rsync/
  104. %{l_shtool} install -c -m 644 /dev/null \
  105. $RPM_BUILD_ROOT%{l_prefix}/etc/rsync/rsync.passwd
  106. %{l_shtool} mkdir -f -p -m 755 \
  107. $RPM_BUILD_ROOT%{l_prefix}/var/rsync
  108. # provide run-command script
  109. %{l_shtool} mkdir -f -p -m 755 \
  110. $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d
  111. %{l_shtool} install -c -m 755 %{l_value -s -a} \
  112. %{SOURCE rc.rsync} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
  113. # determine binary package files
  114. %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
  115. %{l_files_std} '%config %{l_prefix}/etc/rsync/rsync.*'
  116. %files -f files
  117. %clean
  118. rm -rf $RPM_BUILD_ROOT
  119. %post
  120. # after upgrade, restart service
  121. [ $1 -eq 2 ] || exit 0
  122. eval `%{l_rc} rsync status 2>/dev/null`
  123. [ ".$rsync_active" = .yes ] && %{l_rc} rsync restart
  124. exit 0
  125. %preun
  126. # before erase, stop service and remove log files
  127. [ $1 -eq 0 ] || exit 0
  128. %{l_rc} rsync stop 2>/dev/null
  129. rm -f $RPM_INSTALL_PREFIX/var/rsync/rsync.log* >/dev/null 2>&1 || true
  130. exit 0