sudo.spec 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  1. ##
  2. ## sudo.spec -- OpenPKG RPM Specification
  3. ## Copyright (c) 2000-2002 Cable & Wireless Deutschland GmbH
  4. ## Copyright (c) 2000-2002 The OpenPKG Project <http://www.openpkg.org/>
  5. ## Copyright (c) 2000-2002 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 options
  26. %ifndef with_pam
  27. %define with_pam no
  28. %endif
  29. # package information
  30. Name: sudo
  31. Summary: Flexible Switch User Command
  32. URL: http://www.sudo.ws/
  33. Vendor: Todd Miller
  34. Packager: The OpenPKG Project
  35. Distribution: OpenPKG [REL]
  36. Group: System
  37. License: BSD
  38. Version: 1.6.5p2
  39. Release: 20020315
  40. # list of sources
  41. Source0: ftp://ftp.courtesan.com/pub/sudo/sudo-%{version}.tar.gz
  42. # build information
  43. Prefix: %{l_prefix}
  44. BuildRoot: %{l_buildroot}
  45. BuildPreReq: OpenPKG, openpkg >= 20020206, MTA
  46. PreReq: OpenPKG, openpkg >= 20020206, MTA
  47. %if "%{with_pam}" == "yes"
  48. BuildPreReq: PAM
  49. PreReq: PAM
  50. %endif
  51. AutoReq: no
  52. AutoReqProv: no
  53. %description
  54. Sudo (superuser do) allows a system administrator to give certain
  55. users (or groups of users) the ability to run some (or all) commands
  56. as root or another user while logging the commands and arguments.
  57. Options: with_pam=%{with_pam}
  58. %prep
  59. %setup -q
  60. %build
  61. CC="%{l_cc}" \
  62. CFLAGS="%{l_cflags -O}" \
  63. %if "%{with_pam}" == "yes"
  64. CPPFLAGS="-I`%{l_prefix}/etc/rc --query pam_incdir`" \
  65. LDFLAGS="-L`%{l_prefix}/etc/rc --query pam_libdir`" \
  66. %endif
  67. ./configure \
  68. --prefix=%{l_prefix} \
  69. --sysconfdir=%{l_prefix}/etc/sudo \
  70. --with-logpath=%{l_prefix}/var/sudo/log/sudo.log \
  71. --with-logging=file \
  72. --with-sudoers-mode=0400 \
  73. --with-sudoers-uid=0 \
  74. --with-sudoers-gid=%{l_muid} \
  75. --with-sendmail=%{l_prefix}/sbin/sendmail \
  76. --with-ignore-dot \
  77. %if "%{with_pam}" == "yes"
  78. --with-pam \
  79. %endif
  80. --enable-shell-sets-home \
  81. --disable-root-sudo \
  82. --with-env-editor \
  83. --disable-path-info \
  84. --disable-nls
  85. %{l_make} %{l_mflags -O}
  86. %install
  87. rm -rf $RPM_BUILD_ROOT
  88. %{l_shtool} mkdir -f -p -m 755 \
  89. $RPM_BUILD_ROOT%{l_prefix}/var/sudo/log/
  90. %{l_shtool} subst \
  91. -e "s;-m 4111;-m 4511;" \
  92. -e "s;-m 0111;-m 0511;" \
  93. Makefile
  94. %{l_make} %{l_mflags} install \
  95. prefix=$RPM_BUILD_ROOT%{l_prefix} \
  96. exec_prefix=$RPM_BUILD_ROOT%{l_prefix} \
  97. sysconfdir=$RPM_BUILD_ROOT%{l_prefix}/etc/sudo \
  98. install_uid=`%{l_shtool} echo -e %u` \
  99. install_gid=`%{l_shtool} echo -e %u` \
  100. sudoers_uid=`%{l_shtool} echo -e %u` \
  101. sudoers_gid=`%{l_shtool} echo -e %u`
  102. %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
  103. %{l_files_std} \
  104. '%attr(4111,root,%{l_mgrp}) %{l_prefix}/bin/sudo' \
  105. '%attr(0111,root,%{l_mgrp}) %{l_prefix}/sbin/visudo' \
  106. '%config %attr(0400,root,%{l_mgrp}) %{l_prefix}/etc/sudo/sudoers'
  107. %files -f files
  108. %clean
  109. rm -rf $RPM_BUILD_ROOT
  110. %post
  111. %if "%{with_pam}" == "yes"
  112. # add PAM configuration entry
  113. if [ $1 -eq 1 ]; then
  114. $RPM_INSTALL_PREFIX/sbin/pamtool -a -s -n "sudo"
  115. fi
  116. %endif
  117. %preun
  118. %if "%{with_pam}" == "yes"
  119. # remove PAM configuration entry
  120. if [ $1 -eq 0 ]; then
  121. $RPM_INSTALL_PREFIX/sbin/pamtool -r -s -n "sudo"
  122. fi
  123. %endif