sudo.spec 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215
  1. ##
  2. ## sudo.spec -- OpenPKG RPM Package Specification
  3. ## Copyright (c) 2000-2010 OpenPKG Foundation e.V. <http://openpkg.net/>
  4. ##
  5. ## Permission to use, copy, modify, and distribute this software for
  6. ## any purpose with or without fee is hereby granted, provided that
  7. ## the above copyright notice and this permission notice appear in all
  8. ## copies.
  9. ##
  10. ## THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
  11. ## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
  12. ## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
  13. ## IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
  14. ## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  15. ## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  16. ## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
  17. ## USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  18. ## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  19. ## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
  20. ## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  21. ## SUCH DAMAGE.
  22. ##
  23. # package information
  24. Name: sudo
  25. Summary: Flexible Switch User Command
  26. URL: http://www.sudo.ws/
  27. Vendor: Todd Miller
  28. Packager: OpenPKG Foundation e.V.
  29. Distribution: OpenPKG Community
  30. Class: BASE
  31. Group: ShellUtils
  32. License: BSD
  33. Version: 1.7.3
  34. Release: 20100630
  35. # package options
  36. %option with_fsl yes
  37. %option with_pam no
  38. %option with_skey no
  39. %option with_opie no
  40. %option with_ldap no
  41. # list of sources
  42. Source0: http://www.sudo.ws/sudo/dist/sudo-%{version}.tar.gz
  43. Source1: rc.sudo
  44. Source2: fsl.sudo
  45. # build information
  46. BuildPreReq: OpenPKG, openpkg >= 20100101
  47. PreReq: OpenPKG, openpkg >= 20100101
  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. %if "%{with_skey}" == "yes"
  57. BuildPreReq: skey
  58. PreReq: skey
  59. %endif
  60. %if "%{with_opie}" == "yes"
  61. BuildPreReq: opie
  62. PreReq: opie
  63. %endif
  64. %if "%{with_ldap}" == "yes"
  65. BuildPreReq: openldap
  66. PreReq: openldap
  67. %endif
  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 = http://www.sudo.ws/sudo/dist/
  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. libs=""
  97. case "%{l_platform -t}" in
  98. *-freebsd* ) libs="$libs -lutil" ;;
  99. esac
  100. CC="%{l_cc}" \
  101. CFLAGS="%{l_cflags -O}" \
  102. LDFLAGS="%{l_fsl_ldflags}" \
  103. SUDO_LIBS="$libs %{l_fsl_libs}" \
  104. %if "%{with_pam}" == "yes"
  105. CPPFLAGS="-I`%{l_rc} --query pam_incdir`" \
  106. LDFLAGS="-L`%{l_rc} --query pam_libdir` ${LDFLAGS}" \
  107. %endif
  108. true=`%{l_shtool} path true` \
  109. ./configure \
  110. --prefix=%{l_prefix} \
  111. --mandir=%{l_prefix}/man \
  112. --sysconfdir=%{l_prefix}/etc/sudo \
  113. --with-noexec=%{l_prefix}/libexec/sudo/sudo_noexec.so \
  114. --with-logpath=%{l_prefix}/var/sudo/sudo.log \
  115. --with-timedir=%{l_prefix}/var/sudo \
  116. %if "%{with_fsl}" == "yes"
  117. --with-logging=syslog \
  118. %else
  119. --with-logging=file \
  120. %endif
  121. --with-sudoers-mode=0400 \
  122. --with-sudoers-uid=%{l_suid} \
  123. --with-sudoers-gid=%{l_sgid} \
  124. --with-sendmail=$true \
  125. --with-ignore-dot \
  126. %if "%{with_pam}" == "yes"
  127. --with-pam \
  128. %else
  129. --without-pam \
  130. %endif
  131. %if "%{with_skey}" == "yes" || "%{with_opie}" == "yes"
  132. --with-long-otp-prompt \
  133. %endif
  134. %if "%{with_skey}" == "yes"
  135. --with-skey=%{l_prefix} \
  136. %endif
  137. %if "%{with_opie}" == "yes"
  138. --with-opie=%{l_prefix} \
  139. %endif
  140. %if "%{with_ldap}" == "yes"
  141. --with-ldap=%{l_prefix} \
  142. --with-ldap-conf-file=%{l_prefix}/etc/sudo/ldap.conf \
  143. %endif
  144. --enable-shell-sets-home \
  145. --disable-root-sudo \
  146. --with-env-editor \
  147. --disable-path-info \
  148. --disable-nls
  149. %{l_make} %{l_mflags -O}
  150. %install
  151. %{l_shtool} mkdir -f -p -m 755 \
  152. $RPM_BUILD_ROOT%{l_prefix}/var/sudo
  153. %{l_shtool} subst \
  154. -e "s;-M 4111;-M 4511;" \
  155. -e "s;-M 0111;-M 0511;" \
  156. -e "s;-[OG] [^ ]*;;g" \
  157. Makefile
  158. %{l_make} %{l_mflags} install \
  159. prefix=$RPM_BUILD_ROOT%{l_prefix} \
  160. mandir=$RPM_BUILD_ROOT%{l_prefix}/man \
  161. noexecdir=$RPM_BUILD_ROOT%{l_prefix}/libexec/sudo \
  162. sysconfdir=$RPM_BUILD_ROOT%{l_prefix}/etc/sudo
  163. # install run-command script
  164. %{l_shtool} mkdir -f -p -m 755 \
  165. $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d
  166. %{l_shtool} install -c -m 755 %{l_value -s -a} \
  167. %{SOURCE rc.sudo} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
  168. # install OSSP fsl configuration
  169. %{l_shtool} mkdir -f -p -m 755 $RPM_BUILD_ROOT%{l_prefix}/etc/fsl
  170. %{l_shtool} install -c -m 644 %{l_value -s -a} \
  171. %{SOURCE fsl.sudo} \
  172. $RPM_BUILD_ROOT%{l_prefix}/etc/fsl/
  173. # determine installation files
  174. %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
  175. %{l_files_std} \
  176. '%config %{l_prefix}/etc/fsl/fsl.sudo' \
  177. '%attr(4111,%{l_susr},%{l_mgrp}) %{l_prefix}/bin/sudo' \
  178. '%attr(4111,%{l_susr},%{l_mgrp}) %{l_prefix}/bin/sudoedit' \
  179. '%attr(0111,%{l_susr},%{l_mgrp}) %{l_prefix}/sbin/visudo' \
  180. '%attr(0700,%{l_susr},%{l_mgrp}) %dir %{l_prefix}/var/sudo' \
  181. '%config %attr(0400,%{l_susr},%{l_sgrp}) %{l_prefix}/etc/sudo/sudoers'
  182. %files -f files
  183. %clean
  184. %post
  185. %if "%{with_pam}" == "yes"
  186. # add PAM configuration entry
  187. if [ $1 -eq 1 ]; then
  188. $RPM_INSTALL_PREFIX/sbin/pamtool --add --smart --name=sudo
  189. fi
  190. %endif
  191. %preun
  192. %if "%{with_pam}" == "yes"
  193. # remove PAM configuration entry
  194. if [ $1 -eq 0 ]; then
  195. $RPM_INSTALL_PREFIX/sbin/pamtool --remove --smart --name=sudo
  196. fi
  197. %endif