From 245f1ae3380330e31bfdcb7f4fe17698a2fa021d Mon Sep 17 00:00:00 2001 From: Mathieu Lirzin Date: Wed, 22 Feb 2017 15:49:18 +0100 Subject: build: Replace "--enable-no-vixie-clobber" with "--disable-multi-user". * configure.ac: Define "--disable-multi-user" option instead of "--enable-no-vixie-clobber". * Makefile.am (install-exec-hook) [MULTI_USER]: Only set crontab setuid bit. (bin_PROGRAMS): Keep only 'mcron' by default. (bin_PROGRAMS) [MULTI_USER]: Add 'crontab' (sbin_PROGRAMS) [MULTI_USER]: Add 'cron'. (noinst_PROGRAMS) [!MULTI_USER]: Add 'cron' and 'crontab'. (dist_man_MANS): Move 'crontab.1' and 'cron.8' ... (extra_mans): here. New variable. (dist_man_MANS) [MULTI_USER]: Add it. (all-local) [!MULTI_USER]: New target. Depend on it. (EXTRA_DIST) [!MULTI_USER]: Distribute it. (MAINTAINERCLEANFILES): Clean it. --- Makefile.am | 44 +++++++++++++++++++++----------------------- configure.ac | 18 ++++++------------ 2 files changed, 27 insertions(+), 35 deletions(-) diff --git a/Makefile.am b/Makefile.am index ce3ad57..7602341 100644 --- a/Makefile.am +++ b/Makefile.am @@ -21,8 +21,14 @@ ## Programs. ## ## ---------- ## -bin_PROGRAMS = bin/mcron bin/crontab +bin_PROGRAMS = bin/mcron + +if MULTI_USER +bin_PROGRAMS += bin/crontab sbin_PROGRAMS = bin/cron +else +noinst_PROGRAMS = bin/cron bin/crontab +endif AM_CPPFLAGS = \ -DPACKAGE_LOAD_PATH=\"$(moduledir)\" \ @@ -160,26 +166,10 @@ EXTRA_DIST = \ #full program prefix fpp = $(DESTDIR)$(bindir)/@real_program_prefix@ +if MULTI_USER install-exec-hook: - @if [ "x@NO_VIXIE_CLOBBER@" != "xyes" -a "`id -u`" -eq "0" ]; then \ - rm -f $(fpp)cron$(EXEEXT) > /dev/null 2>&1; \ - $(INSTALL) --mode='u=rwx' mcron$(EXEEXT) $(fpp)cron$(EXEEXT); \ - rm -f $(fpp)crontab$(EXEEXT) > /dev/null 2>&1; \ - $(INSTALL) --mode='u=rwxs,og=rx' mcron$(EXEEXT) $(fpp)crontab$(EXEEXT); \ - $(INSTALL) -d --mode='u=rwx' $(DESTDIR)/var/cron; \ - $(INSTALL) -d --mode='u=rwx,og=rx' $(DESTDIR)/var/run; \ - $(INSTALL) -d --mode='u=rwx,og=rx' $(DESTDIR)@GUILE_SITE@; \ - $(INSTALL) -d --mode='u=rwx,og=rx' $(DESTDIR)@GUILE_SITE@/mcron; \ - elif [ "x@NO_VIXIE_CLOBBER@" = "xyes" ]; then \ - echo "Not installing Vixie-style programs"; \ - else \ - echo "+++ WARNING: NON-ROOT INSTALL: ONLY mcron WILL BE INSTALLED, NOT ANY OF THE VIXIE REPLACEMENT PROGRAMS"; \ - fi - -uninstall-hook: - if [ "`id -u`" -eq "0" ]; then \ - rm -f $(fpp){cron,crontab}$(EXEEXT); \ - fi + chmod u+s $(fpp)crontab$(EXEEXT) +endif ## --------------- ## ## Documentation. ## @@ -188,11 +178,19 @@ uninstall-hook: info_TEXINFOS = doc/mcron.texi doc_mcron_TEXINFOS = doc/fdl.texi nodist_doc_mcron_TEXINFOS = doc/config.texi -dist_man_MANS = \ - $(srcdir)/doc/mcron.1 \ +dist_man_MANS = $(srcdir)/doc/mcron.1 +extra_mans = \ $(srcdir)/doc/crontab.1 \ $(srcdir)/doc/cron.8 +if MULTI_USER +dist_man_MANS += $(extra_mans) +else +# Build, distribute, but do not install the extra man pages. +all-local: $(extra_mans) +EXTRA_DIST += $(extra_mans) +endif + # XXX: Allow the inclusion of 'doc/fdl.texi' and 'doc/config.texi' inside # 'doc/mcron.texi' for 'dvi' and 'pdf' targets. TEXI2DVI = texi2dvi -I doc @@ -218,7 +216,7 @@ $(srcdir)/doc/crontab.1: src/mcron/scripts/crontab.scm bin/crontab $(srcdir)/doc/cron.8: src/mcron/scripts/cron.scm bin/cron -@prog="cron"; man_section=8; $(gen_man) -MAINTAINERCLEANFILES = $(dist_man_MANS) +MAINTAINERCLEANFILES = $(dist_man_MANS) $(extra_mans) ## -------------- ## ## Silent rules. ## diff --git a/configure.ac b/configure.ac index 8c5fc08..363a74f 100644 --- a/configure.ac +++ b/configure.ac @@ -104,18 +104,12 @@ else fi SENDMAIL=$ac_cv_prog_SENDMAIL - -# Find out if we are avoiding Vixie. - -AC_MSG_CHECKING([whether to avoid clobbering a Vixie installation]) -AC_ARG_ENABLE(no-vixie-clobber, - AC_HELP_STRING([--enable-no-vixie-clobber], - [do not install with program names that would override a legacy cron installation]), - NO_VIXIE_CLOBBER=$enableval, - NO_VIXIE_CLOBBER=[no]) -AC_MSG_RESULT($NO_VIXIE_CLOBBER) -AC_SUBST(NO_VIXIE_CLOBBER) - +AC_ARG_ENABLE([multi-user], + [AS_HELP_STRING([--disable-multi-user], + [Don't Install legacy cron and crontab programs])], + [enable_multi_user="$enableval"], + [enable_multi_user="yes"]) +AM_CONDITIONAL([MULTI_USER], [test "x$enable_multi_user" != xyes]) # Configure the various files that mcron uses at runtime. -- cgit v1.2.3