From: Todd C. Miller Date: Fri, 30 Mar 2012 16:27:12 +0000 (-0400) Subject: Make sudoersdir relative to PKG_INSTALL_ROOT for Solaris. X-Git-Tag: SUDO_1_7_9p1~27 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=d2ef752c4c8b03470fcaf568a7162e5f3df133fe;p=sudo Make sudoersdir relative to PKG_INSTALL_ROOT for Solaris. Make sure sudoers file is writable before trying to edit it. --HG-- branch : 1.7 --- diff --git a/sudo.pp b/sudo.pp index fd67c78d4..11a485f36 100644 --- a/sudo.pp +++ b/sudo.pp @@ -74,14 +74,17 @@ still allow people to get their work done." # Note that the order must match that of sudoers. case "$pp_rpm_distro" in centos*|rhel*) + chmod u+w ${pp_destdir}${sudoersdir}/sudoers /bin/ed - ${pp_destdir}${sudoersdir}/sudoers <<-'EOF' /Locale settings/+1,s/^# // /Desktop path settings/+1,s/^# // w q EOF + chmod u-w ${pp_destdir}${sudoersdir}/sudoers ;; sles*) + chmod u+w ${pp_destdir}${sudoersdir}/sudoers /bin/ed - ${pp_destdir}${sudoersdir}/sudoers <<-'EOF' /Locale settings/+1,s/^# // /ConsoleKit session/+1,s/^# // @@ -90,6 +93,7 @@ still allow people to get their work done." w q EOF + chmod u-w ${pp_destdir}${sudoersdir}/sudoers ;; esac @@ -157,6 +161,7 @@ still allow people to get their work done." %if [deb] # Uncomment some Defaults and the %sudo rule in sudoers # Note that the order must match that of sudoers and be tab-indented. + chmod u+w ${pp_destdir}${sudoersdir}/sudoers /bin/ed - ${pp_destdir}${sudoersdir}/sudoers <<-'EOF' /Locale settings/+1,s/^# // /X11 resource/+1,s/^# // @@ -164,6 +169,7 @@ still allow people to get their work done." w q EOF + chmod u-w ${pp_destdir}${sudoersdir}/sudoers mkdir -p ${pp_destdir}/etc/pam.d cat > ${pp_destdir}/etc/pam.d/sudo <<-EOF #%PAM-1.0 @@ -225,7 +231,11 @@ still allow people to get their work done." %post [!rpm,deb] # Don't overwrite an existing sudoers file +%if [solaris] + sudoersdir=${PKG_INSTALL_ROOT}%{sudoersdir} +%else sudoersdir=%{sudoersdir} +%endif if test ! -r $sudoersdir/sudoers; then cp $sudoersdir/sudoers.dist $sudoersdir/sudoers chmod %{sudoers_mode} $sudoersdir/sudoers