sudo/sudo.spec

Fri, 03 Aug 2012 15:43:37 +0200

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Fri, 03 Aug 2012 15:43:37 +0200
changeset 457
c5fbc773861c
parent 456
f243ce94972c
permissions
-rw-r--r--

Adapt buildconf to conform to OpenPKG simplistic man path hierarchy.

michael@456 1 ##
michael@456 2 ## sudo.spec -- OpenPKG RPM Package Specification
michael@456 3 ## Copyright (c) 2000-2012 OpenPKG Foundation e.V. <http://openpkg.net/>
michael@456 4 ##
michael@456 5 ## Permission to use, copy, modify, and distribute this software for
michael@456 6 ## any purpose with or without fee is hereby granted, provided that
michael@456 7 ## the above copyright notice and this permission notice appear in all
michael@456 8 ## copies.
michael@456 9 ##
michael@456 10 ## THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
michael@456 11 ## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
michael@456 12 ## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
michael@456 13 ## IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
michael@456 14 ## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
michael@456 15 ## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
michael@456 16 ## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
michael@456 17 ## USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
michael@456 18 ## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
michael@456 19 ## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
michael@456 20 ## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
michael@456 21 ## SUCH DAMAGE.
michael@456 22 ##
michael@456 23
michael@456 24 # package information
michael@456 25 Name: sudo
michael@456 26 Summary: Flexible Switch User Command
michael@456 27 URL: http://www.sudo.ws/
michael@456 28 Vendor: Todd Miller
michael@456 29 Packager: OpenPKG Foundation e.V.
michael@456 30 Distribution: OpenPKG Community
michael@456 31 Class: BASE
michael@456 32 Group: ShellUtils
michael@456 33 License: BSD
michael@456 34 Version: 1.8.5p2
michael@457 35 Release: 20120800
michael@456 36
michael@456 37 # package options
michael@456 38 %option with_fsl yes
michael@456 39 %option with_pam no
michael@456 40 %option with_skey no
michael@456 41 %option with_opie no
michael@456 42 %option with_ldap no
michael@456 43
michael@456 44 # list of sources
michael@456 45 Source0: http://www.sudo.ws/sudo/dist/sudo-%{version}.tar.gz
michael@456 46 Source1: rc.sudo
michael@456 47 Source2: fsl.sudo
michael@456 48 Source3: sudo.conf
michael@456 49 Source4: sudoers
michael@456 50
michael@456 51 # build information
michael@456 52 BuildPreReq: OpenPKG, openpkg >= 20100101
michael@456 53 PreReq: OpenPKG, openpkg >= 20100101
michael@456 54 BuildPreReq: zlib
michael@456 55 PreReq: zlib
michael@456 56 %if "%{with_fsl}" == "yes"
michael@456 57 BuildPreReq: fsl
michael@456 58 PreReq: fsl
michael@456 59 %endif
michael@456 60 %if "%{with_pam}" == "yes"
michael@456 61 BuildPreReq: PAM
michael@456 62 PreReq: PAM
michael@456 63 %endif
michael@456 64 %if "%{with_skey}" == "yes"
michael@456 65 BuildPreReq: skey
michael@456 66 PreReq: skey
michael@456 67 %endif
michael@456 68 %if "%{with_opie}" == "yes"
michael@456 69 BuildPreReq: opie
michael@456 70 PreReq: opie
michael@456 71 %endif
michael@456 72 %if "%{with_ldap}" == "yes"
michael@456 73 BuildPreReq: openldap
michael@456 74 PreReq: openldap
michael@456 75 %endif
michael@456 76
michael@456 77 %description
michael@456 78 Sudo (superuser do) allows a system administrator to give certain
michael@456 79 users (or groups of users) the ability to run some (or all) commands
michael@456 80 as root or another user while logging the commands and arguments.
michael@456 81
michael@456 82 %track
michael@456 83 prog sudo = {
michael@456 84 version = %{version}
michael@456 85 url = http://www.sudo.ws/sudo/dist/
michael@456 86 regex = sudo-(__VER__)\.tar\.gz
michael@456 87 }
michael@456 88
michael@456 89 %prep
michael@456 90 %setup -q
michael@456 91 %{l_shtool} subst \
michael@457 92 -e 's;\(mansect[^0-9][^0-9]*1\)m;\1;g' \
michael@456 93 -e '/LINENO: error: C[+]* preprocessor/{N;N;N;N;s/.*/:/;}' \
michael@456 94 configure
michael@456 95 case "%{l_platform -t}" in
michael@456 96 *-darwin* )
michael@456 97 %{l_shtool} subst \
michael@456 98 -e 's/\(\$(LIBTOOL).*sudo_noexec.lo.*$\)/\1; $(CC) -dynamiclib .libs\/sudo_noexec.o $(LDFLAGS) -o .libs\/sudo_noexec.dylib/' \
michael@456 99 Makefile.in
michael@456 100 ;;
michael@456 101 *-sunos* )
michael@456 102 %{l_shtool} subst \
michael@456 103 -e 's;^(void)isblank(1);if ((int)isblank(0x20)) exit(0);' \
michael@456 104 configure
michael@456 105 ;;
michael@456 106 esac
michael@456 107
michael@456 108 %build
michael@456 109 # configure program
michael@456 110 libs=""
michael@456 111 case "%{l_platform -t}" in
michael@456 112 *-freebsd* ) libs="$libs -lutil" ;;
michael@456 113 esac
michael@456 114 CC="%{l_cc}" \
michael@456 115 CFLAGS="%{l_cflags -O}" \
michael@456 116 LDFLAGS="%{l_fsl_ldflags}" \
michael@456 117 SUDO_LIBS="$libs %{l_fsl_libs}" \
michael@456 118 %if "%{with_pam}" == "yes"
michael@456 119 CPPFLAGS="-I`%{l_rc} --query pam_incdir`" \
michael@456 120 LDFLAGS="-L`%{l_rc} --query pam_libdir` ${LDFLAGS}" \
michael@456 121 %endif
michael@456 122 true=`%{l_shtool} path true` \
michael@456 123 ./configure \
michael@456 124 --prefix=%{l_prefix} \
michael@456 125 --mandir=%{l_prefix}/man \
michael@456 126 --sysconfdir=%{l_prefix}/etc/sudo \
michael@456 127 --libexecdir=%{l_prefix}/libexec/sudo \
michael@456 128 --with-plugindir=%{l_prefix}/libexec/sudo/plugin \
michael@456 129 --with-noexec=%{l_prefix}/libexec/sudo/helper/sudo_noexec.so \
michael@456 130 --with-logpath=%{l_prefix}/var/sudo/sudo.log \
michael@456 131 --with-timedir=%{l_prefix}/var/sudo \
michael@456 132 --enable-zlib=%{l_prefix} \
michael@456 133 %if "%{with_fsl}" == "yes"
michael@456 134 --with-logging=syslog \
michael@456 135 %else
michael@456 136 --with-logging=file \
michael@456 137 %endif
michael@456 138 --with-sudoers-mode=0400 \
michael@456 139 --with-sudoers-uid=%{l_suid} \
michael@456 140 --with-sudoers-gid=%{l_sgid} \
michael@456 141 --with-sendmail=$true \
michael@456 142 --with-ignore-dot \
michael@456 143 %if "%{with_pam}" == "yes"
michael@456 144 --with-pam \
michael@456 145 %else
michael@456 146 --without-pam \
michael@456 147 %endif
michael@456 148 %if "%{with_skey}" == "yes" || "%{with_opie}" == "yes"
michael@456 149 --with-long-otp-prompt \
michael@456 150 %endif
michael@456 151 %if "%{with_skey}" == "yes"
michael@456 152 --with-skey=%{l_prefix} \
michael@456 153 %endif
michael@456 154 %if "%{with_opie}" == "yes"
michael@456 155 --with-opie=%{l_prefix} \
michael@456 156 %endif
michael@456 157 %if "%{with_ldap}" == "yes"
michael@456 158 --with-ldap=%{l_prefix} \
michael@456 159 --with-ldap-conf-file=%{l_prefix}/etc/sudo/ldap.conf \
michael@456 160 %endif
michael@456 161 --enable-shell-sets-home \
michael@456 162 --disable-root-sudo \
michael@456 163 --with-env-editor \
michael@456 164 --disable-path-info \
michael@456 165 --disable-nls
michael@456 166
michael@456 167 # build program
michael@456 168 %{l_make} %{l_mflags -O}
michael@456 169
michael@456 170 %install
michael@456 171 # install program
michael@456 172 %{l_shtool} mkdir -f -p -m 755 \
michael@456 173 $RPM_BUILD_ROOT%{l_prefix}/var/sudo
michael@456 174 %{l_shtool} subst \
michael@456 175 -e "s;-M 4111;-M 4511;" \
michael@456 176 -e "s;-M 0111;-M 0511;" \
michael@456 177 -e "s;-[OG] [^ ]*;;g" \
michael@456 178 Makefile
michael@456 179 %{l_make} %{l_mflags} install \
michael@456 180 DESTDIR=$RPM_BUILD_ROOT
michael@456 181 rm -rf $RPM_BUILD_ROOT%{l_prefix}/share
michael@456 182
michael@456 183 # install run-command script
michael@456 184 %{l_shtool} mkdir -f -p -m 755 \
michael@456 185 $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d
michael@456 186 %{l_shtool} install -c -m 755 %{l_value -s -a} \
michael@456 187 %{SOURCE rc.sudo} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
michael@456 188
michael@456 189 # install OSSP fsl configuration
michael@456 190 %{l_shtool} mkdir -f -p -m 755 \
michael@456 191 $RPM_BUILD_ROOT%{l_prefix}/etc/fsl
michael@456 192 %{l_shtool} install -c -m 644 %{l_value -s -a} \
michael@456 193 %{SOURCE fsl.sudo} \
michael@456 194 $RPM_BUILD_ROOT%{l_prefix}/etc/fsl/
michael@456 195
michael@456 196 # install default configuration file
michael@456 197 %{l_shtool} install -c -m 644 %{l_value -s -a} \
michael@456 198 %{SOURCE sudo.conf} %{SOURCE sudoers} \
michael@456 199 $RPM_BUILD_ROOT%{l_prefix}/etc/sudo/
michael@456 200
michael@456 201 # determine installation files
michael@456 202 %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
michael@456 203 %{l_files_std} \
michael@456 204 '%config %{l_prefix}/etc/fsl/fsl.sudo' \
michael@456 205 '%attr(4111,%{l_susr},%{l_mgrp}) %{l_prefix}/bin/sudo' \
michael@456 206 '%attr(4111,%{l_susr},%{l_mgrp}) %{l_prefix}/bin/sudoedit' \
michael@456 207 '%attr(0111,%{l_susr},%{l_mgrp}) %{l_prefix}/sbin/visudo' \
michael@456 208 '%attr(0755,%{l_susr},%{l_mgrp}) %{l_prefix}/libexec/sudo/plugin/sudoers.so' \
michael@456 209 '%attr(0700,%{l_susr},%{l_mgrp}) %dir %{l_prefix}/var/sudo' \
michael@456 210 '%config(noreplace) %attr(0400,%{l_susr},%{l_sgrp}) %{l_prefix}/etc/sudo/sudo.conf' \
michael@456 211 '%config(noreplace) %attr(0400,%{l_susr},%{l_sgrp}) %{l_prefix}/etc/sudo/sudoers' \
michael@456 212 '%attr(0700,%{l_susr},%{l_sgrp}) %{l_prefix}/etc/sudo/sudoers.d'
michael@456 213
michael@456 214 %files -f files
michael@456 215
michael@456 216 %clean
michael@456 217
michael@456 218 %post
michael@456 219 %if "%{with_pam}" == "yes"
michael@456 220 # add PAM configuration entry
michael@456 221 if [ $1 -eq 1 ]; then
michael@456 222 $RPM_INSTALL_PREFIX/sbin/pamtool --add --smart --name=sudo
michael@456 223 fi
michael@456 224 %endif
michael@456 225
michael@456 226 %preun
michael@456 227 %if "%{with_pam}" == "yes"
michael@456 228 # remove PAM configuration entry
michael@456 229 if [ $1 -eq 0 ]; then
michael@456 230 $RPM_INSTALL_PREFIX/sbin/pamtool --remove --smart --name=sudo
michael@456 231 fi
michael@456 232 %endif
michael@456 233

mercurial