sudo.spec 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206
  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.8p12
  35. Release: 20051109
  36. # package options
  37. %option with_fsl yes
  38. %option with_pam no
  39. %option with_skey no
  40. %option with_opie no
  41. # list of sources
  42. Source0: ftp://ftp.courtesan.com/pub/sudo/sudo-%{version}.tar.gz
  43. Source1: rc.sudo
  44. Source2: fsl.sudo
  45. # build information
  46. Prefix: %{l_prefix}
  47. BuildRoot: %{l_buildroot}
  48. BuildPreReq: OpenPKG, openpkg >= 20040130
  49. PreReq: OpenPKG, openpkg >= 20040130
  50. %if "%{with_fsl}" == "yes"
  51. BuildPreReq: fsl >= 1.2.0
  52. PreReq: fsl >= 1.2.0
  53. %endif
  54. %if "%{with_pam}" == "yes"
  55. BuildPreReq: PAM
  56. PreReq: PAM
  57. %endif
  58. %if "%{with_skey}" == "yes"
  59. BuildPreReq: skey
  60. PreReq: skey
  61. %endif
  62. %if "%{with_opie}" == "yes"
  63. BuildPreReq: opie
  64. PreReq: opie
  65. %endif
  66. AutoReq: no
  67. AutoReqProv: no
  68. %description
  69. Sudo (superuser do) allows a system administrator to give certain
  70. users (or groups of users) the ability to run some (or all) commands
  71. as root or another user while logging the commands and arguments.
  72. %track
  73. prog sudo = {
  74. version = %{version}
  75. url = ftp://ftp.courtesan.com/pub/sudo/
  76. regex = sudo-(__VER__)\.tar\.gz
  77. }
  78. %prep
  79. %setup -q
  80. %{l_shtool} subst \
  81. -e '/LINENO: error: C[+]* preprocessor/{N;N;N;N;s/.*/:/;}' \
  82. configure
  83. case "%{l_platform -t}" in
  84. *-darwin* )
  85. %{l_shtool} subst \
  86. -e 's/\(\$(LIBTOOL).*sudo_noexec.lo.*$\)/\1; $(CC) -dynamiclib .libs\/sudo_noexec.o $(LDFLAGS) -o .libs\/sudo_noexec.dylib/' \
  87. Makefile.in
  88. ;;
  89. *-sunos* )
  90. %{l_shtool} subst \
  91. -e 's;^(void)isblank(1);if ((int)isblank(0x20)) exit(0);' \
  92. configure
  93. ;;
  94. esac
  95. %build
  96. CC="%{l_cc}" \
  97. CFLAGS="%{l_cflags -O}" \
  98. LDFLAGS="%{l_fsl_ldflags}" \
  99. SUDO_LIBS="%{l_fsl_libs}" \
  100. %if "%{with_pam}" == "yes"
  101. CPPFLAGS="-I`%{l_rc} --query pam_incdir`" \
  102. LDFLAGS="-L`%{l_rc} --query pam_libdir` ${LDFLAGS}" \
  103. %endif
  104. true=`%{l_shtool} path true` \
  105. ./configure \
  106. --prefix=%{l_prefix} \
  107. --sysconfdir=%{l_prefix}/etc/sudo \
  108. --with-noexec=%{l_prefix}/libexec/sudo/sudo_noexec.so \
  109. --with-logpath=%{l_prefix}/var/sudo/sudo.log \
  110. --with-timedir=%{l_prefix}/var/sudo \
  111. %if "%{with_fsl}" == "yes"
  112. --with-logging=syslog \
  113. %else
  114. --with-logging=file \
  115. %endif
  116. --with-sudoers-mode=0400 \
  117. --with-sudoers-uid=%{l_suid} \
  118. --with-sudoers-gid=%{l_mgid} \
  119. --with-sendmail=$true \
  120. --with-ignore-dot \
  121. %if "%{with_pam}" == "yes"
  122. --with-pam \
  123. %endif
  124. %if "%{with_skey}" == "yes" || "%{with_opie}" == "yes"
  125. --with-long-otp-prompt \
  126. %endif
  127. %if "%{with_skey}" == "yes"
  128. --with-skey=%{l_prefix} \
  129. %endif
  130. %if "%{with_opie}" == "yes"
  131. --with-opie=%{l_prefix} \
  132. %endif
  133. --enable-shell-sets-home \
  134. --disable-root-sudo \
  135. --with-env-editor \
  136. --disable-path-info \
  137. --disable-nls
  138. %{l_make} %{l_mflags -O}
  139. %install
  140. rm -rf $RPM_BUILD_ROOT
  141. %{l_shtool} mkdir -f -p -m 755 \
  142. $RPM_BUILD_ROOT%{l_prefix}/var/sudo
  143. %{l_shtool} subst \
  144. -e "s;-M 4111;-M 4511;" \
  145. -e "s;-M 0111;-M 0511;" \
  146. -e "s;-[OG] [^ ]*;;g" \
  147. Makefile
  148. %{l_make} %{l_mflags} install \
  149. prefix=$RPM_BUILD_ROOT%{l_prefix} \
  150. noexecdir=$RPM_BUILD_ROOT%{l_prefix}/libexec/sudo \
  151. sysconfdir=$RPM_BUILD_ROOT%{l_prefix}/etc/sudo
  152. # install run-command script
  153. %{l_shtool} mkdir -f -p -m 755 \
  154. $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d
  155. %{l_shtool} install -c -m 755 %{l_value -s -a} \
  156. %{SOURCE rc.sudo} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
  157. # install OSSP fsl configuration
  158. %{l_shtool} mkdir -f -p -m 755 $RPM_BUILD_ROOT%{l_prefix}/etc/fsl
  159. %{l_shtool} install -c -m 644 %{l_value -s -a} \
  160. %{SOURCE fsl.sudo} \
  161. $RPM_BUILD_ROOT%{l_prefix}/etc/fsl/
  162. # determine installation files
  163. %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
  164. %{l_files_std} \
  165. '%not %dir %{l_prefix}/etc/fsl' \
  166. '%config %{l_prefix}/etc/fsl/fsl.sudo' \
  167. '%attr(4111,%{l_susr},%{l_mgrp}) %{l_prefix}/bin/sudo' \
  168. '%attr(4111,%{l_susr},%{l_mgrp}) %{l_prefix}/bin/sudoedit' \
  169. '%attr(0111,%{l_susr},%{l_mgrp}) %{l_prefix}/sbin/visudo' \
  170. '%attr(0700,%{l_susr},%{l_mgrp}) %dir %{l_prefix}/var/sudo' \
  171. '%config %attr(0400,%{l_susr},%{l_mgrp}) %{l_prefix}/etc/sudo/sudoers'
  172. %files -f files
  173. %clean
  174. rm -rf $RPM_BUILD_ROOT
  175. %post
  176. %if "%{with_pam}" == "yes"
  177. # add PAM configuration entry
  178. if [ $1 -eq 1 ]; then
  179. $RPM_INSTALL_PREFIX/sbin/pamtool --add --smart --name=sudo
  180. fi
  181. %endif
  182. %preun
  183. %if "%{with_pam}" == "yes"
  184. # remove PAM configuration entry
  185. if [ $1 -eq 0 ]; then
  186. $RPM_INSTALL_PREFIX/sbin/pamtool --remove --smart --name=sudo
  187. fi
  188. %endif