sudo.spec 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187
  1. ##
  2. ## sudo.spec -- OpenPKG RPM Package Specification
  3. ## Copyright (c) 2000-2005 OpenPKG Foundation e.V. <http://openpkg.net/>
  4. ## Copyright (c) 2000-2005 Ralf S. Engelschall <http://engelschall.com/>
  5. ##
  6. ## Permission to use, copy, modify, and distribute this software for
  7. ## any purpose with or without fee is hereby granted, provided that
  8. ## the above copyright notice and this permission notice appear in all
  9. ## copies.
  10. ##
  11. ## THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
  12. ## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
  13. ## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
  14. ## IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
  15. ## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  16. ## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  17. ## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
  18. ## USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  19. ## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  20. ## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
  21. ## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  22. ## SUCH DAMAGE.
  23. ##
  24. # package information
  25. Name: sudo
  26. Summary: Flexible Switch User Command
  27. URL: http://www.sudo.ws/
  28. Vendor: Todd Miller
  29. Packager: OpenPKG
  30. Distribution: OpenPKG
  31. Class: BASE
  32. Group: System
  33. License: BSD
  34. Version: 1.6.8p9
  35. Release: 20051024
  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 >= 20040130
  47. PreReq: OpenPKG, openpkg >= 20040130
  48. %if "%{with_fsl}" == "yes"
  49. BuildPreReq: fsl >= 1.2.0
  50. PreReq: fsl >= 1.2.0
  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. %track
  63. prog sudo = {
  64. version = %{version}
  65. url = ftp://ftp.courtesan.com/pub/sudo/
  66. regex = sudo-(__VER__)\.tar\.gz
  67. }
  68. %prep
  69. %setup -q
  70. %{l_shtool} subst \
  71. -e '/LINENO: error: C[+]* preprocessor/{N;N;N;N;s/.*/:/;}' \
  72. configure
  73. case "%{l_platform -t}" in
  74. *-darwin* )
  75. %{l_shtool} subst \
  76. -e 's/\(\$(LIBTOOL).*sudo_noexec.lo.*$\)/\1; $(CC) -dynamiclib .libs\/sudo_noexec.o $(LDFLAGS) -o .libs\/sudo_noexec.dylib/' \
  77. Makefile.in
  78. ;;
  79. *-sunos* )
  80. %{l_shtool} subst \
  81. -e 's;^(void)isblank(1);if ((int)isblank(0x20)) exit(0);' \
  82. configure
  83. ;;
  84. esac
  85. %build
  86. CC="%{l_cc}" \
  87. CFLAGS="%{l_cflags -O}" \
  88. LDFLAGS="%{l_fsl_ldflags}" \
  89. SUDO_LIBS="%{l_fsl_libs}" \
  90. %if "%{with_pam}" == "yes"
  91. CPPFLAGS="-I`%{l_rc} --query pam_incdir`" \
  92. LDFLAGS="-L`%{l_rc} --query pam_libdir` ${LDFLAGS}" \
  93. %endif
  94. true=`%{l_shtool} path true` \
  95. ./configure \
  96. --prefix=%{l_prefix} \
  97. --sysconfdir=%{l_prefix}/etc/sudo \
  98. --with-noexec=%{l_prefix}/libexec/sudo/sudo_noexec.so \
  99. --with-logpath=%{l_prefix}/var/sudo/sudo.log \
  100. --with-timedir=%{l_prefix}/var/sudo \
  101. %if "%{with_fsl}" == "yes"
  102. --with-logging=syslog \
  103. %else
  104. --with-logging=file \
  105. %endif
  106. --with-sudoers-mode=0400 \
  107. --with-sudoers-uid=%{l_suid} \
  108. --with-sudoers-gid=%{l_mgid} \
  109. --with-sendmail=$true \
  110. --with-ignore-dot \
  111. %if "%{with_pam}" == "yes"
  112. --with-pam \
  113. %endif
  114. --enable-shell-sets-home \
  115. --disable-root-sudo \
  116. --with-env-editor \
  117. --disable-path-info \
  118. --disable-nls
  119. %{l_make} %{l_mflags -O}
  120. %install
  121. rm -rf $RPM_BUILD_ROOT
  122. %{l_shtool} mkdir -f -p -m 755 \
  123. $RPM_BUILD_ROOT%{l_prefix}/var/sudo
  124. %{l_shtool} subst \
  125. -e "s;-M 4111;-M 4511;" \
  126. -e "s;-M 0111;-M 0511;" \
  127. -e "s;-[OG] [^ ]*;;g" \
  128. Makefile
  129. %{l_make} %{l_mflags} install \
  130. prefix=$RPM_BUILD_ROOT%{l_prefix} \
  131. noexecdir=$RPM_BUILD_ROOT%{l_prefix}/libexec/sudo \
  132. sysconfdir=$RPM_BUILD_ROOT%{l_prefix}/etc/sudo
  133. # install run-command script
  134. %{l_shtool} mkdir -f -p -m 755 \
  135. $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d
  136. %{l_shtool} install -c -m 755 %{l_value -s -a} \
  137. %{SOURCE rc.sudo} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
  138. # install OSSP fsl configuration
  139. %{l_shtool} mkdir -f -p -m 755 $RPM_BUILD_ROOT%{l_prefix}/etc/fsl
  140. %{l_shtool} install -c -m 644 %{l_value -s -a} \
  141. %{SOURCE fsl.sudo} \
  142. $RPM_BUILD_ROOT%{l_prefix}/etc/fsl/
  143. # determine installation files
  144. %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
  145. %{l_files_std} \
  146. '%not %dir %{l_prefix}/etc/fsl' \
  147. '%config %{l_prefix}/etc/fsl/fsl.sudo' \
  148. '%attr(4111,%{l_susr},%{l_mgrp}) %{l_prefix}/bin/sudo' \
  149. '%attr(4111,%{l_susr},%{l_mgrp}) %{l_prefix}/bin/sudoedit' \
  150. '%attr(0111,%{l_susr},%{l_mgrp}) %{l_prefix}/sbin/visudo' \
  151. '%attr(0700,%{l_susr},%{l_mgrp}) %dir %{l_prefix}/var/sudo' \
  152. '%config %attr(0400,%{l_susr},%{l_mgrp}) %{l_prefix}/etc/sudo/sudoers'
  153. %files -f files
  154. %clean
  155. rm -rf $RPM_BUILD_ROOT
  156. %post
  157. %if "%{with_pam}" == "yes"
  158. # add PAM configuration entry
  159. if [ $1 -eq 1 ]; then
  160. $RPM_INSTALL_PREFIX/sbin/pamtool --add --smart --name=sudo
  161. fi
  162. %endif
  163. %preun
  164. %if "%{with_pam}" == "yes"
  165. # remove PAM configuration entry
  166. if [ $1 -eq 0 ]; then
  167. $RPM_INSTALL_PREFIX/sbin/pamtool --remove --smart --name=sudo
  168. fi
  169. %endif