sudo.spec 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174
  1. ##
  2. ## sudo.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: sudo
  27. Summary: Flexible Switch User Command
  28. URL: http://www.sudo.ws/
  29. Vendor: Todd Miller
  30. Packager: The OpenPKG Project
  31. Distribution: OpenPKG
  32. Class: BASE
  33. Group: System
  34. License: BSD
  35. Version: 1.6.8p1
  36. Release: 20041018
  37. # package options
  38. %option with_fsl yes
  39. %option with_pam no
  40. # list of sources
  41. Source0: ftp://ftp.courtesan.com/pub/sudo/sudo-%{version}.tar.gz
  42. Source1: rc.sudo
  43. Source2: fsl.sudo
  44. # build information
  45. Prefix: %{l_prefix}
  46. BuildRoot: %{l_buildroot}
  47. BuildPreReq: OpenPKG, openpkg >= 20040130
  48. PreReq: OpenPKG, openpkg >= 20040130
  49. %if "%{with_fsl}" == "yes"
  50. BuildPreReq: fsl >= 1.2.0
  51. PreReq: fsl >= 1.2.0
  52. %endif
  53. %if "%{with_pam}" == "yes"
  54. BuildPreReq: PAM
  55. PreReq: PAM
  56. %endif
  57. AutoReq: no
  58. AutoReqProv: no
  59. %description
  60. Sudo (superuser do) allows a system administrator to give certain
  61. users (or groups of users) the ability to run some (or all) commands
  62. as root or another user while logging the commands and arguments.
  63. %track
  64. prog sudo = {
  65. version = %{version}
  66. url = ftp://ftp.courtesan.com/pub/sudo/
  67. regex = sudo-(__VER__)\.tar\.gz
  68. }
  69. %prep
  70. %setup -q
  71. %{l_shtool} subst \
  72. -e '/LINENO: error: C[+]* preprocessor/{N;N;N;N;s/.*/:/;}' \
  73. configure
  74. %build
  75. CC="%{l_cc}" \
  76. CFLAGS="%{l_cflags -O}" \
  77. LDFLAGS="%{l_fsl_ldflags}" \
  78. LIBS="%{l_fsl_libs}" \
  79. %if "%{with_pam}" == "yes"
  80. CPPFLAGS="-I`%{l_rc} --query pam_incdir`" \
  81. LDFLAGS="-L`%{l_rc} --query pam_libdir` ${LDFLAGS}" \
  82. %endif
  83. true=`%{l_shtool} path true`
  84. ./configure \
  85. --prefix=%{l_prefix} \
  86. --sysconfdir=%{l_prefix}/etc/sudo \
  87. --with-logpath=%{l_prefix}/var/sudo/sudo.log \
  88. --with-timedir=%{l_prefix}/var/sudo \
  89. %if "%{with_fsl}" == "yes"
  90. --with-logging=syslog \
  91. %else
  92. --with-logging=file \
  93. %endif
  94. --with-sudoers-mode=0400 \
  95. --with-sudoers-uid=%{l_suid} \
  96. --with-sudoers-gid=%{l_mgid} \
  97. --with-sendmail=$true \
  98. --with-ignore-dot \
  99. %if "%{with_pam}" == "yes"
  100. --with-pam \
  101. %endif
  102. --enable-shell-sets-home \
  103. --disable-root-sudo \
  104. --with-env-editor \
  105. --disable-path-info \
  106. --disable-nls
  107. %{l_make} %{l_mflags -O}
  108. %install
  109. rm -rf $RPM_BUILD_ROOT
  110. %{l_shtool} mkdir -f -p -m 755 \
  111. $RPM_BUILD_ROOT%{l_prefix}/var/sudo
  112. %{l_shtool} subst \
  113. -e "s;-M 4111;-M 4511;" \
  114. -e "s;-M 0111;-M 0511;" \
  115. -e "s;-[OG] [^ ]*;;g" \
  116. Makefile
  117. %{l_make} %{l_mflags} install \
  118. prefix=$RPM_BUILD_ROOT%{l_prefix} \
  119. exec_prefix=$RPM_BUILD_ROOT%{l_prefix} \
  120. sysconfdir=$RPM_BUILD_ROOT%{l_prefix}/etc/sudo
  121. # install run-command script
  122. %{l_shtool} mkdir -f -p -m 755 \
  123. $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d
  124. %{l_shtool} install -c -m 755 %{l_value -s -a} \
  125. %{SOURCE rc.sudo} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
  126. # install OSSP fsl configuration
  127. %{l_shtool} mkdir -f -p -m 755 $RPM_BUILD_ROOT%{l_prefix}/etc/fsl
  128. %{l_shtool} install -c -m 644 %{l_value -s -a} \
  129. %{SOURCE fsl.sudo} \
  130. $RPM_BUILD_ROOT%{l_prefix}/etc/fsl/
  131. # determine installation files
  132. %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
  133. %{l_files_std} \
  134. '%not %dir %{l_prefix}/etc/fsl' \
  135. '%config %{l_prefix}/etc/fsl/fsl.sudo' \
  136. '%attr(4111,%{l_susr},%{l_mgrp}) %{l_prefix}/bin/sudo' \
  137. '%attr(4111,%{l_susr},%{l_mgrp}) %{l_prefix}/bin/sudoedit' \
  138. '%attr(0111,%{l_susr},%{l_mgrp}) %{l_prefix}/sbin/visudo' \
  139. '%config %attr(0400,%{l_susr},%{l_mgrp}) %{l_prefix}/etc/sudo/sudoers'
  140. %files -f files
  141. %clean
  142. rm -rf $RPM_BUILD_ROOT
  143. %post
  144. %if "%{with_pam}" == "yes"
  145. # add PAM configuration entry
  146. if [ $1 -eq 1 ]; then
  147. $RPM_INSTALL_PREFIX/sbin/pamtool --add --smart --name=sudo
  148. fi
  149. %endif
  150. %preun
  151. %if "%{with_pam}" == "yes"
  152. # remove PAM configuration entry
  153. if [ $1 -eq 0 ]; then
  154. $RPM_INSTALL_PREFIX/sbin/pamtool --remove --smart --name=sudo
  155. fi
  156. %endif