Imported Upstream version 1.8.3p2
[debian/sudo] / sudo.pp
diff --git a/sudo.pp b/sudo.pp
index 6b9cd926807a4201e72e4c86d9a80853c1919cd2..a6e808cff27eed96bee8572c3cbb5c83cdc01f48 100644 (file)
--- a/sudo.pp
+++ b/sudo.pp
@@ -6,7 +6,7 @@
                name="sudo"
                pp_kit_package="sudo"
        fi
-       summary="Provide limited super-user priveleges to specific users"
+       summary="Provide limited super-user privileges to specific users"
        description="Sudo is a program designed to allow a sysadmin to give \
 limited root privileges to users and log root activity.  \
 The basic philosophy is to give as few privileges as possible but \
@@ -176,17 +176,32 @@ still allow people to get their work done."
        EOF
 %endif
 
+       # OS-level directories that should generally exist but might not.
+       extradirs=`echo ${pp_destdir}/${mandir}/[mc]* | sed "s#${pp_destdir}/##g"`
+       extradirs="$extradirs `dirname $docdir` `dirname $timedir`"
+       test -d ${pp_destdir}/etc/pam.d && extradirs="${extradirs} /etc/pam.d"
+       for dir in $bindir $sbindir $libexecdir $includedir $extradirs; do
+               while test "$dir" != "/"; do
+                       osdirs="${osdirs}${osdirs+ }$dir/"
+                       dir=`dirname $dir`
+               done
+       done
+       osdirs=`echo $osdirs | tr " " "\n" | sort -u`
+
 %files
+       $osdirs                -
        $bindir/sudo        4111 root:
        $bindir/sudoedit    4111 root:
        $sbindir/visudo     0111
        $bindir/sudoreplay  0111
        $includedir/sudo_plugin.h
-       $libexecdir/*
+       $libexecdir/*           optional
        $sudoersdir/sudoers.d/  0750 $sudoers_uid:$sudoers_gid
        $timedir/               0700 root:
        $docdir/
        $docdir/*
+       $localedir/             optional
+       $localedir/**           optional
        /etc/pam.d/*            volatile,optional
 %if [rpm,deb]
        $sudoersdir/sudoers $sudoers_mode $sudoers_uid:$sudoers_gid volatile
@@ -206,7 +221,10 @@ still allow people to get their work done."
        # Don't overwrite an existing sudoers file
        sudoersdir=%{sudoersdir}
        if test ! -r $sudoersdir/sudoers; then
-               cp -p $sudoersdir/sudoers.dist $sudoersdir/sudoers
+               cp $sudoersdir/sudoers.dist $sudoersdir/sudoers
+               chmod %{sudoers_mode} $sudoersdir/sudoers
+               chown %{sudoers_uid} $sudoersdir/sudoers
+               chgrp %{sudoers_gid} $sudoersdir/sudoers
        fi
 
 %post [deb]