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

Add --enable-postinstall, an optional phase when building packages.

This makes it possible to run an arbitrary script between "make
install" and the polypkg run.  This will be used to copy different
word size versions of sudo_intercept.so and sudo_noexec.so.
This commit is contained in:
Todd C. Miller 2023-07-31 19:46:00 -06:00
parent 980e0216ac
commit 0a181849a1
4 changed files with 40 additions and 0 deletions

View File

@ -709,6 +709,11 @@ Defaults are listed in brackets after the description.
enables extra checks to make sure the environment does not enables extra checks to make sure the environment does not
become corrupted. become corrupted.
--enable-postinstall=PATH
Enable the use of a postinstall script that is run after
the "install" target but before packages as built as part
of the "package" target.
--enable-warnings --enable-warnings
Enable compiler warnings when building sudo with gcc or clang. Enable compiler warnings when building sudo with gcc or clang.

View File

@ -193,6 +193,9 @@ install: config.status ChangeLog pre-install install-nls
exit $$?; \ exit $$?; \
done done
postinstall:
@POSTINSTALL@
uninstall: uninstall-nls uninstall: uninstall-nls
for d in $(SUBDIRS); do \ for d in $(SUBDIRS); do \
(cd $$d && exec $(MAKE) $@) && continue; \ (cd $$d && exec $(MAKE) $@) && continue; \
@ -394,6 +397,7 @@ force-dist: ChangeLog $(srcdir)/MANIFEST
package: @PPFILES@ package: @PPFILES@
DESTDIR=$(abs_top_builddir)/destdir; rm -rf $$DESTDIR; \ DESTDIR=$(abs_top_builddir)/destdir; rm -rf $$DESTDIR; \
$(MAKE) install INSTALL_OWNER= DESTDIR=$$DESTDIR && \ $(MAKE) install INSTALL_OWNER= DESTDIR=$$DESTDIR && \
$(MAKE) postinstall INSTALL_OWNER= DESTDIR=$$DESTDIR && \
for p in @PPFILES@; do \ for p in @PPFILES@; do \
$(SHELL) $(scriptdir)/pp $(PPFLAGS) --destdir=$$DESTDIR $$p \ $(SHELL) $(scriptdir)/pp $(PPFLAGS) --destdir=$$DESTDIR $$p \
srcdir=$(top_srcdir) \ srcdir=$(top_srcdir) \

18
configure vendored
View File

@ -848,6 +848,7 @@ SUDOERS_UID
SUDOERS_MODE SUDOERS_MODE
SHLIB_MODE SHLIB_MODE
SHLIB_ENABLE SHLIB_ENABLE
POSTINSTALL
MANCOMPRESSEXT MANCOMPRESSEXT
MANCOMPRESS MANCOMPRESS
MANDIRTYPE MANDIRTYPE
@ -1016,6 +1017,7 @@ enable_noargs_shell
enable_shell_sets_home enable_shell_sets_home
enable_path_info enable_path_info
enable_env_debug enable_env_debug
enable_postinstall
enable_zlib enable_zlib
enable_env_reset enable_env_reset
enable_warnings enable_warnings
@ -1726,6 +1728,7 @@ Optional Features:
Set $HOME to target user in shell mode Set $HOME to target user in shell mode
--disable-path-info Print 'command not allowed' not 'command not found' --disable-path-info Print 'command not allowed' not 'command not found'
--enable-env-debug Whether to enable environment debugging. --enable-env-debug Whether to enable environment debugging.
--enable-postinstall Script to run after the install phase
--enable-zlib[=PATH] Whether to enable or disable zlib --enable-zlib[=PATH] Whether to enable or disable zlib
--enable-env-reset Whether to enable environment resetting by default. --enable-env-reset Whether to enable environment resetting by default.
--enable-warnings Whether to enable compiler warnings --enable-warnings Whether to enable compiler warnings
@ -6615,6 +6618,21 @@ printf "%s\n" "$as_me: WARNING: ignoring unknown argument to --enable-env-debug:
fi fi
# Check whether --enable-postinstall was given.
if test ${enable_postinstall+y}
then :
enableval=$enable_postinstall; case "$enableval" in
yes) as_fn_error $? "must give --enable-postinstall an argument." "$LINENO" 5
;;
no) as_fn_error $? "--enable-postinstall not supported." "$LINENO" 5
;;
*) POSTINSTALL="$enableval"
;;
esac
fi
# Check whether --enable-zlib was given. # Check whether --enable-zlib was given.
if test ${enable_zlib+y} if test ${enable_zlib+y}
then : then :

View File

@ -51,6 +51,7 @@ AC_SUBST([MANTYPE])dnl
AC_SUBST([MANDIRTYPE])dnl AC_SUBST([MANDIRTYPE])dnl
AC_SUBST([MANCOMPRESS])dnl AC_SUBST([MANCOMPRESS])dnl
AC_SUBST([MANCOMPRESSEXT])dnl AC_SUBST([MANCOMPRESSEXT])dnl
AC_SUBST([POSTINSTALL])dnl
AC_SUBST([SHLIB_ENABLE])dnl AC_SUBST([SHLIB_ENABLE])dnl
AC_SUBST([SHLIB_MODE])dnl AC_SUBST([SHLIB_MODE])dnl
AC_SUBST([SUDOERS_MODE])dnl AC_SUBST([SUDOERS_MODE])dnl
@ -1267,6 +1268,18 @@ AC_ARG_ENABLE(env_debug,
esac esac
]) ])
AC_ARG_ENABLE(postinstall,
[AS_HELP_STRING([--enable-postinstall], [Script to run after the install phase])],
[ case "$enableval" in
yes) AC_MSG_ERROR([must give --enable-postinstall an argument.])
;;
no) AC_MSG_ERROR([--enable-postinstall not supported.])
;;
*) POSTINSTALL="$enableval"
;;
esac
])
AC_ARG_ENABLE(zlib, AC_ARG_ENABLE(zlib,
[AS_HELP_STRING([--enable-zlib[[=PATH]]], [Whether to enable or disable zlib])], [AS_HELP_STRING([--enable-zlib[[=PATH]]], [Whether to enable or disable zlib])],
[], [enable_zlib=yes]) [], [enable_zlib=yes])