|
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 ## |
|
23 |
|
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: 20120531 |
|
36 |
|
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 |
|
43 |
|
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 |
|
50 |
|
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 |
|
76 |
|
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. |
|
81 |
|
82 %track |
|
83 prog sudo = { |
|
84 version = %{version} |
|
85 url = http://www.sudo.ws/sudo/dist/ |
|
86 regex = sudo-(__VER__)\.tar\.gz |
|
87 } |
|
88 |
|
89 %prep |
|
90 %setup -q |
|
91 %{l_shtool} subst \ |
|
92 -e '/LINENO: error: C[+]* preprocessor/{N;N;N;N;s/.*/:/;}' \ |
|
93 configure |
|
94 case "%{l_platform -t}" in |
|
95 *-darwin* ) |
|
96 %{l_shtool} subst \ |
|
97 -e 's/\(\$(LIBTOOL).*sudo_noexec.lo.*$\)/\1; $(CC) -dynamiclib .libs\/sudo_noexec.o $(LDFLAGS) -o .libs\/sudo_noexec.dylib/' \ |
|
98 Makefile.in |
|
99 ;; |
|
100 *-sunos* ) |
|
101 %{l_shtool} subst \ |
|
102 -e 's;^(void)isblank(1);if ((int)isblank(0x20)) exit(0);' \ |
|
103 configure |
|
104 ;; |
|
105 esac |
|
106 |
|
107 %build |
|
108 # configure program |
|
109 libs="" |
|
110 case "%{l_platform -t}" in |
|
111 *-freebsd* ) libs="$libs -lutil" ;; |
|
112 esac |
|
113 CC="%{l_cc}" \ |
|
114 CFLAGS="%{l_cflags -O}" \ |
|
115 LDFLAGS="%{l_fsl_ldflags}" \ |
|
116 SUDO_LIBS="$libs %{l_fsl_libs}" \ |
|
117 %if "%{with_pam}" == "yes" |
|
118 CPPFLAGS="-I`%{l_rc} --query pam_incdir`" \ |
|
119 LDFLAGS="-L`%{l_rc} --query pam_libdir` ${LDFLAGS}" \ |
|
120 %endif |
|
121 true=`%{l_shtool} path true` \ |
|
122 ./configure \ |
|
123 --prefix=%{l_prefix} \ |
|
124 --mandir=%{l_prefix}/man \ |
|
125 --sysconfdir=%{l_prefix}/etc/sudo \ |
|
126 --libexecdir=%{l_prefix}/libexec/sudo \ |
|
127 --with-plugindir=%{l_prefix}/libexec/sudo/plugin \ |
|
128 --with-noexec=%{l_prefix}/libexec/sudo/helper/sudo_noexec.so \ |
|
129 --with-logpath=%{l_prefix}/var/sudo/sudo.log \ |
|
130 --with-timedir=%{l_prefix}/var/sudo \ |
|
131 --enable-zlib=%{l_prefix} \ |
|
132 %if "%{with_fsl}" == "yes" |
|
133 --with-logging=syslog \ |
|
134 %else |
|
135 --with-logging=file \ |
|
136 %endif |
|
137 --with-sudoers-mode=0400 \ |
|
138 --with-sudoers-uid=%{l_suid} \ |
|
139 --with-sudoers-gid=%{l_sgid} \ |
|
140 --with-sendmail=$true \ |
|
141 --with-ignore-dot \ |
|
142 %if "%{with_pam}" == "yes" |
|
143 --with-pam \ |
|
144 %else |
|
145 --without-pam \ |
|
146 %endif |
|
147 %if "%{with_skey}" == "yes" || "%{with_opie}" == "yes" |
|
148 --with-long-otp-prompt \ |
|
149 %endif |
|
150 %if "%{with_skey}" == "yes" |
|
151 --with-skey=%{l_prefix} \ |
|
152 %endif |
|
153 %if "%{with_opie}" == "yes" |
|
154 --with-opie=%{l_prefix} \ |
|
155 %endif |
|
156 %if "%{with_ldap}" == "yes" |
|
157 --with-ldap=%{l_prefix} \ |
|
158 --with-ldap-conf-file=%{l_prefix}/etc/sudo/ldap.conf \ |
|
159 %endif |
|
160 --enable-shell-sets-home \ |
|
161 --disable-root-sudo \ |
|
162 --with-env-editor \ |
|
163 --disable-path-info \ |
|
164 --disable-nls |
|
165 |
|
166 # build program |
|
167 %{l_make} %{l_mflags -O} |
|
168 |
|
169 %install |
|
170 # install program |
|
171 %{l_shtool} mkdir -f -p -m 755 \ |
|
172 $RPM_BUILD_ROOT%{l_prefix}/var/sudo |
|
173 %{l_shtool} subst \ |
|
174 -e "s;-M 4111;-M 4511;" \ |
|
175 -e "s;-M 0111;-M 0511;" \ |
|
176 -e "s;-[OG] [^ ]*;;g" \ |
|
177 Makefile |
|
178 %{l_make} %{l_mflags} install \ |
|
179 DESTDIR=$RPM_BUILD_ROOT |
|
180 rm -rf $RPM_BUILD_ROOT%{l_prefix}/share |
|
181 |
|
182 # install run-command script |
|
183 %{l_shtool} mkdir -f -p -m 755 \ |
|
184 $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d |
|
185 %{l_shtool} install -c -m 755 %{l_value -s -a} \ |
|
186 %{SOURCE rc.sudo} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/ |
|
187 |
|
188 # install OSSP fsl configuration |
|
189 %{l_shtool} mkdir -f -p -m 755 \ |
|
190 $RPM_BUILD_ROOT%{l_prefix}/etc/fsl |
|
191 %{l_shtool} install -c -m 644 %{l_value -s -a} \ |
|
192 %{SOURCE fsl.sudo} \ |
|
193 $RPM_BUILD_ROOT%{l_prefix}/etc/fsl/ |
|
194 |
|
195 # install default configuration file |
|
196 %{l_shtool} install -c -m 644 %{l_value -s -a} \ |
|
197 %{SOURCE sudo.conf} %{SOURCE sudoers} \ |
|
198 $RPM_BUILD_ROOT%{l_prefix}/etc/sudo/ |
|
199 |
|
200 # determine installation files |
|
201 %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \ |
|
202 %{l_files_std} \ |
|
203 '%config %{l_prefix}/etc/fsl/fsl.sudo' \ |
|
204 '%attr(4111,%{l_susr},%{l_mgrp}) %{l_prefix}/bin/sudo' \ |
|
205 '%attr(4111,%{l_susr},%{l_mgrp}) %{l_prefix}/bin/sudoedit' \ |
|
206 '%attr(0111,%{l_susr},%{l_mgrp}) %{l_prefix}/sbin/visudo' \ |
|
207 '%attr(0755,%{l_susr},%{l_mgrp}) %{l_prefix}/libexec/sudo/plugin/sudoers.so' \ |
|
208 '%attr(0700,%{l_susr},%{l_mgrp}) %dir %{l_prefix}/var/sudo' \ |
|
209 '%config(noreplace) %attr(0400,%{l_susr},%{l_sgrp}) %{l_prefix}/etc/sudo/sudo.conf' \ |
|
210 '%config(noreplace) %attr(0400,%{l_susr},%{l_sgrp}) %{l_prefix}/etc/sudo/sudoers' \ |
|
211 '%attr(0700,%{l_susr},%{l_sgrp}) %{l_prefix}/etc/sudo/sudoers.d' |
|
212 |
|
213 %files -f files |
|
214 |
|
215 %clean |
|
216 |
|
217 %post |
|
218 %if "%{with_pam}" == "yes" |
|
219 # add PAM configuration entry |
|
220 if [ $1 -eq 1 ]; then |
|
221 $RPM_INSTALL_PREFIX/sbin/pamtool --add --smart --name=sudo |
|
222 fi |
|
223 %endif |
|
224 |
|
225 %preun |
|
226 %if "%{with_pam}" == "yes" |
|
227 # remove PAM configuration entry |
|
228 if [ $1 -eq 0 ]; then |
|
229 $RPM_INSTALL_PREFIX/sbin/pamtool --remove --smart --name=sudo |
|
230 fi |
|
231 %endif |
|
232 |