2
0
mirror of https://github.com/sudo-project/sudo.git synced 2025-08-22 09:57:41 +00:00

In "make install", install sample sudoers file as /etc/sudoers.dist

and copy it to /etc/sudoers if there is no existing /etc/sudoers.
Packages either contain /etc/sudoers (RPM and Debian) or /etc/sudoers.dist
(everything else).
This commit is contained in:
Todd C. Miller 2017-04-26 13:52:49 -06:00
parent 495931f4a8
commit 9bccceaea1
2 changed files with 8 additions and 5 deletions

View File

@ -349,8 +349,9 @@ install-plugin: sudoers.la install-dirs
install-sudoers: install-dirs
$(INSTALL) -d $(INSTALL_OWNER) -m 0750 $(DESTDIR)$(sudoersdir)/sudoers.d
$(INSTALL) $(INSTALL_OWNER) -m $(sudoers_mode) sudoers $(DESTDIR)$(sudoersdir)/sudoers.dist
test -r $(DESTDIR)$(sudoersdir)/sudoers || \
$(INSTALL) $(INSTALL_OWNER) -m $(sudoers_mode) sudoers $(DESTDIR)$(sudoersdir)/sudoers
cp -p $(DESTDIR)$(sudoersdir)/sudoers.dist $(DESTDIR)$(sudoersdir)/sudoers
uninstall:
-$(LIBTOOL) $(LTFLAGS) --mode=uninstall rm -f $(DESTDIR)$(plugindir)/sudoers.la
@ -360,8 +361,9 @@ uninstall:
$(DESTDIR)$(replaydir)/sudoreplay$(INSTALL_BACKUP) \
$(DESTDIR)$(visudodir)/visudo$(INSTALL_BACKUP) \
$(DESTDIR)$(plugindir)/sudoers.so$(INSTALL_BACKUP)
-cmp $(DESTDIR)$(sudoersdir)/sudoers $(srcdir)/sudoers >/dev/null && \
-cmp $(DESTDIR)$(sudoersdir)/sudoers $(DESTDIR)$(sudoersdir)/sudoers.dist >/dev/null && \
rm -f $(DESTDIR)$(sudoersdir)/sudoers
-rm -f $(DESTDIR)$(sudoersdir)/sudoers.dist
splint:
splint $(SPLINT_OPTS) -I$(incdir) -I$(top_builddir) -I$(devdir) -I$(srcdir) -I$(top_srcdir) $(srcdir)/*.c $(srcdir)/auth/*.c

View File

@ -85,10 +85,11 @@ still allow people to get their work done."
if test -n "$linux_audit"; then
pp_rpm_requires="audit-libs >= $linux_audit"
fi
# The package manager will handle an existing sudoers file
rm -f ${pp_destdir}$sudoersdir/sudoers.dist
%else
# For all but RPM and Debian we need to install sudoers with a different
# name and make a copy of it if there is no existing file.
mv ${pp_destdir}$sudoersdir/sudoers ${pp_destdir}$sudoersdir/sudoers.dist
# For all but RPM and Debian we copy sudoers in a post-install script.
rm -f ${pp_destdir}$sudoersdir/sudoers
%endif
%if [deb]