michael@456: ## michael@456: ## sudo.spec -- OpenPKG RPM Package Specification michael@456: ## Copyright (c) 2000-2012 OpenPKG Foundation e.V. michael@456: ## michael@456: ## Permission to use, copy, modify, and distribute this software for michael@456: ## any purpose with or without fee is hereby granted, provided that michael@456: ## the above copyright notice and this permission notice appear in all michael@456: ## copies. michael@456: ## michael@456: ## THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED michael@456: ## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF michael@456: ## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. michael@456: ## IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR michael@456: ## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, michael@456: ## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT michael@456: ## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF michael@456: ## USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND michael@456: ## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, michael@456: ## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT michael@456: ## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF michael@456: ## SUCH DAMAGE. michael@456: ## michael@456: michael@456: # package information michael@456: Name: sudo michael@456: Summary: Flexible Switch User Command michael@456: URL: http://www.sudo.ws/ michael@456: Vendor: Todd Miller michael@456: Packager: OpenPKG Foundation e.V. michael@456: Distribution: OpenPKG Community michael@456: Class: BASE michael@456: Group: ShellUtils michael@456: License: BSD michael@456: Version: 1.8.5p2 michael@457: Release: 20120800 michael@456: michael@456: # package options michael@456: %option with_fsl yes michael@456: %option with_pam no michael@456: %option with_skey no michael@456: %option with_opie no michael@456: %option with_ldap no michael@456: michael@456: # list of sources michael@456: Source0: http://www.sudo.ws/sudo/dist/sudo-%{version}.tar.gz michael@456: Source1: rc.sudo michael@456: Source2: fsl.sudo michael@456: Source3: sudo.conf michael@456: Source4: sudoers michael@456: michael@456: # build information michael@456: BuildPreReq: OpenPKG, openpkg >= 20100101 michael@456: PreReq: OpenPKG, openpkg >= 20100101 michael@456: BuildPreReq: zlib michael@456: PreReq: zlib michael@456: %if "%{with_fsl}" == "yes" michael@456: BuildPreReq: fsl michael@456: PreReq: fsl michael@456: %endif michael@456: %if "%{with_pam}" == "yes" michael@456: BuildPreReq: PAM michael@456: PreReq: PAM michael@456: %endif michael@456: %if "%{with_skey}" == "yes" michael@456: BuildPreReq: skey michael@456: PreReq: skey michael@456: %endif michael@456: %if "%{with_opie}" == "yes" michael@456: BuildPreReq: opie michael@456: PreReq: opie michael@456: %endif michael@456: %if "%{with_ldap}" == "yes" michael@456: BuildPreReq: openldap michael@456: PreReq: openldap michael@456: %endif michael@456: michael@456: %description michael@456: Sudo (superuser do) allows a system administrator to give certain michael@456: users (or groups of users) the ability to run some (or all) commands michael@456: as root or another user while logging the commands and arguments. michael@456: michael@456: %track michael@456: prog sudo = { michael@456: version = %{version} michael@456: url = http://www.sudo.ws/sudo/dist/ michael@456: regex = sudo-(__VER__)\.tar\.gz michael@456: } michael@456: michael@456: %prep michael@456: %setup -q michael@456: %{l_shtool} subst \ michael@457: -e 's;\(mansect[^0-9][^0-9]*1\)m;\1;g' \ michael@456: -e '/LINENO: error: C[+]* preprocessor/{N;N;N;N;s/.*/:/;}' \ michael@456: configure michael@456: case "%{l_platform -t}" in michael@456: *-darwin* ) michael@456: %{l_shtool} subst \ michael@456: -e 's/\(\$(LIBTOOL).*sudo_noexec.lo.*$\)/\1; $(CC) -dynamiclib .libs\/sudo_noexec.o $(LDFLAGS) -o .libs\/sudo_noexec.dylib/' \ michael@456: Makefile.in michael@456: ;; michael@456: *-sunos* ) michael@456: %{l_shtool} subst \ michael@456: -e 's;^(void)isblank(1);if ((int)isblank(0x20)) exit(0);' \ michael@456: configure michael@456: ;; michael@456: esac michael@456: michael@456: %build michael@456: # configure program michael@456: libs="" michael@456: case "%{l_platform -t}" in michael@456: *-freebsd* ) libs="$libs -lutil" ;; michael@456: esac michael@456: CC="%{l_cc}" \ michael@456: CFLAGS="%{l_cflags -O}" \ michael@456: LDFLAGS="%{l_fsl_ldflags}" \ michael@456: SUDO_LIBS="$libs %{l_fsl_libs}" \ michael@456: %if "%{with_pam}" == "yes" michael@456: CPPFLAGS="-I`%{l_rc} --query pam_incdir`" \ michael@456: LDFLAGS="-L`%{l_rc} --query pam_libdir` ${LDFLAGS}" \ michael@456: %endif michael@456: true=`%{l_shtool} path true` \ michael@456: ./configure \ michael@456: --prefix=%{l_prefix} \ michael@456: --mandir=%{l_prefix}/man \ michael@456: --sysconfdir=%{l_prefix}/etc/sudo \ michael@456: --libexecdir=%{l_prefix}/libexec/sudo \ michael@456: --with-plugindir=%{l_prefix}/libexec/sudo/plugin \ michael@456: --with-noexec=%{l_prefix}/libexec/sudo/helper/sudo_noexec.so \ michael@456: --with-logpath=%{l_prefix}/var/sudo/sudo.log \ michael@456: --with-timedir=%{l_prefix}/var/sudo \ michael@456: --enable-zlib=%{l_prefix} \ michael@456: %if "%{with_fsl}" == "yes" michael@456: --with-logging=syslog \ michael@456: %else michael@456: --with-logging=file \ michael@456: %endif michael@456: --with-sudoers-mode=0400 \ michael@456: --with-sudoers-uid=%{l_suid} \ michael@456: --with-sudoers-gid=%{l_sgid} \ michael@456: --with-sendmail=$true \ michael@456: --with-ignore-dot \ michael@456: %if "%{with_pam}" == "yes" michael@456: --with-pam \ michael@456: %else michael@456: --without-pam \ michael@456: %endif michael@456: %if "%{with_skey}" == "yes" || "%{with_opie}" == "yes" michael@456: --with-long-otp-prompt \ michael@456: %endif michael@456: %if "%{with_skey}" == "yes" michael@456: --with-skey=%{l_prefix} \ michael@456: %endif michael@456: %if "%{with_opie}" == "yes" michael@456: --with-opie=%{l_prefix} \ michael@456: %endif michael@456: %if "%{with_ldap}" == "yes" michael@456: --with-ldap=%{l_prefix} \ michael@456: --with-ldap-conf-file=%{l_prefix}/etc/sudo/ldap.conf \ michael@456: %endif michael@456: --enable-shell-sets-home \ michael@456: --disable-root-sudo \ michael@456: --with-env-editor \ michael@456: --disable-path-info \ michael@456: --disable-nls michael@456: michael@456: # build program michael@456: %{l_make} %{l_mflags -O} michael@456: michael@456: %install michael@456: # install program michael@456: %{l_shtool} mkdir -f -p -m 755 \ michael@456: $RPM_BUILD_ROOT%{l_prefix}/var/sudo michael@456: %{l_shtool} subst \ michael@456: -e "s;-M 4111;-M 4511;" \ michael@456: -e "s;-M 0111;-M 0511;" \ michael@456: -e "s;-[OG] [^ ]*;;g" \ michael@456: Makefile michael@456: %{l_make} %{l_mflags} install \ michael@456: DESTDIR=$RPM_BUILD_ROOT michael@456: rm -rf $RPM_BUILD_ROOT%{l_prefix}/share michael@456: michael@456: # install run-command script michael@456: %{l_shtool} mkdir -f -p -m 755 \ michael@456: $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d michael@456: %{l_shtool} install -c -m 755 %{l_value -s -a} \ michael@456: %{SOURCE rc.sudo} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/ michael@456: michael@456: # install OSSP fsl configuration michael@456: %{l_shtool} mkdir -f -p -m 755 \ michael@456: $RPM_BUILD_ROOT%{l_prefix}/etc/fsl michael@456: %{l_shtool} install -c -m 644 %{l_value -s -a} \ michael@456: %{SOURCE fsl.sudo} \ michael@456: $RPM_BUILD_ROOT%{l_prefix}/etc/fsl/ michael@456: michael@456: # install default configuration file michael@456: %{l_shtool} install -c -m 644 %{l_value -s -a} \ michael@456: %{SOURCE sudo.conf} %{SOURCE sudoers} \ michael@456: $RPM_BUILD_ROOT%{l_prefix}/etc/sudo/ michael@456: michael@456: # determine installation files michael@456: %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \ michael@456: %{l_files_std} \ michael@456: '%config %{l_prefix}/etc/fsl/fsl.sudo' \ michael@456: '%attr(4111,%{l_susr},%{l_mgrp}) %{l_prefix}/bin/sudo' \ michael@456: '%attr(4111,%{l_susr},%{l_mgrp}) %{l_prefix}/bin/sudoedit' \ michael@456: '%attr(0111,%{l_susr},%{l_mgrp}) %{l_prefix}/sbin/visudo' \ michael@456: '%attr(0755,%{l_susr},%{l_mgrp}) %{l_prefix}/libexec/sudo/plugin/sudoers.so' \ michael@456: '%attr(0700,%{l_susr},%{l_mgrp}) %dir %{l_prefix}/var/sudo' \ michael@456: '%config(noreplace) %attr(0400,%{l_susr},%{l_sgrp}) %{l_prefix}/etc/sudo/sudo.conf' \ michael@456: '%config(noreplace) %attr(0400,%{l_susr},%{l_sgrp}) %{l_prefix}/etc/sudo/sudoers' \ michael@456: '%attr(0700,%{l_susr},%{l_sgrp}) %{l_prefix}/etc/sudo/sudoers.d' michael@456: michael@456: %files -f files michael@456: michael@456: %clean michael@456: michael@456: %post michael@456: %if "%{with_pam}" == "yes" michael@456: # add PAM configuration entry michael@456: if [ $1 -eq 1 ]; then michael@456: $RPM_INSTALL_PREFIX/sbin/pamtool --add --smart --name=sudo michael@456: fi michael@456: %endif michael@456: michael@456: %preun michael@456: %if "%{with_pam}" == "yes" michael@456: # remove PAM configuration entry michael@456: if [ $1 -eq 0 ]; then michael@456: $RPM_INSTALL_PREFIX/sbin/pamtool --remove --smart --name=sudo michael@456: fi michael@456: %endif michael@456: