sudo.spec 5.2 KB

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