~ubuntu-branches/ubuntu/saucy/sudo/saucy

« back to all changes in this revision

Viewing changes to sudo.pp

  • Committer: Package Import Robot
  • Author(s): Stéphane Graber
  • Date: 2012-11-16 09:31:32 UTC
  • mfrom: (1.4.13)
  • Revision ID: package-import@ubuntu.com-20121116093132-ptext55adlzbrq6y
Tags: 1.8.6p3-0ubuntu1
* New upstream release (1.8.6p3).
* Add patch to fix building with sssd when ldap is disabled.
* Drop sudo.manpages and sudo-ldap.manpages as the upstream build system
  now does the right thing here.
* Build the main sudo package with support for sssd, this doesn't add any
  additional build time or runtime dependency. sudo will dynamically load
  the sssd library if 'sss' is listed for the 'sudoers' nss service.

Show diffs side-by-side

added added

removed removed

Lines of Context:
13
13
still allow people to get their work done."
14
14
        vendor="Todd C. Miller"
15
15
        copyright="(c) 1993-1996,1998-2012 Todd C. Miller"
 
16
        sudoedit_man=`echo ${pp_destdir}$mandir/*/sudoedit.*|sed "s:^${pp_destdir}::"`
 
17
        sudoedit_man_target=`basename $sudoedit_man | sed 's/edit//'`
16
18
 
17
19
%if [aix]
18
20
        # AIX package summary is limited to 40 characters
44
46
        pp_rpm_license="BSD"
45
47
        pp_rpm_url="http://www.sudo.ws/"
46
48
        pp_rpm_group="Applications/System"
47
 
        pp_rpm_packager="Todd.Miller@courtesan.com"
 
49
        pp_rpm_packager="Todd C. Miller <Todd.Miller@courtesan.com>"
48
50
        if test -n "$linux_audit"; then
49
51
                pp_rpm_requires="audit-libs >= $linux_audit"
50
52
        fi
 
53
%else
 
54
        # For all but RPM and Debian we need to install sudoers with a different
 
55
        # name and make a copy of it if there is no existing file.
 
56
        mv ${pp_destdir}$sudoersdir/sudoers ${pp_destdir}$sudoersdir/sudoers.dist
 
57
%endif
51
58
 
 
59
%if [deb]
52
60
        pp_deb_maintainer="$pp_rpm_packager"
53
61
        pp_deb_release="$pp_rpm_release"
54
62
        pp_deb_version="$pp_rpm_version"
55
 
%else
56
 
        # For all but RPM and Debian we need to install sudoers with a different
57
 
        # name and make a copy of it if there is no existing file.
58
 
        mv ${pp_destdir}$sudoersdir/sudoers ${pp_destdir}$sudoersdir/sudoers.dist
 
63
        pp_deb_section=admin
 
64
        install -D -m 644 ${pp_destdir}$docdir/LICENSE ${pp_wrkdir}/${name}/usr/share/doc/${name}/copyright
 
65
        install -D -m 644 ${pp_destdir}$docdir/ChangeLog ${pp_wrkdir}/${name}/usr/share/doc/${name}/changelog
 
66
        gzip -9f ${pp_wrkdir}/${name}/usr/share/doc/${name}/changelog
 
67
        printf "$name ($pp_deb_version-$pp_deb_release) admin; urgency=low\n\n  * see upstream changelog\n\n -- $pp_deb_maintainer  `date '+%a, %d %b %Y %T %z'`\n" > ${pp_wrkdir}/${name}/usr/share/doc/${name}/changelog.Debian
 
68
        chmod 644 ${pp_wrkdir}/${name}/usr/share/doc/${name}/changelog.Debian
 
69
        gzip -9f ${pp_wrkdir}/${name}/usr/share/doc/${name}/changelog.Debian
 
70
        # Create lintian override file
 
71
        mkdir -p ${pp_wrkdir}/${name}/usr/share/lintian/overrides
 
72
        cat >${pp_wrkdir}/${name}/usr/share/lintian/overrides/${name} <<-EOF
 
73
        # The sudo binary must be setuid root
 
74
        $name: setuid-binary usr/bin/sudo 4755 root/root
 
75
        # Sudo configuration and data dirs must not be world-readable
 
76
        $name: non-standard-file-perm etc/sudoers 0440 != 0644
 
77
        $name: non-standard-dir-perm etc/sudoers.d/ 0750 != 0755
 
78
        $name: non-standard-dir-perm var/lib/sudo/ 0700 != 0755
 
79
        # Sudo ships with debugging symbols
 
80
        $name: unstripped-binary-or-object
 
81
        EOF
 
82
        chmod 644 ${pp_wrkdir}/${name}/usr/share/lintian/overrides/${name}
59
83
%endif
60
84
 
61
85
%if [rpm]
190
214
        perl -pe 'last if (/^What/i && $seen++)' NEWS > ${pp_wrkdir}/ReadMe.txt
191
215
%endif
192
216
 
 
217
%if X"$aix_freeware" = X"true"
 
218
        # Create links from /opt/freeware/{bin,sbin} -> /usr/{bin.sbin}
 
219
        mkdir -p ${pp_destdir}/usr/bin ${pp_destdir}/usr/sbin
 
220
        ln -s -f ${bindir}/sudo ${pp_destdir}/usr/bin
 
221
        ln -s -f ${bindir}/sudoedit ${pp_destdir}/usr/bin
 
222
        ln -s -f ${bindir}/sudoreplay ${pp_destdir}/usr/bin
 
223
        ln -s -f ${sbindir}/visudo ${pp_destdir}/usr/sbin
 
224
%endif
 
225
 
193
226
        # OS-level directories that should generally exist but might not.
194
227
        extradirs=`echo ${pp_destdir}/${mandir}/[mc]* | sed "s#${pp_destdir}/##g"`
195
228
        extradirs="$extradirs `dirname $docdir` `dirname $timedir`"
 
229
        test -d ${pp_destdir}${localedir} && extradirs="$extradirs $localedir"
196
230
        test -d ${pp_destdir}/etc/pam.d && extradirs="${extradirs} /etc/pam.d"
197
231
        for dir in $bindir $sbindir $libexecdir $includedir $extradirs; do
198
232
                while test "$dir" != "/"; do
202
236
        done
203
237
        osdirs=`echo $osdirs | tr " " "\n" | sort -u`
204
238
 
 
239
%depend [deb]
 
240
        libc6, libpam0g, libpam-modules, zlib1g, libselinux1
 
241
 
 
242
%fixup [deb]
 
243
        # Add Conflicts, Replaces headers and add libldap depedency as needed.
 
244
        if test -z "%{flavor}"; then
 
245
            echo "Conflicts: sudo-ldap" >> %{pp_wrkdir}/%{name}/DEBIAN/control
 
246
            echo "Replaces: sudo-ldap" >> %{pp_wrkdir}/%{name}/DEBIAN/control
 
247
        elif test "%{flavor}" = "ldap"; then
 
248
            echo "Conflicts: sudo" >> %{pp_wrkdir}/%{name}/DEBIAN/control
 
249
            echo "Replaces: sudo" >> %{pp_wrkdir}/%{name}/DEBIAN/control
 
250
            echo "Provides: sudo" >> %{pp_wrkdir}/%{name}/DEBIAN/control
 
251
            cp -p %{pp_wrkdir}/%{name}/DEBIAN/control %{pp_wrkdir}/%{name}/DEBIAN/control.$$
 
252
            sed 's/^\(Depends:.*\) *$/\1, libldap-2.4-2/' %{pp_wrkdir}/%{name}/DEBIAN/control.$$ > %{pp_wrkdir}/%{name}/DEBIAN/control
 
253
            rm -f %{pp_wrkdir}/%{name}/DEBIAN/control.$$
 
254
        fi
 
255
        echo "Homepage: http://www.sudo.ws/sudo/" >> %{pp_wrkdir}/%{name}/DEBIAN/control
 
256
        echo "Bugs: http://www.sudo.ws/bugs/" >> %{pp_wrkdir}/%{name}/DEBIAN/control
 
257
 
205
258
%files
206
259
        $osdirs                 -
207
 
        $bindir/sudo            4111 root:
208
 
        $bindir/sudoedit        4111 root:
209
 
        $sbindir/visudo         0111
210
 
        $bindir/sudoreplay      0111
211
 
        $includedir/sudo_plugin.h 0444
212
 
        $libexecdir/*           0755 optional
 
260
        $bindir/sudo            4755 root:
 
261
        $bindir/sudoedit        0755 root: symlink sudo
 
262
        $sbindir/visudo         0755
 
263
        $bindir/sudoreplay      0755
 
264
        $includedir/sudo_plugin.h 0644
 
265
        $libexecdir/*           $shlib_mode optional
213
266
        $sudoersdir/sudoers.d/  0750 $sudoers_uid:$sudoers_gid
214
267
        $timedir/               0700 root:
215
268
        $docdir/                0755
216
 
        $docdir/sudoers2ldif    0555 optional,ignore-others
217
 
        $docdir/*               0444
218
 
        $localedir/             -    optional
219
 
        $localedir/**           0444 optional
220
 
        /etc/pam.d/*            0444 volatile,optional
 
269
        $docdir/sudoers2ldif    0755 optional,ignore-others
 
270
%if [deb]
 
271
        $docdir/LICENSE         ignore,ignore-others
 
272
        $docdir/ChangeLog       ignore,ignore-others
 
273
%endif
 
274
        $docdir/*               0644
 
275
        $localedir/*/           -    optional
 
276
        $localedir/*/LC_MESSAGES/ -    optional
 
277
        $localedir/*/LC_MESSAGES/* 0644    optional
 
278
        /etc/pam.d/*            0644 volatile,optional
221
279
%if [rpm,deb]
222
280
        $sudoersdir/sudoers $sudoers_mode $sudoers_uid:$sudoers_gid volatile
223
281
%else
224
282
        $sudoersdir/sudoers.dist $sudoers_mode $sudoers_uid:$sudoers_gid volatile
225
283
%endif
 
284
%if X"$aix_freeware" = X"true"
 
285
        # Links for binaries from /opt/freeware to /usr
 
286
        /usr/bin/sudo           0755 root: symlink $bindir/sudo
 
287
        /usr/bin/sudoedit       0755 root: symlink $bindir/sudoedit
 
288
        /usr/bin/sudoreplay     0755 root: symlink $bindir/sudoreplay
 
289
        /usr/sbin/visudo        0755 root: symlink $sbindir/visudo
 
290
%endif
226
291
 
227
292
%files [!aix]
228
 
        $mandir/man*/*
 
293
        $sudoedit_man           0644 symlink,ignore-others $sudoedit_man_target
 
294
        $mandir/man*/*          0644
229
295
 
230
296
%files [aix]
231
297
        # Some versions use catpages, some use manpages.
232
 
        $mandir/cat*/* optional
233
 
        $mandir/man*/* optional
 
298
        $sudoedit_man           0644 symlink,ignore-others $sudoedit_man_target
 
299
        $mandir/cat*/*          0644 optional
 
300
        $mandir/man*/*          0644 optional
 
301
 
 
302
%pre [aix]
 
303
        if rpm -q %{name} >/dev/null 2>&1; then
 
304
                echo "Another version of sudo is currently installed via rpm." 2>&1
 
305
                echo "Please either uninstall the rpm version of sudo by running \"rpm -e sudo\"" 2>&1
 
306
                echo "or upgrade the existing version of sudo using the .rpm packagae instead" 2>&1
 
307
                echo "instead of the .bff package." 2>&1
 
308
                echo "" 2>&1
 
309
                echo "Note that you may need to pass rpm the --oldpackage flag when upgrading" 2>&1
 
310
                echo "the AIX Toolbox version of sudo to the latest sudo rpm from sudo.ws." 2>&1
 
311
                echo "" 2>&1
 
312
                exit 1
 
313
        fi
234
314
 
235
315
%post [!rpm,deb]
236
316
        # Don't overwrite an existing sudoers file
247
327
        fi
248
328
 
249
329
%post [deb]
 
330
        set -e
 
331
 
250
332
        # dpkg-deb does not maintain the mode on the sudoers file, and
251
333
        # installs it 0640 when sudo requires 0440
252
334
        chmod %{sudoers_mode} %{sudoersdir}/sudoers
281
363
        '
282
364
 
283
365
%preun [deb]
 
366
        set -e
 
367
 
284
368
        # Remove the /etc/ldap/ldap.conf -> /etc/sudo-ldap.conf symlink if
285
369
        # it matches what we created in the postinstall script.
286
370
        if test X"%{flavor}" = X"ldap" -a \