sudo/sudo.spec

Mon, 28 Jan 2013 17:37:18 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Mon, 28 Jan 2013 17:37:18 +0100
changeset 758
a2c6460cfb16
parent 456
f243ce94972c
permissions
-rw-r--r--

Correct socket error reporting improvement with IPv6 portable code,
after helpful recommendation by Saúl Ibarra Corretgé on OSips devlist.

     1 ##
     2 ##  sudo.spec -- OpenPKG RPM Package Specification
     3 ##  Copyright (c) 2000-2012 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 ##
    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 Foundation e.V.
    30 Distribution: OpenPKG Community
    31 Class:        BASE
    32 Group:        ShellUtils
    33 License:      BSD
    34 Version:      1.8.5p2
    35 Release:      20120800
    37 #   package options
    38 %option       with_fsl    yes
    39 %option       with_pam    no
    40 %option       with_skey   no
    41 %option       with_opie   no
    42 %option       with_ldap   no
    44 #   list of sources
    45 Source0:      http://www.sudo.ws/sudo/dist/sudo-%{version}.tar.gz
    46 Source1:      rc.sudo
    47 Source2:      fsl.sudo
    48 Source3:      sudo.conf
    49 Source4:      sudoers
    51 #   build information
    52 BuildPreReq:  OpenPKG, openpkg >= 20100101
    53 PreReq:       OpenPKG, openpkg >= 20100101
    54 BuildPreReq:  zlib
    55 PreReq:       zlib
    56 %if "%{with_fsl}" == "yes"
    57 BuildPreReq:  fsl
    58 PreReq:       fsl
    59 %endif
    60 %if "%{with_pam}" == "yes"
    61 BuildPreReq:  PAM
    62 PreReq:       PAM
    63 %endif
    64 %if "%{with_skey}" == "yes"
    65 BuildPreReq:  skey
    66 PreReq:       skey
    67 %endif
    68 %if "%{with_opie}" == "yes"
    69 BuildPreReq:  opie
    70 PreReq:       opie
    71 %endif
    72 %if "%{with_ldap}" == "yes"
    73 BuildPreReq:  openldap
    74 PreReq:       openldap
    75 %endif
    77 %description
    78     Sudo (superuser do) allows a system administrator to give certain
    79     users (or groups of users) the ability to run some (or all) commands
    80     as root or another user while logging the commands and arguments.
    82 %track
    83     prog sudo = {
    84         version   = %{version}
    85         url       = http://www.sudo.ws/sudo/dist/
    86         regex     = sudo-(__VER__)\.tar\.gz
    87     }
    89 %prep
    90     %setup -q
    91     %{l_shtool} subst \
    92         -e 's;\(mansect[^0-9][^0-9]*1\)m;\1;g' \
    93         -e '/LINENO: error: C[+]* preprocessor/{N;N;N;N;s/.*/:/;}' \
    94         configure
    95     case "%{l_platform -t}" in
    96         *-darwin* )
    97             %{l_shtool} subst \
    98                 -e 's/\(\$(LIBTOOL).*sudo_noexec.lo.*$\)/\1; $(CC) -dynamiclib .libs\/sudo_noexec.o $(LDFLAGS) -o .libs\/sudo_noexec.dylib/' \
    99                 Makefile.in
   100             ;;
   101         *-sunos* )
   102             %{l_shtool} subst \
   103                 -e 's;^(void)isblank(1);if ((int)isblank(0x20)) exit(0);' \
   104                 configure
   105             ;;
   106     esac
   108 %build
   109     #   configure program
   110     libs=""
   111     case "%{l_platform -t}" in
   112         *-freebsd* ) libs="$libs -lutil" ;;
   113     esac
   114     CC="%{l_cc}" \
   115     CFLAGS="%{l_cflags -O}" \
   116     LDFLAGS="%{l_fsl_ldflags}" \
   117     SUDO_LIBS="$libs %{l_fsl_libs}" \
   118 %if "%{with_pam}" == "yes"
   119     CPPFLAGS="-I`%{l_rc} --query pam_incdir`" \
   120     LDFLAGS="-L`%{l_rc} --query pam_libdir` ${LDFLAGS}" \
   121 %endif
   122     true=`%{l_shtool} path true` \
   123     ./configure \
   124         --prefix=%{l_prefix} \
   125         --mandir=%{l_prefix}/man \
   126         --sysconfdir=%{l_prefix}/etc/sudo \
   127         --libexecdir=%{l_prefix}/libexec/sudo \
   128         --with-plugindir=%{l_prefix}/libexec/sudo/plugin \
   129         --with-noexec=%{l_prefix}/libexec/sudo/helper/sudo_noexec.so \
   130         --with-logpath=%{l_prefix}/var/sudo/sudo.log \
   131         --with-timedir=%{l_prefix}/var/sudo \
   132         --enable-zlib=%{l_prefix} \
   133 %if "%{with_fsl}" == "yes"
   134         --with-logging=syslog \
   135 %else
   136         --with-logging=file \
   137 %endif
   138         --with-sudoers-mode=0400 \
   139         --with-sudoers-uid=%{l_suid} \
   140         --with-sudoers-gid=%{l_sgid} \
   141         --with-sendmail=$true \
   142         --with-ignore-dot \
   143 %if "%{with_pam}" == "yes"
   144         --with-pam \
   145 %else
   146         --without-pam \
   147 %endif
   148 %if "%{with_skey}" == "yes" || "%{with_opie}" == "yes"
   149         --with-long-otp-prompt \
   150 %endif
   151 %if "%{with_skey}" == "yes"
   152         --with-skey=%{l_prefix} \
   153 %endif
   154 %if "%{with_opie}" == "yes"
   155         --with-opie=%{l_prefix} \
   156 %endif
   157 %if "%{with_ldap}" == "yes"
   158         --with-ldap=%{l_prefix} \
   159         --with-ldap-conf-file=%{l_prefix}/etc/sudo/ldap.conf \
   160 %endif
   161         --enable-shell-sets-home \
   162         --disable-root-sudo \
   163         --with-env-editor \
   164         --disable-path-info \
   165         --disable-nls
   167     #   build program
   168     %{l_make} %{l_mflags -O}
   170 %install
   171     #   install program
   172     %{l_shtool} mkdir -f -p -m 755 \
   173         $RPM_BUILD_ROOT%{l_prefix}/var/sudo
   174     %{l_shtool} subst \
   175         -e "s;-M 4111;-M 4511;" \
   176         -e "s;-M 0111;-M 0511;" \
   177         -e "s;-[OG] [^ ]*;;g" \
   178         Makefile
   179     %{l_make} %{l_mflags} install \
   180         DESTDIR=$RPM_BUILD_ROOT
   181     rm -rf $RPM_BUILD_ROOT%{l_prefix}/share
   183     #   install run-command script
   184     %{l_shtool} mkdir -f -p -m 755 \
   185         $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d
   186     %{l_shtool} install -c -m 755 %{l_value -s -a} \
   187         %{SOURCE rc.sudo} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
   189     #   install OSSP fsl configuration
   190     %{l_shtool} mkdir -f -p -m 755 \
   191         $RPM_BUILD_ROOT%{l_prefix}/etc/fsl
   192     %{l_shtool} install -c -m 644 %{l_value -s -a} \
   193         %{SOURCE fsl.sudo} \
   194         $RPM_BUILD_ROOT%{l_prefix}/etc/fsl/
   196     #   install default configuration file
   197     %{l_shtool} install -c -m 644 %{l_value -s -a} \
   198         %{SOURCE sudo.conf} %{SOURCE sudoers} \
   199         $RPM_BUILD_ROOT%{l_prefix}/etc/sudo/
   201     #   determine installation files
   202     %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
   203         %{l_files_std} \
   204         '%config %{l_prefix}/etc/fsl/fsl.sudo' \
   205         '%attr(4111,%{l_susr},%{l_mgrp}) %{l_prefix}/bin/sudo' \
   206         '%attr(4111,%{l_susr},%{l_mgrp}) %{l_prefix}/bin/sudoedit' \
   207         '%attr(0111,%{l_susr},%{l_mgrp}) %{l_prefix}/sbin/visudo' \
   208         '%attr(0755,%{l_susr},%{l_mgrp}) %{l_prefix}/libexec/sudo/plugin/sudoers.so' \
   209         '%attr(0700,%{l_susr},%{l_mgrp}) %dir %{l_prefix}/var/sudo' \
   210         '%config(noreplace) %attr(0400,%{l_susr},%{l_sgrp}) %{l_prefix}/etc/sudo/sudo.conf' \
   211         '%config(noreplace) %attr(0400,%{l_susr},%{l_sgrp}) %{l_prefix}/etc/sudo/sudoers' \
   212         '%attr(0700,%{l_susr},%{l_sgrp}) %{l_prefix}/etc/sudo/sudoers.d'
   214 %files -f files
   216 %clean
   218 %post
   219 %if "%{with_pam}" == "yes"
   220     #   add PAM configuration entry
   221     if [ $1 -eq 1 ]; then
   222         $RPM_INSTALL_PREFIX/sbin/pamtool --add --smart --name=sudo
   223     fi
   224 %endif
   226 %preun
   227 %if "%{with_pam}" == "yes"
   228     #   remove PAM configuration entry
   229     if [ $1 -eq 0 ]; then
   230         $RPM_INSTALL_PREFIX/sbin/pamtool --remove --smart --name=sudo
   231     fi
   232 %endif

mercurial