rsync.spec 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  1. ##
  2. ## rsync.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: rsync
  27. Summary: Remote Filesystem Synchronization
  28. URL: http://rsync.samba.org/
  29. Vendor: Andrew Tridgell & Paul Mackerras
  30. Packager: The OpenPKG Project
  31. Distribution: OpenPKG
  32. Class: CORE
  33. Group: Filesystem
  34. License: GPL
  35. Version: 2.6.1
  36. Release: 20040428
  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 >= 20040130
  46. PreReq: OpenPKG, openpkg >= 20040130
  47. AutoReq: no
  48. AutoReqProv: no
  49. %description
  50. Rsync is a replacement for rcp(1) that has many more features.
  51. Rsync uses the "rsync algorithm" which provides a very fast method
  52. for bringing remote files into sync. It does this by sending just
  53. the differences in the files across the link, without requiring
  54. that both sets of files are present at one of the ends of the link
  55. beforehand. At first glance this may seem impossible because the
  56. calculation of differences between two files normally requires local
  57. access to both files.
  58. %track
  59. prog rsync = {
  60. version = %{version}
  61. url = http://rsync.samba.org/ftp/rsync/
  62. regex = rsync-(\d+\.\d+\.\d+)\.tar\.gz
  63. }
  64. %prep
  65. # unpack vendor sources
  66. %setup -q
  67. %patch -p0
  68. %build
  69. # configure vendor sources
  70. CC="%{l_cc}" \
  71. CFLAGS="%{l_cflags -O}" \
  72. ./configure \
  73. --prefix=%{l_prefix} \
  74. --with-rsyncd-conf=%{l_prefix}/etc/rsync/rsync.conf \
  75. --disable-debug \
  76. --with-included-popt
  77. # build vendor sources
  78. %{l_make} %{l_mflags -O}
  79. %install
  80. # perform vendor installation
  81. rm -rf $RPM_BUILD_ROOT
  82. %{l_make} %{l_mflags} install \
  83. prefix=$RPM_BUILD_ROOT%{l_prefix} \
  84. exec_prefix=$RPM_BUILD_ROOT%{l_prefix}
  85. # post-adjust vendor installation
  86. strip $RPM_BUILD_ROOT%{l_prefix}/bin/* >/dev/null 2>&1 || true
  87. mv $RPM_BUILD_ROOT%{l_prefix}/man/man5/rsyncd.conf.5 \
  88. $RPM_BUILD_ROOT%{l_prefix}/man/man5/rsync.conf.5
  89. # provide default (deamon) configuration
  90. %{l_shtool} mkdir -f -p -m 755 \
  91. $RPM_BUILD_ROOT%{l_prefix}/etc/rsync
  92. %{l_shtool} install -c -m 644 %{l_value -s -a} \
  93. -e 's;@version@;%{version};g' \
  94. %{SOURCE rsync.conf} $RPM_BUILD_ROOT%{l_prefix}/etc/rsync/
  95. %{l_shtool} install -c -m 644 /dev/null \
  96. $RPM_BUILD_ROOT%{l_prefix}/etc/rsync/rsync.passwd
  97. %{l_shtool} mkdir -f -p -m 755 \
  98. $RPM_BUILD_ROOT%{l_prefix}/var/rsync
  99. # provide run-command script
  100. %{l_shtool} mkdir -f -p -m 755 \
  101. $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d
  102. %{l_shtool} install -c -m 755 %{l_value -s -a} \
  103. %{SOURCE rc.rsync} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
  104. # determine binary package files
  105. %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
  106. %{l_files_std} '%config %{l_prefix}/etc/rsync/rsync.*'
  107. %files -f files
  108. %clean
  109. rm -rf $RPM_BUILD_ROOT
  110. %post
  111. # after upgrade, restart service
  112. [ $1 -eq 2 ] || exit 0
  113. eval `%{l_rc} rsync status 2>/dev/null`
  114. [ ".$rsync_active" = .yes ] && %{l_rc} rsync restart
  115. exit 0
  116. %preun
  117. # before erase, stop service and remove log files
  118. [ $1 -eq 0 ] || exit 0
  119. %{l_rc} rsync stop 2>/dev/null
  120. rm -f $RPM_INSTALL_PREFIX/var/rsync/rsync.log* >/dev/null 2>&1 || true
  121. exit 0