1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/sudo/sudo.spec Fri Aug 03 15:42:27 2012 +0200 1.3 @@ -0,0 +1,232 @@ 1.4 +## 1.5 +## sudo.spec -- OpenPKG RPM Package Specification 1.6 +## Copyright (c) 2000-2012 OpenPKG Foundation e.V. <http://openpkg.net/> 1.7 +## 1.8 +## Permission to use, copy, modify, and distribute this software for 1.9 +## any purpose with or without fee is hereby granted, provided that 1.10 +## the above copyright notice and this permission notice appear in all 1.11 +## copies. 1.12 +## 1.13 +## THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED 1.14 +## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 1.15 +## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 1.16 +## IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR 1.17 +## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 1.18 +## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 1.19 +## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF 1.20 +## USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 1.21 +## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 1.22 +## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 1.23 +## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 1.24 +## SUCH DAMAGE. 1.25 +## 1.26 + 1.27 +# package information 1.28 +Name: sudo 1.29 +Summary: Flexible Switch User Command 1.30 +URL: http://www.sudo.ws/ 1.31 +Vendor: Todd Miller 1.32 +Packager: OpenPKG Foundation e.V. 1.33 +Distribution: OpenPKG Community 1.34 +Class: BASE 1.35 +Group: ShellUtils 1.36 +License: BSD 1.37 +Version: 1.8.5p2 1.38 +Release: 20120531 1.39 + 1.40 +# package options 1.41 +%option with_fsl yes 1.42 +%option with_pam no 1.43 +%option with_skey no 1.44 +%option with_opie no 1.45 +%option with_ldap no 1.46 + 1.47 +# list of sources 1.48 +Source0: http://www.sudo.ws/sudo/dist/sudo-%{version}.tar.gz 1.49 +Source1: rc.sudo 1.50 +Source2: fsl.sudo 1.51 +Source3: sudo.conf 1.52 +Source4: sudoers 1.53 + 1.54 +# build information 1.55 +BuildPreReq: OpenPKG, openpkg >= 20100101 1.56 +PreReq: OpenPKG, openpkg >= 20100101 1.57 +BuildPreReq: zlib 1.58 +PreReq: zlib 1.59 +%if "%{with_fsl}" == "yes" 1.60 +BuildPreReq: fsl 1.61 +PreReq: fsl 1.62 +%endif 1.63 +%if "%{with_pam}" == "yes" 1.64 +BuildPreReq: PAM 1.65 +PreReq: PAM 1.66 +%endif 1.67 +%if "%{with_skey}" == "yes" 1.68 +BuildPreReq: skey 1.69 +PreReq: skey 1.70 +%endif 1.71 +%if "%{with_opie}" == "yes" 1.72 +BuildPreReq: opie 1.73 +PreReq: opie 1.74 +%endif 1.75 +%if "%{with_ldap}" == "yes" 1.76 +BuildPreReq: openldap 1.77 +PreReq: openldap 1.78 +%endif 1.79 + 1.80 +%description 1.81 + Sudo (superuser do) allows a system administrator to give certain 1.82 + users (or groups of users) the ability to run some (or all) commands 1.83 + as root or another user while logging the commands and arguments. 1.84 + 1.85 +%track 1.86 + prog sudo = { 1.87 + version = %{version} 1.88 + url = http://www.sudo.ws/sudo/dist/ 1.89 + regex = sudo-(__VER__)\.tar\.gz 1.90 + } 1.91 + 1.92 +%prep 1.93 + %setup -q 1.94 + %{l_shtool} subst \ 1.95 + -e '/LINENO: error: C[+]* preprocessor/{N;N;N;N;s/.*/:/;}' \ 1.96 + configure 1.97 + case "%{l_platform -t}" in 1.98 + *-darwin* ) 1.99 + %{l_shtool} subst \ 1.100 + -e 's/\(\$(LIBTOOL).*sudo_noexec.lo.*$\)/\1; $(CC) -dynamiclib .libs\/sudo_noexec.o $(LDFLAGS) -o .libs\/sudo_noexec.dylib/' \ 1.101 + Makefile.in 1.102 + ;; 1.103 + *-sunos* ) 1.104 + %{l_shtool} subst \ 1.105 + -e 's;^(void)isblank(1);if ((int)isblank(0x20)) exit(0);' \ 1.106 + configure 1.107 + ;; 1.108 + esac 1.109 + 1.110 +%build 1.111 + # configure program 1.112 + libs="" 1.113 + case "%{l_platform -t}" in 1.114 + *-freebsd* ) libs="$libs -lutil" ;; 1.115 + esac 1.116 + CC="%{l_cc}" \ 1.117 + CFLAGS="%{l_cflags -O}" \ 1.118 + LDFLAGS="%{l_fsl_ldflags}" \ 1.119 + SUDO_LIBS="$libs %{l_fsl_libs}" \ 1.120 +%if "%{with_pam}" == "yes" 1.121 + CPPFLAGS="-I`%{l_rc} --query pam_incdir`" \ 1.122 + LDFLAGS="-L`%{l_rc} --query pam_libdir` ${LDFLAGS}" \ 1.123 +%endif 1.124 + true=`%{l_shtool} path true` \ 1.125 + ./configure \ 1.126 + --prefix=%{l_prefix} \ 1.127 + --mandir=%{l_prefix}/man \ 1.128 + --sysconfdir=%{l_prefix}/etc/sudo \ 1.129 + --libexecdir=%{l_prefix}/libexec/sudo \ 1.130 + --with-plugindir=%{l_prefix}/libexec/sudo/plugin \ 1.131 + --with-noexec=%{l_prefix}/libexec/sudo/helper/sudo_noexec.so \ 1.132 + --with-logpath=%{l_prefix}/var/sudo/sudo.log \ 1.133 + --with-timedir=%{l_prefix}/var/sudo \ 1.134 + --enable-zlib=%{l_prefix} \ 1.135 +%if "%{with_fsl}" == "yes" 1.136 + --with-logging=syslog \ 1.137 +%else 1.138 + --with-logging=file \ 1.139 +%endif 1.140 + --with-sudoers-mode=0400 \ 1.141 + --with-sudoers-uid=%{l_suid} \ 1.142 + --with-sudoers-gid=%{l_sgid} \ 1.143 + --with-sendmail=$true \ 1.144 + --with-ignore-dot \ 1.145 +%if "%{with_pam}" == "yes" 1.146 + --with-pam \ 1.147 +%else 1.148 + --without-pam \ 1.149 +%endif 1.150 +%if "%{with_skey}" == "yes" || "%{with_opie}" == "yes" 1.151 + --with-long-otp-prompt \ 1.152 +%endif 1.153 +%if "%{with_skey}" == "yes" 1.154 + --with-skey=%{l_prefix} \ 1.155 +%endif 1.156 +%if "%{with_opie}" == "yes" 1.157 + --with-opie=%{l_prefix} \ 1.158 +%endif 1.159 +%if "%{with_ldap}" == "yes" 1.160 + --with-ldap=%{l_prefix} \ 1.161 + --with-ldap-conf-file=%{l_prefix}/etc/sudo/ldap.conf \ 1.162 +%endif 1.163 + --enable-shell-sets-home \ 1.164 + --disable-root-sudo \ 1.165 + --with-env-editor \ 1.166 + --disable-path-info \ 1.167 + --disable-nls 1.168 + 1.169 + # build program 1.170 + %{l_make} %{l_mflags -O} 1.171 + 1.172 +%install 1.173 + # install program 1.174 + %{l_shtool} mkdir -f -p -m 755 \ 1.175 + $RPM_BUILD_ROOT%{l_prefix}/var/sudo 1.176 + %{l_shtool} subst \ 1.177 + -e "s;-M 4111;-M 4511;" \ 1.178 + -e "s;-M 0111;-M 0511;" \ 1.179 + -e "s;-[OG] [^ ]*;;g" \ 1.180 + Makefile 1.181 + %{l_make} %{l_mflags} install \ 1.182 + DESTDIR=$RPM_BUILD_ROOT 1.183 + rm -rf $RPM_BUILD_ROOT%{l_prefix}/share 1.184 + 1.185 + # install run-command script 1.186 + %{l_shtool} mkdir -f -p -m 755 \ 1.187 + $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d 1.188 + %{l_shtool} install -c -m 755 %{l_value -s -a} \ 1.189 + %{SOURCE rc.sudo} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/ 1.190 + 1.191 + # install OSSP fsl configuration 1.192 + %{l_shtool} mkdir -f -p -m 755 \ 1.193 + $RPM_BUILD_ROOT%{l_prefix}/etc/fsl 1.194 + %{l_shtool} install -c -m 644 %{l_value -s -a} \ 1.195 + %{SOURCE fsl.sudo} \ 1.196 + $RPM_BUILD_ROOT%{l_prefix}/etc/fsl/ 1.197 + 1.198 + # install default configuration file 1.199 + %{l_shtool} install -c -m 644 %{l_value -s -a} \ 1.200 + %{SOURCE sudo.conf} %{SOURCE sudoers} \ 1.201 + $RPM_BUILD_ROOT%{l_prefix}/etc/sudo/ 1.202 + 1.203 + # determine installation files 1.204 + %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \ 1.205 + %{l_files_std} \ 1.206 + '%config %{l_prefix}/etc/fsl/fsl.sudo' \ 1.207 + '%attr(4111,%{l_susr},%{l_mgrp}) %{l_prefix}/bin/sudo' \ 1.208 + '%attr(4111,%{l_susr},%{l_mgrp}) %{l_prefix}/bin/sudoedit' \ 1.209 + '%attr(0111,%{l_susr},%{l_mgrp}) %{l_prefix}/sbin/visudo' \ 1.210 + '%attr(0755,%{l_susr},%{l_mgrp}) %{l_prefix}/libexec/sudo/plugin/sudoers.so' \ 1.211 + '%attr(0700,%{l_susr},%{l_mgrp}) %dir %{l_prefix}/var/sudo' \ 1.212 + '%config(noreplace) %attr(0400,%{l_susr},%{l_sgrp}) %{l_prefix}/etc/sudo/sudo.conf' \ 1.213 + '%config(noreplace) %attr(0400,%{l_susr},%{l_sgrp}) %{l_prefix}/etc/sudo/sudoers' \ 1.214 + '%attr(0700,%{l_susr},%{l_sgrp}) %{l_prefix}/etc/sudo/sudoers.d' 1.215 + 1.216 +%files -f files 1.217 + 1.218 +%clean 1.219 + 1.220 +%post 1.221 +%if "%{with_pam}" == "yes" 1.222 + # add PAM configuration entry 1.223 + if [ $1 -eq 1 ]; then 1.224 + $RPM_INSTALL_PREFIX/sbin/pamtool --add --smart --name=sudo 1.225 + fi 1.226 +%endif 1.227 + 1.228 +%preun 1.229 +%if "%{with_pam}" == "yes" 1.230 + # remove PAM configuration entry 1.231 + if [ $1 -eq 0 ]; then 1.232 + $RPM_INSTALL_PREFIX/sbin/pamtool --remove --smart --name=sudo 1.233 + fi 1.234 +%endif 1.235 +