From cd9b2b32aaefb7b829d6338e9861fbdcb8bee93b Mon Sep 17 00:00:00 2001 From: Zdenek Kabelac Date: Tue, 9 Apr 2024 14:50:52 +0200 Subject: [PATCH] configure: add --with-default-event-activaion=ON Add new configurable option for building lvm2 with enable/disable default autoactivation setting. Might be useful for building i.e. rpms for systems where this event_activation is not desired. --- conf/example.conf.in | 2 +- configure | 33 +++++++++++++++++++++++++++++++-- configure.ac | 14 +++++++++++++- include/configure.h.in | 3 +++ lib/config/config_settings.h | 2 +- 5 files changed, 49 insertions(+), 5 deletions(-) diff --git a/conf/example.conf.in b/conf/example.conf.in index 1063363f4..a40990349 100644 --- a/conf/example.conf.in +++ b/conf/example.conf.in @@ -1176,7 +1176,7 @@ global { # services (via the lvm2-activation-generator), but the autoactivation # services and generator have been removed. # This configuration option has an automatic default value. - # event_activation = 1 + # event_activation = @DEFAULT_EVENT_ACTIVATION@ # Configuration option global/use_aio. # Use async I/O when reading and writing devices. diff --git a/configure b/configure index fe6a9a515..5c1c8514d 100755 --- a/configure +++ b/configure @@ -732,6 +732,7 @@ DEFAULT_PROFILE_SUBDIR DEFAULT_PID_DIR DEFAULT_MIRROR_SEGTYPE DEFAULT_LOCK_DIR +DEFAULT_EVENT_ACTIVATION DEFAULT_DMEVENTD_EXIT_ON_PATH DEFAULT_DM_RUN_DIR DEFAULT_CACHE_SUBDIR @@ -920,6 +921,7 @@ with_device_mode with_device_nodes_on with_default_use_devices_file with_default_name_mangling +with_default_event_activation with_snapshots with_mirrors with_default_mirror_segtype @@ -1747,10 +1749,12 @@ Optional Packages: --with-device-mode=MODE set the mode used for new device nodes [MODE=0600] --with-device-nodes-on=ON create nodes on resume or create [ON=resume] - --with-default-use-devices-file - default for lvm.conf devices/use_devicesfile = [0] + --with-default-use-devices-file=ON + default lvm.conf devices/use_devicesfile = [ON=0] --with-default-name-mangling=MANGLING default name mangling: auto/none/hex [auto] + --with-default-event-activation=ON + default lvm.conf global/event_activation = [ON=1] --with-snapshots=TYPE snapshot support: internal/none [internal] --with-mirrors=TYPE mirror support: internal/none [internal] --with-default-mirror-segtype=TYPE @@ -9310,6 +9314,30 @@ printf "%s\n" "$MANGLING" >&6; } printf "%s\n" "#define DEFAULT_DM_NAME_MANGLING $mangling" >>confdefs.h +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking default for event_activation" >&5 +printf %s "checking default for event_activation... " >&6; } + +# Check whether --with-default-event-activation was given. +if test ${with_default_event_activation+y} +then : + withval=$with_default_event_activation; DEFAULT_EVENT_ACTIVATION=$withval +else case e in #( + e) DEFAULT_EVENT_ACTIVATION=1 ;; +esac +fi + +case "$DEFAULT_EVENT_ACTIVATION" in #( + 0|1) : + ;; #( + *) : + as_fn_error $? "--with-default-event-activation parameter invalid" "$LINENO" 5 ;; +esac +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $DEFAULT_EVENT_ACTIVATION" >&5 +printf "%s\n" "$DEFAULT_EVENT_ACTIVATION" >&6; } + +printf "%s\n" "#define DEFAULT_EVENT_ACTIVATION $DEFAULT_EVENT_ACTIVATION" >>confdefs.h + + ################################################################################ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether to include snapshots" >&5 printf %s "checking whether to include snapshots... " >&6; } @@ -16525,6 +16553,7 @@ AIO_LIBS=${AIO_LIBS:--laio} + ################################################################################ diff --git a/configure.ac b/configure.ac index 1f5c7045f..44ae746e4 100644 --- a/configure.ac +++ b/configure.ac @@ -291,7 +291,7 @@ AC_DEFINE_UNQUOTED([DEFAULT_DM_ADD_NODE], $add_on, [Define default node creation dnl -- Default settings for lvm.conf { devices/use_devicesfile } AC_MSG_CHECKING([default for use_devicesfile]) AC_ARG_WITH(default-use-devices-file, - AS_HELP_STRING([--with-default-use-devices-file], [default for lvm.conf devices/use_devicesfile = [0]]), + AS_HELP_STRING([--with-default-use-devices-file=ON], [default lvm.conf devices/use_devicesfile = [ON=0]]), DEFAULT_USE_DEVICES_FILE=$withval, DEFAULT_USE_DEVICES_FILE=0) AS_CASE(["$DEFAULT_USE_DEVICES_FILE"], [0|1], [], @@ -313,6 +313,17 @@ AS_CASE(["$MANGLING"], AC_MSG_RESULT([$MANGLING]) AC_DEFINE_UNQUOTED([DEFAULT_DM_NAME_MANGLING], $mangling, [Define default name mangling behaviour]) +AC_MSG_CHECKING([default for event_activation]) +AC_ARG_WITH(default-event-activation, + AS_HELP_STRING([--with-default-event-activation=ON], [default lvm.conf global/event_activation = [ON=1]]), + DEFAULT_EVENT_ACTIVATION=$withval, DEFAULT_EVENT_ACTIVATION=1) +AS_CASE(["$DEFAULT_EVENT_ACTIVATION"], + [0|1], [], + [AC_MSG_ERROR([--with-default-event-activation parameter invalid])]) +AC_MSG_RESULT([$DEFAULT_EVENT_ACTIVATION]) +AC_DEFINE_UNQUOTED(DEFAULT_EVENT_ACTIVATION, [$DEFAULT_EVENT_ACTIVATION], + [Default for lvm.conf event_activation.]) + ################################################################################ dnl -- snapshots inclusion type AC_MSG_CHECKING([whether to include snapshots]) @@ -1865,6 +1876,7 @@ AC_SUBST(DEFAULT_BACKUP_SUBDIR) AC_SUBST(DEFAULT_CACHE_SUBDIR) AC_SUBST(DEFAULT_DM_RUN_DIR) AC_SUBST(DEFAULT_DMEVENTD_EXIT_ON_PATH) +AC_SUBST(DEFAULT_EVENT_ACTIVATION) AC_SUBST(DEFAULT_LOCK_DIR) AC_SUBST(DEFAULT_MIRROR_SEGTYPE) AC_SUBST(DEFAULT_PID_DIR) diff --git a/include/configure.h.in b/include/configure.h.in index 25e1f697e..fa5da1599 100644 --- a/include/configure.h.in +++ b/include/configure.h.in @@ -58,6 +58,9 @@ /* Default system configuration directory. */ #undef DEFAULT_ETC_DIR +/* Default for lvm.conf event_activation. */ +#undef DEFAULT_EVENT_ACTIVATION + /* Name of default locking directory. */ #undef DEFAULT_LOCK_DIR diff --git a/lib/config/config_settings.h b/lib/config/config_settings.h index 3b7ae4ed9..d39e7ff4c 100644 --- a/lib/config/config_settings.h +++ b/lib/config/config_settings.h @@ -1150,7 +1150,7 @@ cfg(global_lvdisplay_shows_full_device_path_CFG, "lvdisplay_shows_full_device_pa "Previously this was always shown as /dev/vgname/lvname even when that\n" "was never a valid path in the /dev filesystem.\n") -cfg(global_event_activation_CFG, "event_activation", global_CFG_SECTION, CFG_DEFAULT_COMMENTED, CFG_TYPE_BOOL, 1, vsn(2, 3, 1), 0, 0, NULL, +cfg(global_event_activation_CFG, "event_activation", global_CFG_SECTION, CFG_DEFAULT_COMMENTED, CFG_TYPE_BOOL, DEFAULT_EVENT_ACTIVATION, vsn(2, 3, 1), "@DEFAULT_EVENT_ACTIVATION@", 0, NULL, "Disable event based autoactivation commands.\n" "WARNING: setting this to zero may cause machine startup to fail.\n" "Previously, setting this to zero would enable static autoactivation\n"