From cd7c9b897e06a353b6ad3e7fce9d8acadff19e97 Mon Sep 17 00:00:00 2001 From: Charles Lepple Date: Wed, 24 Jan 2024 22:08:57 -0500 Subject: [PATCH 001/805] drivers/tripplite_usb.c: Protocol 3017 first cut Reference: #2258 --- drivers/tripplite_usb.c | 112 ++++++++++++++++++++++++++++++---------- 1 file changed, 86 insertions(+), 26 deletions(-) diff --git a/drivers/tripplite_usb.c b/drivers/tripplite_usb.c index f4e2a1560b..1e49d1511f 100644 --- a/drivers/tripplite_usb.c +++ b/drivers/tripplite_usb.c @@ -137,7 +137,7 @@ #include "usb-common.h" #define DRIVER_NAME "Tripp Lite OMNIVS / SMARTPRO driver" -#define DRIVER_VERSION "0.35" +#define DRIVER_VERSION "0.36" /* driver description structure */ upsdrv_info_t upsdrv_info = { @@ -203,7 +203,8 @@ static enum tl_model_t { TRIPP_LITE_OMNIVS_2001, TRIPP_LITE_SMARTPRO, TRIPP_LITE_SMART_0004, - TRIPP_LITE_SMART_3005 + TRIPP_LITE_SMART_3005, + TRIPP_LITE_SMART_3017 } tl_model = TRIPP_LITE_UNKNOWN; /*! Are the values encoded in ASCII or binary? @@ -218,6 +219,7 @@ static int is_binary_protocol(void) case TRIPP_LITE_SMART_0004: case TRIPP_LITE_OMNIVS: case TRIPP_LITE_OMNIVS_2001: + case TRIPP_LITE_SMART_3017: case TRIPP_LITE_UNKNOWN: #if (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP) && (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_COVERED_SWITCH_DEFAULT) # pragma GCC diagnostic push @@ -244,6 +246,7 @@ static int is_smart_protocol(void) case TRIPP_LITE_SMARTPRO: case TRIPP_LITE_SMART_0004: case TRIPP_LITE_SMART_3005: + case TRIPP_LITE_SMART_3017: return 1; case TRIPP_LITE_OMNIVS: case TRIPP_LITE_OMNIVS_2001: @@ -518,6 +521,9 @@ static enum tl_model_t decode_protocol(unsigned int proto) case 0x3005: upslogx(3, "Using binary SMART protocol (%x)", proto); return TRIPP_LITE_SMART_3005; + case 0x3017: + upslogx(3, "Using (mostly) ASCII SMART protocol (%x)", proto); + return TRIPP_LITE_SMART_3017; default: printf("Unknown protocol (%04x)", proto); break; @@ -542,31 +548,79 @@ static void decode_v(const unsigned char *value) ivn = value[1]; lb = value[4]; - switch(ivn) { - case '0': input_voltage_nominal = - input_voltage_scaled = 100; - break; - - case 2: /* protocol 3005 */ - case '1': input_voltage_nominal = - input_voltage_scaled = 120; - break; - - case '2': input_voltage_nominal = - input_voltage_scaled = 230; - break; - - case '3': input_voltage_nominal = 208; - input_voltage_scaled = 230; - break; + if( is_smart_protocol() ) { + switch(ivn) { + case 0: + case '0': input_voltage_nominal = + input_voltage_scaled = 100; + break; + + case 1: + case '1': input_voltage_nominal = + input_voltage_scaled = 110; + break; + + case 2: /* protocol 3005 */ + case '2': input_voltage_nominal = + input_voltage_scaled = 120; + break; + + case 3: + case '3': input_voltage_nominal = + input_voltage_scaled = 127; + break; + + case 4: + case '4': input_voltage_nominal = + input_voltage_scaled = 208; + break; + + case 5: + case '5': input_voltage_nominal = + input_voltage_scaled = 220; + break; + + case 6: + case '6': input_voltage_nominal = + input_voltage_scaled = 230; + break; + + case 7: + case '7': input_voltage_nominal = + input_voltage_scaled = 240; + break; - case 6: input_voltage_nominal = - input_voltage_scaled = 230; - break; + default: + upslogx(2, "Unknown input voltage range: 0x%02x", (unsigned int)ivn); + break; + } + } else { + /* Lots of odd cases here; maybe some of the SMART protocols got mixed in, too: */ + switch(ivn) { + case '0': input_voltage_nominal = + input_voltage_scaled = 100; + break; + + case '1': input_voltage_nominal = + input_voltage_scaled = 120; + break; + + case '2': input_voltage_nominal = + input_voltage_scaled = 230; + break; + + case '3': input_voltage_nominal = 208; + input_voltage_scaled = 230; + break; + + case 6: input_voltage_nominal = + input_voltage_scaled = 230; + break; - default: - upslogx(2, "Unknown input voltage range: 0x%02x", (unsigned int)ivn); - break; + default: + upslogx(2, "Unknown input voltage range: 0x%02x", (unsigned int)ivn); + break; + } } if( (lb >= '0') && (lb <= '9') ) { @@ -769,8 +823,12 @@ static int soft_shutdown(void) int ret; unsigned char buf[256], cmd_N[]="N\0x", cmd_G[] = "G"; + /* TODO: find size/format of ASCII delay command */ + if( !is_binary_protocol() ) { + upslogx(LOG_WARNING, "Other commands for this UPS are binary, but the format of the shutdown delay command has not been confirmed."); + } + /* Already binary: */ - /* FIXME: Assumes memory layout / endianness? */ cmd_N[2] = (unsigned char)(offdelay & 0x00FF); cmd_N[1] = (unsigned char)(offdelay >> 8); upsdebugx(3, "soft_shutdown(offdelay=%d): N", offdelay); @@ -885,6 +943,7 @@ static int control_outlet(int outlet_id, int state) case TRIPP_LITE_OMNIVS: case TRIPP_LITE_OMNIVS_2001: + case TRIPP_LITE_SMART_3017: case TRIPP_LITE_UNKNOWN: #if (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP) && (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_COVERED_SWITCH_DEFAULT) # pragma GCC diagnostic push @@ -1534,6 +1593,7 @@ void upsdrv_updateinfo(void) hex2d(l_value+1, 4)/240.0*input_voltage_scaled); break; case TRIPP_LITE_SMARTPRO: + case TRIPP_LITE_SMART_3017: dstate_setinfo("ups.load", "%ld", hex2d(l_value+1, 2)); break; case TRIPP_LITE_SMART_3005: From 76d0602fb777253239d523d80cb968d6d5992a1e Mon Sep 17 00:00:00 2001 From: Charles Lepple Date: Thu, 25 Jan 2024 22:09:53 -0500 Subject: [PATCH 002/805] drivers/tripplite_usb.c: Protocol 3017 adjustments Reference: #2258 SMX1200XLHG is 230V / 50 Hz --- drivers/tripplite_usb.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/tripplite_usb.c b/drivers/tripplite_usb.c index 1e49d1511f..cc830d27b9 100644 --- a/drivers/tripplite_usb.c +++ b/drivers/tripplite_usb.c @@ -548,7 +548,7 @@ static void decode_v(const unsigned char *value) ivn = value[1]; lb = value[4]; - if( is_smart_protocol() ) { + if( is_smart_protocol() && (tl_model != TRIPP_LITE_SMART_3017) ) { switch(ivn) { case 0: case '0': input_voltage_nominal = @@ -605,6 +605,7 @@ static void decode_v(const unsigned char *value) input_voltage_scaled = 120; break; + /* UK SMX1200XLHG protocol 3017 confirmed: */ case '2': input_voltage_nominal = input_voltage_scaled = 230; break; @@ -621,6 +622,8 @@ static void decode_v(const unsigned char *value) upslogx(2, "Unknown input voltage range: 0x%02x", (unsigned int)ivn); break; } + upslogx(2, "Regard the input voltage range with skepticism (nominal = %ld, scaled = %ld; V[0] = 0x%02x)", + input_voltage_nominal, input_voltage_scaled, (unsigned int)ivn); } if( (lb >= '0') && (lb <= '9') ) { @@ -1530,7 +1533,7 @@ void upsdrv_updateinfo(void) return; } - if( tl_model == TRIPP_LITE_SMARTPRO ) { + if( (tl_model == TRIPP_LITE_SMARTPRO) || (tl_model == TRIPP_LITE_SMART_3017) ) { freq = hex2d(t_value + 3, 3); dstate_setinfo("input.frequency", "%.1f", freq / 10.0); From 49d4a5ed7eb3d01058c249b77c2c3d455b761297 Mon Sep 17 00:00:00 2001 From: Charles Lepple Date: Wed, 31 Jan 2024 06:57:38 -0500 Subject: [PATCH 003/805] drivers/tripplite_usb.c: add battery.charge for Protocol 3017 Reference: #2258 --- drivers/tripplite_usb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/tripplite_usb.c b/drivers/tripplite_usb.c index cc830d27b9..44436b70c7 100644 --- a/drivers/tripplite_usb.c +++ b/drivers/tripplite_usb.c @@ -1565,7 +1565,7 @@ void upsdrv_updateinfo(void) /* - * - * - * - * - * - * - * - * - * - * - * - * - * - * - */ if( tl_model == TRIPP_LITE_OMNIVS || tl_model == TRIPP_LITE_OMNIVS_2001 || - tl_model == TRIPP_LITE_SMARTPRO || tl_model == TRIPP_LITE_SMART_0004 || tl_model == TRIPP_LITE_SMART_3005) { + is_smart_protocol() ) { /* dq ~= sqrt(dV) is a reasonable approximation * Results fit well against the discrete function used in the Tripp Lite * source, but give a continuous result. */ From d759cb2bd950ca5cf39443aaf58d731e72eeaa73 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Tue, 8 Jul 2025 11:04:50 +0200 Subject: [PATCH 004/805] drivers/powercom-hid.c: WIP fixes for discrete shutdown timings (per RAPTOR RPT-1500AP LCD practice) [#3000] Authored-by: https://github.com/aleka204 Signed-off-by: Jim Klimov --- drivers/powercom-hid.c | 46 +++++++++++++++++++++++------------------- 1 file changed, 25 insertions(+), 21 deletions(-) diff --git a/drivers/powercom-hid.c b/drivers/powercom-hid.c index ebadc68841..f001e889a5 100644 --- a/drivers/powercom-hid.c +++ b/drivers/powercom-hid.c @@ -75,19 +75,21 @@ static const char *powercom_startup_fun(double value) static double powercom_startup_nuf(const char *value) { const char *s = dstate_getinfo("ups.delay.start"); - uint16_t val, command; + uint32_t val, command; int iv; - iv = atoi(value ? value : s) / 60; - if (iv < 0 || (intmax_t)iv > (intmax_t)UINT16_MAX) { + //iv = atoi(value ? value : s) / 60; + iv = atoi(value ? value : s); + if (iv < 0 || (intmax_t)iv > (intmax_t)UINT32_MAX) { upsdebugx(0, "%s: value = %d is not in uint16_t range", __func__, iv); return 0; } /* COMMENTME: What are we doing here, a byte-swap in the word? */ - val = (uint16_t)iv; - command = (uint16_t)(val << 8); - command += (uint16_t)(val >> 8); + // val = (uint16_t)iv; + // command = (uint16_t)(val << 8); + // command += (uint16_t)(val >> 8); + command = (uint32_t)iv; upsdebugx(3, "%s: value = %s, command = %04X", __func__, value, command); return command; @@ -117,28 +119,30 @@ static const char *powercom_shutdown_fun(double value) static double powercom_shutdown_nuf(const char *value) { const char *s = dstate_getinfo("ups.delay.shutdown"); - uint16_t val, command; + uint8_t val, command; int iv; iv = atoi(value ? value : s); - if (iv < 0 || (intmax_t)iv > (intmax_t)UINT16_MAX) { + if (iv < 0 || (intmax_t)iv > (intmax_t)UINT8_MAX) { upsdebugx(0, "%s: value = %d is not in uint16_t range", __func__, iv); return 0; } - val = (uint16_t)iv; - val = val ? val : 1; /* 0 sets the maximum delay */ - if (powercom_sdcmd_byte_order_fallback) { - /* Legacy behavior */ - command = ((uint16_t)((val % 60) << 8)) + (uint16_t)(val / 60); - command |= 0x4000; /* AC RESTART NORMAL ENABLE */ - } else { - /* New default */ - command = ((uint16_t)((val / 60) << 8)) + (uint16_t)(val % 60); - command |= 0x0040; /* AC RESTART NORMAL ENABLE */ - } - - upsdebugx(3, "%s: value = %s, command = %04X", __func__, value, command); + command = (uint8_t)iv; + + // val = (uint16_t)iv; + // val = val ? val : 1; /* 0 sets the maximum delay */ + // if (powercom_sdcmd_byte_order_fallback) { + // /* Legacy behavior */ + // command = ((uint16_t)((val % 60) << 8)) + (uint16_t)(val / 60); + // command |= 0x4000; /* AC RESTART NORMAL ENABLE */ + // } else { + // /* New default */ + // command = ((uint16_t)((val / 60) << 8)) + (uint16_t)(val % 60); + // command |= 0x0040; /* AC RESTART NORMAL ENABLE */ + // } + + upsdebugx(3, "%s: value = %s, command = %02X", __func__, value, command); return command; } From 7021964240effc65e853c9339ca5a6356f9c8ddb Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Tue, 8 Jul 2025 11:14:51 +0200 Subject: [PATCH 005/805] NEWS.adoc, drivers/powercom-hid.c: fix shutdown delays for Powercom HID [#3000] Signed-off-by: Jim Klimov --- NEWS.adoc | 5 +++++ drivers/powercom-hid.c | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/NEWS.adoc b/NEWS.adoc index 8323d85f3a..8b25fa8671 100644 --- a/NEWS.adoc +++ b/NEWS.adoc @@ -181,6 +181,11 @@ https://github.com/networkupstools/nut/milestone/9 threshold, as seen with a EC850LCD device. [issue #2917, PR #2919] * Added APC BVKxxxM2 to list of devices where `lbrb_log_delay_sec=N` may be necessary to address spurious LOWBATT and REPLACEBATT events. [#2942] + * The `powercom-hid` subdriver did not handle delayed shutdown commands + properly, at least as of RAPTOR RPT-1500AP LCD models. The RPT series + seem to have same USB protocol like Smart KING Pro series, and that + only supports a specific set of possible delays for Shutdown commands + (certain fractions or counts of whole minutes). [issue #3000] - New NUT drivers: * Introduced a `ve-direct` driver for Victron Energy UPS/solar panels diff --git a/drivers/powercom-hid.c b/drivers/powercom-hid.c index f001e889a5..97e44eaa55 100644 --- a/drivers/powercom-hid.c +++ b/drivers/powercom-hid.c @@ -26,7 +26,7 @@ #include "powercom-hid.h" #include "usb-common.h" -#define POWERCOM_HID_VERSION "PowerCOM HID 0.71" +#define POWERCOM_HID_VERSION "PowerCOM HID 0.72" /* FIXME: experimental flag to be put in upsdrv_info */ /* PowerCOM */ From 7bfb4516a1bdd2a4da026fee0bcd9172962108b1 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Tue, 8 Jul 2025 11:34:48 +0200 Subject: [PATCH 006/805] drivers/powercom-hid.c: WIP fixes for discrete shutdown timings (per RAPTOR RPT-1500AP LCD practice) - fix messages [#3000] Signed-off-by: Jim Klimov --- drivers/powercom-hid.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/powercom-hid.c b/drivers/powercom-hid.c index 97e44eaa55..90a1af30b4 100644 --- a/drivers/powercom-hid.c +++ b/drivers/powercom-hid.c @@ -81,7 +81,7 @@ static double powercom_startup_nuf(const char *value) //iv = atoi(value ? value : s) / 60; iv = atoi(value ? value : s); if (iv < 0 || (intmax_t)iv > (intmax_t)UINT32_MAX) { - upsdebugx(0, "%s: value = %d is not in uint16_t range", __func__, iv); + upsdebugx(0, "%s: value = %d is not in uint32_t range", __func__, iv); return 0; } @@ -124,7 +124,7 @@ static double powercom_shutdown_nuf(const char *value) iv = atoi(value ? value : s); if (iv < 0 || (intmax_t)iv > (intmax_t)UINT8_MAX) { - upsdebugx(0, "%s: value = %d is not in uint16_t range", __func__, iv); + upsdebugx(0, "%s: value = %d is not in uint8_t range", __func__, iv); return 0; } From 78fe47a85a1ad6f11d82ffb0e6d41dbf10ce50cb Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Tue, 8 Jul 2025 14:36:53 +0200 Subject: [PATCH 007/805] drivers/usbhid-ups.c, drivers/powercom-hid.c, docs/man/usbhid-ups.txt, NEWS.adoc: introduce powercom_sdcmd_discrete_delay flag for Powercom Raptor and Smart KING Pro series [#3000] Signed-off-by: Jim Klimov --- NEWS.adoc | 3 +- docs/man/usbhid-ups.txt | 9 +++ drivers/powercom-hid.c | 119 +++++++++++++++++++++++++++++++--------- drivers/usbhid-ups.c | 5 +- 4 files changed, 107 insertions(+), 29 deletions(-) diff --git a/NEWS.adoc b/NEWS.adoc index 8b25fa8671..a60437ca79 100644 --- a/NEWS.adoc +++ b/NEWS.adoc @@ -185,7 +185,8 @@ https://github.com/networkupstools/nut/milestone/9 properly, at least as of RAPTOR RPT-1500AP LCD models. The RPT series seem to have same USB protocol like Smart KING Pro series, and that only supports a specific set of possible delays for Shutdown commands - (certain fractions or counts of whole minutes). [issue #3000] + (certain fractions or counts of whole minutes) -- which should now be + handled if `powercom_sdcmd_discrete_delay` flag is set. [issue #3000] - New NUT drivers: * Introduced a `ve-direct` driver for Victron Energy UPS/solar panels diff --git a/docs/man/usbhid-ups.txt b/docs/man/usbhid-ups.txt index efd0f8a961..2ce4bf88d0 100644 --- a/docs/man/usbhid-ups.txt +++ b/docs/man/usbhid-ups.txt @@ -221,6 +221,15 @@ firmwares out there with opposite behaviors, we provide this toggle to use old behavior in a particular deployment. Maybe it was just a bug and nobody needs this fall-back... +*powercom_sdcmd_discrete_delay*:: +Some devices (Raptor and Smart KING Pro series) follow the protocol +where we can not set arbitrary value of shutdown delay in seconds +(like in other powercom UPSes), but must use values only from the +"Table of possible delays for Shutdown commands" specified in the +protocol document. This option causes the driver to convert delays +between seconds (in standard NUT variables) and nearest indexed +entry from that table. + *explore*:: With this option, the driver will connect to any device, including ones that are not yet supported. This must always be combined with the diff --git a/drivers/powercom-hid.c b/drivers/powercom-hid.c index 90a1af30b4..96912111ff 100644 --- a/drivers/powercom-hid.c +++ b/drivers/powercom-hid.c @@ -62,10 +62,30 @@ static char powercom_scratch_buf[32]; */ static char powercom_sdcmd_byte_order_fallback = 0; +/* Some devices (Raptor and Smart KING Pro series) follow the protocol + * where we can not set arbitrary value of shutdown delay in seconds + * (like in other powercom UPSes), but the shutdown delay can be set + * only from table "Table of possible delays for Shutdown commands" + * specified at page 17 of the protocol document: + * https://networkupstools.org/protocols/powercom/Software_USB_communication_controller_SKP_series.doc + * + * "Table of possible delays for Shutdown commands" (mentioned for + * `DelayBeforeShutdown` and `DelayBeforeStartup` HID Usages): + * Index 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 + * Value 12s 18s 24s 30s 36s 42s 48s 54s 1m 2m 3m 4m 5m 6m 7m 8m 9m 10m + * Sent to UPS .2 .3 .4 .5 .6 .7 .8 .9 01 02 03 04 05 06 07 08 09 10 + * + */ +static char powercom_sdcmd_discrete_delay = 0; + static const char *powercom_startup_fun(double value) { uint16_t i = value; + /* For powercom_sdcmd_discrete_delay we also read minutes + * from DelayBeforeStartup (same as for older dialects). + * FIXME: ...but theoretically they can be 32-bit (1..99999) + */ snprintf(powercom_scratch_buf, sizeof(powercom_scratch_buf), "%d", 60 * (((i & 0x00FF) << 8) + (i >> 8))); upsdebugx(3, "%s: value = %.0f, buf = %s", __func__, value, powercom_scratch_buf); @@ -78,19 +98,37 @@ static double powercom_startup_nuf(const char *value) uint32_t val, command; int iv; - //iv = atoi(value ? value : s) / 60; - iv = atoi(value ? value : s); + /* Start with seconds "as is" - convert into whole minutes */ + iv = atoi(value ? value : s) / 60; /* minutes */ +#if (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP) && ( (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TYPE_LIMITS) || (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TAUTOLOGICAL_CONSTANT_OUT_OF_RANGE_COMPARE) ) +# pragma GCC diagnostic push +#endif +#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TYPE_LIMITS +# pragma GCC diagnostic ignored "-Wtype-limits" +#endif +#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TAUTOLOGICAL_CONSTANT_OUT_OF_RANGE_COMPARE +# pragma GCC diagnostic ignored "-Wtautological-constant-out-of-range-compare" +#endif if (iv < 0 || (intmax_t)iv > (intmax_t)UINT32_MAX) { +#if (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP) && ( (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TYPE_LIMITS) || (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TAUTOLOGICAL_CONSTANT_OUT_OF_RANGE_COMPARE) ) +# pragma GCC diagnostic pop +#endif upsdebugx(0, "%s: value = %d is not in uint32_t range", __func__, iv); return 0; } - /* COMMENTME: What are we doing here, a byte-swap in the word? */ - // val = (uint16_t)iv; - // command = (uint16_t)(val << 8); - // command += (uint16_t)(val >> 8); - command = (uint32_t)iv; - upsdebugx(3, "%s: value = %s, command = %04X", __func__, value, command); + if (powercom_sdcmd_discrete_delay) { + /* Per spec, DelayBeforeStartup reads and writes + * 4-byte "mmmm" values in minutes (1..99999) */ + command = (uint32_t)iv; + } else { + /* COMMENTME: What are we doing here, a byte-swap in the word? */ + val = (uint16_t)iv; + command = (uint16_t)(val << 8); + command += (uint16_t)(val >> 8); + } + + upsdebugx(3, "%s: value = %s, command = 0x%08X", __func__, value, command); return command; } @@ -103,6 +141,12 @@ static const char *powercom_shutdown_fun(double value) { uint16_t i = value; + /* NOTE: for powercom_sdcmd_discrete_delay mode it seems we + * do not read DelayBeforeShutdown at all (not for time), + * the value is stored and retrieved as DelayBeforeStartup. + * FIXME: Should anything be changed here? + */ + if (powercom_sdcmd_byte_order_fallback) { /* Legacy behavior */ snprintf(powercom_scratch_buf, sizeof(powercom_scratch_buf), "%d", 60 * (i & 0x00FF) + (i >> 8)); @@ -119,30 +163,49 @@ static const char *powercom_shutdown_fun(double value) static double powercom_shutdown_nuf(const char *value) { const char *s = dstate_getinfo("ups.delay.shutdown"); - uint8_t val, command; + uint16_t val, command; int iv; - iv = atoi(value ? value : s); - if (iv < 0 || (intmax_t)iv > (intmax_t)UINT8_MAX) { - upsdebugx(0, "%s: value = %d is not in uint8_t range", __func__, iv); + iv = atoi(value ? value : s); /* seconds */ + if (iv < 0 || (intmax_t)iv > (intmax_t)UINT16_MAX) { + upsdebugx(0, "%s: value = %d is not in uint16_t range", __func__, iv); return 0; } - command = (uint8_t)iv; - - // val = (uint16_t)iv; - // val = val ? val : 1; /* 0 sets the maximum delay */ - // if (powercom_sdcmd_byte_order_fallback) { - // /* Legacy behavior */ - // command = ((uint16_t)((val % 60) << 8)) + (uint16_t)(val / 60); - // command |= 0x4000; /* AC RESTART NORMAL ENABLE */ - // } else { - // /* New default */ - // command = ((uint16_t)((val / 60) << 8)) + (uint16_t)(val % 60); - // command |= 0x0040; /* AC RESTART NORMAL ENABLE */ - // } + if (powercom_sdcmd_discrete_delay) { + if (iv <= 12) command = 1; + else if (iv <= 18) command = 2; + else if (iv <= 24) command = 3; + else if (iv <= 30) command = 4; + else if (iv <= 36) command = 5; + else if (iv <= 42) command = 6; + else if (iv <= 48) command = 7; + else if (iv <= 54) command = 8; + else if (iv <= 60) command = 9; + else if (iv <= 120) command = 10; + else if (iv <= 180) command = 11; + else if (iv <= 240) command = 12; + else if (iv <= 300) command = 13; + else if (iv <= 360) command = 14; + else if (iv <= 420) command = 15; + else if (iv <= 480) command = 16; + else if (iv <= 540) command = 17; + else command = 18; + } else { + val = (uint16_t)iv; + val = val ? val : 1; /* 0 sets the maximum delay */ + if (powercom_sdcmd_byte_order_fallback) { + /* Legacy behavior */ + command = ((uint16_t)((val % 60) << 8)) + (uint16_t)(val / 60); + command |= 0x4000; /* AC RESTART NORMAL ENABLE */ + } else { + /* New default */ + command = ((uint16_t)((val / 60) << 8)) + (uint16_t)(val % 60); + command |= 0x0040; /* AC RESTART NORMAL ENABLE */ + } + } - upsdebugx(3, "%s: value = %s, command = %02X", __func__, value, command); + upsdebugx(3, "%s: value = %s, command = 0x%04X", __func__, value, command); return command; } @@ -157,6 +220,7 @@ static double powercom_stayoff_nuf(const char *value) uint16_t val, command; int iv; + /* FIXME: Anything for powercom_sdcmd_discrete_delay? */ iv = atoi(value ? value : s); if (iv < 0 || (intmax_t)iv > (intmax_t)UINT16_MAX) { upsdebugx(0, "%s: value = %d is not in uint16_t range", __func__, iv); @@ -175,7 +239,7 @@ static double powercom_stayoff_nuf(const char *value) command |= 0x0080; /* AC RESTART NORMAL DISABLE */ } - upsdebugx(3, "%s: value = %s, command = %04X", __func__, value, command); + upsdebugx(3, "%s: value = %s, command = 0x%04X", __func__, value, command); return command; } @@ -596,6 +660,7 @@ static int powercom_claim(HIDDevice_t *hd) accept: powercom_sdcmd_byte_order_fallback = testvar("powercom_sdcmd_byte_order_fallback"); + powercom_sdcmd_discrete_delay = testvar("powercom_sdcmd_discrete_delay"); return 1; } diff --git a/drivers/usbhid-ups.c b/drivers/usbhid-ups.c index 633311c205..8dbc644aba 100644 --- a/drivers/usbhid-ups.c +++ b/drivers/usbhid-ups.c @@ -29,7 +29,7 @@ */ #define DRIVER_NAME "Generic HID driver" -#define DRIVER_VERSION "0.65" +#define DRIVER_VERSION "0.66" #define HU_VAR_WAITBEFORERECONNECT "waitbeforereconnect" @@ -1144,6 +1144,9 @@ void upsdrv_makevartable(void) addvar(VAR_FLAG, "powercom_sdcmd_byte_order_fallback", "Set to use legacy byte order for Powercom HID shutdown commands. Either it was wrong forever, or some older devices/firmwares had it the other way around"); + addvar(VAR_FLAG, "powercom_sdcmd_discrete_delay", + "Set to use discrete timing table for Powercom HID shutdown commands (Raptor and Smart KING Pro series)"); + #if !((defined SHUT_MODE) && SHUT_MODE) addvar(VAR_VALUE, "subdriver", "Explicit USB HID subdriver selection"); From 58b599c569579921436ef1af952ecafd2c597689 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Fri, 8 Aug 2025 10:47:53 +0200 Subject: [PATCH 008/805] tools/gitlog2version.sh: for development, set fallback NUT_VERSION_DEFAULT=2.8.4.1 Signed-off-by: Jim Klimov --- tools/gitlog2version.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/gitlog2version.sh b/tools/gitlog2version.sh index 92938424d2..ceafc5d6ff 100755 --- a/tools/gitlog2version.sh +++ b/tools/gitlog2version.sh @@ -131,7 +131,7 @@ if [ -z "${NUT_VERSION_DEFAULT-}" -a -s "${abs_top_srcdir}/VERSION_DEFAULT" ] ; fi # Fallback default, to be updated only during release cycle -[ -n "${NUT_VERSION_DEFAULT-}" ] || NUT_VERSION_DEFAULT='2.8.4' +[ -n "${NUT_VERSION_DEFAULT-}" ] || NUT_VERSION_DEFAULT='2.8.4.1' # Default website paths, extended for historic sub-sites for a release [ -n "${NUT_WEBSITE-}" ] || NUT_WEBSITE="https://www.networkupstools.org/" From 2982978db067567bd68d683f14e23035fe50e1bd Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Fri, 8 Aug 2025 10:50:44 +0200 Subject: [PATCH 009/805] Revert "NEWS.adoc, UPGRADING.adoc, docs/docinfo.xml.in: finalize text before NUT v2.8.4 release" This reverts commit 8f14140bbc395baa108bd06a9f664bd0a6f00bc8. Signed-off-by: Jim Klimov --- NEWS.adoc | 21 +++++++++++++++++++++ UPGRADING.adoc | 2 ++ docs/docinfo.xml.in | 2 -- 3 files changed, 23 insertions(+), 2 deletions(-) diff --git a/NEWS.adoc b/NEWS.adoc index 4e538bbf45..8cc53dea40 100644 --- a/NEWS.adoc +++ b/NEWS.adoc @@ -18,6 +18,27 @@ Release notes for NUT 2.8.4 - what's new since 2.8.3 https://github.com/networkupstools/nut/milestone/9 + - (expected) Dynamic Mapping Files (DMF) feature supported, to allow + the driver binaries to be built once and data mappings to be loaded + and modernized on the fly (porting from 42ITy project) + + - (expected) Porting of reference packaging from 42ITy project + + - (expected) Porting of patches suggested by different distribution packages + + - (expected) C code clean-up/consistency (string format security, work with + Boolean values, string to number conversions, etc. in the same manner) + + - (expected) clean-up of libusb API variants support [#300 and follow-ups] + + - (expected) CI automation for coding style + + - (expected) CI automation for driver flags and variables to be certainly + documented, handled in augeas lenses, nutconf classes, etc. + + - (expected) CI automation for use of data points in drivers that conform + to patterns defined in link:docs/nut-names.txt[] + - Bug fixes for fallout possible due to "fightwarn" effort in 2.8.0+: * In `usbhid-ups` sources, introduced optional `HU_FLAG_PARAM_REQUIRED` for `setvar()` or `instcmd()` handling (and a `HU_TYPE_CMD_PARAM_REQUIRED` diff --git a/UPGRADING.adoc b/UPGRADING.adoc index 1069297631..382fbf1cd7 100644 --- a/UPGRADING.adoc +++ b/UPGRADING.adoc @@ -24,6 +24,8 @@ command line, in order to quickly pick up any other removed option flags. Changes from 2.8.3 to 2.8.4 --------------------------- +- PLANNED: Keep track of any further API clean-up? + - Introduced handling (possibly rewriting) for man page section "Overviews, conventions, and miscellaneous" (commonly number 7), to deliver support for `man nut` queries (NUT overview manual page also created). diff --git a/docs/docinfo.xml.in b/docs/docinfo.xml.in index 2b3b7bef29..5cc0596519 100644 --- a/docs/docinfo.xml.in +++ b/docs/docinfo.xml.in @@ -4,7 +4,6 @@ --> - /a'"$NEWTAGS_SED" \ | tr '|' '\n' \ > "${DOCINFO_XML}.tmp" -diff -bu "${DOCINFO_XML}" "${DOCINFO_XML}.tmp" +OUTD="`diff -bu "${DOCINFO_XML}" "${DOCINFO_XML}.tmp" 2>/dev/null`" +if echo "$OUTD" | head -1 | ${EGREP} '^[-+]' >/dev/null ; then + echo "$OUTD" +else + diff "${DOCINFO_XML}" "${DOCINFO_XML}.tmp" +fi echo "Was the change acceptable? Press Y to modify the original '${DOCINFO_XML}' file [Y/N]" >&2 read LINE diff --git a/tools/driver-list-format.sh b/tools/driver-list-format.sh index 2ad3f8256a..72d8ec44b9 100755 --- a/tools/driver-list-format.sh +++ b/tools/driver-list-format.sh @@ -100,13 +100,21 @@ do # Ensure new content is applied mv -f "${TMPBUILD_PATH}/${drvfile}.tabbed" "${DRVLIST_PATH}/${drvfile}" fi - else # Checking - diff -u "${TMPBUILD_PATH}/${drvfile}.tabbed" "${DRVLIST_PATH}/${drvfile}" \ - || { GITACT="" - case "${drvfile}" in *.in) GITACT=" and commit the git change" ;; esac - echo "$0: ERROR: markup of '${DRVLIST_PATH}/${drvfile}' needs to be fixed: re-run this script without args${GITACT}, please" >&2 - RES=1 - } + else # Checking; also report the diff markup + OUTD="`diff -u "${TMPBUILD_PATH}/${drvfile}.tabbed" "${DRVLIST_PATH}/${drvfile}" 2>/dev/null`" || + if echo "$OUTD" | head -1 | ${EGREP} '^[-+]' >/dev/null ; then + true + else + OUTD="`diff "${TMPBUILD_PATH}/${drvfile}.tabbed" "${DRVLIST_PATH}/${drvfile}"`" + fi + + if test -n "${OUTD}" ; then + echo "$OUTD" + GITACT="" + case "${drvfile}" in *.in) GITACT=" and commit the git change" ;; esac + echo "$0: ERROR: markup of '${DRVLIST_PATH}/${drvfile}' needs to be fixed: re-run this script without args${GITACT}, please" >&2 + RES=1 + fi fi \ || RES=$? From d8f9bbe5bf107cc6410ea3c53ff497d32759b9d8 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Wed, 1 Oct 2025 18:21:56 +0200 Subject: [PATCH 197/805] tools/driver-list-format.sh: sed class [[:blank:]] is not portable [#3099] Signed-off-by: Jim Klimov --- tools/driver-list-format.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/driver-list-format.sh b/tools/driver-list-format.sh index 72d8ec44b9..48efc5cbc8 100755 --- a/tools/driver-list-format.sh +++ b/tools/driver-list-format.sh @@ -74,8 +74,8 @@ do # * if there is a trailing comment, make sure it is # also TAB-separated (from the presumed sixth field) sed \ - -e '/^#/!s/\"[[:blank:]]\+\"/\"\t\"/g' \ - -e '/^#/!s/[[:blank:]]*$//' \ + -e '/^#/!s/\"[ '"${TABCHAR}"']\+\"/\"\t\"/g' \ + -e '/^#/!s/[ '"${TABCHAR}"']*$//' \ -e '/^#/!s/\" \+\#/\"\t\#/' \ < "${DRVLIST_PATH}/${drvfile}" \ > "${TMPBUILD_PATH}/${drvfile}.tabbed" \ From a8955cd40c366f662f5cfc350b607dda2b5281cb Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Wed, 1 Oct 2025 18:33:38 +0000 Subject: [PATCH 198/805] tools/driver-list-format.sh: revise reaction to "diff" problems or successes [#3099] Signed-off-by: Jim Klimov --- tools/driver-list-format.sh | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/tools/driver-list-format.sh b/tools/driver-list-format.sh index 48efc5cbc8..9b6f9dc125 100755 --- a/tools/driver-list-format.sh +++ b/tools/driver-list-format.sh @@ -101,11 +101,19 @@ do mv -f "${TMPBUILD_PATH}/${drvfile}.tabbed" "${DRVLIST_PATH}/${drvfile}" fi else # Checking; also report the diff markup - OUTD="`diff -u "${TMPBUILD_PATH}/${drvfile}.tabbed" "${DRVLIST_PATH}/${drvfile}" 2>/dev/null`" || - if echo "$OUTD" | head -1 | ${EGREP} '^[-+]' >/dev/null ; then - true + if OUTD="`diff -u "${TMPBUILD_PATH}/${drvfile}.tabbed" "${DRVLIST_PATH}/${drvfile}" 2>/dev/null`" ; then + # Ok, no differences encountered + OUTD="" else - OUTD="`diff "${TMPBUILD_PATH}/${drvfile}.tabbed" "${DRVLIST_PATH}/${drvfile}"`" + # Either different contents, or "diff -u" does not work + if echo "$OUTD" | head -1 | ${EGREP} '^[-+]' >/dev/null ; then + true + else + if OUTD="`diff "${TMPBUILD_PATH}/${drvfile}.tabbed" "${DRVLIST_PATH}/${drvfile}"`" ; then + # Ok, no differences encountered + OUTD="" + fi + fi fi if test -n "${OUTD}" ; then From 6ec2485abc747a1dacc41f0cbbb8628631fb3d30 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Wed, 1 Oct 2025 21:53:24 +0200 Subject: [PATCH 199/805] ci_build.sh: fix GGREP detection [#3099] Signed-off-by: Jim Klimov --- ci_build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci_build.sh b/ci_build.sh index 752025b109..9dd2237de0 100755 --- a/ci_build.sh +++ b/ci_build.sh @@ -19,7 +19,7 @@ SCRIPT_ARGS=("$@") [ -n "${GREP}" ] || { GREP="`command -v grep`" && [ x"${GREP}" != x ] || { echo "$0: FAILED to locate GREP tool" >&2 ; exit 1 ; } ; export GREP ; } [ -n "${EGREP}" ] || { if ( [ x"`echo a | $GREP -E '(a|b)'`" = xa ] ) 2>/dev/null ; then EGREP="$GREP -E" ; else EGREP="`command -v egrep`" ; fi && [ x"${EGREP}" != x ] || { echo "$0: FAILED to locate EGREP tool" >&2 ; exit 1 ; } ; export EGREP ; } # Hoping for a GNU-style grep with -A/-B support here (for aid printouts; failing is not fatal): -[ -n "$GGREP" ] || { GREP="`command -v ggrep`" && [ x"${GREP}" != x ] || GGREP="${GREP}" ; } +[ -n "$GGREP" ] || { GGREP="`command -v ggrep`" && [ x"${GGREP}" != x ] || GGREP="${GREP}" ; } # Quick hijack for interactive development like this: # BUILD_TYPE=fightwarn-clang ./ci_build.sh From ee9ff632463a4f2de29f644de706f4cb039af2f0 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Wed, 1 Oct 2025 21:53:59 +0200 Subject: [PATCH 200/805] ci_build.sh: avoid "GREP -e", it is also not ubiquitous [#3099] Signed-off-by: Jim Klimov --- ci_build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci_build.sh b/ci_build.sh index 9dd2237de0..758b2a6958 100755 --- a/ci_build.sh +++ b/ci_build.sh @@ -249,7 +249,7 @@ ensure_CI_CCACHE_SYMLINKDIR_envvar() { if [ -z "${CI_CCACHE_SYMLINKDIR-}" ] ; then for D in `propose_CI_CCACHE_SYMLINKDIR` ; do if [ -d "$D" ] ; then - if ( ls -la "$D" | ${GREP} -e ' -> .*ccache' >/dev/null) \ + if ( ls -la "$D" | ${GREP} ' -> .*ccache' >/dev/null) \ || ( test -n "`find "$D" -maxdepth 1 -type f -exec ${GREP} -li ccache '{}' \;`" ) \ ; then CI_CCACHE_SYMLINKDIR="$D" && break From 8b038f41e4f9ec6e234865f380c77eca5d4138b8 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Wed, 1 Oct 2025 21:55:57 +0200 Subject: [PATCH 201/805] scripts/subdriver/gen-snmp-subdriver.sh: avoid "GREP -e", it is also not ubiquitous [#3099] Signed-off-by: Jim Klimov --- scripts/subdriver/gen-snmp-subdriver.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/subdriver/gen-snmp-subdriver.sh b/scripts/subdriver/gen-snmp-subdriver.sh index 511917388c..5863efc7aa 100755 --- a/scripts/subdriver/gen-snmp-subdriver.sh +++ b/scripts/subdriver/gen-snmp-subdriver.sh @@ -456,8 +456,8 @@ natural (upper- and lowercase) capitalization, e.g., 'Belkin', 'APC'." done # remove blank and "End of MIB" lines -${EGREP} -e "^[[:space:]]?$" -e "End of MIB" -v "${NUMWALKFILE}" > "${TMP_NUMWALKFILE}" -${EGREP} -e "^[[:space:]]?$" -e "End of MIB" -v "${STRWALKFILE}" > "${TMP_STRWALKFILE}" +${EGREP} "^[[:space:]]?$" | ${GREP} "End of MIB" | ${GREP} -v "${NUMWALKFILE}" > "${TMP_NUMWALKFILE}" +${EGREP} "^[[:space:]]?$" | ${GREP} "End of MIB" | ${GREP} -v "${STRWALKFILE}" > "${TMP_STRWALKFILE}" NUMWALKFILE="${TMP_NUMWALKFILE}" STRWALKFILE="${TMP_STRWALKFILE}" From dee65053c6270f50afb4f7a1698a987369c8cfdd Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Wed, 1 Oct 2025 21:57:43 +0200 Subject: [PATCH 202/805] scripts/subdriver/gen-snmp-subdriver.sh: avoid grep for char classes, it is also not ubiquitous [#3099] Signed-off-by: Jim Klimov --- scripts/subdriver/gen-snmp-subdriver.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/scripts/subdriver/gen-snmp-subdriver.sh b/scripts/subdriver/gen-snmp-subdriver.sh index 5863efc7aa..39483547b8 100755 --- a/scripts/subdriver/gen-snmp-subdriver.sh +++ b/scripts/subdriver/gen-snmp-subdriver.sh @@ -456,8 +456,9 @@ natural (upper- and lowercase) capitalization, e.g., 'Belkin', 'APC'." done # remove blank and "End of MIB" lines -${EGREP} "^[[:space:]]?$" | ${GREP} "End of MIB" | ${GREP} -v "${NUMWALKFILE}" > "${TMP_NUMWALKFILE}" -${EGREP} "^[[:space:]]?$" | ${GREP} "End of MIB" | ${GREP} -v "${STRWALKFILE}" > "${TMP_STRWALKFILE}" +TABCHAR="`printf '\t'`" +${EGREP} "^[ ${TABCHAR}]?\$" | ${GREP} "End of MIB" | ${GREP} -v "${NUMWALKFILE}" > "${TMP_NUMWALKFILE}" +${EGREP} "^[ ${TABCHAR}]?\$" | ${GREP} "End of MIB" | ${GREP} -v "${STRWALKFILE}" > "${TMP_STRWALKFILE}" NUMWALKFILE="${TMP_NUMWALKFILE}" STRWALKFILE="${TMP_STRWALKFILE}" From f24a8592cc4bfacb9a311d92cc86f175e8c64fb1 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Wed, 1 Oct 2025 22:07:58 +0200 Subject: [PATCH 203/805] scripts/subdriver/gen-snmp-subdriver.sh, scripts/subdriver/gen-usbhid-subdriver.sh: add a fallback mktemp implementation [#3099] Signed-off-by: Jim Klimov --- scripts/subdriver/gen-snmp-subdriver.sh | 13 +++++++++++++ scripts/subdriver/gen-usbhid-subdriver.sh | 13 +++++++++++++ 2 files changed, 26 insertions(+) diff --git a/scripts/subdriver/gen-snmp-subdriver.sh b/scripts/subdriver/gen-snmp-subdriver.sh index 39483547b8..8a8329bb7a 100755 --- a/scripts/subdriver/gen-snmp-subdriver.sh +++ b/scripts/subdriver/gen-snmp-subdriver.sh @@ -90,6 +90,19 @@ DEVICE_SYSOID="" SYSOID="" MODE=0 +if (command -v mktemp) >/dev/null ; then true ; else +# Have a simple (unsafe, unfeatured) fallback implementation: +mktemp() { + if [ x"$1" = x"-d" ] ; then + shift + mkdir -p "$1.$$" || return + else + cat /dev/null > "$1.$$" || return + fi + echo "$1.$$" +} +fi + # constants NAME=gen-snmp-subdriver TMPDIR="${TEMPDIR:-/tmp}" diff --git a/scripts/subdriver/gen-usbhid-subdriver.sh b/scripts/subdriver/gen-usbhid-subdriver.sh index db8ea0b0a2..4058525e68 100755 --- a/scripts/subdriver/gen-usbhid-subdriver.sh +++ b/scripts/subdriver/gen-usbhid-subdriver.sh @@ -65,6 +65,19 @@ if [ -z "$KEEP" ]; then trap cleanup EXIT fi +if (command -v mktemp) >/dev/null ; then true ; else +# Have a simple (unsafe, unfeatured) fallback implementation: +mktemp() { + if [ x"$1" = x"-d" ] ; then + shift + mkdir -p "$1.$$" || return + else + cat /dev/null > "$1.$$" || return + fi + echo "$1.$$" +} +fi + NAME=gen-usbhid-subdriver TMPDIR="${TEMPDIR:-/tmp}" DEBUG=`mktemp "$TMPDIR/$NAME-DEBUG.XXXXXX"` From ba8fd0353b4d194ab57927cf565b43da4ab37c68 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Wed, 1 Oct 2025 22:09:49 +0200 Subject: [PATCH 204/805] scripts/subdriver/gen-usbhid-subdriver.sh: quote calls to mktemp [#3099] Signed-off-by: Jim Klimov --- scripts/subdriver/gen-usbhid-subdriver.sh | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/scripts/subdriver/gen-usbhid-subdriver.sh b/scripts/subdriver/gen-usbhid-subdriver.sh index 4058525e68..2d0861492f 100755 --- a/scripts/subdriver/gen-usbhid-subdriver.sh +++ b/scripts/subdriver/gen-usbhid-subdriver.sh @@ -80,12 +80,12 @@ fi NAME=gen-usbhid-subdriver TMPDIR="${TEMPDIR:-/tmp}" -DEBUG=`mktemp "$TMPDIR/$NAME-DEBUG.XXXXXX"` -UTABLE=`mktemp "$TMPDIR/$NAME-UTABLE.XXXXXX"` -USAGES=`mktemp "$TMPDIR/$NAME-USAGES.XXXXXX"` -SUBST=`mktemp "$TMPDIR/$NAME-SUBST.XXXXXX"` -SEDFILE=`mktemp "$TMPDIR/$NAME-SEDFILE.XXXXXX"` -NEWUTABLE=`mktemp "$TMPDIR/$NAME-NEWUTABLE.XXXXXX"` +DEBUG="`mktemp "$TMPDIR/$NAME-DEBUG.XXXXXX"`" +UTABLE="`mktemp "$TMPDIR/$NAME-UTABLE.XXXXXX"`" +USAGES="`mktemp "$TMPDIR/$NAME-USAGES.XXXXXX"`" +SUBST="`mktemp "$TMPDIR/$NAME-SUBST.XXXXXX"`" +SEDFILE="`mktemp "$TMPDIR/$NAME-SEDFILE.XXXXXX"`" +NEWUTABLE="`mktemp "$TMPDIR/$NAME-NEWUTABLE.XXXXXX"`" # save standard input to a file if [ -z "$FILE" ]; then From 8658f623a52020d30bb2ae98b87b2fecf3b727bd Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Wed, 1 Oct 2025 22:17:54 +0200 Subject: [PATCH 205/805] configure.ac, m4/ax_realpath.m4: introduce a fallback "mktemp" [#3099] Signed-off-by: Jim Klimov --- configure.ac | 25 ++++++++++++++++++++----- m4/ax_realpath.m4 | 2 +- 2 files changed, 21 insertions(+), 6 deletions(-) diff --git a/configure.ac b/configure.ac index 749d4e7322..3ff098a667 100644 --- a/configure.ac +++ b/configure.ac @@ -135,6 +135,21 @@ AC_MSG_RESULT([${CONFIG_FLAGS}]) AC_DEFINE_UNQUOTED([CONFIG_FLAGS],["${CONFIG_FLAGS}"],[Flags passed to configure script]) AC_SUBST(CONFIG_FLAGS) +AC_CHECK_PROGS([MKTEMP], [mktemp], []) +AS_IF([test x"${MKTEMP}" = x], [ +dnl # Have a simple (unsafe, unfeatured) fallback implementation: +mktemp() { + if test x"$1" = x"-d" ; then + shift + mkdir -p "$1.$$" || return + else + cat /dev/null > "$1.$$" || return + fi + echo "$1.$$" +} +MKTEMP=mktemp +]) + AC_CONFIG_AUX_DIR([.]) AC_CONFIG_SRCDIR(server/upsd.c) AC_CONFIG_MACRO_DIR([m4]) @@ -1659,8 +1674,8 @@ if test "$as_ln_s" = "ln -s" ; then unset _abs_srcdir _abs_builddir dnl Explore GNU ln (or compatible) with relative symlink support - DIR1="$(mktemp -d "dir1.XXXXXXX")" && \ - DIR2="$(mktemp -d "dir2.XXXXXXX")" && \ + DIR1="$(${MKTEMP} -d "dir1.XXXXXXX")" && \ + DIR2="$(${MKTEMP} -d "dir2.XXXXXXX")" && \ touch "${DIR1}/a" && \ $as_ln_s -r "${DIR1}/a" "${DIR2}/b" && \ ls -la "${DIR2}/b" | ${GREP} '\.\./' > /dev/null && \ @@ -3682,7 +3697,7 @@ if test -z "${abs_srcdir}" ; then *) abs_srcdir="$(cd "${srcdir}" && pwd)" || AC_MSG_ERROR([Can not detect 'srcdir']) ;; esac fi -DOCTESTDIR="$(mktemp -d configure-test.docbuild.$$.XXXXXXX)" && \ +DOCTESTDIR="$(${MKTEMP} -d configure-test.docbuild.$$.XXXXXXX)" && \ DOCTESTDIR="$(cd "$DOCTESTDIR" && pwd)" dnl NOTE: We perform some of these checks/infos also if docs=(man=)skip @@ -5008,7 +5023,7 @@ dnl Relevant since 2023: https://github.com/systemd/systemd/pull/25916 SYSTEMD_SUPPORTS_DAEMON_TYPE_NOTIFY=no AS_IF([test -x "$SYSTEMD_ANALYZE_PROGRAM"], [ AC_MSG_CHECKING([if your systemd version supports Type=notify]) - myFILE="`mktemp systemd-analyze-XXXXXX.service`" + myFILE="`${MKTEMP} systemd-analyze-XXXXXX.service`" cat > "$myFILE" << EOF @<:@Unit@:>@ Description=temp @@ -5030,7 +5045,7 @@ EOF SYSTEMD_SUPPORTS_DAEMON_TYPE_NOTIFY_RELOAD=no AS_IF([test -x "$SYSTEMD_ANALYZE_PROGRAM"], [ AC_MSG_CHECKING([if your systemd version supports Type=notify-reload]) - myFILE="`mktemp systemd-analyze-XXXXXX.service`" + myFILE="`${MKTEMP} systemd-analyze-XXXXXX.service`" cat > "$myFILE" << EOF @<:@Unit@:>@ Description=temp diff --git a/m4/ax_realpath.m4 b/m4/ax_realpath.m4 index d84f79795f..6d0bc0f807 100644 --- a/m4/ax_realpath.m4 +++ b/m4/ax_realpath.m4 @@ -174,7 +174,7 @@ AC_DEFUN([UNITTEST_AX_REALPATH], [ AC_MSG_NOTICE([======= starting UNITTEST for REALPATH macro]) AC_MSG_NOTICE([=== Testing macro for realpath; .../q/x are directories, qwe is a file inside, and .../Q is a symlink to .../q]) - TESTDIR="`mktemp -d`" && test -d "$TESTDIR" && test -w "$TESTDIR" || TESTDIR="/tmp" + TESTDIR="`${MKTEMP} -d`" && test -d "$TESTDIR" && test -w "$TESTDIR" || TESTDIR="/tmp" rm -rf "$TESTDIR"/q ; mkdir -p "$TESTDIR"/q/x ; echo qwe > "$TESTDIR"/q/x/qwe ; ln -fs q "$TESTDIR"/Q dnl Do not quote TESTDIR in macro calls below, shell quotes are added in implem AC_MSG_NOTICE([=======]) From c5c54df47d66175047ba5576ef69b3d46aaf5dca Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Wed, 1 Oct 2025 22:42:53 +0200 Subject: [PATCH 206/805] ci_build.sh, scripts/subdriver/gen-snmp-subdriver.sh, scripts/subdriver/gen-usbhid-subdriver.sh: add a fallback TOUPPER/TOLOWER implementation [#3099] Signed-off-by: Jim Klimov --- ci_build.sh | 12 ++++++++++-- scripts/subdriver/gen-snmp-subdriver.sh | 21 +++++++++++++++++++-- scripts/subdriver/gen-usbhid-subdriver.sh | 23 ++++++++++++++++++++--- 3 files changed, 49 insertions(+), 7 deletions(-) diff --git a/ci_build.sh b/ci_build.sh index 758b2a6958..e604039cf8 100755 --- a/ci_build.sh +++ b/ci_build.sh @@ -182,6 +182,14 @@ case "${CI_BUILDDIR-}" in ;; esac +TOLOWER="cat" +for TR_VARIANT in "tr 'A-Z' 'a-z'" "tr '[:upper:]' '[:lower:]'" "tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'" ; do + if [ x"`echo C | $TR_VARIANT`" = xc ] ; then + TOLOWER="$TR_VARIANT" + break + fi +done + # Just in case we get blanks from CI - consider them as not-set: if [ -z "`echo "${MAKE-}" | tr -d ' '`" ] ; then if [ "$1" = spellcheck -o "$1" = spellcheck-interactive -o "$1" = spellcheck-quick -o "$1" = spellcheck-interactive-quick ] \ @@ -694,7 +702,7 @@ if [ -z "$CI_OS_NAME" ]; then [ -z "$CI_OS_HINT" -o "$CI_OS_HINT" = "-" ] || break done - case "`echo "$CI_OS_HINT" | tr 'A-Z' 'a-z'`" in + case "`echo "$CI_OS_HINT" | $TOLOWER`" in *freebsd*) CI_OS_NAME="freebsd" ;; *openbsd*) @@ -858,7 +866,7 @@ detect_platform_PKG_CONFIG_PATH_and_FLAGS() { # then, including a PKG_CONFIG_PATH), where a "-" value leaves it empty. SYS_PKG_CONFIG_PATH="" # Let the OS guess... usually BUILTIN_PKG_CONFIG_PATH="`pkg-config --variable pc_path pkg-config`" || BUILTIN_PKG_CONFIG_PATH="" - case "`echo "$CI_OS_NAME" | tr 'A-Z' 'a-z'`" in + case "`echo "$CI_OS_NAME" | $TOLOWER`" in *openindiana*|*omnios*|*solaris*|*illumos*|*sunos*) _ARCHES="${ARCH-}" _BITS="${BITS-}" diff --git a/scripts/subdriver/gen-snmp-subdriver.sh b/scripts/subdriver/gen-snmp-subdriver.sh index 8a8329bb7a..e07c8301c1 100755 --- a/scripts/subdriver/gen-snmp-subdriver.sh +++ b/scripts/subdriver/gen-snmp-subdriver.sh @@ -113,6 +113,23 @@ DFL_STRWALKFILE="`mktemp "$TMPDIR/$NAME-STRWALK.XXXXXX"`" TMP_NUMWALKFILE="`mktemp "$TMPDIR/$NAME-TMP-NUMWALK.XXXXXX"`" TMP_STRWALKFILE="`mktemp "$TMPDIR/$NAME-TMP-STRWALK.XXXXXX"`" +# Platforms vary with tooling abilitites... +TOLOWER="cat" +for TR_VARIANT in "tr 'A-Z' 'a-z'" "tr '[:upper:]' '[:lower:]'" "tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'" ; do + if [ x"`echo C | $TR_VARIANT`" = xc ] ; then + TOLOWER="$TR_VARIANT" + break + fi +done + +TOUPPER="cat" +for TR_VARIANT in "tr 'a-z' 'A-Z'" "tr '[:lower:]' '[:upper:]'" "tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'" ; do + if [ x"`echo c | $TR_VARIANT`" = xC ] ; then + TOUPPER="$TR_VARIANT" + break + fi +done + get_snmp_data() { # 1) get the sysOID (points the mfr specif MIB), apart if there's an override if [ -z "$SYSOID" ] @@ -149,8 +166,8 @@ get_snmp_data() { generate_C() { # create file names, lowercase - LDRIVER="`echo "$DRIVER" | tr A-Z a-z`" - UDRIVER="`echo "$DRIVER" | tr a-z A-Z`" + LDRIVER="`echo "$DRIVER" | $TOLOWER`" + UDRIVER="`echo "$DRIVER" | $TOUPPER`" # keep dashes in name for files CFILE="$LDRIVER-mib.c" HFILE="$LDRIVER-mib.h" diff --git a/scripts/subdriver/gen-usbhid-subdriver.sh b/scripts/subdriver/gen-usbhid-subdriver.sh index 2d0861492f..0e4bd0ec01 100755 --- a/scripts/subdriver/gen-usbhid-subdriver.sh +++ b/scripts/subdriver/gen-usbhid-subdriver.sh @@ -117,8 +117,25 @@ if [ -z "$PRODUCTID" ]; then read -p "Product ID: " PRODUCTID < /dev/tty fi -LDRIVER=`echo $DRIVER | tr A-Z a-z` -UDRIVER=`echo $DRIVER | tr a-z A-Z` +# Platforms vary with tooling abilitites... +TOLOWER="cat" +for TR_VARIANT in "tr 'A-Z' 'a-z'" "tr '[:upper:]' '[:lower:]'" "tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'" ; do + if [ x"`echo C | $TR_VARIANT`" = xc ] ; then + TOLOWER="$TR_VARIANT" + break + fi +done + +TOUPPER="cat" +for TR_VARIANT in "tr 'a-z' 'A-Z'" "tr '[:lower:]' '[:upper:]'" "tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'" ; do + if [ x"`echo c | $TR_VARIANT`" = xC ] ; then + TOUPPER="$TR_VARIANT" + break + fi +done + +LDRIVER="`echo $DRIVER | $TOLOWER`" +UDRIVER="`echo $DRIVER | $TOUPPER`" CFILE="$LDRIVER-hid.c" HFILE="$LDRIVER-hid.h" @@ -263,7 +280,7 @@ static hid_info_t ${LDRIVER}_hid2nut[] = { EOF cat "$NEWUTABLE" | sort -u | while read U; do - UL=`echo $U | tr A-Z a-z` + UL="`echo $U | $TOLOWER`" cat >> "$CFILE" < Date: Wed, 1 Oct 2025 22:47:38 +0200 Subject: [PATCH 207/805] scripts/python/Makefile.am: add a fallback TOUPPER/TOLOWER implementation [#3099] Signed-off-by: Jim Klimov --- scripts/python/Makefile.am | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/scripts/python/Makefile.am b/scripts/python/Makefile.am index 56e9abb2ec..a62380bf29 100644 --- a/scripts/python/Makefile.am +++ b/scripts/python/Makefile.am @@ -97,14 +97,24 @@ NUT_MONITOR_COMMON_TEMPLATE = \ app/locale/it/it.po \ app/locale/ru/ru.po +# Platforms vary with tooling abilitites... +DEF_TOUPPER = { TOUPPER="cat" ; \ +for TR_VARIANT in "tr 'a-z' 'A-Z'" "tr '[:lower:]' '[:upper:]'" "tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'" ; do \ + if [ x"`echo c | $${TR_VARIANT}`" = xC ] ; then \ + TOUPPER="$${TR_VARIANT}" ; \ + break ; \ + fi ; \ +done ; \ +} # Craft locale subdirs with "xx_YY.UTF-8" patterned names, # and similarly alias the "*.po" files inside, as needed # by some platforms but not others to find these files. install-data-hook-app-locale-symlinks: - @cd "$(DESTDIR)$(nutmonitordir)/app/locale" && \ + @cd "$(DESTDIR)$(nutmonitordir)/app/locale" || exit ; \ + $(DEF_TOUPPER) ; \ for L in fr it ru ; do \ - UTF8_NAME="$$L"_"`echo "$$L" | tr '[a-z]' '[A-Z]'`".UTF-8 || exit ; \ + UTF8_NAME="$$L"_"`echo "$$L" | $${TOUPPER}`".UTF-8 || exit ; \ UTF8_POFILE="$${L}/$${UTF8_NAME}.po" || exit ; \ UTF8_SUBDIR="$${UTF8_NAME}" || exit ; \ rm -f "$${UTF8_POFILE}" || true ; rm -f "$${UTF8_SUBDIR}" || true ; \ @@ -114,9 +124,10 @@ install-data-hook-app-locale-symlinks: uninstall-hook-app-locale-symlinks: @RES=0 ; \ - cd "$(DESTDIR)$(nutmonitordir)/app/locale" && \ + cd "$(DESTDIR)$(nutmonitordir)/app/locale" || exit ; \ + $(DEF_TOUPPER) ; \ for L in fr it ru ; do \ - UTF8_NAME="$$L"_"`echo "$$L" | tr '[a-z]' '[A-Z]'`".UTF-8 || exit ; \ + UTF8_NAME="$$L"_"`echo "$$L" | $${TOUPPER}`".UTF-8 || exit ; \ UTF8_POFILE="$${L}/$${UTF8_NAME}.po" || exit ; \ UTF8_SUBDIR="$${UTF8_NAME}" || exit ; \ rm -f "$${UTF8_POFILE}" || RES=$$? ; \ From 330220c924fb6188c804a3448a95b449c06987a3 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Wed, 1 Oct 2025 23:01:04 +0200 Subject: [PATCH 208/805] ci_build.sh: work around lack of "find -maxdepth" [#3099] Signed-off-by: Jim Klimov --- ci_build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci_build.sh b/ci_build.sh index e604039cf8..2f9c8e5ff1 100755 --- a/ci_build.sh +++ b/ci_build.sh @@ -258,7 +258,7 @@ ensure_CI_CCACHE_SYMLINKDIR_envvar() { for D in `propose_CI_CCACHE_SYMLINKDIR` ; do if [ -d "$D" ] ; then if ( ls -la "$D" | ${GREP} ' -> .*ccache' >/dev/null) \ - || ( test -n "`find "$D" -maxdepth 1 -type f -exec ${GREP} -li ccache '{}' \;`" ) \ + || ( cd "$D" && test -n "`find . -type f | sed 's,^\./,,' | ${GREP} -v / | while read F ; do ${GREP} -li ccache $F ; done`" ) \ ; then CI_CCACHE_SYMLINKDIR="$D" && break else From 5b91be778a7c7fff42da3292d04076ffd932e644 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Wed, 1 Oct 2025 23:01:42 +0200 Subject: [PATCH 209/805] ci_build.sh: work around NCPUS prefixed with white-space [#3099] Signed-off-by: Jim Klimov --- ci_build.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/ci_build.sh b/ci_build.sh index 2f9c8e5ff1..a833f9a222 100755 --- a/ci_build.sh +++ b/ci_build.sh @@ -552,6 +552,7 @@ esac NCPUS="`cat /proc/cpuinfo | ${GREP} -wc processor`" || \ { [ -x /usr/sbin/psrinfo ] && NCPUS="`/usr/sbin/psrinfo | wc -l`"; } \ || NCPUS=1; } 2>/dev/null +[ x"$NCPUS" = x ] || NCPUS="`echo "$NCPUS" | tr -d ' '`" [ x"$NCPUS" != x -a "$NCPUS" -ge 1 ] || NCPUS=1 [ x"$NPARMAKES" = x ] && { NPARMAKES="`expr "$NCPUS" '*' 2`" || NPARMAKES=2; } From 30bb844eed232bd1553c808e72c721db302993f4 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Wed, 1 Oct 2025 23:04:49 +0200 Subject: [PATCH 210/805] ci_build.sh: detect_platform_PKG_CONFIG_PATH_and_FLAGS(): fix use of PKG_CONFIG variable [#3099] Signed-off-by: Jim Klimov --- ci_build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci_build.sh b/ci_build.sh index a833f9a222..b23de73e1b 100755 --- a/ci_build.sh +++ b/ci_build.sh @@ -866,7 +866,7 @@ detect_platform_PKG_CONFIG_PATH_and_FLAGS() { # Caller can override by OVERRIDE_PKG_CONFIG_PATH (ignore other values # then, including a PKG_CONFIG_PATH), where a "-" value leaves it empty. SYS_PKG_CONFIG_PATH="" # Let the OS guess... usually - BUILTIN_PKG_CONFIG_PATH="`pkg-config --variable pc_path pkg-config`" || BUILTIN_PKG_CONFIG_PATH="" + BUILTIN_PKG_CONFIG_PATH="`$PKG_CONFIG --variable pc_path pkg-config`" || BUILTIN_PKG_CONFIG_PATH="" case "`echo "$CI_OS_NAME" | $TOLOWER`" in *openindiana*|*omnios*|*solaris*|*illumos*|*sunos*) _ARCHES="${ARCH-}" From 4b661d8cd83ee92ceee0528d45e7e3853a8090eb Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Wed, 1 Oct 2025 23:38:02 +0200 Subject: [PATCH 211/805] Makefile.am: work around lack of "id -u" [#3099] Signed-off-by: Jim Klimov --- Makefile.am | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Makefile.am b/Makefile.am index 669591d910..ec5bc68c3c 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1083,7 +1083,7 @@ install-data-hook: @case "@target_os@" in *mingw*) exit 0;; esac ; \ if [ x"@host_os@" != x"@build_os@" ]; then exit 0 ; fi ; \ if [ x"@target_os@" != x"@build_os@" ]; then exit 0 ; fi ; \ - if (command -v id) && [ x"`id -u`" = x0 ] && [ x"$(DESTDIR)" = x -o x"$(DESTDIR)" = x/ ] ; then \ + if (command -v id) && ( [ x"`id -u 2>/dev/null`" = x0 ] || [ x"`id | sed -e 's,(.*$$,,' -e 's,^.*uid=,,'`" = x0 ] ) && [ x"$(DESTDIR)" = x -o x"$(DESTDIR)" = x/ ] ; then \ echo "================================================================================" >&2 ; \ echo "| NUT data files have been installed into the system, now consider running |" >&2 ; \ echo "| '(sudo) make install-as-root' to apply permissions and service state changes |" >&2 ; \ @@ -1135,7 +1135,7 @@ install-as-root: case "@target_os@" in *mingw*) echo "$@: SKIP: not supported for this target_os='@target_os@'" >&2 ; exit 0;; esac ; \ if [ x"@host_os@" != x"@build_os@" ]; then echo "$@: SKIP: build_os='@build_os@' is not host_os='@host_os@'" >&2 ; exit 0 ; fi ; \ if [ x"@target_os@" != x"@build_os@" ]; then echo "$@: SKIP: build_os='@build_os@' is not target_os='@target_os@'" >&2 ; exit 0 ; fi ; \ - if (command -v id) && [ x"`id -u`" = x0 ] ; then \ + if (command -v id) && ( [ x"`id -u 2>/dev/null`" = x0 ] || [ x"`id | sed -e 's,(.*$$,,' -e 's,^.*uid=,,'`" = x0 ] ) ; then \ echo "$@: we seem to be root, PROCEEDING" >&2 ; \ else \ echo "$@: SKIP: we seem to NOT be root" >&2 ; \ @@ -1212,7 +1212,7 @@ install-as-root: else \ echo "$@: WARNING: Can not CHMOD created locations!" >&2 ; \ fi ; \ - if (command -v chown) && test 0 -lt "`id -u '@RUN_AS_USER@'`" \ + if (command -v chown) && ( test 0 -lt "`id -u '@RUN_AS_USER@' 2>/dev/null`" || test 0 -lt "`id '@RUN_AS_USER@' | sed -e 's,(.*$$,,' -e 's,^.*uid=,,'`" ] ) \ && ( test 0 -lt "`getent group '@RUN_AS_GROUP@' | awk -F: '{print $$3}'`" || test 0 -lt "`id -g '@RUN_AS_GROUP@'`" ) \ ; then \ echo " CHOWN(@RUN_AS_USER@:@RUN_AS_GROUP@) $(DESTDIR)/@STATEPATH@/upssched" >&2 ; \ From 70f396d060e9135d16534286b5fc8e6e733bfa2d Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Thu, 2 Oct 2025 17:31:10 +0200 Subject: [PATCH 212/805] upssched: introduce passing of NOTIFYMSG to CMDSCRIPT [#3105] Signed-off-by: Jim Klimov --- NEWS.adoc | 3 + clients/upssched-cmd | 4 +- clients/upssched.c | 172 +++++++++++++++++++++++++++-------- conf/upssched.conf.sample.in | 11 ++- docs/man/upssched.conf.txt | 10 +- docs/man/upssched.txt | 14 ++- scripts/misc/notifyme-debug | 2 +- 7 files changed, 165 insertions(+), 51 deletions(-) diff --git a/NEWS.adoc b/NEWS.adoc index d62589886f..a9d8b34bae 100644 --- a/NEWS.adoc +++ b/NEWS.adoc @@ -120,6 +120,9 @@ https://github.com/networkupstools/nut/milestone/12 * Introduced `upssched -l` mode to list currently tracked timers. [#3097] * Make use of `setproctag()` and `getproctag()` to report parent/child process names. [#3084] + * Introduced optional passing of `NOTIFYMSG` text (normally originating + from `upsmon` which calls `upssched`) as an environment variable into + the ultimately executed `CMDSCRIPT` processes. [#3105] - `configure` script options: * Introduced `--with-python{,2,3}-modules-dir` to specify PyNUT(Client) diff --git a/clients/upssched-cmd b/clients/upssched-cmd index 160f50584c..59ad5236d3 100755 --- a/clients/upssched-cmd +++ b/clients/upssched-cmd @@ -17,8 +17,8 @@ echo "`date -u`: $0: THIS IS A SAMPLE SCRIPT, PLEASE TAILOR IT FOR YOUR DEPLOYMENT OF NUT!" >&2 logger -t upssched-cmd "THIS IS A SAMPLE SCRIPT, PLEASE TAILOR IT FOR YOUR DEPLOYMENT OF NUT!" -printf "`date -u`: UPSNAME='%s'\tNOTIFYTYPE='%s'\targs=%s\n" "$UPSNAME" "$NOTIFYTYPE" "$@" >&2 -printf "UPSNAME='%s' NOTIFYTYPE='%s' args=%s\n" "$UPSNAME" "$NOTIFYTYPE" "$@" | logger -t upssched-cmd-received-NOTIFYTYPE +printf "`date -u`: UPSNAME='%s'\tNOTIFYTYPE='%s'\tNOTIFYMSG='%s'\targs=%s\n" "$UPSNAME" "$NOTIFYTYPE" "$NOTIFYMSG" "$*" >&2 +printf "UPSNAME='%s' NOTIFYTYPE='%s' NOTIFYMSG='%s' args=%s\n" "$UPSNAME" "$NOTIFYTYPE" "$NOTIFYMSG" "$*" | logger -t upssched-cmd-received-NOTIFYTYPE #set diff --git a/clients/upssched.c b/clients/upssched.c index d458315e22..bcef61b7f0 100644 --- a/clients/upssched.c +++ b/clients/upssched.c @@ -28,6 +28,8 @@ /* design notes for the curious: * * 1. we get called with a ups_name and notify_type from upsmon + * (and notify_msg via first non-option argv[] element if + * present and not trivial) * 2. the config file is searched for an AT condition that matches * 3. the conditions on any matching lines are parsed * @@ -73,6 +75,7 @@ typedef struct ttype_s { time_t etime; char **upsnames; /* List of unique UPSNAME values that commanded to start this timer name */ char **notifytypes; /* List of unique NOTIFYTYPE values that commanded to start this timer name */ + char **notifymsgs; /* List of unique NOTIFYMSG values that commanded to start this timer name */ struct ttype_s *next; } ttype_t; @@ -83,7 +86,7 @@ static int nut_debug_level_args = 0, nut_debug_level_env = 0, nut_debug_level_co static int list_timers = 0; /* ups name and notify type (string) as received from upsmon */ -static const char *ups_name, *notify_type, *prog = NULL; +static const char *ups_name = NULL, *notify_type = NULL, *notify_msg = NULL, *prog = NULL; #ifdef WIN32 static OVERLAPPED connect_overlapped; @@ -221,8 +224,8 @@ static char* collect_string(char **string_arr, char *logtag, char *sep, size_t * static void exec_cmd_timer(ttype_t *item) { - char *upsnames = NULL, *notifytypes = NULL; - size_t upsnames_count = 0, notifytypes_count = 0; + char *upsnames = NULL, *notifytypes = NULL, *notifymsgs = NULL; + size_t upsnames_count = 0, notifytypes_count = 0, notifymsgs_count = 0; if (!item || !item->name || !(*(item->name))) { upsdebugx(1, "%s: SKIP bad call with null arg or its command name", __func__); @@ -238,15 +241,22 @@ static void exec_cmd_timer(ttype_t *item) notifytypes = collect_string(item->notifytypes, "NOTIFYTYPE", ",", NULL, ¬ifytypes_count); } + if (item->notifymsgs && *(item->notifymsgs) && **(item->notifymsgs)) { + notifymsgs = collect_string(item->notifymsgs, "NOTIFYMSG", ".\t", NULL, ¬ifymsgs_count); + } + if (upsnames) setenv("UPSNAME", upsnames, 1); if (notifytypes) setenv("NOTIFYTYPE", notifytypes, 1); + if (notifymsgs) + setenv("NOTIFYMSG", notifymsgs, 1); + if (nut_debug_level) - upslogx(LOG_INFO, "Executing command by timer: %s\t[%s]\t[%s]", - item->name, NUT_STRARG(notifytypes), NUT_STRARG(upsnames)); + upslogx(LOG_INFO, "Executing command by timer: %s\t[%s]\t[%s]\t[%s]", + item->name, NUT_STRARG(notifytypes), NUT_STRARG(upsnames), NUT_STRARG(notifymsgs)); exec_cmd(item->name); upsdebugx(3, "%s: returned from exec_cmd()", __func__); @@ -261,6 +271,11 @@ static void exec_cmd_timer(ttype_t *item) free(notifytypes); } + if (notifymsgs) { + unsetenv("NOTIFYMSG"); + free(notifymsgs); + } + upsdebugx(3, "%s: done", __func__); } @@ -295,6 +310,14 @@ static void removetimer(ttype_t *tfind) free(tmp->notifytypes); } + if (tmp->notifymsgs) { + char **ps; + for (ps = tmp->notifymsgs; ps != NULL && *ps != NULL; ps++) { + free(*ps); + } + free(tmp->notifymsgs); + } + upsdebugx(3, "%s: forgetting %s", __func__, tmp->name); free(tmp->name); free(tmp); @@ -367,7 +390,7 @@ static void checktimers(void) upsdebugx(3, "%s: done", __func__); } -static void start_timer(const char *name, const char *ofsstr, const char *notifytype, const char *upsname, int shared_timer) +static void start_timer(const char *name, const char *ofsstr, const char *notifytype, const char *upsname, const char *notifymsg, int shared_timer) { time_t now; long ofs; @@ -393,8 +416,8 @@ static void start_timer(const char *name, const char *ofsstr, const char *notify while (tmp) { if (tmp->name && !strcmp(tmp->name, name)) { if (nut_debug_level) - upslogx(LOG_INFO, "Append data to shared timer: %s\t[%s]\t[%s]\t(will elapse in %g seconds)", - name, NUT_STRARG(notifytype), NUT_STRARG(upsname), + upslogx(LOG_INFO, "Append data to shared timer: %s\t[%s]\t[%s]\t[%s]\t(will elapse in %g seconds)", + name, NUT_STRARG(notifytype), NUT_STRARG(upsname), NUT_STRARG(notifymsg), difftime(tmp->etime, now)); /* FIXME? Consider only the first hit as the shared timer? @@ -423,6 +446,29 @@ static void start_timer(const char *name, const char *ofsstr, const char *notify } } + if (notifymsg && *notifymsg) { + if (tmp->notifymsgs) { + char **ps = NULL; + size_t count = 0; /* amount of non-NULL entries, if we get to the end */ + + for (ps = tmp->notifymsgs; ps != NULL && *ps != NULL ; ps++) { + count++; + if (!strcmp(*ps, notifymsg)) + break; + } + + if (ps == NULL || *ps == NULL) { + tmp->notifymsgs = xrealloc(tmp->notifymsgs, count + 2); + tmp->notifymsgs[count] = xstrdup(notifymsg); + tmp->notifymsgs[count + 1] = NULL; + } + } else { + tmp->notifymsgs = xcalloc(2, sizeof(char*)); + tmp->notifymsgs[0] = xstrdup(notifymsg); + tmp->notifymsgs[1] = NULL; + } + } + if (upsname && *upsname) { if (tmp->upsnames) { char **ps = NULL; @@ -456,8 +502,8 @@ static void start_timer(const char *name, const char *ofsstr, const char *notify } if (nut_debug_level) - upslogx(LOG_INFO, "New timer: %s\t[%s]\t[%s]\t(will elapse in %ld seconds)", - name, NUT_STRARG(notifytype), NUT_STRARG(upsname), ofs); + upslogx(LOG_INFO, "New timer: %s\t[%s]\t[%s]\t[%s]\t(will elapse in %ld seconds)", + name, NUT_STRARG(notifytype), NUT_STRARG(upsname), NUT_STRARG(notifymsg), ofs); /* now add to the queue */ if (!shared_timer) { @@ -473,6 +519,7 @@ static void start_timer(const char *name, const char *ofsstr, const char *notify tmp->name = xstrdup(name); tmp->etime = now + ofs; tmp->notifytypes = NULL; + tmp->notifymsgs = NULL; tmp->upsnames = NULL; tmp->next = NULL; @@ -482,6 +529,12 @@ static void start_timer(const char *name, const char *ofsstr, const char *notify tmp->notifytypes[1] = NULL; } + if (notifymsg && *notifymsg) { + tmp->notifymsgs = xcalloc(2, sizeof(char*)); + tmp->notifymsgs[0] = xstrdup(notifymsg); + tmp->notifymsgs[1] = NULL; + } + if (upsname && *upsname) { tmp->upsnames = xcalloc(2, sizeof(char*)); tmp->upsnames[0] = xstrdup(upsname); @@ -494,7 +547,7 @@ static void start_timer(const char *name, const char *ofsstr, const char *notify thead = tmp; } -static void cancel_timer(const char *name, const char *cname, const char *notifytype, const char *upsname, int do_cancel_matched) +static void cancel_timer(const char *name, const char *cname, const char *notifytype, const char *upsname, const char *notifymsg, int do_cancel_matched) { ttype_t *tmp; size_t removed = 0; @@ -505,6 +558,7 @@ static void cancel_timer(const char *name, const char *cname, const char *notify for (tmp = thead; tmp != NULL; tmp = tmp->next) { if (!strcmp(tmp->name, name)) { /* match */ + /* Note we do not match "notifymsg" as it likely differs */ if (!do_cancel_matched || ( (!notifytype || !(*notifytype)) && (!upsname || !(*upsname)) ) @@ -553,8 +607,13 @@ static void cancel_timer(const char *name, const char *cname, const char *notify } } - if (nut_debug_level) - upslogx(LOG_INFO, "Cancelling timer: %s", name); + if (nut_debug_level) { + if (notifymsg && *notifymsg) { + upslogx(LOG_INFO, "Cancelling timer: %s: %s", name, notifymsg); + } else { + upslogx(LOG_INFO, "Cancelling timer: %s", name); + } + } removetimer(tmp); removed++; @@ -969,7 +1028,7 @@ static int sock_arg(conn_t *conn) /* LIST-TIMERS (no args expected now) * returns a list with tab-separated values for: - * NAME TO_ABS TO_REL NOTIFYTYPES UPSNAMES + * NAME TO_ABS TO_REL NOTIFYTYPES UPSNAMES NOTIFYMSGS_TABSEP */ if (!strcmp(conn->ctx.arglist[0], "LIST-TIMERS")) { ttype_t *item = thead; @@ -1003,6 +1062,20 @@ static int sock_arg(conn_t *conn) s = collect_string(item->upsnames, "UPSNAME", ",", NULL, NULL); } + if (s && *s) { + send_to_one(conn, "%s\t", s); + } else { + send_to_one(conn, "\"\"\t"); + } + if (s) { + free(s); + } + + s = NULL; + if (item->notifymsgs && *(item->notifymsgs) && **(item->notifymsgs)) { + s = collect_string(item->notifymsgs, "NOTIFYMSG", ".\t", NULL, NULL); + } + if (s && *s) { send_to_one(conn, "%s\n", s); } else { @@ -1020,7 +1093,7 @@ static int sock_arg(conn_t *conn) return 1; } - /* CANCEL [] [ [] [ ] */ { /* scoping */ int do_cancel = !strcmp(conn->ctx.arglist[0], "CANCEL"), do_cancel_matched = !strcmp(conn->ctx.arglist[0], "CANCEL-MATCHED"); @@ -1028,34 +1101,39 @@ static int sock_arg(conn_t *conn) if (do_cancel || do_cancel_matched) { /* "cmd" may be present and empty, this is handled in the method */ if (conn->ctx.numargs < 3) - cancel_timer(conn->ctx.arglist[1], NULL, NULL, NULL, do_cancel_matched); + cancel_timer(conn->ctx.arglist[1], NULL, + NULL, NULL, NULL, do_cancel_matched); else - if (conn->ctx.numargs < 5) - cancel_timer(conn->ctx.arglist[1], conn->ctx.arglist[2], NULL, NULL, do_cancel_matched); + if (conn->ctx.numargs < 6) + cancel_timer(conn->ctx.arglist[1], conn->ctx.arglist[2], + NULL, NULL, NULL, do_cancel_matched); else cancel_timer(conn->ctx.arglist[1], conn->ctx.arglist[2], - conn->ctx.arglist[3], conn->ctx.arglist[4], do_cancel_matched); + conn->ctx.arglist[3], conn->ctx.arglist[4], + conn->ctx.arglist[5], do_cancel_matched); send_to_one(conn, "OK\n"); return 1; } } - if (conn->ctx.numargs < 5) + if (conn->ctx.numargs < 6) return 0; - /* START */ + /* START */ if (!strcmp(conn->ctx.arglist[0], "START")) { start_timer(conn->ctx.arglist[1], conn->ctx.arglist[2], - conn->ctx.arglist[3], conn->ctx.arglist[4], 0); + conn->ctx.arglist[3], conn->ctx.arglist[4], + conn->ctx.arglist[5], 0); send_to_one(conn, "OK\n"); return 1; } - /* START-SHARED */ + /* START-SHARED */ if (!strcmp(conn->ctx.arglist[0], "START-SHARED")) { start_timer(conn->ctx.arglist[1], conn->ctx.arglist[2], - conn->ctx.arglist[3], conn->ctx.arglist[4], 1); + conn->ctx.arglist[3], conn->ctx.arglist[4], + conn->ctx.arglist[5], 1); send_to_one(conn, "OK\n"); return 1; } @@ -1293,6 +1371,7 @@ static void start_daemon(TYPE_FD lockfd) * CMDSCRIPT to run */ unsetenv("NOTIFYTYPE"); unsetenv("UPSNAME"); + unsetenv("NOTIFYMSG"); /* now watch for activity */ upsdebugx(2, "Timer daemon waiting for connections on pipefd %d", @@ -1404,6 +1483,7 @@ static void start_daemon(TYPE_FD lockfd) * CMDSCRIPT to run */ unsetenv("NOTIFYTYPE"); unsetenv("UPSNAME"); + unsetenv("NOTIFYMSG"); /* now watch for activity */ @@ -1587,7 +1667,7 @@ static void sendcmd(const char *cmd, const char *arg1, const char *arg2) int i; ssize_t ret; size_t enclen, buflen; - char buf[SMALLBUF], enc[SMALLBUF + 8]; + char buf[LARGEBUF], enc[LARGEBUF + 8]; #ifndef WIN32 int ret_s; struct timeval tv; @@ -1621,6 +1701,9 @@ static void sendcmd(const char *cmd, const char *arg1, const char *arg2) snprintfcat(buf, sizeof(buf), " \"%s\"", ups_name? pconf_encode(ups_name, enc, sizeof(enc)) : ""); + snprintfcat(buf, sizeof(buf), " \"%s\"", + notify_msg ? pconf_encode(notify_msg, enc, sizeof(enc)) : ""); + snprintf(enc, sizeof(enc), "%s\n", buf); /* Sanity checks, for static analyzers to sleep well */ @@ -1895,33 +1978,37 @@ static void parse_at(const char *ntype, const char *un, const char *cmd, /* if command is valid, send it to the daemon (which may start it) */ if (!strcmp(cmd, "START-TIMER")) { - upsdebugx(1, "%s: processing %s\t[%s]\t[%s]\t[%s]\t[%s]", __func__, cmd, + upsdebugx(1, "%s: processing %s\t[%s]\t[%s]\t[%s]\t[%s]\t[%s]", __func__, cmd, NUT_STRARG(ca1), NUT_STRARG(ca2), - NUT_STRARG(notify_type), NUT_STRARG(ups_name)); + NUT_STRARG(notify_type), NUT_STRARG(ups_name), + NUT_STRARG(notify_msg)); sendcmd("START", ca1, ca2); return; } if (!strcmp(cmd, "START-TIMER-SHARED")) { - upsdebugx(1, "%s: processing %s\t[%s]\t[%s]\t[%s]\t[%s]", __func__, cmd, + upsdebugx(1, "%s: processing %s\t[%s]\t[%s]\t[%s]\t[%s]\t[%s]", __func__, cmd, NUT_STRARG(ca1), NUT_STRARG(ca2), - NUT_STRARG(notify_type), NUT_STRARG(ups_name)); + NUT_STRARG(notify_type), NUT_STRARG(ups_name), + NUT_STRARG(notify_msg)); sendcmd("START-SHARED", ca1, ca2); return; } if (!strcmp(cmd, "CANCEL-TIMER")) { - upsdebugx(1, "%s: processing %s\t[%s]\t[%s]\t[%s]\t[%s]", __func__, cmd, + upsdebugx(1, "%s: processing %s\t[%s]\t[%s]\t[%s]\t[%s]\t[%s]", __func__, cmd, NUT_STRARG(ca1), NUT_STRARG(ca2), - NUT_STRARG(notify_type), NUT_STRARG(ups_name)); + NUT_STRARG(notify_type), NUT_STRARG(ups_name), + NUT_STRARG(notify_msg)); sendcmd("CANCEL", ca1, ca2); return; } if (!strcmp(cmd, "EXECUTE")) { - upsdebugx(1, "%s: processing %s\t[%s]\t[%s]\t[%s]\t[%s]", __func__, cmd, + upsdebugx(1, "%s: processing %s\t[%s]\t[%s]\t[%s]\t[%s]\t[%s]", __func__, cmd, NUT_STRARG(ca1), NUT_STRARG(ca2), - NUT_STRARG(notify_type), NUT_STRARG(ups_name)); + NUT_STRARG(notify_type), NUT_STRARG(ups_name), + NUT_STRARG(notify_msg)); if (ca1[0] == '\0') { upslogx(LOG_ERR, "Empty EXECUTE command argument"); @@ -1935,9 +2022,10 @@ static void parse_at(const char *ntype, const char *un, const char *cmd, return; } - upslogx(LOG_ERR, "Invalid command: %s\t[%s]\t[%s]\t[%s]\t[%s]", cmd, + upslogx(LOG_ERR, "Invalid command: %s\t[%s]\t[%s]\t[%s]\t[%s]\t[%s]", cmd, NUT_STRARG(ca1), NUT_STRARG(ca2), - NUT_STRARG(notify_type), NUT_STRARG(ups_name)); + NUT_STRARG(notify_type), NUT_STRARG(ups_name), + NUT_STRARG(notify_msg)); } static int conf_arg(size_t numargs, char **arg) @@ -2085,7 +2173,7 @@ static void help(const char *arg_progname) printf("upssched: upsmon's scheduling helper for offset timers\n"); printf("Practical behavior is managed by UPSNAME and NOTIFYTYPE envvars\n"); - printf("\nUsage: %s [OPTIONS]\n\n", arg_progname); + printf("\nUsage: %s [OPTIONS] [NOTIFYMSG]\n\n", arg_progname); printf(" -D raise debugging level (NOTE: keeps reporting when daemonized)\n"); printf(" -V display the version of this software\n"); printf(" -h display this help\n"); @@ -2100,7 +2188,7 @@ static void help(const char *arg_progname) int main(int argc, char **argv) { - int i; + int i, argn = 0; if (argc > 0) prog = xbasename(argv[0]); @@ -2108,6 +2196,7 @@ int main(int argc, char **argv) prog = "upssched"; while ((i = getopt(argc, argv, "+DVhl")) != -1) { + argn++; switch (i) { case 'D': nut_debug_level_args++; @@ -2153,6 +2242,9 @@ int main(int argc, char **argv) ups_name = getenv("UPSNAME"); notify_type = getenv("NOTIFYTYPE"); + upsdebugx(2, "Remaining argn=%d of argc=%d", argn, argc); + if (argc > argn + 1 && *argv[argn + 1]) + notify_msg = argv[argn + 1]; if ((!list_timers) && ((!ups_name) || (!notify_type))) { printf("Error: environment variables UPSNAME and NOTIFYTYPE must be set.\n"); @@ -2160,6 +2252,12 @@ int main(int argc, char **argv) exit(EXIT_FAILURE); } + upsdebugx(1, "Handling NOTIFYTYPE='%s' for UPSNAME='%s'", notify_type, ups_name); + if (notify_msg) + upsdebugx(1, "Got a NOTIFYMSG from command line: %s", notify_msg); + else + upsdebugx(1, "Did not get any NOTIFYMSG from command line"); + /* see if this matches anything in the config file */ /* This is actually the processing loop: * checkconf -> conf_arg -> parse_at -> sendcmd -> daemon if needed diff --git a/conf/upssched.conf.sample.in b/conf/upssched.conf.sample.in index 1d2961a1ce..bfb9b99f68 100644 --- a/conf/upssched.conf.sample.in +++ b/conf/upssched.conf.sample.in @@ -118,10 +118,10 @@ CMDSCRIPT @BINDIR@/upssched-cmd # Start a timer called that will trigger after # seconds, calling your CMDSCRIPT with as the first # argument. Each invocation checks if the was already -# started, and if so -- appends the current event's `UPSNAME` and -# `NOTIFYTYPE` to the list of unique values it would report via -# environment variables (as a comma-separated string) when the -# timer does execute. +# started, and if so -- appends the current event's `UPSNAME`, +# `NOTIFYTYPE` and `NOTIFYMSG` to the list of unique values it would +# report via environment variables (as a comma-separated string) when +# the timer does execute. # # NOTE: Currently this updates the first seen instance with the # (in case you managed to start many). @@ -156,7 +156,8 @@ CMDSCRIPT @BINDIR@/upssched-cmd # - CANCEL-TIMER-MATCHED [cmd] # # Similar to the above, but tries to only cancel the if it -# refers to the `UPSNAME` and `NOTIFYTYPE` values passed by caller. +# refers to the `UPSNAME` and `NOTIFYTYPE` values passed by caller (the +# `NOTIFYMSG` is ignored in this context). # # 1) If any UPS (*) reverts to utility power, then stop the timer before it # triggers ONLY if that UPS is associated with the already scheduled timer: diff --git a/docs/man/upssched.conf.txt b/docs/man/upssched.conf.txt index 33d3b2ca57..d9992e9853 100644 --- a/docs/man/upssched.conf.txt +++ b/docs/man/upssched.conf.txt @@ -98,10 +98,11 @@ gone for 10 seconds Start a timer of 'interval' seconds. When it triggers, it will pass the argument 'timername' as an argument to your CMDSCRIPT. Each invocation checks if the 'timername' was already -started, and if so -- appends the current event's `UPSNAME` and -`NOTIFYTYPE` to the list of unique values it would report via -environment variables (as a comma-separated string) when the -timer does execute. +started, and if so -- appends the current event's `UPSNAME`, +`NOTIFYTYPE` and `NOTIFYMSG` to the list of unique values it +would report via environment variables (as a comma-separated +string for `UPSNAME` and `NOTIFYTYPE`, and tab-separated +sentences for `NOTIFYMSG`) when the timer does execute. + NOTE: Currently this updates the first seen instance with the 'timername' (in case you managed to start many). @@ -131,6 +132,7 @@ stop the timer before it triggers *CANCEL-TIMER-MATCHED* 'timername' ['cmd'];; Similar to the above, but tries to only cancel the 'timername' if it refers to the `UPSNAME` and `NOTIFYTYPE` values passed by caller. +The `NOTIFYMSG` is ignored in this context. + Example: + diff --git a/docs/man/upssched.txt b/docs/man/upssched.txt index ef8ebd0bd9..2849965faa 100644 --- a/docs/man/upssched.txt +++ b/docs/man/upssched.txt @@ -9,7 +9,7 @@ upssched - Timer helper for scheduling events from upsmon SYNOPSIS -------- -*upssched* +*upssched* [OPTIONS] [NOTIFYMSG] NOTE: *upssched* should be run from linkman:upsmon[8] via the NOTIFYCMD. You should never run it directly during normal operations. @@ -17,7 +17,8 @@ You should never run it directly during normal operations. *upssched* -l List currently tracked timer events, if any. Report as a TAB-separated -table of: 'NAME', 'TIMEOUT_ABS', 'TIMEOUT_REL', 'NOTIFYTYPE', 'UPSNAME'. +table of: 'NAME', 'TIMEOUT_ABS', 'TIMEOUT_REL', 'NOTIFYTYPE', 'UPSNAME', +`NOTIFYMSG`. DESCRIPTION ----------- @@ -27,6 +28,15 @@ relative to events being monitored by linkman:upsmon[8]. The original purpose was to allow for a shutdown to occur after some fixed period on battery, but there are other uses that are possible. +OPTIONS +------- + +*NOTIFYMSG*:: +Optionally pass a text message (typically originates from linkman:upsmon[8] +call to `upssched` as its `NOTIFYCMD`) as an environment variable named +`NOTIFYMSG` to the `CMDSCRIPT` launched by `upssched` immediately or after +a timer expires. + INTEGRATION ----------- diff --git a/scripts/misc/notifyme-debug b/scripts/misc/notifyme-debug index ea1ad37b09..550e62e4f2 100755 --- a/scripts/misc/notifyme-debug +++ b/scripts/misc/notifyme-debug @@ -24,5 +24,5 @@ if [ -n "${TOP_BUILDDIR}" -a -x "${TOP_BUILDDIR}/clients/upssched" ] ; then if [ "${NUT_DEBUG_LEVEL-}" -gt 0 ] 2>/dev/null ; then printf '%s: %s\t%s\t[%s]:\targs: %s\t(%s arg tokens)\n' "`date -u`" "$0" "${NOTIFYTYPE-}" "${UPSNAME-}" "$*" "$#" >&2 fi - "${TOP_BUILDDIR}/clients/upssched" + "${TOP_BUILDDIR}/clients/upssched" "$@" fi From 595be136871b166831c3fd1e8bfad95ac5afda3e Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Thu, 2 Oct 2025 17:33:04 +0200 Subject: [PATCH 213/805] docs/man/upssched.txt: list common and unique options Signed-off-by: Jim Klimov --- docs/man/upssched.txt | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/docs/man/upssched.txt b/docs/man/upssched.txt index 2849965faa..face7658f0 100644 --- a/docs/man/upssched.txt +++ b/docs/man/upssched.txt @@ -28,9 +28,30 @@ relative to events being monitored by linkman:upsmon[8]. The original purpose was to allow for a shutdown to occur after some fixed period on battery, but there are other uses that are possible. +COMMON OPTIONS +-------------- + +*-h*:: +Show the command-line help message. + +*-V*:: +Show NUT version banner. More details may be available if you also +`export NUT_DEBUG_LEVEL=1` or greater verbosity level. + +*-D*:: +Raise the debugging level. Use this option multiple times for more details. + OPTIONS ------- +By default `upssched` processes its configuration file and executes or queues +calls to its `CMDSCRIPT`, or cancels some previously queued item(s), based on +configuration and the `NOTIFYTYPE` it receives. One exception to this is the +queue listing mode `-l`. + +*-l*:: +List pending timers (if any) and exit. + *NOTIFYMSG*:: Optionally pass a text message (typically originates from linkman:upsmon[8] call to `upssched` as its `NOTIFYCMD`) as an environment variable named From 929daa26495ca2fdc6738b434cec8706f1409cac Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Thu, 2 Oct 2025 17:47:57 +0200 Subject: [PATCH 214/805] clients/upsmon.c: add debug logging to NOTIFYCMD (WIN32) [#3097] Signed-off-by: Jim Klimov --- clients/upsmon.c | 1 + 1 file changed, 1 insertion(+) diff --git a/clients/upsmon.c b/clients/upsmon.c index 8a862f3307..378a382ef6 100644 --- a/clients/upsmon.c +++ b/clients/upsmon.c @@ -280,6 +280,7 @@ static unsigned __stdcall async_notify(LPVOID param) if (notifycmd != NULL) { snprintf(exec, sizeof(exec), "%s \"%s\"", notifycmd, data->notice); + upsdebugx(6, "%s: Calling NOTIFYCMD: %s", __func__, exec); if (data->upsname) setenv("UPSNAME", data->upsname, 1); else From 6900725c15c56f220dd8834cc449b3e9232bed5c Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Thu, 2 Oct 2025 17:56:53 +0200 Subject: [PATCH 215/805] tests/NIT/upssched.conf.in: rename parameters passed to "EXECUTE" methods, for less confusing dev-testing logs [#3105] Signed-off-by: Jim Klimov --- tests/NIT/upssched.conf.in | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/tests/NIT/upssched.conf.in b/tests/NIT/upssched.conf.in index abf5129f48..5bc3a821a1 100644 --- a/tests/NIT/upssched.conf.in +++ b/tests/NIT/upssched.conf.in @@ -15,7 +15,7 @@ LOCKFN @NUT_STATEPATH@/upssched.lock # ============================================================================ # info2client -AT ONLINE * EXECUTE ONLINE +AT ONLINE * EXECUTE ONLINE-HANDLER # info2admin only AT ONLINE * CANCEL-TIMER BATT-STATUS-1s AT ONLINE * CANCEL-TIMER BATT-STATUS-2s @@ -41,7 +41,7 @@ AT ONLINE * START-TIMER LINE-STATUS-30 1800 AT ONLINE * START-TIMER LINE-STATUS-60 3600 # # info2client -AT ONBATT * EXECUTE ONBATT +AT ONBATT * EXECUTE ONBATT-HANDLER # info2admin only AT ONBATT * CANCEL-TIMER LINE-STATUS-1s AT ONBATT * CANCEL-TIMER LINE-STATUS-2s @@ -70,10 +70,10 @@ AT ONBATT * START-TIMER BATT-STATUS-60 3600 ######################### # info2client -AT REPLBATT * ONBATT * EXECUTE REPLBATT -AT NOCOMM * EXECUTE NOCOMM -AT FSD * EXECUTE FSD -AT SHUTDOWN * EXECUTE SHUTDOWN +AT REPLBATT * ONBATT * EXECUTE REPLBATT-HANDLER +AT NOCOMM * EXECUTE NOCOMM-HANDLER +AT FSD * EXECUTE FSD-HANDLER +AT SHUTDOWN * EXECUTE SHUTDOWN-HANDLER # info2admin only AT LOWBATT * EXECUTE LOWBATT-INFO From 4fed2e3a18bd1c94c71b09dafa2135615a3e0220 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Thu, 2 Oct 2025 18:04:50 +0200 Subject: [PATCH 216/805] clients/upssched.c: simplify loop processing [#3097] Signed-off-by: Jim Klimov --- clients/upssched.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/clients/upssched.c b/clients/upssched.c index bcef61b7f0..b01787ae52 100644 --- a/clients/upssched.c +++ b/clients/upssched.c @@ -296,7 +296,7 @@ static void removetimer(ttype_t *tfind) if (tmp->upsnames) { char **ps; - for (ps = tmp->upsnames; ps != NULL && *ps != NULL; ps++) { + for (ps = tmp->upsnames; *ps != NULL; ps++) { free(*ps); } free(tmp->upsnames); @@ -304,7 +304,7 @@ static void removetimer(ttype_t *tfind) if (tmp->notifytypes) { char **ps; - for (ps = tmp->notifytypes; ps != NULL && *ps != NULL; ps++) { + for (ps = tmp->notifytypes; *ps != NULL; ps++) { free(*ps); } free(tmp->notifytypes); @@ -312,7 +312,7 @@ static void removetimer(ttype_t *tfind) if (tmp->notifymsgs) { char **ps; - for (ps = tmp->notifymsgs; ps != NULL && *ps != NULL; ps++) { + for (ps = tmp->notifymsgs; *ps != NULL; ps++) { free(*ps); } free(tmp->notifymsgs); @@ -428,7 +428,7 @@ static void start_timer(const char *name, const char *ofsstr, const char *notify char **ps = NULL; size_t count = 0; /* amount of non-NULL entries, if we get to the end */ - for (ps = tmp->notifytypes; ps != NULL && *ps != NULL ; ps++) { + for (ps = tmp->notifytypes; *ps != NULL ; ps++) { count++; if (!strcmp(*ps, notifytype)) break; @@ -451,7 +451,7 @@ static void start_timer(const char *name, const char *ofsstr, const char *notify char **ps = NULL; size_t count = 0; /* amount of non-NULL entries, if we get to the end */ - for (ps = tmp->notifymsgs; ps != NULL && *ps != NULL ; ps++) { + for (ps = tmp->notifymsgs; *ps != NULL ; ps++) { count++; if (!strcmp(*ps, notifymsg)) break; @@ -474,7 +474,7 @@ static void start_timer(const char *name, const char *ofsstr, const char *notify char **ps = NULL; size_t count = 0; /* amount of non-NULL entries, if we get to the end */ - for (ps = tmp->upsnames; ps != NULL && *ps != NULL ; ps++) { + for (ps = tmp->upsnames; *ps != NULL ; ps++) { count++; if (!strcmp(*ps, upsname)) break; @@ -576,7 +576,7 @@ static void cancel_timer(const char *name, const char *cname, const char *notify upsdebugx(2, "%s: do not cancel timer %s due to lack of NOTIFYTYPE in it", __func__, name); continue; } - for (ps = tmp->notifytypes; ps != NULL && *ps != NULL ; ps++) { + for (ps = tmp->notifytypes; *ps != NULL ; ps++) { if (!strcmp(*ps, notifytype)) { matched = 1; break; @@ -594,7 +594,7 @@ static void cancel_timer(const char *name, const char *cname, const char *notify upsdebugx(2, "%s: do not cancel timer %s due to lack of UPSNAME in it", __func__, name); continue; } - for (ps = tmp->upsnames; ps != NULL && *ps != NULL ; ps++) { + for (ps = tmp->upsnames; *ps != NULL ; ps++) { if (!strcmp(*ps, upsname)) { matched = 1; break; From ce0a0783c12346d62ef1ffc2e98873446ffb3a78 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Sat, 4 Oct 2025 16:00:40 +0200 Subject: [PATCH 217/805] .github/workflows/codeql.yml: disable ccache use for actual compilation, for CodeQL analysis to hook into compiler correctly Signed-off-by: Jim Klimov --- .github/workflows/codeql.yml | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index fc0bbb169b..3ef64b68bc 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -40,13 +40,16 @@ jobs: # Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support os: [ 'ubuntu-latest' ] # TOTHINK: windows-latest, macos-latest? - build-mode: [ 'none' ] + build-mode: [ 'manual' ] # https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/codeql-code-scanning-for-compiled-languages - # Abusing "none" here to try building with ccache (and + # Abusing "manual" here to try building with ccache (and # have codeql not intercept that build but parse C/C++ # files on its own), and "manual" to custom-build without; # the "autobuild" mode is handled by codeql itself but # would probably ignore our CC/CXX setting + # NOTE: We do not add ccache to PATH when actually compiling NUT code + # (we only speed up "configure" stages), so compilation always happens + # and is parsed by current CodeQL detectors of the day as they evolve! compiler: [ 'CC=gcc CXX=g++', 'CC=clang CXX=clang++' ] NUT_SSL_VARIANTS: [ 'no', 'nss', 'openssl' ] NUT_USB_VARIANTS: [ 'no', 'libusb-1.0', 'libusb-0.1' ] @@ -158,21 +161,29 @@ jobs: # and then spread it out for builds and analyses? # Can ccache be used across builds? - if: matrix.build-mode != 'autobuild' && matrix.language == 'cpp' - name: NUT CI Build + name: NUT CI Build Configuration run: | case x"${{matrix.build-mode}}" in - xnone) + xmanual) PATH="/usr/lib/ccache:$PATH" ; export PATH CCACHE_COMPRESS=true; export CCACHE_COMPRESS ccache --version || true ;; - xmanual|*) - echo "NOTE: NOT USING CCACHE for the CI-tested code base" >&2 + xnone|*) + echo "NOTE: NOT USING CCACHE for the CI-tested code base configuration" >&2 ;; esac ( ${{matrix.compiler}} ; echo "=== CC: $CC => `command -v $CC` =>" ; $CC --version ; echo "=== CXX: $CXX => `command -v $CXX` =>" ; $CXX --version ) || true - ./autogen.sh + ./autogen.sh && \ ./configure --enable-warnings --enable-Werror --enable-Wcolor --with-all=auto --with-dev --without-docs --disable-docs-changelog ${{matrix.compiler}} --with-ssl=${{matrix.NUT_SSL_VARIANTS}} --with-usb=${{matrix.NUT_USB_VARIANTS}} + + # NOTE: We do not add ccache to PATH here, so compilation always happens + # and is parsed by current CodeQL detectors of the day as they evolve: + - if: matrix.build-mode != 'autobuild' && matrix.language == 'cpp' + name: NUT CI Build Compilation + run: | + echo "NOTE: NOT USING CCACHE for the CI-tested code base compilation" >&2 + ( ${{matrix.compiler}} ; echo "=== CC: $CC => `command -v $CC` =>" ; $CC --version ; echo "=== CXX: $CXX => `command -v $CXX` =>" ; $CXX --version ) || true make -s -j 8 || exit # NOTE: Assuming GNU make here, not limiting "-j NUM" runners From 5be343bcfe62a79eb85ec9cb2a7b4e5c6d693a67 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Sat, 4 Oct 2025 17:43:55 +0200 Subject: [PATCH 218/805] scripts/misc/nut.bash_completion, scripts/Solaris/reset-ups-usb-solaris.sh.sample, scripts/upsdrvsvcctl/nut-driver-enumerator.sh.in: avoid "tail -n +/-NUM" syntax as unportable [#3099] Signed-off-by: Jim Klimov --- scripts/Solaris/reset-ups-usb-solaris.sh.sample | 2 +- scripts/misc/nut.bash_completion | 2 +- scripts/upsdrvsvcctl/nut-driver-enumerator.sh.in | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/Solaris/reset-ups-usb-solaris.sh.sample b/scripts/Solaris/reset-ups-usb-solaris.sh.sample index c04f078810..893df71fc1 100755 --- a/scripts/Solaris/reset-ups-usb-solaris.sh.sample +++ b/scripts/Solaris/reset-ups-usb-solaris.sh.sample @@ -58,7 +58,7 @@ cfgadm -lv "${CFGADM_APID}" if $DO_SVC ; then svcadm enable "$DEVICE" ; fi svcadm clear "$DEVICE" 2>/dev/null -dmesg | tail -n 20 +dmesg | tail -20 date svcs -p "$DEVICE" ; upsc "$DEVICE" || { \ COUNT=60 diff --git a/scripts/misc/nut.bash_completion b/scripts/misc/nut.bash_completion index 1844134277..286e734e01 100644 --- a/scripts/misc/nut.bash_completion +++ b/scripts/misc/nut.bash_completion @@ -80,7 +80,7 @@ _nut_upscmd_completion() # Get the list of commands from the UPS named in the previous word: local cmds - cmds=$(upscmd -l $prev 2>/dev/null | tail -n +3 | sed 's/ - .*//' ) + cmds=$(upscmd -l $prev 2>/dev/null | tail +3 | sed 's/ - .*//' ) COMPREPLY=( $(compgen -W "$cmds" -- ${cur}) ) return 0 diff --git a/scripts/upsdrvsvcctl/nut-driver-enumerator.sh.in b/scripts/upsdrvsvcctl/nut-driver-enumerator.sh.in index 5b91be60cc..032aa92ec9 100644 --- a/scripts/upsdrvsvcctl/nut-driver-enumerator.sh.in +++ b/scripts/upsdrvsvcctl/nut-driver-enumerator.sh.in @@ -668,7 +668,7 @@ upsconf_getDriverMedia() { upsconf_getMedia() { _DRVMED="`upsconf_getDriverMedia "$1"`" || return - echo "${_DRVMED}" | tail -n +2 + echo "${_DRVMED}" | tail +2 return 0 } From 4727297779f047b67fb6f79ee0c3bc1892ae552b Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Sat, 4 Oct 2025 19:43:20 +0200 Subject: [PATCH 219/805] scripts/Solaris/preremove.in, scripts/Solaris/postinstall.in: quiesce upsdrvctl activity; add tweak-ability for debugging NUT programs in the install script context (possibly with custom package builds) [#3099] Signed-off-by: Jim Klimov --- scripts/Solaris/postinstall.in | 13 ++++++++++++- scripts/Solaris/preremove.in | 13 ++++++++++++- 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/scripts/Solaris/postinstall.in b/scripts/Solaris/postinstall.in index 468fa661f2..ea8bb26b52 100755 --- a/scripts/Solaris/postinstall.in +++ b/scripts/Solaris/postinstall.in @@ -5,6 +5,17 @@ NUT_DIR="@prefix@" prefix="@prefix@" # expanded as part of some autoconf macros below +# Operations with upsdrvctl below should not warn about running +# directly on an SMF-capable system (note it currently acts as +# set/unset, e.g. there is no meaningful "false" value handling): +NUT_QUIET_INIT_NDE_WARNING=true +export NUT_QUIET_INIT_NDE_WARNING + +# Possibly tweak the defaults here (or in a calling session) to +# troubleshoot package installation: +[ -n "${NUT_DEBUG_LEVEL-}" ] || NUT_DEBUG_LEVEL=0 +export NUT_DEBUG_LEVEL + # TODO/FIXME : Should "/var/run" be a configure variable? # Note that "/var/run" is transient tmpfs, so upgrade has to be done during same uptime. ACTIVE_ENUMERATOR_FMRI_FILE="/var/run/nut-driver-enumerator-fmri.prev" @@ -72,7 +83,7 @@ if test -x /usr/sbin/svcadm && test -x /usr/sbin/svccfg && test -x /usr/bin/svcs if test -s "@CONFPATH@/ups.conf" ; then echo "Stopping NUT drivers, if any (in case of upgrade)..." @SBINDIR@/upsdrvsvcctl stop - @SBINDIR@/upsdrvctl -DDDDD stop + @SBINDIR@/upsdrvctl stop sleep 5 echo "(Re-)register NUT drivers (if any)..." REPORT_RESTART_42=no AUTO_START=no "@NUT_LIBEXECDIR@/nut-driver-enumerator.sh" --reconfigure diff --git a/scripts/Solaris/preremove.in b/scripts/Solaris/preremove.in index abce051343..1054d76782 100755 --- a/scripts/Solaris/preremove.in +++ b/scripts/Solaris/preremove.in @@ -7,6 +7,17 @@ NUT_DIR="@prefix@" prefix="@prefix@" # expanded as part of some autoconf macros below +# Operations with upsdrvctl below should not warn about running +# directly on an SMF-capable system (note it currently acts as +# set/unset, e.g. there is no meaningful "false" value handling): +NUT_QUIET_INIT_NDE_WARNING=true +export NUT_QUIET_INIT_NDE_WARNING + +# Possibly tweak the defaults here (or in a calling session) to +# troubleshoot package installation: +[ -n "${NUT_DEBUG_LEVEL-}" ] || NUT_DEBUG_LEVEL=0 +export NUT_DEBUG_LEVEL + # TODO/FIXME : Should "/var/run" be a configure variable? # Note that "/var/run" is transient tmpfs, so upgrade has to be done during same uptime. ACTIVE_ENUMERATOR_FMRI_FILE="/var/run/nut-driver-enumerator-fmri.prev" @@ -39,7 +50,7 @@ if test -x /usr/sbin/svcadm && test -x /usr/sbin/svccfg && test -x /usr/bin/svcs done echo "Stopping NUT drivers, if any..." @SBINDIR@/upsdrvsvcctl stop - @SBINDIR@/upsdrvctl -DDDDD stop + @SBINDIR@/upsdrvctl stop sleep 5 for S in `/usr/bin/svcs -H -o fmri '*/nut-driver:*'` `/usr/bin/svcs -H -o fmri '*/nut-driver-enumerator:*'` ; do echo "Stopping NUT service: $S..." From 701416ea7b231b419f94638f16a760d957ae7128 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Sat, 4 Oct 2025 19:44:01 +0200 Subject: [PATCH 220/805] scripts/Solaris/postinstall.in: Update comments/messages for legacy init script usage on Solaris older than 10 [#3099] Signed-off-by: Jim Klimov --- scripts/Solaris/postinstall.in | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/scripts/Solaris/postinstall.in b/scripts/Solaris/postinstall.in index ea8bb26b52..112fa1aaba 100755 --- a/scripts/Solaris/postinstall.in +++ b/scripts/Solaris/postinstall.in @@ -125,9 +125,10 @@ if test -x /usr/sbin/svcadm && test -x /usr/sbin/svccfg && test -x /usr/bin/svcs echo "Enable NUT umbrella service..." /usr/sbin/svcadm enable -s nut else - echo "Put init script in /etc/init.d..." + echo "Put legacy init script in /etc/init.d..." cp -pf "@NUT_DATADIR@/solaris-init/nut" /etc/init.d chown root:bin /etc/init.d/nut + # Not 755, so only root may run it: chmod 744 /etc/init.d/nut ln -s ../init.d/nut /etc/rc3.d/S90nut > /dev/null 2>&1 @@ -135,7 +136,7 @@ else # Start nut services - #echo "Starting nut services" + #echo "Starting legacy NUT services" #$NUT_DIR/sbin/upsdrvctl start #> /dev/null 2>&1 #$NUT_DIR/sbin/upsd #> /dev/null 2>&1 #$NUT_DIR/sbin/upsmon #> /dev/null 2>&1 From 2246e77d268d9d3676f699698fd5a719179bd191 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Thu, 2 Oct 2025 14:09:16 +0200 Subject: [PATCH 221/805] ci_build.sh: revise indentation Signed-off-by: Jim Klimov --- ci_build.sh | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/ci_build.sh b/ci_build.sh index b23de73e1b..c9bc7de6bb 100755 --- a/ci_build.sh +++ b/ci_build.sh @@ -55,7 +55,7 @@ case "$BUILD_TYPE" in echo "SKIPPING BUILD_TYPE=fightwarn-clang: compiler not found" >&2 fi if $TRIED_BUILD ; then true - else + else echo "FAILED to run: no default-named compilers were found" >&2 exit 1 fi @@ -2754,16 +2754,16 @@ bindings) esac if [ "${_EXPORT_FLAGS}" = true ] ; then - [ -z "${CFLAGS}" ] || export CFLAGS - [ -z "${CXXFLAGS}" ] || export CXXFLAGS - [ -z "${CPPFLAGS}" ] || export CPPFLAGS - [ -z "${LDFLAGS}" ] || export LDFLAGS + [ -z "${CFLAGS}" ] || export CFLAGS + [ -z "${CXXFLAGS}" ] || export CXXFLAGS + [ -z "${CPPFLAGS}" ] || export CPPFLAGS + [ -z "${LDFLAGS}" ] || export LDFLAGS else - # NOTE: Passing via CONFIG_OPTS also fails - [ -z "${CFLAGS}" ] || echo "WARNING: SKIP: On '${CI_OS_NAME}' with ccache used, can not export CFLAGS='${CFLAGS}'" >&2 - [ -z "${CXXFLAGS}" ] || echo "WARNING: SKIP: On '${CI_OS_NAME}' with ccache used, can not export CXXFLAGS='${CXXFLAGS}'" >&2 - [ -z "${CPPFLAGS}" ] || echo "WARNING: SKIP: On '${CI_OS_NAME}' with ccache used, can not export CPPFLAGS='${CPPFLAGS}'" >&2 - [ -z "${LDFLAGS}" ] || echo "WARNING: SKIP: On '${CI_OS_NAME}' with ccache used, can not export LDFLAGS='${LDFLAGS}'" >&2 + # NOTE: Passing via CONFIG_OPTS also fails + [ -z "${CFLAGS}" ] || echo "WARNING: SKIP: On '${CI_OS_NAME}' with ccache used, can not export CFLAGS='${CFLAGS}'" >&2 + [ -z "${CXXFLAGS}" ] || echo "WARNING: SKIP: On '${CI_OS_NAME}' with ccache used, can not export CXXFLAGS='${CXXFLAGS}'" >&2 + [ -z "${CPPFLAGS}" ] || echo "WARNING: SKIP: On '${CI_OS_NAME}' with ccache used, can not export CPPFLAGS='${CPPFLAGS}'" >&2 + [ -z "${LDFLAGS}" ] || echo "WARNING: SKIP: On '${CI_OS_NAME}' with ccache used, can not export LDFLAGS='${LDFLAGS}'" >&2 fi PATH="`echo "${PATH}" | normalize_path`" From 2c9858305fa6016dcae0e5a624e653f2444bd306 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Thu, 2 Oct 2025 14:50:48 +0200 Subject: [PATCH 222/805] ci_build.sh: USE_CONFIG_SHELL at least from explicit caller envvar [#3099] Signed-off-by: Jim Klimov --- ci_build.sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/ci_build.sh b/ci_build.sh index c9bc7de6bb..50684eb190 100755 --- a/ci_build.sh +++ b/ci_build.sh @@ -1354,7 +1354,11 @@ consider_cleanup_shortcut() { if [ -s "${CI_BUILDDIR}"/configure ] ; then # FIXME: Consider CONFIG_SHELL, maybe from script shebang, # here - like autogen.sh does - if sh -n "${CI_BUILDDIR}"/configure 2>/dev/null ; then + USE_CONFIG_SHELL=sh + if [ -n "${CONFIG_SHELL-}" ]; then + USE_CONFIG_SHELL="${CONFIG_SHELL}" + fi + if ${USE_CONFIG_SHELL} -n "${CI_BUILDDIR}"/configure 2>/dev/null ; then true else echo "=== Starting initial clean-up (from old build products): TAKING SHORTCUT because current configure script syntax is broken" From 9beda72d7c9906570e09f380c659400f02aa0c5c Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Thu, 2 Oct 2025 15:30:05 +0200 Subject: [PATCH 223/805] ci_build.sh: fix typo in message Signed-off-by: Jim Klimov --- ci_build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci_build.sh b/ci_build.sh index 50684eb190..ed69ad4304 100755 --- a/ci_build.sh +++ b/ci_build.sh @@ -1512,7 +1512,7 @@ if [ -z "$BUILD_TYPE" ] ; then fi ;; - *) echo "WARNING: Command-line argument '$1' wsa not recognized as a BUILD_TYPE alias" >&2 ;; + *) echo "WARNING: Command-line argument '$1' was not recognized as a BUILD_TYPE alias" >&2 ;; esac fi From 9fc5355001cc897213c1ac602e01a90b9bbaece9 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Mon, 6 Oct 2025 07:52:44 +0000 Subject: [PATCH 224/805] configure.ac: fix indent Signed-off-by: Jim Klimov --- configure.ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 3ff098a667..e8102958c8 100644 --- a/configure.ac +++ b/configure.ac @@ -242,7 +242,7 @@ AS_IF([test x"${nut_enable_configure_debug}" = xyes], [ AC_MSG_CHECKING(for autoconf macro to enable system extensions) m4_version_prereq(2.61, [ AC_MSG_RESULT(yes) - dnl Causes calls to ac_prog stuff, so dittoed below if "no" + dnl Causes calls to ac_prog stuff, so dittoed below if "no" AC_USE_SYSTEM_EXTENSIONS ], [ AC_MSG_RESULT(no) From 9400809be0ef4cf4334fac89b58fc641feb5c4ea Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Mon, 6 Oct 2025 07:53:24 +0000 Subject: [PATCH 225/805] configure.ac: detect TAIL_ARGS_FROM_NTH_LINE [#3099] Signed-off-by: Jim Klimov --- configure.ac | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/configure.ac b/configure.ac index e8102958c8..cf17dbdd7d 100644 --- a/configure.ac +++ b/configure.ac @@ -314,6 +314,36 @@ AC_SUBST(NUT_AM_MAKE_CAN_EXPORT) dnl Some systems have older autotools without direct macro support for PKG_CONF* NUT_CHECK_PKGCONFIG +dnl Nowadays both `tail -n +3` and `tail +3` work almost everywhere +dnl * CentOS7 tail can not do `tail +3` -- no such file +dnl * Classic Solaris tooling (even in Solaris 11) can not do `tail -n` -- no such option +AC_MSG_CHECKING([how to "tail" starting from Nth line]) +dnl Requires autoconf 2.62 or newer; for even older systems consider +dnl an adapted implementation of the logic below. For more details see +dnl https://www.gnu.org/software/autoconf/manual/autoconf-2.68/html_node/Generic-Programs.html +TAIL_ARGS_FROM_NTH_LINE="" +ac_path_TAIL_found="" +AC_PATH_PROGS_FEATURE_CHECK([TAIL], [tail gtail], + [_TAIL_OUT="`(echo "1"; echo "2"; echo "3"; echo "4"; echo "5"; echo "6"; echo "7") | $ac_path_TAIL +3`" || _TAIL_OUT="" + AS_IF([(test x"${_TAIL_OUT}" != x && echo "${_TAIL_OUT}" | ${GREP} 3 && echo "${_TAIL_OUT}" | ${GREP} 7) >/dev/null], + [AS_IF([(echo "${_TAIL_OUT}" | ${GREP} 1 || echo "${_TAIL_OUT}" | ${GREP} 2) >/dev/null], [], + [ac_path_TAIL_found=: + ac_cv_path_TAIL="${ac_path_TAIL}"]) + ]) + AS_IF([test x"${ac_path_TAIL_found}" != x:], + [_TAIL_OUT="`(echo "1"; echo "2"; echo "3"; echo "4"; echo "5"; echo "6"; echo "7") | $ac_path_TAIL -n +3`" || _TAIL_OUT="" + AS_IF([(test x"${_TAIL_OUT}" != x && echo "${_TAIL_OUT}" | ${GREP} 3 && echo "${_TAIL_OUT}" | ${GREP} 7) >/dev/null], + [AS_IF([(echo "${_TAIL_OUT}" | ${GREP} 1 || echo "${_TAIL_OUT}" | ${GREP} 2) >/dev/null], [], + [ac_path_TAIL_found=: + ac_cv_path_TAIL="${ac_path_TAIL}" + TAIL_ARGS_FROM_NTH_LINE="-n"]) + ]) + ]) + ], [AC_MSG_ERROR([could not find tail that supports starting a listing from Nth line])] +) +AC_MSG_RESULT([$ac_cv_path_TAIL $TAIL_ARGS_FROM_NTH_LINE +NUM_FIRST_LINE]) +AC_SUBST([TAIL], [$ac_cv_path_TAIL]) +AC_SUBST([TAIL_ARGS_FROM_NTH_LINE], [$TAIL_ARGS_FROM_NTH_LINE]) dnl Various version related processing dnl ---------------------------------- From e16cc20c1738ccf81e036f7e24809692329ad04c Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Mon, 6 Oct 2025 07:53:40 +0000 Subject: [PATCH 226/805] scripts/upsdrvsvcctl/nut-driver-enumerator.sh.in: use TAIL_ARGS_FROM_NTH_LINE [#3099] Signed-off-by: Jim Klimov --- scripts/upsdrvsvcctl/nut-driver-enumerator.sh.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/upsdrvsvcctl/nut-driver-enumerator.sh.in b/scripts/upsdrvsvcctl/nut-driver-enumerator.sh.in index 032aa92ec9..3a231e575e 100644 --- a/scripts/upsdrvsvcctl/nut-driver-enumerator.sh.in +++ b/scripts/upsdrvsvcctl/nut-driver-enumerator.sh.in @@ -668,7 +668,7 @@ upsconf_getDriverMedia() { upsconf_getMedia() { _DRVMED="`upsconf_getDriverMedia "$1"`" || return - echo "${_DRVMED}" | tail +2 + echo "${_DRVMED}" | @TAIL@ @TAIL_ARGS_FROM_NTH_LINE@ +2 return 0 } From 31a770bc2f3daa20c09e7da121854ab5c44c68fa Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Mon, 6 Oct 2025 07:57:24 +0000 Subject: [PATCH 227/805] scripts/misc/nut.bash_completion: convert to .in template to use TAIL_ARGS_FROM_NTH_LINE [#3099] Signed-off-by: Jim Klimov --- configure.ac | 1 + scripts/Makefile.am | 4 +++- scripts/misc/.gitignore | 1 + scripts/misc/{nut.bash_completion => nut.bash_completion.in} | 2 +- 4 files changed, 6 insertions(+), 2 deletions(-) create mode 100644 scripts/misc/.gitignore rename scripts/misc/{nut.bash_completion => nut.bash_completion.in} (98%) diff --git a/configure.ac b/configure.ac index cf17dbdd7d..83f74193bd 100644 --- a/configure.ac +++ b/configure.ac @@ -6782,6 +6782,7 @@ AC_CONFIG_FILES([ scripts/hotplug/libhidups scripts/HP-UX/nut.psf scripts/installer/Makefile + scripts/misc/nut.bash_completion scripts/python/Makefile scripts/python/module/Makefile scripts/python/module/PyNUT.py diff --git a/scripts/Makefile.am b/scripts/Makefile.am index eacc13b908..748aff54cb 100644 --- a/scripts/Makefile.am +++ b/scripts/Makefile.am @@ -10,7 +10,7 @@ EXTRA_DIST = \ HP-UX/nut-upsmon \ HP-UX/nut-upsmon.sh \ logrotate/nutlogd \ - misc/nut.bash_completion \ + misc/nut.bash_completion.in \ misc/osd-notify \ perl/Nut.pm \ RedHat/halt.patch \ @@ -56,4 +56,6 @@ spellcheck spellcheck-interactive spellcheck-sortdict: CLEANFILES = *-spellchecked RedHat/*-spellchecked usb_resetter/*-spellchecked +DISTCLEANFILES = misc/nut.bash_completion + MAINTAINERCLEANFILES = Makefile.in .dirstamp diff --git a/scripts/misc/.gitignore b/scripts/misc/.gitignore new file mode 100644 index 0000000000..6147e35ee8 --- /dev/null +++ b/scripts/misc/.gitignore @@ -0,0 +1 @@ +/nut.bash_completion diff --git a/scripts/misc/nut.bash_completion b/scripts/misc/nut.bash_completion.in similarity index 98% rename from scripts/misc/nut.bash_completion rename to scripts/misc/nut.bash_completion.in index 286e734e01..cb77436164 100644 --- a/scripts/misc/nut.bash_completion +++ b/scripts/misc/nut.bash_completion.in @@ -80,7 +80,7 @@ _nut_upscmd_completion() # Get the list of commands from the UPS named in the previous word: local cmds - cmds=$(upscmd -l $prev 2>/dev/null | tail +3 | sed 's/ - .*//' ) + cmds=$(upscmd -l $prev 2>/dev/null | @TAIL@ @TAIL_ARGS_FROM_NTH_LINE@ +3 | sed 's/ - .*//' ) COMPREPLY=( $(compgen -W "$cmds" -- ${cur}) ) return 0 From 210482fc2621e87c4f2f2678244e5e511b2587c0 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Mon, 6 Oct 2025 08:00:36 +0000 Subject: [PATCH 228/805] scripts/misc/nut.bash_completion.in: fix indentations Signed-off-by: Jim Klimov --- scripts/misc/nut.bash_completion.in | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/scripts/misc/nut.bash_completion.in b/scripts/misc/nut.bash_completion.in index cb77436164..d87be20a50 100644 --- a/scripts/misc/nut.bash_completion.in +++ b/scripts/misc/nut.bash_completion.in @@ -62,12 +62,12 @@ _nut_upscmd_completion() case "$prev" in -u|-p) # TODO: match against upsd.users, if readable. COMPREPLY=( ) ; return 0 ;; - -l) + -l) upses="$(_nut_upses)" COMPREPLY=( $(compgen -W "$upses" -- ${cur}) ) ; return 0 ;; - upscmd) - upses="$(_nut_upses)" - COMPREPLY=( $(compgen -W "$options $upses" -- ${cur}) ) ; return 0 ;; + upscmd) + upses="$(_nut_upses)" + COMPREPLY=( $(compgen -W "$options $upses" -- ${cur}) ) ; return 0 ;; esac # If the user starts to type an option, then only offer options for that word: @@ -100,9 +100,9 @@ _nut_upsd_completion() options="-c -D -f -h -r -u -V -4 -6" case "$prev" in - -c) # commands: + -c) # commands: COMPREPLY=( $(compgen -W "reload stop" -- ${cur}) ) ; return 0 ;; - -r) # chroot: + -r) # chroot: COMPREPLY=( $(compgen -A directory -- ${cur}) ) ; return 0 ;; -u) # system user, not in upsd.users COMPREPLY=( $(compgen -u -- ${cur}) ) ; return 0 ;; @@ -128,13 +128,13 @@ _nut_upsdrvctl_completion() options="-h -r -t -u -D" case "$prev" in - -r) # chroot: + -r) # chroot: COMPREPLY=( $(compgen -A directory -- ${cur}) ) ; return 0 ;; -u) # system user, not in upsd.users COMPREPLY=( $(compgen -u -- ${cur}) ) ; return 0 ;; - start|stop|shutdown) - upses="$(_nut_local_upses)" - COMPREPLY=( $(compgen -W "$upses" -- ${cur}) ) ; return 0 ;; + start|stop|shutdown) + upses="$(_nut_local_upses)" + COMPREPLY=( $(compgen -W "$upses" -- ${cur}) ) ; return 0 ;; esac # If the user starts to type an option, then only offer options for that word: @@ -162,7 +162,7 @@ _nut_upsmon_completion() options="-c -D -h -K -u -4 -6" case "$prev" in - -c) # commands: + -c) # commands: COMPREPLY=( $(compgen -W "fsd reload stop" -- ${cur}) ) ; return 0 ;; -u) # system user, not in upsd.users COMPREPLY=( $(compgen -u -- ${cur}) ) ; return 0 ;; @@ -192,7 +192,7 @@ _nut_upsrw_completion() case "$prev" in -u|-p) # TODO: match against upsd.users, if readable. COMPREPLY=( ) ; return 0 ;; - -l) + -l) COMPREPLY=( $(compgen -W "$upses" -- ${cur}) ) ; return 0 ;; esac From 517140facf5d095dc4ef27d1fa6c14864b5f1030 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Mon, 6 Oct 2025 08:28:56 +0000 Subject: [PATCH 229/805] ci_build.sh: consider_cleanup_shortcut(): better react to changes of sources for configure script ...even if there is no Makefile yet Signed-off-by: Jim Klimov --- ci_build.sh | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/ci_build.sh b/ci_build.sh index ed69ad4304..a055c2631e 100755 --- a/ci_build.sh +++ b/ci_build.sh @@ -1336,17 +1336,17 @@ consider_cleanup_shortcut() { DO_REGENERATE=true fi - if [ -s Makefile ]; then - if [ -n "`find "${SCRIPTDIR}" -name configure.ac -newer "${CI_BUILDDIR}"/configure`" ] \ - || [ -n "`find "${SCRIPTDIR}" -name '*.m4' -newer "${CI_BUILDDIR}"/configure`" ] \ - || [ -n "`find "${SCRIPTDIR}" -name Makefile.am -newer "${CI_BUILDDIR}"/Makefile`" ] \ - || [ -n "`find "${SCRIPTDIR}" -name Makefile.in -newer "${CI_BUILDDIR}"/Makefile`" ] \ - || [ -n "`find "${SCRIPTDIR}" -name Makefile.am -newer "${CI_BUILDDIR}"/Makefile.in`" ] \ - ; then - # Avoid reconfiguring just for the sake of distclean - echo "=== Starting initial clean-up (from old build products): TAKING SHORTCUT because recipes changed" - DO_REGENERATE=true - fi + if ( [ -s Makefile ] && ( + [ -n "`find "${SCRIPTDIR}" -name Makefile.am -newer "${CI_BUILDDIR}"/Makefile`" ] \ + || [ -n "`find "${SCRIPTDIR}" -name Makefile.in -newer "${CI_BUILDDIR}"/Makefile`" ] \ + || [ -n "`find "${SCRIPTDIR}" -name Makefile.am -newer "${CI_BUILDDIR}"/Makefile.in`" ] ) ) \ + || ( [ -s configure ] && ( + [ -n "`find "${SCRIPTDIR}" -name configure.ac -newer "${CI_BUILDDIR}"/configure`" ] \ + || [ -n "`find "${SCRIPTDIR}" -name '*.m4' -newer "${CI_BUILDDIR}"/configure`" ] ) ) \ + ; then + # Avoid reconfiguring just for the sake of distclean + echo "=== Starting initial clean-up (from old build products): TAKING SHORTCUT because recipes changed" + DO_REGENERATE=true fi # When iterating configure.ac or m4 sources, we can end up with an From b5528ad261feba9c5697071b3a787bf330bbae9b Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Mon, 6 Oct 2025 22:36:34 +0200 Subject: [PATCH 230/805] clients/upsmon.{c,h}, NEWS.adoc: Make sure `FSD` notifications are always issued at latest when shutdown handling just starts (or earlier) [#3003, #3110] Signed-off-by: Jim Klimov --- NEWS.adoc | 11 +++++++++++ clients/upsmon.c | 27 +++++++++++++++++++++++---- clients/upsmon.h | 4 +++- 3 files changed, 37 insertions(+), 5 deletions(-) diff --git a/NEWS.adoc b/NEWS.adoc index a9d8b34bae..85b026a970 100644 --- a/NEWS.adoc +++ b/NEWS.adoc @@ -100,6 +100,17 @@ https://github.com/networkupstools/nut/milestone/12 * Introduced a `SHUTDOWN_HOSTSYNC` notification message, to report that the primary `upsmon` initiated the shutdown and has some secondaries to wait for first. [#3084] + * Make sure an `FSD` notification is issued for each UPS when this primary + `upsmon` instance sets it (and does not return to usual data processing + loop to see and report it like secondaries do). This allows a `NOTIFYCMD` + such as `upssched` on the primary to handle the pending power outage + (e.g. begin stopping heavy services) even while `upsmon` waits for the + secondaries to complete their shutdowns and log out of the `upsd` data + server. [issue #3003, PR #3110] ++ +NOTE: If using `upssched` and monitoring multiple UPSes, consider setting up +a `START-TIMER-SHARED` rule with a short (approx. 1 second) timeout to group +several `FSD` notifications into one executed action. [PR #3097] - `upssched` tool updates: * Previously in PR #2896 (NUT releases v2.8.3 and v2.8.4) the `UPSNAME` and diff --git a/clients/upsmon.c b/clients/upsmon.c index 378a382ef6..0d4f5d3c94 100644 --- a/clients/upsmon.c +++ b/clients/upsmon.c @@ -1133,8 +1133,20 @@ static void setfsd(utype_t *ups) return; } - if (!strncmp(buf, "OK", 2)) + if (!strncmp(buf, "OK", 2)) { + upsdebugx(1, "%s: data server confirmed setting FSD for UPS [%s]", __func__, ups->sys); + + /* Let NOTIFYCMD (if any) know, and have a chance to react */ + if (ups->lastfsdnotify) { + /* e.g. upsd was still alive with a latched FSD + * status when this upsmon instance started */ + upsdebugx(2, "%s: not notifying about FSD for UPS [%s] because it was recently reported already", __func__, ups->sys); + } else { + time(&(ups->lastfsdnotify)); + do_notify(ups, NOTIFY_FSD, NULL); + } return; + } /* protocol error: upsd said something other than "OK" */ upslogx(LOG_ERR, "FSD set on UPS %s failed: %s", ups->sys, buf); @@ -1843,9 +1855,12 @@ static void ups_fsd(utype_t *ups) upsdebugx(3, "%s: %s (first time)", __func__, ups->sys); - /* must have changed from !FSD to FSD, so notify */ + /* must have changed from !FSD to FSD, so notify; avoid duplicates though */ - do_notify(ups, NOTIFY_FSD, NULL); + if (!(ups->lastfsdnotify)) { + time(&(ups->lastfsdnotify)); + do_notify(ups, NOTIFY_FSD, NULL); + } setflag(&ups->status, ST_FSD); } @@ -2113,6 +2128,8 @@ static void addups(int reloading, const char *sys, const char *pvs, tmp->lastrbwarn = 0; tmp->lastncwarn = 0; + tmp->lastfsdnotify = 0; + tmp->offsince = 0; tmp->oblbsince = 0; tmp->oversince = 0; @@ -2868,8 +2885,10 @@ static void parse_status(utype_t *ups, char *status, char *buzzword, char *buzzw /* clear these out early if they disappear */ if (!strstr(status, "LB")) clearflag(&ups->status, ST_LOWBATT); - if (!strstr(status, "FSD")) + if (!strstr(status, "FSD")) { clearflag(&ups->status, ST_FSD); + ups->lastfsdnotify = 0; + } /* similar to above - clear these flags and send notifications */ if (!strstr(status, "CAL")) diff --git a/clients/upsmon.h b/clients/upsmon.h index 118f554a63..4007cb1b40 100644 --- a/clients/upsmon.h +++ b/clients/upsmon.h @@ -92,10 +92,12 @@ typedef struct { int pollfail_log_throttle_count; /* How many pollfreq loops this UPS was in this state since last logged report? */ time_t lastpoll; /* time of last successful poll */ - time_t lastnoncrit; /* time of last non-crit poll */ + time_t lastnoncrit; /* time of last non-crit poll */ time_t lastrbwarn; /* time of last REPLBATT warning*/ time_t lastncwarn; /* time of last NOCOMM warning */ + time_t lastfsdnotify; /* time of last FSD notification (when first discovering the state, or setting it - avoid duplicate notification); 0 initially or if that state clears */ + time_t offsince; /* time of recent entry into OFF state */ time_t oblbsince; /* time of recent entry into OB LB state (normally this causes immediate shutdown alert, unless we are configured to delay it) */ time_t oversince; /* time of recent entry into OVER state */ From 16ac6510a74c5adb740f4bcc891e94b13624f5d0 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Mon, 6 Oct 2025 23:00:50 +0200 Subject: [PATCH 231/805] docs/man/upssched.conf.txt, docs/man/upssched.txt: note that command execution is not async in upssched Signed-off-by: Jim Klimov --- docs/man/upssched.conf.txt | 7 +++++++ docs/man/upssched.txt | 8 ++++++++ 2 files changed, 15 insertions(+) diff --git a/docs/man/upssched.conf.txt b/docs/man/upssched.conf.txt index d9992e9853..b0d38f04c8 100644 --- a/docs/man/upssched.conf.txt +++ b/docs/man/upssched.conf.txt @@ -18,6 +18,13 @@ IMPORTANT NOTES * Contents of this file should be pure ASCII (character codes not in range would be ignored with a warning message). +* Command execution is synchronous (with the called tool process in case + of `EXECUTE` directive, or with the timer process). Consider using your + system shell abilities like `&` to send long-duration handling to the + background and let `upssched` timer daemon continue. This should not + impact `upsmon` daemon, which handles each notification in a separate + sub-process (and so not a problem for immediate `EXECUTE` events). + CONFIGURATION DIRECTIVES ------------------------ diff --git a/docs/man/upssched.txt b/docs/man/upssched.txt index face7658f0..ae09850300 100644 --- a/docs/man/upssched.txt +++ b/docs/man/upssched.txt @@ -81,6 +81,14 @@ If you also want to continue writing to the syslog, just add it in: For a full list of notify flags, see the linkman:upsmon[8] documentation. +Please note that command execution is synchronous (with the called `upssched` +tool process in case of `EXECUTE` directive, or with the timer process). +Consider using your system shell abilities like `&` to send long-duration +handling to the background and let `upssched` timer daemon continue. +This should not impact `upsmon` daemon, which handles each notification +in a separate sub-process (and so not a problem for immediate `EXECUTE` +events). + CONFIGURATION ------------- From 355caae1bdd5849860d744affe54ecc3fa1a7e50 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Mon, 6 Oct 2025 23:08:35 +0200 Subject: [PATCH 232/805] docs/man/upssched.txt: suggest using FSD notification for early shutdown activity on the upsmon primary system [#3003] Signed-off-by: Jim Klimov --- docs/man/upssched.txt | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/docs/man/upssched.txt b/docs/man/upssched.txt index ae09850300..3b790fbb0f 100644 --- a/docs/man/upssched.txt +++ b/docs/man/upssched.txt @@ -104,6 +104,24 @@ to shut down the slaves in a controlled manner. Be sure you cancel the timer if power returns (ONLINE). +EARLY PREPARATION FOR A SHUTDOWN ON UPSMON PRIMARY INSTANCE +----------------------------------------------------------- + +The linkman:upsmon[8] primary instance is responsible for telling the UPS(es) +to power off at the end of emergency shutdown. As such, if there are several +clients, the primary instance raises an "FSD" (Forced Shut Down) flag on the +data server for each UPS it manages, and waits for secondary instances to log +off (or for a timeout to expire). If there are activities that should happen +on the primary upsmon's computer during shutdown which take a long time, you +can use the `FSD` notification to begin those operations while the primary +`upsmon` instance waits for the secondaries to complete their shutdowns. + +If you have several UPSes, you may want to combine several notifications with +the `START-TIMER-SHARED` directive (with a short timeout), so you only react +once. Alternately, if the needed activity varies by the UPS (e.g. custom +remote-device shutdown scripts), you may actually want to use `EXECUTE` rules +right away (and dispatch further work in your `CMDSCRIPT`). + DEBOUNCING EVENTS ----------------- From 0c5fae926160174f44ddb53cdfeac23f630465da Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Tue, 7 Oct 2025 10:12:06 +0200 Subject: [PATCH 233/805] docs/man/upsmon.txt: reword intro (and name) of UPS CONNECTION TYPES AND UPSMON ROLES section Signed-off-by: Jim Klimov --- docs/man/upsmon.txt | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/docs/man/upsmon.txt b/docs/man/upsmon.txt index 521946b0dd..cfe1953cc3 100644 --- a/docs/man/upsmon.txt +++ b/docs/man/upsmon.txt @@ -394,16 +394,16 @@ This design allows you to lose some of your power supplies in a redundant power environment without bringing down the entire system, while still working properly for smaller systems. -UPS TYPES ---------- +UPS CONNECTION TYPES AND UPSMON ROLES +------------------------------------- *upsmon* and linkman:upsd[8] don't always run on the same system. When they -do, any UPSes that are directly attached to the upsmon host should be -monitored in "primary" mode. This makes upsmon take charge of that equipment, -and it will wait for the "secondary" systems to disconnect before shutting -down the local system. This allows the distant systems (monitoring over -the network) to shut down cleanly before `upsdrvctl shutdown` runs locally -and turns them all off. +do, any UPSes that are directly attached to that upsmon host should be +monitored in "primary" mode, which makes that upsmon instance take charge +of that equipment, and it will wait for the "secondary" systems to disconnect +before shutting down the local system. This allows the distant systems (just +monitoring over the network) to shut down cleanly before `upsdrvctl shutdown` +runs locally on the primary system and turns them all off. When upsmon runs as a secondary, it is relying on the distant system to tell it about the state of the UPS. When that UPS goes critical (on battery From a4af58209dc139ead6afcff9b0b13752bc16793e Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Tue, 7 Oct 2025 10:12:51 +0200 Subject: [PATCH 234/805] docs/man/upsmon.txt: from UPS CONNECTION TYPES AND UPSMON ROLES section, refer to TIMED SHUTDOWNS section Signed-off-by: Jim Klimov --- docs/man/upsmon.txt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/docs/man/upsmon.txt b/docs/man/upsmon.txt index cfe1953cc3..f309f37eeb 100644 --- a/docs/man/upsmon.txt +++ b/docs/man/upsmon.txt @@ -423,7 +423,9 @@ should break somehow. This defaults to 15 seconds. If your primary system is shutting down too quickly, set the FINALDELAY interval to something greater than the default 15 seconds. Don't set this too high, or your UPS battery may run out of power before the -primary upsmon process shuts down that system. +primary upsmon process shuts down that system. If you do need more time, +consider starting the shutdown after a short time on battery, for details +see the Timed Shutdowns section. TIMED SHUTDOWNS --------------- From 266da08bdd39d9a4f2257dd918c25ef42f05c651 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Tue, 7 Oct 2025 10:26:27 +0200 Subject: [PATCH 235/805] docs/man/upsmon.txt: in SIMULATING POWER FAILURES section, refer to NIT scripts as a source of inspiration Signed-off-by: Jim Klimov --- docs/man/upsmon.txt | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/docs/man/upsmon.txt b/docs/man/upsmon.txt index f309f37eeb..2365e7121e 100644 --- a/docs/man/upsmon.txt +++ b/docs/man/upsmon.txt @@ -544,6 +544,16 @@ crawling under a desk to find the plug. Note you can also use a dummy SHUTDOWNCMD setting to just report that the systems would shut down at this point, without actually disrupting their work. +For inspiration, you can see the setup done by the NUT Integration Tests suite +under the `tests/NIT` directory in NUT sources, including references to the +shutdown and notification scripts which only log the activity (you may have +to configure at least a trivial NUT build and run `make check-NIT-sandbox` to +generate some of the configuration files -- or inspect the `nit.sh` script +which pieces them together). Notably, see `scripts/misc/notifyme-debug` as +not only a logger, but optionally a wrapper for `upssched` (in test runs), +and `clients/upssched-cmd` as a sample implementation of an linkman:upssched[8] +`CMDSCRIPT` which also focuses on logging. + WARNING: After such "dummy" experiments you may have to restart the NUT data server `upsd` to clear its "FSD" flag for the devices and clients involved, and make sure no files named by `POWERDOWNFLAG` option (e.g. `/etc/killpower`) From c14d5d75ace3199e17a14173a1d2d95a6ceca1fb Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Tue, 7 Oct 2025 10:31:07 +0200 Subject: [PATCH 236/805] docs/man/upsmon.txt, docs/nut.dict: introduce SHUTDOWN ACTIVITY WORKFLOW section [#3003, #3110] Signed-off-by: Jim Klimov --- docs/man/upsmon.txt | 49 +++++++++++++++++++++++++++++++++++++++++++++ docs/nut.dict | 4 +++- 2 files changed, 52 insertions(+), 1 deletion(-) diff --git a/docs/man/upsmon.txt b/docs/man/upsmon.txt index 2365e7121e..05c20e29c1 100644 --- a/docs/man/upsmon.txt +++ b/docs/man/upsmon.txt @@ -427,6 +427,8 @@ primary upsmon process shuts down that system. If you do need more time, consider starting the shutdown after a short time on battery, for details see the Timed Shutdowns section. +For a more technical take, please see the Shutdown Activity Workflow section. + TIMED SHUTDOWNS --------------- @@ -502,6 +504,8 @@ by starting another copy of the program with `-c fsd` command line argument. This is useful when you want to initiate a shutdown before the critical stage through some external means, such as linkman:upssched[8]. +For a more technical take, please see the Shutdown Activity Workflow section. + WARNING: Please note that by design, since we require power-cycling the load and don't want some systems to be powered off while others remain running if the "wall power" returns at the wrong moment as usual, the "FSD" @@ -559,6 +563,51 @@ server `upsd` to clear its "FSD" flag for the devices and clients involved, and make sure no files named by `POWERDOWNFLAG` option (e.g. `/etc/killpower`) remain on the `upsmon primary` systems under test. +SHUTDOWN ACTIVITY WORKFLOW +-------------------------- + +Looking into `clients/upsmon.c` sources as the ultimate authority, you +can find that the chain of events during a forced shutdown is. This can +help make sense of the timing variables involved, and notifications sent +(which you may want to handle, perhaps with linkman:upssched[8]): + +* The path to shutdown activity of a host starts when its locally running + `upsmon` client (in any role) decides the power situation is critical, + e.g. by having too few "healthy" power supplies in a real outage, and/or + by seeing `FSD` among `ups.status` tokens -- possibly still "latched" in + the `upsd` data server while you start a new `upsmon` instance, or when + you call `upsmon -c fsd` on that system to simulate the outage; +* Such `upsmon` instance ends up in `forceshutdown()` method; +* There it loops over all UPSes it `MONITOR`s as a `primary`, and calls the + `setfsd()` method for each (causing a local `FSD` notification, if one was + not sent earlier); +* If there were no such UPSes -- we are a secondary, and go into `doshutdown()` + method immediately +* Otherwise we are a primary, and only go into `doshutdown()` method after + first completing the `sync_secondaries()` method, which: + * runs an infinite loop until either there are no other persistent clients + logged on to the data server (`upsd`) for each UPS we are a primary for, + or until `HOSTSYNC` timeout elapses; + * it should issue a `SHUTDOWN_HOSTSYNC` notification if it is going to wait + at all (if there were other clients seen on first loop cycle). +* Finally, in the `doshutdown()` method, it: + * issues a `SHUTDOWN` notification; + * waits for `FINALDELAY`; + * starts the timer for `SHUTDOWNEXIT` (which may be used to force `upsmon` + process to linger after calling `SHUTDOWNCMD` -- e.g. can be used by a + secondary to block the primary from cutting power too early for some use + cases, like safely parking some external machinery); + * calls the `SHUTDOWNCMD` (either directly in mono-process mode, or by + telling the `root`-privileged part to do so in the common case); + * optionally linger, if `SHUTDOWNEXIT` is so configured; + * ultimately exit the daemon (also causes the `root`-privileged part to exit, + by breaking the communications pipe between them). + +Note that if your `upsmon` does split into privileged and unprivileged parts, +all notifications run in the unprivileged context (your handling scripts may +have to `sudo` explicitly if/when/where you want to do something to the system). +Only `SHUTDOWNCMD` is called in privileged context. + DEAD UPSES ---------- diff --git a/docs/nut.dict b/docs/nut.dict index aba9ef023f..af914be15d 100644 --- a/docs/nut.dict +++ b/docs/nut.dict @@ -1,4 +1,4 @@ -personal_ws-1.1 en 3555 utf-8 +personal_ws-1.1 en 3557 utf-8 AAC AAS ABI @@ -1961,6 +1961,7 @@ docinfo docs dod domxml +doshutdown dotnet downloadable dpkg @@ -3043,6 +3044,7 @@ servicebypass setFeature setaux setflags +setfsd setgid setinfo setpci From e63365cdba9f4e50d5862bc5661153d9291fa48d Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Tue, 7 Oct 2025 10:33:18 +0200 Subject: [PATCH 237/805] tests/NIT/upssched.conf.in: add handling for SHUTDOWN_HOSTSYNC [#3084] Signed-off-by: Jim Klimov --- tests/NIT/upssched.conf.in | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/NIT/upssched.conf.in b/tests/NIT/upssched.conf.in index 5bc3a821a1..2a6d630c09 100644 --- a/tests/NIT/upssched.conf.in +++ b/tests/NIT/upssched.conf.in @@ -74,6 +74,7 @@ AT REPLBATT * ONBATT * EXECUTE REPLBATT-HANDLER AT NOCOMM * EXECUTE NOCOMM-HANDLER AT FSD * EXECUTE FSD-HANDLER AT SHUTDOWN * EXECUTE SHUTDOWN-HANDLER +AT SHUTDOWN_HOSTSYNC * EXECUTE SHUTDOWN_HOSTSYNC-HANDLER # info2admin only AT LOWBATT * EXECUTE LOWBATT-INFO From 99d74b513009d026adf10458b642e61784fb5dd8 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Tue, 7 Oct 2025 10:40:36 +0200 Subject: [PATCH 238/805] conf/upsmon.conf.sample.in: align NOTIFYFLAG samples with NOTIFYMSG definitions [#3084] Also helps NIT generate an upsmon.conf to report those events in tests. Signed-off-by: Jim Klimov --- conf/upsmon.conf.sample.in | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/conf/upsmon.conf.sample.in b/conf/upsmon.conf.sample.in index 0dc09dc48c..1a0be42969 100644 --- a/conf/upsmon.conf.sample.in +++ b/conf/upsmon.conf.sample.in @@ -402,6 +402,7 @@ POWERDOWNFLAG "@POWERDOWNFLAG@" # NOTIFYFLAG COMMOK SYSLOG+WALL # NOTIFYFLAG COMMBAD SYSLOG+WALL # NOTIFYFLAG SHUTDOWN SYSLOG+WALL +# NOTIFYFLAG SHUTDOWN_HOSTSYNC SYSLOG+WALL # NOTIFYFLAG REPLBATT SYSLOG+WALL # NOTIFYFLAG NOCOMM SYSLOG+WALL # NOTIFYFLAG NOPARENT SYSLOG+WALL @@ -413,9 +414,17 @@ POWERDOWNFLAG "@POWERDOWNFLAG@" # NOTIFYFLAG NOTBYPASS SYSLOG+WALL # NOTIFYFLAG ECO SYSLOG+WALL # NOTIFYFLAG NOTECO SYSLOG+WALL +# # NOTIFYFLAG ALARM SYSLOG+WALL # NOTIFYFLAG NOTALARM SYSLOG+WALL # +# NOTIFYFLAG OVER SYSLOG+WALL +# NOTIFYFLAG NOTOVER SYSLOG+WALL +# NOTIFYFLAG TRIM SYSLOG+WALL +# NOTIFYFLAG NOTTRIM SYSLOG+WALL +# NOTIFYFLAG BOOST SYSLOG+WALL +# NOTIFYFLAG NOTBOOST SYSLOG+WALL +# # NOTIFYFLAG OTHER SYSLOG+WALL # NOTIFYFLAG NOTOTHER SYSLOG+WALL # From 7bbedea5aa0bcb6297b8e6844c5b972e4ff423bf Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Tue, 7 Oct 2025 13:44:54 +0200 Subject: [PATCH 239/805] clients/upssched.c: start_timer(): drop unneeded NULLness checks [#3105] Signed-off-by: Jim Klimov --- clients/upssched.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/clients/upssched.c b/clients/upssched.c index b01787ae52..fe8f914a12 100644 --- a/clients/upssched.c +++ b/clients/upssched.c @@ -434,7 +434,7 @@ static void start_timer(const char *name, const char *ofsstr, const char *notify break; } - if (ps == NULL || *ps == NULL) { + if (*ps == NULL) { tmp->notifytypes = xrealloc(tmp->notifytypes, count + 2); tmp->notifytypes[count] = xstrdup(notifytype); tmp->notifytypes[count + 1] = NULL; @@ -457,7 +457,7 @@ static void start_timer(const char *name, const char *ofsstr, const char *notify break; } - if (ps == NULL || *ps == NULL) { + if (*ps == NULL) { tmp->notifymsgs = xrealloc(tmp->notifymsgs, count + 2); tmp->notifymsgs[count] = xstrdup(notifymsg); tmp->notifymsgs[count + 1] = NULL; @@ -480,7 +480,7 @@ static void start_timer(const char *name, const char *ofsstr, const char *notify break; } - if (ps == NULL || *ps == NULL) { + if (*ps == NULL) { tmp->upsnames = xrealloc(tmp->upsnames, count + 2); tmp->upsnames[count] = xstrdup(upsname); tmp->upsnames[count + 1] = NULL; From fe4851f1012e584781f7dac3dccb35a2e2ce7f4e Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Wed, 8 Oct 2025 12:24:23 +0200 Subject: [PATCH 240/805] drivers/mge-hid.c: add Eaton Ellipse PRO 5S1600 [#2380] Signed-off-by: Jim Klimov --- drivers/mge-hid.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/mge-hid.c b/drivers/mge-hid.c index eaed4cb468..5a89bde796 100644 --- a/drivers/mge-hid.c +++ b/drivers/mge-hid.c @@ -52,7 +52,7 @@ # endif #endif /* WIN32 */ -#define MGE_HID_VERSION "MGE HID 1.56" +#define MGE_HID_VERSION "MGE HID 1.57" /* (prev. MGE Office Protection Systems, prev. MGE UPS SYSTEMS) */ /* Eaton */ @@ -1847,6 +1847,8 @@ static models_name_t mge_model_names [] = * https://github.com/networkupstools/nut/issues/2380#issuecomment-3263848849 */ { "Ellipse PRO", "1500 ", EATON_5P, "Eaton 5S1500" }, + /* https://github.com/networkupstools/nut/issues/2380#issuecomment-3380826913 */ + { "Ellipse PRO", "1600 ", EATON_5P, "Eaton 5S1600" }, /* Eaton 9E entry-level series per discussions in * https://github.com/networkupstools/nut/issues/1925 From 8144f600f6d9759c1408284848b05585e212e1f0 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Wed, 8 Oct 2025 13:32:45 +0200 Subject: [PATCH 241/805] configure.ac, scripts/python/Makefile.am: Avoid "make install" writing PyNUT.py and test_nutclient.py to same location twice Signed-off-by: Jim Klimov --- configure.ac | 4 ++++ scripts/python/Makefile.am | 8 ++++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index 83f74193bd..0889cb9de1 100644 --- a/configure.ac +++ b/configure.ac @@ -3599,6 +3599,10 @@ AS_IF([test "${nut_with_nut_monitor}" != no -o "${nut_with_pynut}" != no], [ dnl # Python site-packages installation path for specific Python3 interpreter ]) +dnl Avoid "make install" writing to same location twice +AM_CONDITIONAL(PYTHON_SITE_PACKAGES_IS_PY2, test x"${PYTHON_SITE_PACKAGES}" = x"${PYTHON2_SITE_PACKAGES}") +AM_CONDITIONAL(PYTHON_SITE_PACKAGES_IS_PY3, test x"${PYTHON_SITE_PACKAGES}" = x"${PYTHON3_SITE_PACKAGES}") + dnl ---------------------------------------------------------------------- dnl checks related to --enable-cppcheck diff --git a/scripts/python/Makefile.am b/scripts/python/Makefile.am index a62380bf29..6627798374 100644 --- a/scripts/python/Makefile.am +++ b/scripts/python/Makefile.am @@ -254,17 +254,21 @@ endif if WITH_PYNUT_PY2 +if !PYTHON_SITE_PACKAGES_IS_PY2 pynut_py2_sitedir = $(PYTHON2_SITE_PACKAGES) pynut_py2_site_DATA = $(PYNUT_GENERATED_NOEXEC) pynut_py2_site_SCRIPTS = $(PYNUT_GENERATED_SCRIPT) $(PYNUT_COMMON_CODE) -endif +endif !PYTHON_SITE_PACKAGES_IS_PY2 +endif WITH_PYNUT_PY2 if WITH_PYNUT_PY3 +if !PYTHON_SITE_PACKAGES_IS_PY3 pynut_py3_sitedir = $(PYTHON3_SITE_PACKAGES) pynut_py3_site_DATA = $(PYNUT_GENERATED_NOEXEC) pynut_py3_site_SCRIPTS = $(PYNUT_GENERATED_SCRIPT) $(PYNUT_COMMON_CODE) -endif +endif !PYTHON_SITE_PACKAGES_IS_PY3 +endif WITH_PYNUT_PY3 ################################################################# From d4eac3bc98c228f80ec20cf457330c97e41184c4 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Wed, 8 Oct 2025 17:34:09 +0200 Subject: [PATCH 242/805] docs/man/nutdrv_siemens-sitop.txt, docs/man/Makefile.am, UPGRADING.adoc: Fixed man page naming for `nutdrv_siemens-sitop(.8)` (dash vs. underscore) to match the driver program name [#1209, #545] Signed-off-by: Jim Klimov --- NEWS.adoc | 4 ++++ UPGRADING.adoc | 4 ++++ docs/man/Makefile.am | 6 +++--- ...rv_siemens_sitop.txt => nutdrv_siemens-sitop.txt} | 12 ++++++------ 4 files changed, 17 insertions(+), 9 deletions(-) rename docs/man/{nutdrv_siemens_sitop.txt => nutdrv_siemens-sitop.txt} (95%) diff --git a/NEWS.adoc b/NEWS.adoc index 85b026a970..c492fee1b4 100644 --- a/NEWS.adoc +++ b/NEWS.adoc @@ -164,6 +164,10 @@ several `FSD` notifications into one executed action. [PR #3097] syntax is not supported everywhere (or the `!` operator generally). [#3099, #1660] + - Fixed man page naming for `nutdrv_siemens-sitop(.8)` (dash vs. underscore) + to match the driver program name. Follow-up from slightly botched renaming + in original contribution. [PR #545] + Release notes for NUT 2.8.4 - what's new since 2.8.3 ---------------------------------------------------- diff --git a/UPGRADING.adoc b/UPGRADING.adoc index 51a9de4a75..968e32ecf0 100644 --- a/UPGRADING.adoc +++ b/UPGRADING.adoc @@ -35,6 +35,10 @@ Changes from 2.8.4 to 2.8.5 of this new facility to keep working under both old and new file names. [#3101] +- Fixed man page naming for `nutdrv_siemens-sitop(.8)` (dash vs. underscore) + to match the driver program name. Packaging recipes may have to be updated. + Follow-up from slightly botched renaming in original contribution. [PR #545] + Changes from 2.8.3 to 2.8.4 --------------------------- diff --git a/docs/man/Makefile.am b/docs/man/Makefile.am index 2c308575a0..210b5c707c 100644 --- a/docs/man/Makefile.am +++ b/docs/man/Makefile.am @@ -911,7 +911,7 @@ SRC_SERIAL_PAGES = \ microdowell.txt \ microsol-apc.txt \ nutdrv_hashx.txt \ - nutdrv_siemens_sitop.txt \ + nutdrv_siemens-sitop.txt \ optiups.txt \ powercom.txt \ powerpanel.txt \ @@ -962,7 +962,7 @@ INST_MAN_SERIAL_PAGES = \ microdowell.$(MAN_SECTION_CMD_SYS) \ microsol-apc.$(MAN_SECTION_CMD_SYS) \ nutdrv_hashx.$(MAN_SECTION_CMD_SYS) \ - nutdrv_siemens_sitop.$(MAN_SECTION_CMD_SYS) \ + nutdrv_siemens-sitop.$(MAN_SECTION_CMD_SYS) \ optiups.$(MAN_SECTION_CMD_SYS) \ powercom.$(MAN_SECTION_CMD_SYS) \ powerpanel.$(MAN_SECTION_CMD_SYS) \ @@ -1031,7 +1031,7 @@ INST_HTML_SERIAL_MANS = \ microdowell.html \ microsol-apc.html \ nutdrv_hashx.html \ - nutdrv_siemens_sitop.html \ + nutdrv_siemens-sitop.html \ optiups.html \ powercom.html \ powerpanel.html \ diff --git a/docs/man/nutdrv_siemens_sitop.txt b/docs/man/nutdrv_siemens-sitop.txt similarity index 95% rename from docs/man/nutdrv_siemens_sitop.txt rename to docs/man/nutdrv_siemens-sitop.txt index 11a2fe4883..dc809ddaee 100644 --- a/docs/man/nutdrv_siemens_sitop.txt +++ b/docs/man/nutdrv_siemens-sitop.txt @@ -1,26 +1,26 @@ -NUTDRV_SIEMENS_SITOP(8) +NUTDRV_SIEMENS-SITOP(8) ======================= NAME ---- -nutdrv_siemens_sitop - Driver for the Siemens SITOP UPS500 series UPS +nutdrv_siemens-sitop - Driver for the Siemens SITOP UPS500 series UPS SYNOPSIS -------- -*nutdrv_siemens_sitop* -h +*nutdrv_siemens-sitop* -h -*nutdrv_siemens_sitop* -a 'UPS_NAME' ['OPTIONS'] +*nutdrv_siemens-sitop* -a 'UPS_NAME' ['OPTIONS'] NOTE: This man page only documents the hardware-specific features of the -*nutdrv_siemens_sitop* driver. For information about the core driver, see +*nutdrv_siemens-sitop* driver. For information about the core driver, see linkman:nutupsdrv[8]. SUPPORTED HARDWARE ------------------ -*nutdrv_siemens_sitop* supports Siemens UPS models from the SITOP UPS500 +*nutdrv_siemens-sitop* supports Siemens UPS models from the SITOP UPS500 series. Some models have a serial port, others have a USB port. The models with USB port actually contain a serial-over-USB chip, From bd09c7f686b89bc978129bf6ae0e4c5bda78b793 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Thu, 9 Oct 2025 01:57:31 +0000 Subject: [PATCH 243/805] Drop git-tracked compile script Signed-off-by: Jim Klimov --- .gitignore | 1 + compile | 143 ----------------------------------------------------- 2 files changed, 1 insertion(+), 143 deletions(-) delete mode 100755 compile diff --git a/.gitignore b/.gitignore index 0cc1efc99f..2d32fbb90d 100644 --- a/.gitignore +++ b/.gitignore @@ -21,6 +21,7 @@ Makefile.in /autom4te.cache/ /ChangeLog /ChangeLog.adoc +/compile /config.guess /config.log /config.log.inplace-outer diff --git a/compile b/compile deleted file mode 100755 index c0096a7b56..0000000000 --- a/compile +++ /dev/null @@ -1,143 +0,0 @@ -#! /bin/sh -# Wrapper for compilers which do not understand `-c -o'. - -scriptversion=2009-10-06.20; # UTC - -# Copyright (C) 1999, 2000, 2003, 2004, 2005, 2009 Free Software -# Foundation, Inc. -# Written by Tom Tromey . -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2, or (at your option) -# any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . - -# As a special exception to the GNU General Public License, if you -# distribute this file as part of a program that contains a -# configuration script generated by Autoconf, you may include it under -# the same distribution terms that you use for the rest of that program. - -# This file is maintained in Automake, please report -# bugs to or send patches to -# . - -case $1 in - '') - echo "$0: No command. Try \`$0 --help' for more information." 1>&2 - exit 1; - ;; - -h | --h*) - cat <<\EOF -Usage: compile [--help] [--version] PROGRAM [ARGS] - -Wrapper for compilers which do not understand `-c -o'. -Remove `-o dest.o' from ARGS, run PROGRAM with the remaining -arguments, and rename the output as expected. - -If you are trying to build a whole package this is not the -right script to run: please start by reading the file `INSTALL'. - -Report bugs to . -EOF - exit $? - ;; - -v | --v*) - echo "compile $scriptversion" - exit $? - ;; -esac - -ofile= -cfile= -eat= - -for arg -do - if test -n "$eat"; then - eat= - else - case $1 in - -o) - # configure might choose to run compile as `compile cc -o foo foo.c'. - # So we strip `-o arg' only if arg is an object. - eat=1 - case $2 in - *.o | *.obj) - ofile=$2 - ;; - *) - set x "$@" -o "$2" - shift - ;; - esac - ;; - *.c) - cfile=$1 - set x "$@" "$1" - shift - ;; - *) - set x "$@" "$1" - shift - ;; - esac - fi - shift -done - -if test -z "$ofile" || test -z "$cfile"; then - # If no `-o' option was seen then we might have been invoked from a - # pattern rule where we don't need one. That is ok -- this is a - # normal compilation that the losing compiler can handle. If no - # `.c' file was seen then we are probably linking. That is also - # ok. - exec "$@" -fi - -# Name of file we expect compiler to create. -cofile=`echo "$cfile" | sed 's|^.*[\\/]||; s|^[a-zA-Z]:||; s/\.c$/.o/'` - -# Create the lock directory. -# Note: use `[/\\:.-]' here to ensure that we don't use the same name -# that we are using for the .o file. Also, base the name on the expected -# object file name, since that is what matters with a parallel build. -lockdir=`echo "$cofile" | sed -e 's|[/\\:.-]|_|g'`.d -while true; do - if mkdir "$lockdir" >/dev/null 2>&1; then - break - fi - sleep 1 -done -# FIXME: race condition here if user kills between mkdir and trap. -trap "rmdir '$lockdir'; exit 1" 1 2 15 - -# Run the compile. -"$@" -ret=$? - -if test -f "$cofile"; then - test "$cofile" = "$ofile" || mv "$cofile" "$ofile" -elif test -f "${cofile}bj"; then - test "${cofile}bj" = "$ofile" || mv "${cofile}bj" "$ofile" -fi - -rmdir "$lockdir" -exit $ret - -# Local Variables: -# mode: shell-script -# sh-indentation: 2 -# eval: (add-hook 'write-file-hooks 'time-stamp) -# time-stamp-start: "scriptversion=" -# time-stamp-format: "%:y-%02m-%02d.%02H" -# time-stamp-time-zone: "UTC" -# time-stamp-end: "; # UTC" -# End: From 6a69cabf99f4748e9aa2cdd012a41544c25055be Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Thu, 9 Oct 2025 01:58:12 +0000 Subject: [PATCH 244/805] Makefile.am: EXTRA_DIST the autotools compile script Signed-off-by: Jim Klimov --- Makefile.am | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Makefile.am b/Makefile.am index 3beb1bf4cb..2a11360eef 100644 --- a/Makefile.am +++ b/Makefile.am @@ -173,6 +173,9 @@ EXTRA_DIST += autogen.sh # Help also the tarball users contribute properly: EXTRA_DIST += .editorconfig +# automake xompilation wrapper +EXTRA_DIST += compile + if KEEP_NUT_REPORT nodist_data_DATA = config.nut_report_feature.log endif KEEP_NUT_REPORT From c94550572cee682c8691e58f5f191461a9cf5584 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Fri, 10 Oct 2025 12:38:02 +0200 Subject: [PATCH 245/805] NEWS.adoc: one more Eaton USB ID supported [#2380] Signed-off-by: Jim Klimov --- NEWS.adoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/NEWS.adoc b/NEWS.adoc index c492fee1b4..783ed09d63 100644 --- a/NEWS.adoc +++ b/NEWS.adoc @@ -72,7 +72,7 @@ https://github.com/networkupstools/nut/milestone/12 - `usbhid-ups` driver updates: * Declared support for APC with USB ID `051d:0005` (details may evolve as the devices become better known). [issue #3047, PR #3081] - * Improved support for Eaton 5S1500LCD (US version). [#2380] + * Improved support for Eaton 5S1500LCD and 5S1600LCD (US version). [#2380] * For `ups.status` processing, do not assume that `!online`==`offline`, it may well be that the device just did not report anything (e.g. if it does not really talk USB HID). [#3080] From 455ddcdc16dff329dd026ad2fddb83cbb327d9c7 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Fri, 10 Oct 2025 11:25:30 +0200 Subject: [PATCH 246/805] tests/NIT/nit.sh, tests/NIT/Makefile.am, NEWS.adoc: let test runs started as root in under-provisioned environments tweak user/group to what is available [#1209] Signed-off-by: Jim Klimov --- NEWS.adoc | 6 ++ docs/nut.dict | 3 +- tests/NIT/Makefile.am | 3 + tests/NIT/nit.sh | 205 +++++++++++++++++++++++++++++++++++++----- 4 files changed, 195 insertions(+), 22 deletions(-) diff --git a/NEWS.adoc b/NEWS.adoc index 783ed09d63..507d0c1541 100644 --- a/NEWS.adoc +++ b/NEWS.adoc @@ -164,6 +164,12 @@ several `FSD` notifications into one executed action. [PR #3097] syntax is not supported everywhere (or the `!` operator generally). [#3099, #1660] + - The NUT Integration Testing suite (NIT) script, if started as `root`, + can now consult its run-time situation vs. `BUILTIN_RUN_AS_USER` and + `BUILTIN_RUN_AS_GROUP` environment variables, and if those accounts + do not exist (e.g. running in a packaging build root), a different + value like "nobody" or "nogroup" would be defaulted for tests. [#1209] + - Fixed man page naming for `nutdrv_siemens-sitop(.8)` (dash vs. underscore) to match the driver program name. Follow-up from slightly botched renaming in original contribution. [PR #545] diff --git a/docs/nut.dict b/docs/nut.dict index af914be15d..22ff561205 100644 --- a/docs/nut.dict +++ b/docs/nut.dict @@ -1,4 +1,4 @@ -personal_ws-1.1 en 3557 utf-8 +personal_ws-1.1 en 3558 utf-8 AAC AAS ABI @@ -105,6 +105,7 @@ BTEST BTS BTV BUFRD +BUILTIN BUZ BVKnnnnM BVKxxxM diff --git a/tests/NIT/Makefile.am b/tests/NIT/Makefile.am index 72e3d08200..40af57864f 100644 --- a/tests/NIT/Makefile.am +++ b/tests/NIT/Makefile.am @@ -22,6 +22,7 @@ endif # Avoid running "$<" - not all make implementations handle that check-NIT: $(abs_srcdir)/nit.sh GREP="$(GREP)"; EGREP="$(EGREP)"; export GREP; export EGREP; \ + BUILTIN_RUN_AS_USER='$(RUN_AS_USER)' BUILTIN_RUN_AS_GROUP='$(RUN_AS_GROUP)' \ "$(abs_srcdir)/nit.sh" # Make sure pre-requisites for NIT are fresh as we iterate @@ -41,6 +42,7 @@ check-NIT-sandbox: $(abs_srcdir)/nit.sh [ -n "$${DEBUG_SLEEP-}" ] && [ "$${DEBUG_SLEEP-}" -gt 0 ] || DEBUG_SLEEP=600 ; export DEBUG_SLEEP ; \ LANG=C LC_ALL=C TZ=UTC \ NUT_PORT=$(NUT_PORT) NIT_CASE="$(NIT_CASE)" NUT_FOREGROUND_WITH_PID=true \ + BUILTIN_RUN_AS_USER='$(RUN_AS_USER)' BUILTIN_RUN_AS_GROUP='$(RUN_AS_GROUP)' \ "$(abs_srcdir)/nit.sh" check-NIT-sandbox-devel: $(abs_srcdir)/nit.sh @@ -48,6 +50,7 @@ check-NIT-sandbox-devel: $(abs_srcdir)/nit.sh GREP="$(GREP)"; EGREP="$(EGREP)"; export GREP; export EGREP; \ LANG=C LC_ALL=C TZ=UTC \ NUT_PORT=$(NUT_PORT) NIT_CASE="$(NIT_CASE)" NUT_FOREGROUND_WITH_PID=true \ + BUILTIN_RUN_AS_USER='$(RUN_AS_USER)' BUILTIN_RUN_AS_GROUP='$(RUN_AS_GROUP)' \ $(MAKE) $(AM_MAKEFLAGS) check-NIT-devel SPELLCHECK_SRC = README.adoc diff --git a/tests/NIT/nit.sh b/tests/NIT/nit.sh index eae6e7c394..4692915144 100755 --- a/tests/NIT/nit.sh +++ b/tests/NIT/nit.sh @@ -35,6 +35,16 @@ # properly work in whatever different OSes have (bash, dash, # ksh, busybox sh...) # +# Special considerations for starting the tests as "root": +# * See I_AM_ROOT evaluation and conditional uses in code below for the +# most authoritative reference. +# * More liberal permissions to TESTDIR, STATEPATH and configuration files +# than when a non-root user started the test suite right away and could +# only constrain access to allow itself. +# * BUILTIN_RUN_AS_USER and BUILTIN_RUN_AS_GROUP envvars would be consulted +# and if those accounts do not exist (e.g. in a packaging build root), a +# different value like "nobody" or "nogroup" would be defaulted for test. +# # Copyright # 2022-2025 Jim Klimov # @@ -323,12 +333,153 @@ PID_DUMMYUPS="" PID_DUMMYUPS1="" PID_DUMMYUPS2="" +# Platforms vary in abilities to report this... +I_AM_NAME="" +get_my_user_name() { + if [ x"${I_AM_NAME}" != x ]; then + # Use cache + echo "${I_AM_NAME}" + return + fi + + _ME="`whoami 2>/dev/null`" && [ x"${_ME}" != x ] \ + || { _ME="`ps -ef 2>/dev/null | grep -v grep | grep $$`" && [ x"${_ME}" != x ] ; } \ + || { _ME="`ps -xawwu 2>/dev/null | grep -v grep | grep $$`" && [ x"${_ME}" != x ] ; } \ + || _ME="" + + if [ x"${_ME}" != x ] ; then + echo "${_ME}" + return + fi + + # TOTHINK: Fallback to get "my current user": touch a file and see who owns it? + + # Non-numeric (empty) stdout; non-successful exit code + return 1 +} + +get_user_id() { + if _ID="`id -u ${1-} 2>/dev/null`" \ + && [ "${_ID}" -ge 0 ] 2>/dev/null ; then echo "${_ID}"; return ; fi + if _ID="`id ${1-} 2>/dev/null | sed -e 's,^.*uid=,,' -e 's,(.*$,,'`" \ + && [ "${_ID}" -ge 0 ] 2>/dev/null ; then echo "${_ID}"; return ; fi + if [ x"${1-}" != x ] 2>/dev/null && _ID="`getent passwd "$1" 2>/dev/null | awk -F: '{print $3}'`" \ + && [ "${_ID}" -ge 0 ] 2>/dev/null ; then echo "${_ID}"; return ; fi + + # Fallback + if [ x"${1-}" = x ] 2>/dev/null ; then + if _ME="`get_my_user_name`" 2>/dev/null && [ x"${_ME}" != x ] ; then + _RES=0 + get_user_id "${_ME}" || _RES=$? + return ${_RES} + fi + fi + + # Non-numeric (empty) stdout; non-successful exit code + return 1 +} + +get_group_id() { + if _ID="`id -g ${1-} 2>/dev/null`" \ + && [ "${_ID}" -ge 0 ] 2>/dev/null ; then echo "${_ID}"; return ; fi + if _ID="`id ${1-} 2>/dev/null | sed -e 's,^.*gid=,,' -e 's,(.*$,,'`" \ + && [ "${_ID}" -ge 0 ] 2>/dev/null ; then echo "${_ID}"; return ; fi + if [ x"${1-}" != x ] 2>/dev/null && _ID="`getent group "$1" 2>/dev/null | awk -F: '{print $3}'`" \ + && [ "${_ID}" -ge 0 ] 2>/dev/null ; then echo "${_ID}"; return ; fi + + # TOTHINK: Fallback to get "my current group": touch a file and see who owns it? + + # Non-numeric (empty) stdout; non-successful exit code + return 1 +} + +I_AM_NAME="`get_my_user_name`" +I_AM_NAME_REPORT="'${I_AM_NAME}'" I_AM_ROOT=false -if ( [ "`id -u`" = 0 ] ) 2>/dev/null ; then +if [ "`get_user_id`" = 0 ] ; then + if [ x"${I_AM_NAME}" = x ]; then + log_warn "Seems we have started as UID 0, but could not detect user name: assuming 'root'" + else if [ x"${I_AM_NAME}" != xroot ]; then + log_warn "Seems we have started as UID 0, but detected user name was not 'root': '${I_AM_NAME}'" + I_AM_NAME_REPORT="'${I_AM_NAME}' (root?)" + fi; fi I_AM_ROOT=true -else - if id | sed -e 's,(.*$,,' -e 's,^.*uid=,,' | ${EGREP} '^0$' >/dev/null ; then - I_AM_ROOT=true +fi + +# We have a certain problem when the requested user account does not exist: +# our `common::get_user_pwent()` aborts with `fatalx()` during such a check for +# validity of built-in or CLI-requested account (sometimes before even looking +# at any config files), and fails like "OS user upsd not found". Note we do not +# currently have similar troubles for groups (and interactions with customizing +# them seem limited to `chgrp()` of driver-upsd local socket). +# While this should not happen in real life, it can on test or packaging +# systems that did not provision the accounts (claimed by a NUT build) for +# the build/test run-time environment. In this case, tweak it into something +# we know exists (current non-root user explicitly, or a commonly available +# name if we are running as root). +TWEAK_RUN_AS_USER="" +TWEAK_RUN_AS_GROUP="" +ARG_USER="" +if [ x"${BUILTIN_RUN_AS_USER}" != x ] ; then + if [ "`get_user_id "${BUILTIN_RUN_AS_USER}"`" -ge 0 ] 2>/dev/null; then + # Do not bother to re-evaluate more IDs to rule out aliases - many names on same ID? + if $I_AM_ROOT || [ x"${I_AM_NAME}" = x"${BUILTIN_RUN_AS_USER}" ] ; then + log_info "Started as ${I_AM_NAME_REPORT}, and built-in RUN_AS_USER='${BUILTIN_RUN_AS_USER}' seems present on this system to run test daemons as" + else + log_info "Started as ${I_AM_NAME_REPORT}, and built-in RUN_AS_USER='${BUILTIN_RUN_AS_USER}' seems present on this system (but we would run test daemons as current unprivileged user)" + fi + else + # The string allegedly built into NUT binaries is unknown to the + # account identification databases of this runtime environment... + if $I_AM_ROOT ; then + for U in nobody daemon bin ; do + if [ "`get_user_id "${U}"`" -ge 0 ] ; then + TWEAK_RUN_AS_USER="${U}" + break + fi + done + else + TWEAK_RUN_AS_USER="${I_AM_NAME}" + fi + + if [ x"${TWEAK_RUN_AS_USER}" = x ] ; then + log_warn "Started as ${I_AM_NAME_REPORT}, and built-in RUN_AS_USER='${BUILTIN_RUN_AS_USER}' seems absent on this system, and did not find a common alternative to run test daemons as; NIT suite can fail below!" + else + log_warn "Started as ${I_AM_NAME_REPORT}, and built-in RUN_AS_USER='${BUILTIN_RUN_AS_USER}' seems absent on this system, will run test daemons as '${TWEAK_RUN_AS_USER}'" + # Needed e.g. for upsd, its config has no RUN_AS_USER setting + ARG_USER="-u ${TWEAK_RUN_AS_USER}" + fi + fi +fi + +if [ x"${BUILTIN_RUN_AS_GROUP}" != x ] ; then + # Note: GID setting is not much used in NUT code at the moment: + # * In `drivers/main.c` we can set FS access for the pipe to data server + # * Otherwise in `common.c::become_user()` we try to assume the default + # GID of that user account we were asked to switch into. + if [ "`get_group_id "${BUILTIN_RUN_AS_GROUP}"`" -ge 0 ] 2>/dev/null ; then + # Do not bother to re-evaluate more IDs to rule out aliases - many names on same ID? + # TOTHINK: Would need I_AM_GROUP first?.. + if $I_AM_ROOT ; then + log_info "Started as ${I_AM_NAME_REPORT}, and built-in RUN_AS_GROUP='${BUILTIN_RUN_AS_GROUP}' seems present on this system to run test daemons as" + else + log_info "Started as ${I_AM_NAME_REPORT}, and built-in RUN_AS_GROUP='${BUILTIN_RUN_AS_GROUP}' seems present on this system (but we would run test daemons as current unprivileged user and untweaked group)" + fi + else + # The string allegedly built into NUT binaries is unknown to the + # account identification databases of this runtime environment... + for G in nobody nogroup daemon bin ; do + if [ "`get_group_id "${G}"`" -ge 0 ] ; then + TWEAK_RUN_AS_GROUP="${G}" + break + fi + done + + if [ x"${TWEAK_RUN_AS_GROUP}" = x ] ; then + log_warn "Started as ${I_AM_NAME_REPORT}, and built-in RUN_AS_GROUP='${BUILTIN_RUN_AS_GROUP}' seems absent on this system, and did not find a common alternative to run test daemons as; NIT suite can fail below!" + else + log_warn "Started as ${I_AM_NAME_REPORT}, and built-in RUN_AS_GROUP='${BUILTIN_RUN_AS_GROUP}' seems absent on this system, will run test daemons as '${TWEAK_RUN_AS_GROUP}'" + fi fi fi @@ -345,7 +496,7 @@ else if $I_AM_ROOT ; then case "${TESTDIR}" in "${HOME}"/*) - log_info "Test script was started by 'root' and '${TESTDIR}' seems to be under its home, will mktemp so unprivileged daemons may access their configs, pipes and PID files" + log_info "Test script was started by ${I_AM_NAME_REPORT} and '${TESTDIR}' seems to be under its home, will mktemp so unprivileged daemons may access their configs, pipes and PID files" TESTDIR="" ;; esac @@ -396,7 +547,7 @@ mkdir -p "${TESTDIR}/etc" "${TESTDIR}/run" && chmod 750 "${TESTDIR}/run" \ || die "Failed to create temporary FS structure for the NIT" if $I_AM_ROOT ; then - log_info "Test script was started by 'root' - expanding permissions for '${TESTDIR}/run' so unprivileged daemons may create pipes and PID files there" + log_info "Test script was started by ${I_AM_NAME_REPORT} - expanding permissions for '${TESTDIR}/run' so unprivileged daemons may create pipes and PID files there" chmod 777 "${TESTDIR}/run" fi @@ -538,7 +689,8 @@ EOF [ $? = 0 ] || die "Failed to populate temporary FS structure for the NIT: upsd.conf" if $I_AM_ROOT ; then - log_info "Test script was started by 'root' - expanding permissions for '$NUT_CONFPATH/upsd.conf' so unprivileged daemons (after de-elevation) may read it" + log_info "Test script was started by ${I_AM_NAME_REPORT} - expanding permissions for '$NUT_CONFPATH/upsd.conf' so unprivileged daemons (after de-elevation) may read it" + # NOTE: No RUN_AS_USER in upsd.conf currently; tweaking via CLI args if needed chmod 644 "$NUT_CONFPATH/upsd.conf" else chmod 640 "$NUT_CONFPATH/upsd.conf" @@ -606,7 +758,7 @@ EOF [ $? = 0 ] || die "Failed to populate temporary FS structure for the NIT: upsd.users" if $I_AM_ROOT ; then - log_info "Test script was started by 'root' - expanding permissions for '$NUT_CONFPATH/upsd.users' so unprivileged daemons (after de-elevation) may read it" + log_info "Test script was started by ${I_AM_NAME_REPORT} - expanding permissions for '$NUT_CONFPATH/upsd.users' so unprivileged daemons (after de-elevation) may read it" chmod 644 "$NUT_CONFPATH/upsd.users" else chmod 640 "$NUT_CONFPATH/upsd.users" @@ -672,12 +824,16 @@ generatecfg_upsmon_trivial() { || die "Failed to populate temporary FS structure for the NIT: upssched.conf" if $I_AM_ROOT ; then - log_info "Test script was started by 'root' - expanding permissions for '$NUT_CONFPATH/upsmon.conf' and '$NUT_CONFPATH/upssched.conf' so unprivileged daemons (after de-elevation) may read them" + log_info "Test script was started by ${I_AM_NAME_REPORT} - expanding permissions for '$NUT_CONFPATH/upsmon.conf' and '$NUT_CONFPATH/upssched.conf' so unprivileged daemons (after de-elevation) may read them" chmod 644 "$NUT_CONFPATH/upsmon.conf" "$NUT_CONFPATH/upssched.conf" else chmod 640 "$NUT_CONFPATH/upsmon.conf" "$NUT_CONFPATH/upssched.conf" fi + if [ x"${TWEAK_RUN_AS_USER}" != x ] ; then + echo "RUN_AS_USER ${TWEAK_RUN_AS_USER}" >> "$NUT_CONFPATH/upsmon.conf" + fi + if [ $# -gt 0 ] ; then updatecfg_upsmon_supplies "$1" fi @@ -737,11 +893,18 @@ generatecfg_ups_trivial() { ) || die "Failed to populate temporary FS structure for the NIT: ups.conf" if $I_AM_ROOT ; then - log_info "Test script was started by 'root' - expanding permissions for '$NUT_CONFPATH/ups.conf' so unprivileged daemons (after de-elevation) may read it" + log_info "Test script was started by ${I_AM_NAME_REPORT} - expanding permissions for '$NUT_CONFPATH/ups.conf' so unprivileged daemons (after de-elevation) may read it" chmod 644 "$NUT_CONFPATH/ups.conf" else chmod 640 "$NUT_CONFPATH/ups.conf" fi + + if [ x"${TWEAK_RUN_AS_USER}" != x ] ; then + echo "user ${TWEAK_RUN_AS_USER}" >> "$NUT_CONFPATH/ups.conf" + fi + if [ x"${TWEAK_RUN_AS_GROUP}" != x ] ; then + echo "group ${TWEAK_RUN_AS_GROUP}" >> "$NUT_CONFPATH/ups.conf" + fi } generatecfg_ups_dummy() { @@ -812,7 +975,7 @@ testcase_upsd_no_configs_at_all() { if [ -n "${NUT_DEBUG_LEVEL_UPSD-}" ]; then NUT_DEBUG_LEVEL="${NUT_DEBUG_LEVEL_UPSD}" fi - upsd ${ARG_FG} + upsd ${ARG_FG} ${ARG_USER} if [ "$?" = 0 ]; then log_error "[testcase_upsd_no_configs_at_all] upsd should fail without configs" FAILED="`expr $FAILED + 1`" @@ -831,7 +994,7 @@ testcase_upsd_no_configs_driver_file() { if [ -n "${NUT_DEBUG_LEVEL_UPSD-}" ]; then NUT_DEBUG_LEVEL="${NUT_DEBUG_LEVEL_UPSD}" fi - upsd ${ARG_FG} + upsd ${ARG_FG} ${ARG_USER} if [ "$?" = 0 ]; then log_error "[testcase_upsd_no_configs_driver_file] upsd should fail without driver config file" FAILED="`expr $FAILED + 1`" @@ -851,7 +1014,7 @@ testcase_upsd_no_configs_in_driver_file() { if [ -n "${NUT_DEBUG_LEVEL_UPSD-}" ]; then NUT_DEBUG_LEVEL="${NUT_DEBUG_LEVEL_UPSD}" fi - upsd ${ARG_FG} + upsd ${ARG_FG} ${ARG_USER} if [ "$?" = 0 ]; then log_error "[testcase_upsd_no_configs_in_driver_file] upsd should fail without drivers defined in config file" FAILED="`expr $FAILED + 1`" @@ -873,7 +1036,7 @@ upsd_start_loop() { if [ -n "${NUT_DEBUG_LEVEL_UPSD-}" ]; then NUT_DEBUG_LEVEL="${NUT_DEBUG_LEVEL_UPSD}" fi - upsd ${ARG_FG} & + upsd ${ARG_FG} ${ARG_USER} & PID_UPSD="$!" NUT_DEBUG_LEVEL="${NUT_DEBUG_LEVEL_ORIG}" log_debug "[${TESTCASE}] Tried to start UPSD as PID $PID_UPSD" @@ -907,7 +1070,7 @@ upsd_start_loop() { if [ -n "${NUT_DEBUG_LEVEL_UPSD-}" ]; then NUT_DEBUG_LEVEL="${NUT_DEBUG_LEVEL_UPSD}" fi - upsd ${ARG_FG} & + upsd ${ARG_FG} ${ARG_USER} & PID_UPSD="$!" NUT_DEBUG_LEVEL="${NUT_DEBUG_LEVEL_ORIG}" log_warn "[${TESTCASE}] Tried to start UPSD again, now as PID $PID_UPSD" @@ -1058,17 +1221,17 @@ sandbox_start_drivers() { if [ -n "${NUT_DEBUG_LEVEL_DRIVERS-}" ]; then NUT_DEBUG_LEVEL="${NUT_DEBUG_LEVEL_DRIVERS}" fi - #upsdrvctl ${ARG_FG} start dummy & - dummy-ups -a dummy ${ARG_FG} & + #upsdrvctl ${ARG_FG} ${ARG_USER} start dummy & + dummy-ups -a dummy ${ARG_USER} ${ARG_FG} & PID_DUMMYUPS="$!" log_debug "Tried to start dummy-ups driver for 'dummy' as PID $PID_DUMMYUPS" if [ x"${TOP_SRCDIR}" != x ]; then - dummy-ups -a UPS1 ${ARG_FG} & + dummy-ups -a UPS1 ${ARG_USER} ${ARG_FG} & PID_DUMMYUPS1="$!" log_debug "Tried to start dummy-ups driver for 'UPS1' as PID $PID_DUMMYUPS1" - dummy-ups -a UPS2 ${ARG_FG} & + dummy-ups -a UPS2 ${ARG_USER} ${ARG_FG} & PID_DUMMYUPS2="$!" log_debug "Tried to start dummy-ups driver for 'UPS2' as PID $PID_DUMMYUPS2" fi @@ -1160,7 +1323,7 @@ testcase_sandbox_start_upsd_after_drivers() { if [ -n "${NUT_DEBUG_LEVEL_UPSD-}" ]; then NUT_DEBUG_LEVEL="${NUT_DEBUG_LEVEL_UPSD}" fi - upsd ${ARG_FG} & + upsd ${ARG_FG} ${ARG_USER} & PID_UPSD="$!" NUT_DEBUG_LEVEL="${NUT_DEBUG_LEVEL_ORIG}" log_debug "[testcase_sandbox_start_upsd_after_drivers] Tried to start UPSD as PID $PID_UPSD" @@ -1653,7 +1816,7 @@ upsmon_start_loop() { # but the sample script honours NUT_DEBUG_LEVEL_UPSSCHED if set NUT_DEBUG_LEVEL="${NUT_DEBUG_LEVEL_UPSMON}" fi - upsmon ${ARG_FG} & + upsmon ${ARG_FG} ${ARG_USER} & PID_UPSMON="$!" NUT_DEBUG_LEVEL="${NUT_DEBUG_LEVEL_ORIG}" log_debug "[${TESTCASE}] Tried to start UPSMON as PID $PID_UPSMON" From b564282bb53ca2ecf040c6e909343f749b3ddfdf Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Fri, 10 Oct 2025 15:56:41 +0200 Subject: [PATCH 247/805] m4/nut_check_python.m4: try harder to report the "purelib" location as PYTHON*_SITE_PACKAGES [#1209] Signed-off-by: Jim Klimov --- NEWS.adoc | 3 +++ UPGRADING.adoc | 4 ++++ docs/nut.dict | 1 + m4/nut_check_python.m4 | 17 ++++++++++++++--- 4 files changed, 22 insertions(+), 3 deletions(-) diff --git a/NEWS.adoc b/NEWS.adoc index 507d0c1541..f664b36a4e 100644 --- a/NEWS.adoc +++ b/NEWS.adoc @@ -174,6 +174,9 @@ several `FSD` notifications into one executed action. [PR #3097] to match the driver program name. Follow-up from slightly botched renaming in original contribution. [PR #545] + - The `configure` script should now try harder to report specifically + the "purelib" location as `PYTHON*_SITE_PACKAGES`. [#1209] + Release notes for NUT 2.8.4 - what's new since 2.8.3 ---------------------------------------------------- diff --git a/UPGRADING.adoc b/UPGRADING.adoc index 968e32ecf0..840ee3473d 100644 --- a/UPGRADING.adoc +++ b/UPGRADING.adoc @@ -39,6 +39,10 @@ Changes from 2.8.4 to 2.8.5 to match the driver program name. Packaging recipes may have to be updated. Follow-up from slightly botched renaming in original contribution. [PR #545] +- The `configure` script should now try harder to report specifically + the "purelib" location as `PYTHON*_SITE_PACKAGES`. Packaging recipes + may have to be updated. [#1209] + Changes from 2.8.3 to 2.8.4 --------------------------- diff --git a/docs/nut.dict b/docs/nut.dict index 22ff561205..788742fdef 100644 --- a/docs/nut.dict +++ b/docs/nut.dict @@ -2882,6 +2882,7 @@ pts ptv pty pulizzi +purelib pv pw pwd diff --git a/m4/nut_check_python.m4 b/m4/nut_check_python.m4 index 873aad7196..ef1a020bc0 100644 --- a/m4/nut_check_python.m4 +++ b/m4/nut_check_python.m4 @@ -136,8 +136,12 @@ AC_DEFUN([NUT_CHECK_PYTHON], printf "Using caller-provided location... " nut_cv_PYTHON_SITE_PACKAGES="${nut_with_python_modules_dir}"], [printf "Using interpreter-provided location... " - dnl sysconfig introduced in python3.2 - AS_IF([test x"`${PYTHON} -c 'import sys; print (sys.version_info >= (3, 2))'`" = xTrue], + dnl sysconfig introduced in python3.2 and 2.7 according to + dnl https://docs.python.org/3/library/sysconfig.html + dnl https://docs.python.org/2.7/library/sysconfig.html + dnl Note that the list at getsitepackages() MAY start + dnl with a "platlib" location (including compiled code): + AS_IF([test x"`${PYTHON} -c 'import sys; print (sys.version_info >= (3, 2))'`" = xTrue || test x"`${PYTHON} -c 'import sys; print (sys.version_info >= (2, 7) and sys.version_info < (3, 0))'`"], [nut_cv_PYTHON_SITE_PACKAGES="`${PYTHON} -c 'import sysconfig; print(sysconfig.get_path("purelib"))'`"], [nut_cv_PYTHON_SITE_PACKAGES="`${PYTHON} -c 'import site; print(site.getsitepackages().pop(0))'`"]) ] @@ -272,7 +276,12 @@ AC_DEFUN([NUT_CHECK_PYTHON2], printf "Using caller-provided location... " nut_cv_PYTHON2_SITE_PACKAGES="${nut_with_python2_modules_dir}"], [printf "Using interpreter-provided location... " - nut_cv_PYTHON2_SITE_PACKAGES="`${PYTHON2} -c 'import site; print(site.getsitepackages().pop(0))'`" + dnl sysconfig introduced in python2.7 according to + dnl Note that the list at getsitepackages() MAY start + dnl with a "platlib" location (including compiled code): + AS_IF([test x"`${PYTHON2} -c 'import sys; print (sys.version_info >= (2, 7) and sys.version_info < (3, 0))'`"], + [nut_cv_PYTHON2_SITE_PACKAGES="`${PYTHON2} -c 'import sysconfig; print(sysconfig.get_path("purelib"))'`"], + [nut_cv_PYTHON2_SITE_PACKAGES="`${PYTHON2} -c 'import site; print(site.getsitepackages().pop(0))'`"]) ] ) AS_CASE(["$nut_cv_PYTHON2_SITE_PACKAGES"], @@ -406,6 +415,8 @@ AC_DEFUN([NUT_CHECK_PYTHON3], nut_cv_PYTHON3_SITE_PACKAGES="${nut_with_python3_modules_dir}"], [printf "Using interpreter-provided location... " dnl sysconfig introduced in python3.2 + dnl Note that the list at getsitepackages() MAY start + dnl with a "platlib" location (including compiled code): AS_IF([test x"`${PYTHON3} -c 'import sys; print (sys.version_info >= (3, 2))'`" = xTrue], [nut_cv_PYTHON3_SITE_PACKAGES="`${PYTHON3} -c 'import sysconfig; print(sysconfig.get_path("purelib"))'`"], [nut_cv_PYTHON3_SITE_PACKAGES="`${PYTHON3} -c 'import site; print(site.getsitepackages().pop(0))'`"]) From 5eca1989f4e6bc157464fe997ae604f2d620cc0c Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Fri, 10 Oct 2025 16:21:18 +0200 Subject: [PATCH 248/805] scripts/upsdrvsvcctl/nut-driver-enumerator.sh.in: fix svccfg setprop for multiple DEPSVC FMRIs [#3099] Signed-off-by: Jim Klimov Co-authored-by: Nick Briggs --- scripts/upsdrvsvcctl/nut-driver-enumerator.sh.in | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/scripts/upsdrvsvcctl/nut-driver-enumerator.sh.in b/scripts/upsdrvsvcctl/nut-driver-enumerator.sh.in index 3a231e575e..5a9f8aa56e 100644 --- a/scripts/upsdrvsvcctl/nut-driver-enumerator.sh.in +++ b/scripts/upsdrvsvcctl/nut-driver-enumerator.sh.in @@ -807,13 +807,16 @@ smf_registerInstance() { [ -n "$DEPREQ" ] || DEPREQ="optional_all" echo "Adding '$DEPREQ' dependency for '$SVCINST' on '$DEPSVC'..." + # NOTE: it seems (at least as of Solaris 11) that the fmri: definition + # below (especially when there are many dependency FMRI's) must be a + # multi-token list with parentheses, not a single quoted string. DEPPG="nut-driver-enumerator-generated" RESTARTON="refresh" /usr/sbin/svccfg -s "$TARGET_FMRI" addpg "$DEPPG" dependency && \ /usr/sbin/svccfg -s "$TARGET_FMRI" setprop "$DEPPG"/grouping = astring: "$DEPREQ" && \ /usr/sbin/svccfg -s "$TARGET_FMRI" setprop "$DEPPG"/restart_on = astring: "$RESTARTON" && \ /usr/sbin/svccfg -s "$TARGET_FMRI" setprop "$DEPPG"/type = astring: service && \ - /usr/sbin/svccfg -s "$TARGET_FMRI" setprop "$DEPPG"/entities = fmri: "($DEPSVC)" && \ + /usr/sbin/svccfg -s "$TARGET_FMRI" setprop "$DEPPG"/entities = fmri: "(" $DEPSVC ")" && \ echo "OK" || echo "FAILED to define the dependency" >&2 fi From 86ca46ad1b4954f8b4eb597ba0322084cfe05ff2 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Thu, 9 Oct 2025 01:57:31 +0000 Subject: [PATCH 249/805] Drop git-tracked compile script Signed-off-by: Jim Klimov --- NEWS.adoc | 4 ++++ UPGRADING.adoc | 7 +++++++ 2 files changed, 11 insertions(+) diff --git a/NEWS.adoc b/NEWS.adoc index f664b36a4e..2aaaccffcf 100644 --- a/NEWS.adoc +++ b/NEWS.adoc @@ -152,6 +152,10 @@ several `FSD` notifications into one executed action. [PR #3097] - Updated `docs/*.txt`: add asciidoc comments with links to nut-website rendered contents of most interesting pages. [#3095] + - Dropped the `compile` script from Git sources. It originates from automake + and is added to work area (if missing) during `autogen.sh` rituals anyway. + It is still distributed as part of `make dist` tarball. [#1209] + - Revised CI and deliverable scripts, and Makefile recipes, to not use the verbatim `grep -E` (loudly preferred by newer systems, but may be absent on older ones) after all, nor use `egrep` (loudly disliked by diff --git a/UPGRADING.adoc b/UPGRADING.adoc index 840ee3473d..cb476f902d 100644 --- a/UPGRADING.adoc +++ b/UPGRADING.adoc @@ -26,6 +26,13 @@ Changes from 2.8.4 to 2.8.5 - PLANNED: Keep track of any further API clean-up? +- Dropped the `compile` script from Git sources. It originates from automake + and is added to work area (if missing) during `autogen.sh` rituals anyway + (as `make` says, `'automake --add-missing' can install 'compile'` when you + run without it). It is still distributed as part of `make dist` tarball. + We are open to any feedback whether this removal impacts NUT rebuilds on + any systems. [#1209] + - In drivers using the common `main.c` and `main.h` framework, introduced a `void upsdrv_tweak_prognames(void)` required method (may be no-op) to optionally tweak `prognames[]` entries now that there is certain support From cb58fedd3e34707daf906dbc0c6a7275777e424f Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Sat, 11 Oct 2025 21:10:23 +0200 Subject: [PATCH 250/805] configure.ac, NEWS.adoc, UPGRADING.adoc: `PIDPATH` is now more strictly `/var/run`, unless `/run` is more preferable for good reason [#3099] Signed-off-by: Jim Klimov --- NEWS.adoc | 4 ++++ UPGRADING.adoc | 6 ++++++ configure.ac | 18 ++++++++++++++++-- 3 files changed, 26 insertions(+), 2 deletions(-) diff --git a/NEWS.adoc b/NEWS.adoc index 2aaaccffcf..be52777955 100644 --- a/NEWS.adoc +++ b/NEWS.adoc @@ -156,6 +156,10 @@ several `FSD` notifications into one executed action. [PR #3097] and is added to work area (if missing) during `autogen.sh` rituals anyway. It is still distributed as part of `make dist` tarball. [#1209] + - Default `PIDPATH` is now more strictly `/var/run`, unless building on a + system conforming to FHS-3.0 standard where that location is absent or + is a symlink, while `/run` exists and is a true directory. [#3099] + - Revised CI and deliverable scripts, and Makefile recipes, to not use the verbatim `grep -E` (loudly preferred by newer systems, but may be absent on older ones) after all, nor use `egrep` (loudly disliked by diff --git a/UPGRADING.adoc b/UPGRADING.adoc index cb476f902d..037d4654e7 100644 --- a/UPGRADING.adoc +++ b/UPGRADING.adoc @@ -33,6 +33,12 @@ Changes from 2.8.4 to 2.8.5 We are open to any feedback whether this removal impacts NUT rebuilds on any systems. [#1209] +- Default `PIDPATH` is now more strictly `/var/run`, unless building on a + system conforming to FHS-3.0 standard where that location is absent or + is a symlink, while `/run` exists and is a true directory. Package recipes + usually override `--with-pidpath` anyway to provide a dedicated location + for NUT `root`-owned daemon PID files. [#3099] + - In drivers using the common `main.c` and `main.h` framework, introduced a `void upsdrv_tweak_prognames(void)` required method (may be no-op) to optionally tweak `prognames[]` entries now that there is certain support diff --git a/configure.ac b/configure.ac index 0889cb9de1..41000888fa 100644 --- a/configure.ac +++ b/configure.ac @@ -388,11 +388,25 @@ STATEPATH="/var/state/ups" dnl Historically this refers to *system location* for PID files, dnl and more specifically that for `upsmon` (running as `root`). +dnl +dnl Note that by default we directly use the path that commonly +dnl exists on a system (see the likes of `man filesystem` or +dnl `man hier` for the "public" structure of the directory hierarchy +dnl accepted in an OS distribution), while usage of sub-directories +dnl like `/var/run/nut/...` can be explicitly configured on systems +dnl where our packaging, init-scripts, tmpfiles manifests etc. can +dnl ensure that these locations would exist and be properly owned. +dnl dnl See also ALTPIDPATH (defaulted to STATEPATH) setting below dnl for the unprivileged daemons (`upsd`, drivers). PIDPATH="/var/run" -dnl Honour new LFS recommendations if applied on the build system: -AS_IF([test -d "/run"], [PIDPATH="/run"]) +dnl Honour new FHS-3.0 recommendations if applied on the build +dnl system (but do still prefer '/var/run' if usable); see also +dnl https://en.wikipedia.org/wiki/Filesystem_Hierarchy_Standard : +AS_IF([test ! -d "${PIDPATH}" -o -h "${PIDPATH}" && test -d "/run" -a ! -h "/run"], [ + AC_MSG_NOTICE([This system seems to prefer '/run' over '${PIDPATH}': adjusting default PIDPATH]) + PIDPATH="/run" +]) AC_CHECK_PROGS([GETENT], [getent], []) AC_CHECK_PROGS([ID], [id], []) From 3bb94ad361924ffefda15ac2ed68b775a9f067b8 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Sat, 11 Oct 2025 21:12:28 +0200 Subject: [PATCH 251/805] docs/config-notes.txt, docs/configure.txt, docs/man/nut.txt, docs/man/upsmon.conf.txt: clarify /run vs. /var/run [#3099] Signed-off-by: Jim Klimov --- docs/config-notes.txt | 4 +++- docs/configure.txt | 16 ++++++++++++++-- docs/man/nut.txt | 6 +++--- docs/man/upsmon.conf.txt | 3 ++- 4 files changed, 22 insertions(+), 7 deletions(-) diff --git a/docs/config-notes.txt b/docs/config-notes.txt index fa87e70e38..12e139b3a8 100644 --- a/docs/config-notes.txt +++ b/docs/config-notes.txt @@ -584,7 +584,9 @@ become sufficiently charged. - generates a `NOTIFY_SHUTDOWN` event - waits `FINALDELAY` seconds -- typically `5` - creates the `POWERDOWNFLAG` file in its local filesystem -- usually - `/etc/killpower`, or `/run/nut/killpower` in a temporary file system + configured (explicitly!) to be `/etc/killpower`, or preferably be + `/var/run/nut/killpower` or `/run/nut/killpower` in a temporary file + system that disappears after reboot - calls the `SHUTDOWNCMD` - disconnect from `upsd` and exit (subject to `SHUTDOWNEXIT` setting) diff --git a/docs/configure.txt b/docs/configure.txt index 591373dc3e..1572277b7d 100644 --- a/docs/configure.txt +++ b/docs/configure.txt @@ -1078,8 +1078,14 @@ Directories used by NUT at run-time --with-pidpath=PATH Changes the directory where NUT pid files are stored for processes running -as `root`. By default this is `/var/run`. Certain programs like `upsmon` -will leave files here. +as `root`. By default this is `/var/run` (or `/run` on systems that follow +FHS-3.0 standard strictly and do not offer a legacy symlink). A build of +NUT is encouraged to configure the use of a dedicated sub-directory, like +`/var/run/ups` or `/var/run/nut`, as long as its existence and proper +ownership and permissions can be ensured by the time NUT daemons start. +Certain programs like `upsmon` will leave files here. + +The `NUT_PIDPATH` environment variable overrides this at run time. --with-altpidpath=PATH @@ -1098,6 +1104,12 @@ commands. Default is `/var/state/ups`. This is also the default location for non-`root` daemons to write a PID file, if a separate location is not specified by `--with-altpidpath` option. +Sample configuration examples for `upssched.conf` (and default systemd-tmpfiles +configuration generated with a NUT build) suggest using a sub-directory like +`${STATEPATH}/upssched` for the tool's lock file and client-daemon communication +pipe. This allows to potentially run that tool and daemon under a dedicated +user account, without overlapping with permissions needed by other NUT programs. + The `NUT_STATEPATH` environment variable overrides this at run time. NOTE: Fun fact: in early iterations of the NUT project, the drivers and the diff --git a/docs/man/nut.txt b/docs/man/nut.txt index 6f6801c2df..2a48ad0f42 100644 --- a/docs/man/nut.txt +++ b/docs/man/nut.txt @@ -239,9 +239,9 @@ The message can also be seen from linkman:upsmon[8] being unable to populate the `POWERDOWNFLAG` if the location it points to (`/etc/killpower` by default) does not exist or is read-only, or from a late shutdown integration script like the `nutshutdown` hook if that location was un-mounted by the time it runs. -It is recommended to store that file on a volatile file system (under `/run` -on most modern distributions; typically the `pidpath` is located there too), -which remains until reboot and disappears during reboot. +It is recommended to store that file on a volatile file system (under `/var/run` +or `/run` on most modern distributions; typically the `pidpath` is located there +too), which remains until reboot and disappears during reboot. User/Group Accounts ^^^^^^^^^^^^^^^^^^^ diff --git a/docs/man/upsmon.conf.txt b/docs/man/upsmon.conf.txt index d71f9365f2..0772be515e 100644 --- a/docs/man/upsmon.conf.txt +++ b/docs/man/upsmon.conf.txt @@ -391,7 +391,8 @@ may be called for this effect, if NUT configuration files remain readable at that point (file systems mostly unmounted or changed to read-only). + Historically it was often `/etc/killpower` but nowadays you may want it -in a temporary filesystem (e.g. under `/run` or `/run/nut` location). +in a temporary filesystem (e.g. under `(/var)/run` or even a dedicated +`(/var)/run/nut` location). + Note that double backslashes must be used for Windows paths, e.g. `C:\\Temp\\killpower` (modern Windows may also accept forward slashes From 3073fdd9513be36bf73aa11b4840e7bf6792b71b Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Sat, 11 Oct 2025 21:35:13 +0200 Subject: [PATCH 252/805] scripts/upsdrvsvcctl/nut-driver-enumerator.sh.in: avoid logging bogus-looking "OK" confirming undeclared activities [#3099] Signed-off-by: Jim Klimov --- scripts/upsdrvsvcctl/nut-driver-enumerator.sh.in | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/scripts/upsdrvsvcctl/nut-driver-enumerator.sh.in b/scripts/upsdrvsvcctl/nut-driver-enumerator.sh.in index 5a9f8aa56e..0686704dfc 100644 --- a/scripts/upsdrvsvcctl/nut-driver-enumerator.sh.in +++ b/scripts/upsdrvsvcctl/nut-driver-enumerator.sh.in @@ -906,6 +906,7 @@ smf_setSavedUniq() { *) __TYPE="${__TYPE}:" ;; esac __VAL="$5" + echo "Stashing service property '${__PG}/${__PROP}' of '${__TARGET_FMRI}'..." /usr/sbin/svccfg -s "${__TARGET_FMRI}" delprop "${__PG}" 2>/dev/null || true /usr/sbin/svccfg -s "${__TARGET_FMRI}" addpg "${__PG}" application && \ /usr/sbin/svccfg -s "${__TARGET_FMRI}" setprop "${__PG}/${__PROP}" = "${__TYPE}" "${__VAL}" @@ -957,6 +958,7 @@ smf_setDocLink() { #tm_man_nwamd8/title astring nwamd __PG="tm_doc_${__DRV}_Page" + echo "Stashing service property group '${__PG}' of '${__TARGET_FMRI}' for online docs..." /usr/sbin/svccfg -s "${__TARGET_FMRI}" delprop "${__PG}" 2>/dev/null || true /usr/sbin/svccfg -s "${__TARGET_FMRI}" addpg "${__PG}" template && \ /usr/sbin/svccfg -s "${__TARGET_FMRI}" setprop "${__PG}/name" = "astring:" "\"${__DRV} online\"" && \ @@ -964,6 +966,7 @@ smf_setDocLink() { [ $? = 0 ] && echo "OK" || { echo "FAILED to stash the service property group '${__PG}' for online docs">&2 ; return 1 ; } __PG="tm_man_${__DRV}@MAN_SECTION_CMD_SYS@" + echo "Stashing service property group '${__PG}' for '${__TARGET_FMRI}' for local docs..." /usr/sbin/svccfg -s "${__TARGET_FMRI}" delprop "${__PG}" 2>/dev/null || true /usr/sbin/svccfg -s "${__TARGET_FMRI}" addpg "${__PG}" template && \ /usr/sbin/svccfg -s "${__TARGET_FMRI}" setprop "${__PG}/manpath" = "astring:" "@NUT_MANDIR@" && \ @@ -972,7 +975,7 @@ smf_setDocLink() { [ $? = 0 ] && echo "OK" || { echo "FAILED to stash the service property group '${__PG}' for local docs">&2 ; return 1 ; } unset __DRV __PG __TARGET_FMRI - [ $? = 0 ] && echo "OK" || { echo "FAILED to stash the device doc links">&2 ; return 1 ; } + [ $? = 0 ] || { echo "FAILED to stash the device doc links">&2 ; return 1 ; } } smf_restart_upsd() { echo "Reloading or restarting NUT data server to make sure it knows new configuration..." @@ -1162,6 +1165,7 @@ systemd_getSavedDeviceName() { systemd_setSavedDeviceName() { # Save device (config section) name $2 into service instance $1 [ -n "$1" ] || return # No-op for global section + echo "Saving device (config section) name $2 into service instance $...1" PROPFILE="${SYSTEMD_CONFPATH}/nut-driver@$1.service.d/nut-driver-enumerator-generated-devicename.conf" mkdir -p "${SYSTEMD_CONFPATH}/nut-driver@$1.service.d" && \ cat > "${PROPFILE}" << EOF @@ -1174,6 +1178,7 @@ systemd_setDocLink() { # Save documentation links for driver of device (config section) named $2 # into service instance $1 [ -n "$1" ] || return # No-op for global section + echo "Saving documentation links for driver of device (config section) named $2 into service instance $1..." PROPFILE="${SYSTEMD_CONFPATH}/nut-driver@$1.service.d/nut-driver-enumerator-generated-doclink.conf" mkdir -p "${SYSTEMD_CONFPATH}/nut-driver@$1.service.d" && \ __DRV="`upsconf_getDriver "$2"`" @@ -1189,6 +1194,7 @@ systemd_setSavedMD5() { # Save checksum value $2 into service instance $1 PROP="SECTION_CHECKSUM" [ -n "$1" ] || PROP="SECTION_CHECKSUM_GLOBAL" + echo "Saving checksum value $2 into service instance $1..." PROPFILE="${SYSTEMD_CONFPATH}/nut-driver@$1.service.d/nut-driver-enumerator-generated-checksum.conf" mkdir -p "${SYSTEMD_CONFPATH}/nut-driver@$1.service.d" && \ cat > "${PROPFILE}" << EOF From 74925ff422cfa83d3900de45f8a6aa55a45c81d7 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Sat, 11 Oct 2025 21:59:23 +0200 Subject: [PATCH 253/805] drivers/apcupsd-ups.c: update comments about default port 3551 Signed-off-by: Jim Klimov --- drivers/apcupsd-ups.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/apcupsd-ups.c b/drivers/apcupsd-ups.c index ebec08cba7..c4c8c20c3d 100644 --- a/drivers/apcupsd-ups.c +++ b/drivers/apcupsd-ups.c @@ -70,7 +70,7 @@ upsdrv_info_t upsdrv_info = { { NULL } }; -static uint16_t port=3551; +static uint16_t port = 3551; /* apcupsd default port */ static struct sockaddr_in host; static void process(char *item,char *data) @@ -396,7 +396,7 @@ void upsdrv_initups(void) port = (uint16_t)i; } } - else device_path="localhost"; + else device_path="localhost"; /* default port e.g. 3551 was set above */ if(!(h=gethostbyname(device_path)))port=0; else memcpy(&host.sin_addr,h->h_addr,4); From cee42f994a7b00bdeb5b30eaf1ddb5c1414c379d Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Sat, 11 Oct 2025 22:54:19 +0200 Subject: [PATCH 254/805] drivers/apcupsd-ups.c: use strrchr(device_path,:) to look for LAST colon, since bare IPv6 addresses contain colons too [#1209] Signed-off-by: Jim Klimov --- drivers/apcupsd-ups.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/apcupsd-ups.c b/drivers/apcupsd-ups.c index c4c8c20c3d..4e78edc08a 100644 --- a/drivers/apcupsd-ups.c +++ b/drivers/apcupsd-ups.c @@ -57,7 +57,7 @@ typedef struct pollfd { #include "nut_stdint.h" #define DRIVER_NAME "apcupsd network client UPS driver" -#define DRIVER_VERSION "0.74" +#define DRIVER_VERSION "0.75" #define POLL_INTERVAL_MIN 10 @@ -386,8 +386,8 @@ void upsdrv_initups(void) if(device_path&&*device_path) { - /* TODO: fix parsing since bare IPv6 addresses contain colons */ - if((p=strchr(device_path,':'))) + /* Look for last colon, since bare IPv6 addresses contain colons too */ + if((p=strrchr(device_path,':'))) { int i; *p++=0; From 70965626c4c24d2d683777a3837fe102c0d030b9 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Sat, 11 Oct 2025 23:13:03 +0200 Subject: [PATCH 255/805] drivers/apcupsd-ups.c: revise comments and markup Signed-off-by: Jim Klimov --- drivers/apcupsd-ups.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/drivers/apcupsd-ups.c b/drivers/apcupsd-ups.c index 4e78edc08a..af9ef2abd2 100644 --- a/drivers/apcupsd-ups.c +++ b/drivers/apcupsd-ups.c @@ -384,15 +384,18 @@ void upsdrv_initups(void) atexit((void(*)(void))WSACleanup); #endif /* WIN32 */ - if(device_path&&*device_path) + /* NOTE: in case of errors below we set "port" to 0, + * and bail out with fatalx() in upsdrv_initinfo() */ + if (device_path && *device_path) { /* Look for last colon, since bare IPv6 addresses contain colons too */ if((p=strrchr(device_path,':'))) { - int i; - *p++=0; - i=atoi(p); - if(i<1||i>65535)i=0; + int i; + *p++ = '\0'; /* cut off just the host name in device_path */ + i = atoi(p); + if (i<1 || i>65535) + i = 0; port = (uint16_t)i; } } From f878cfd4d15011667a9f9e4ee4ad12bfc3402e16 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Wed, 30 Jul 2025 13:19:24 +0200 Subject: [PATCH 256/805] docs/nut-versioning.adoc, docs/developers.txt: rename to "NUT Semantic Versioning" consistently Signed-off-by: Jim Klimov --- docs/developers.txt | 2 +- docs/nut-versioning.adoc | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/developers.txt b/docs/developers.txt index 623f107a09..ed43d00a4a 100644 --- a/docs/developers.txt +++ b/docs/developers.txt @@ -1219,7 +1219,7 @@ you can limit the depth of the clone: OPTIONALLY you can then fetch known git tags, so semantic versions look better (based off a recent release, see -linkdoc:developer-guide[NUT Versioning,versioning,docs/nut-versioning.adoc] +linkdoc:developer-guide[NUT Semantic Versioning,versioning,docs/nut-versioning.adoc] for more details): :; cd nut diff --git a/docs/nut-versioning.adoc b/docs/nut-versioning.adoc index 489bd9b040..e3059112f4 100644 --- a/docs/nut-versioning.adoc +++ b/docs/nut-versioning.adoc @@ -1,5 +1,5 @@ -NUT versioning -============== +NUT Semantic Versioning +======================= ////////////////////////////////////////////////////////////////////////////// // You can find a rendered variant of this document on the web at From a0b7cf1960bd9f1fce5225ee156520bbeab9fe94 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Wed, 30 Jul 2025 13:19:58 +0200 Subject: [PATCH 257/805] docs/qa-guide.adoc: move CodeQL up (alphabetically, and before semi-defunct Travis) Signed-off-by: Jim Klimov --- docs/qa-guide.adoc | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/docs/qa-guide.adoc b/docs/qa-guide.adoc index 9ec49aaf66..22a657c2a0 100644 --- a/docs/qa-guide.adoc +++ b/docs/qa-guide.adoc @@ -487,6 +487,14 @@ and so ensure non-regression across several Xcode releases. This relies on a few prerequisite packages and a common NUT configuration, as coded in the `.circleci/config.yml` file in the NUT codebase. +CodeQL +~~~~~~ +[[NUT_CI_CODEQL]] + +(Earlier this role was performed by LGTM.com) Run GitHub Actions for static +analysis of C, C++ and Python code and recipes, to produce suggestions based +on common coding flaws and best-practice security patterns. + Travis CI ~~~~~~~~~ [[NUT_CI_TRAVIS]] @@ -512,14 +520,6 @@ gcc and clang, C standards, and requiring to pass builds at least in a mode without warnings (and checking the other cases where any warnings are made fatal). -CodeQL -~~~~~~ -[[NUT_CI_CODEQL]] - -(Earlier this role was performed by LGTM.com) Run GitHub Actions for static -analysis of C, C++ and Python code and recipes, to produce suggestions based -on common coding flaws and best-practice security patterns. - Continuous Integration (NUT CI farm) build agent preparation ------------------------------------------------------------ [[NUTCI_farm_agents]] From dd7967b611a37f93a9b91b22b8fd5ddc309c5323 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Sun, 12 Oct 2025 14:14:49 +0200 Subject: [PATCH 258/805] configure.ac: refactor echo of NUT_SOURCE_VERSION_REPORT, and suggest to "make" after "configure" is done Many projects do this latter convenience for beginner users. Seems nice. Signed-off-by: Jim Klimov --- configure.ac | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/configure.ac b/configure.ac index 41000888fa..06174b8ddc 100644 --- a/configure.ac +++ b/configure.ac @@ -153,12 +153,15 @@ MKTEMP=mktemp AC_CONFIG_AUX_DIR([.]) AC_CONFIG_SRCDIR(server/upsd.c) AC_CONFIG_MACRO_DIR([m4]) -AS_IF([test x"${NUT_SOURCE_GITREV}" = x], - [echo "Network UPS Tools version ${PACKAGE_VERSION}"], + +NUT_SOURCE_VERSION_REPORT="Network UPS Tools version ${PACKAGE_VERSION}" +AS_IF([test x"${NUT_SOURCE_GITREV}" != x], [AS_IF([test x"${NUT_SOURCE_GITREV}" = x"${PACKAGE_VERSION}"], - [echo "Network UPS Tools version ${PACKAGE_VERSION} ${NUT_SOURCE_GITREV_DEVREL}"], - [echo "Network UPS Tools version ${PACKAGE_VERSION} (${NUT_SOURCE_GITREV}) ${NUT_SOURCE_GITREV_DEVREL}"]) + [NUT_SOURCE_VERSION_REPORT="Network UPS Tools version ${PACKAGE_VERSION} ${NUT_SOURCE_GITREV_DEVREL}"], + [NUT_SOURCE_VERSION_REPORT="Network UPS Tools version ${PACKAGE_VERSION} (${NUT_SOURCE_GITREV}) ${NUT_SOURCE_GITREV_DEVREL}"]) ]) +echo "${NUT_SOURCE_VERSION_REPORT}" + AC_CANONICAL_TARGET NUT_CHECK_OS @@ -6936,3 +6939,8 @@ AS_IF([test x"${NUT_VERSION_DEPLOYED-}" = x""], [ AC_MSG_NOTICE([Check INSTALL.nut.adoc for practical details and example.]) AC_MSG_NOTICE([==========================================================]) ]) + +AC_MSG_NOTICE([==========================================================]) +AC_MSG_NOTICE([Configuration complete: Run '$MAKE' to build ${NUT_SOURCE_VERSION_REPORT} now.]) +AC_MSG_NOTICE([You may use parallelism if supported by your hardware and 'make' implementation, e.g. '$MAKE -j 8']) +AC_MSG_NOTICE([==========================================================]) From 15bc72b0ae7952fe30b013b48eebfd7a6c9bf0a7 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Sun, 12 Oct 2025 16:09:56 +0200 Subject: [PATCH 259/805] NEWS.adoc: Fallout of the refactoring of drivers to use `shutdown.*` commands consistently [#1962] Signed-off-by: Jim Klimov --- NEWS.adoc | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/NEWS.adoc b/NEWS.adoc index be52777955..b9fa32201e 100644 --- a/NEWS.adoc +++ b/NEWS.adoc @@ -39,6 +39,12 @@ https://github.com/networkupstools/nut/milestone/12 - (expected) CI automation for use of data points in drivers that conform to patterns defined in link:docs/nut-names.txt[] + - Fix fallout of development in recent NUT v2.8.x releases: + * Refactoring of drivers to use `shutdown.*` commands consistently (in NUT + v2.8.3 and v2.8.4) may have skipped executions of `INSTCMD` initialization + when the driver is quickly started to power down or cycle an UPS during + systems shutdown. [#1962] + - common code: * Introduced `setproctag()` and `getproctag()` (see examples in `upsmon`) to help track the log messages from massively-forking NUT daemons. [#3084] From 3ac9b26a7577c622ea70efdf8fd0e872419ce69d Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Sun, 12 Oct 2025 15:58:42 +0200 Subject: [PATCH 260/805] scripts/Solaris/Makefile.am: "target_cpu=sparc" is inconclusive about binary bitness [#3099] Signed-off-by: Jim Klimov --- scripts/Solaris/Makefile.am | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/scripts/Solaris/Makefile.am b/scripts/Solaris/Makefile.am index e9e7406336..b527c2a3c4 100644 --- a/scripts/Solaris/Makefile.am +++ b/scripts/Solaris/Makefile.am @@ -62,15 +62,18 @@ SOLARIS_PACKAGE_SVR4_INSTALLSCRIPTS = preinstall postinstall preremove postremov SOLARIS_PACKAGE_SVR4_INSTALLDATA = pkginfo package-solaris-svr4: $(SOLARIS_PACKAGE_SVR4_HELPERSCRIPTS) $(SOLARIS_PACKAGE_SVR4_INSTALLSCRIPTS) $(SOLARIS_PACKAGE_SVR4_INSTALLDATA) ISANAME=''; case x"$(target_cpu)" in \ - xi386|xsparc|xsparcv9|xamd64) ISANAME='$(target_cpu)' ;; \ + xi386|xsparc|xsparcv7|xsparcv9|xamd64) ISANAME='$(target_cpu)' ;; \ xx86_64) ISANAME='amd64' ;; \ xi686) ISANAME='i386' ;; \ - xsparcv7)ISANAME='sparc' ;; \ x) UNAME_P="`uname -p`" && ISANAME="$${UNAME_P}" ;; \ esac ; \ ISABITS=32; case x"$${ISANAME}" in \ - xi386|xsparc) ISABITS=32 ;; \ + xi386|xsparcv7) ISABITS=32 ;; \ xsparcv9|xamd64) ISABITS=64 ;; \ + xsparc) case "`(file server/upsd || file server/.libs/upsd) 2>/dev/null`" in \ + *32-bit*) ISABITS=32 ;; \ + *64-bit*) ISABITS=64 ;; \ + esac ;; \ x*) echo "WARNING: Unexpected ISANAME='$${ISANAME}'" >&2 ;; \ esac; \ case x"$${ISABITS}" in \ From 2fc3fdeff8cc6de4b25be9f060445a3ed57c0bf8 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Sat, 11 Oct 2025 23:13:57 +0200 Subject: [PATCH 261/805] drivers/apcupsd-ups.c, docs: migrate from gethostbyname() to getaddrinfo(); become IPv6 capable [#1209] Signed-off-by: Jim Klimov --- NEWS.adoc | 4 ++ docs/man/apcupsd-ups.txt | 8 +++ docs/nut.dict | 4 +- drivers/apcupsd-ups.c | 121 +++++++++++++++++++++++++++++++++------ 4 files changed, 117 insertions(+), 20 deletions(-) diff --git a/NEWS.adoc b/NEWS.adoc index be52777955..969cbd8c2e 100644 --- a/NEWS.adoc +++ b/NEWS.adoc @@ -50,6 +50,10 @@ https://github.com/networkupstools/nut/milestone/12 framework introduced a `upsdrv_tweak_prognames()` hook method to let them manipulate the array of `prognames[]` aliases. [PR #3101] + - `apcupsd-ups` driver updates: + * Abandoned use of obsolete `gethostbyname()` in favour of `getaddrinfo()`. + Extended to be IPv6-capable along the way. [#1209] + - `nutdrv_qx` driver updates: * Define an internal `QX_FLAG_MAPPING_HANDLED` to check if the subdriver code (mapping table) and the data found from device walk sit together diff --git a/docs/man/apcupsd-ups.txt b/docs/man/apcupsd-ups.txt index ebdad2d467..f2e6da78cc 100644 --- a/docs/man/apcupsd-ups.txt +++ b/docs/man/apcupsd-ups.txt @@ -41,6 +41,14 @@ For instance: port = localhost desc = "apcupsd client" +For IPv6 addresses, use square brackets for the hostname part (so colons in +it are not mistaken to be the port, especially if using the default one): + + [apcupsd] + driver = apcupsd-ups + port = "[::1]:3551" + desc = "apcupsd client" + BACKGROUND ---------- diff --git a/docs/nut.dict b/docs/nut.dict index 788742fdef..1945a1e40b 100644 --- a/docs/nut.dict +++ b/docs/nut.dict @@ -1,4 +1,4 @@ -personal_ws-1.1 en 3558 utf-8 +personal_ws-1.1 en 3561 utf-8 AAC AAS ABI @@ -2133,9 +2133,11 @@ getDevicesVariableValues getTrackingResult getValue getVariable +getaddrinfo getconf getent getenv +gethostbyname getopt getproctag gettext diff --git a/drivers/apcupsd-ups.c b/drivers/apcupsd-ups.c index af9ef2abd2..0a0bd4cae4 100644 --- a/drivers/apcupsd-ups.c +++ b/drivers/apcupsd-ups.c @@ -18,13 +18,24 @@ #include "config.h" +#define NUT_WANT_INET_NTOP_XX 1 +#include "common.h" + #ifndef WIN32 #include #include #include #include #else /* WIN32 */ +# define SOCK_OPT_CAST (char *) +/* Those 2 files for support of getaddrinfo, getnameinfo and freeaddrinfo + on Windows 2000 and older versions */ +# include +# include +/* This override network system calls to adapt to Windows specificity */ +# define W32_NETWORK_CALL_OVERRIDE #include "wincompat.h" +# undef W32_NETWORK_CALL_OVERRIDE #endif /* WIN32 */ #ifdef HAVE_POLL_H @@ -70,8 +81,8 @@ upsdrv_info_t upsdrv_info = { { NULL } }; -static uint16_t port = 3551; /* apcupsd default port */ -static struct sockaddr_in host; +static uint16_t port = 3551; /* apcupsd default port */ +static struct addrinfo *host = NULL; static void process(char *item,char *data) { @@ -195,7 +206,7 @@ static int getdata(void) state_get_timestamp((st_tree_timespec_t *)&start); - if (INVALID_FD_SOCK( (p.fd = socket(AF_INET, SOCK_STREAM, 0)) )) + if (INVALID_FD_SOCK( (p.fd = socket(host->ai_family, SOCK_STREAM, 0)) )) { upsdebugx(1,"socket error"); /* return -1; */ @@ -203,7 +214,7 @@ static int getdata(void) goto getdata_return; } - if(connect(p.fd,(struct sockaddr *)&host,sizeof(host))) + if (connect(p.fd, host->ai_addr, host->ai_addrlen)) { upsdebugx(1,"can't connect to apcupsd"); /* close(p.fd); @@ -245,7 +256,7 @@ static int getdata(void) p.events=POLLIN; n=htons(6); - x=write(p.fd,&n,2); + x=write(p.fd,(void*)&n,2); x=write(p.fd,"status",6); /* TODO: double-check for poll() in configure script */ @@ -255,7 +266,7 @@ static int getdata(void) while (WaitForMultipleObjects(1, &event, FALSE, 15000) == WAIT_TIMEOUT) #endif /* WIN32 */ { - if(read(p.fd,&n,2)!=2) + if(read(p.fd,(void*)&n,2)!=2) { upsdebugx(1,"apcupsd communication error"); ret = -1; @@ -334,8 +345,11 @@ static int getdata(void) void upsdrv_initinfo(void) { - if(!port)fatalx(EXIT_FAILURE,"invalid host or port specified!"); - if(getdata())fatalx(EXIT_FAILURE,"can't communicate with apcupsd!"); + if (!port || !host) + fatalx(EXIT_FAILURE,"invalid host or port specified!"); + + if (getdata()) + fatalx(EXIT_FAILURE,"can't communicate with apcupsd!"); else dstate_dataok(); poll_interval = (poll_interval < POLL_INTERVAL_MIN) ? POLL_INTERVAL_MIN : poll_interval; @@ -343,8 +357,10 @@ void upsdrv_initinfo(void) void upsdrv_updateinfo(void) { - if(getdata())upslogx(LOG_ERR,"can't communicate with apcupsd!"); - else dstate_dataok(); + if (getdata()) { + upslogx(LOG_ERR,"can't communicate with apcupsd!"); + dstate_datastale(); + } else dstate_dataok(); poll_interval = (poll_interval < POLL_INTERVAL_MIN) ? POLL_INTERVAL_MIN : poll_interval; } @@ -375,8 +391,9 @@ void upsdrv_makevartable(void) void upsdrv_initups(void) { - char *p; - struct hostent *h; + struct addrinfo hints, *res; + char *p, *namestart = device_path, *nameend = NULL, *portstart = device_path, sport[NI_MAXSERV]; + int v; #ifdef WIN32 WSADATA WSAdata; @@ -388,8 +405,20 @@ void upsdrv_initups(void) * and bail out with fatalx() in upsdrv_initinfo() */ if (device_path && *device_path) { + /* IPv6 */ + if (*device_path == '[') { + namestart++; + nameend = strchr(namestart, ']'); + if (nameend) { + *nameend = '\0'; + portstart = (nameend + 1); + } else { + upslogx(LOG_WARNING, "%s: Seems we were asked for IPv6 address (had an opening bracket, but never a closing one): '%s'", __func__, device_path); + } + } + /* Look for last colon, since bare IPv6 addresses contain colons too */ - if((p=strrchr(device_path,':'))) + if((p=strrchr(portstart, ':'))) { int i; *p++ = '\0'; /* cut off just the host name in device_path */ @@ -399,16 +428,70 @@ void upsdrv_initups(void) port = (uint16_t)i; } } - else device_path="localhost"; /* default port e.g. 3551 was set above */ - if(!(h=gethostbyname(device_path)))port=0; - else memcpy(&host.sin_addr,h->h_addr,4); + if (!namestart || !(*namestart)) /* did we chop it all off above? */ + namestart = "localhost"; /* keep default port e.g. 3551 was set at start */ - /* TODO: add IPv6 support */ - host.sin_family=AF_INET; - host.sin_port=htons(port); + snprintf(sport, sizeof(sport), "%" PRIuMAX, (uintmax_t)port); + + memset(&hints, 0, sizeof(hints)); + + hints.ai_family = AF_UNSPEC; /* Allow IPv4 or IPv6 */ + hints.ai_socktype = SOCK_STREAM; + hints.ai_protocol = IPPROTO_TCP; + + while ((v = getaddrinfo(namestart, sport, &hints, &res)) != 0) { + upsdebugx(1, "%s: getaddrinfo: %s", __func__, NUT_STRARG(gai_strerror(v))); + + switch (v) + { + case EAI_AGAIN: + continue; + case EAI_NONAME: + upslogx(LOG_WARNING, "%s: Host not found: '%s'", __func__, NUT_STRARG(namestart)); + break; + case EAI_MEMORY: + upslogx(LOG_WARNING, "%s: Insufficient memory", __func__); + break; + case EAI_SYSTEM: + upslog_with_errno(LOG_WARNING, "%s: System error happened during getaddrinfo()", __func__); + break; + default: + upslog_with_errno(LOG_WARNING, "%s: Unknown error happened during getaddrinfo()", __func__); + break; + } + + port = 0; /* abort later in upsdrv_initinfo() */ + res = NULL; /* whatever got populated into the pointer is anyway undefined */ + break; + } + + if (res) + { + /* TODO: loop, connect, retry? + * See the more elaborate examples in NUT code (upsclient) or + * https://man7.org/linux/man-pages/man3/getaddrinfo.3.html + */ + if (res->ai_next) { + upslogx(LOG_WARNING, "%s: Host %s does not map to a unique address; " + "we only tried the first hit", __func__, NUT_STRARG(namestart)); + } + } + + /* Maybe loop above; end up with what we have (or don't) */ + if (port) { + host = res; /* Keep until upsdrv_cleanup()... may be done better */ + + upslogx(LOG_INFO, "Will poll apcupsd at IPv%s address %s port %" PRIu16, + (host->ai_family == AF_INET ? "4" : (host->ai_family == AF_INET6 ? "6" : "?")), + NUT_STRARG(inet_ntopAI(host)), port); + } else if(res) { + freeaddrinfo(res); + } } void upsdrv_cleanup(void) { + if (host) + freeaddrinfo(host); } From 4c8ae483aa824fea6c64887b0b5731ecc812af49 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Sun, 12 Oct 2025 17:34:38 +0200 Subject: [PATCH 262/805] drivers/riello_{ser,usb}.c: refactor parse_ups_status() and do not constrain "shutdown.return" and "load.*" INSTCMD with whether the UPS is known to be on battery or not [#1962] Signed-off-by: Jim Klimov --- NEWS.adoc | 9 +++ drivers/riello_ser.c | 126 +++++++++++++++++++++++++++--------------- drivers/riello_usb.c | 128 ++++++++++++++++++++++++++++--------------- 3 files changed, 175 insertions(+), 88 deletions(-) diff --git a/NEWS.adoc b/NEWS.adoc index be52777955..54242fb407 100644 --- a/NEWS.adoc +++ b/NEWS.adoc @@ -57,6 +57,15 @@ https://github.com/networkupstools/nut/milestone/12 mappings. Suggest how user can help improve the driver if too few data points were seen. [PR #3095] + - `riello_ser` and `riello_usb` driver updates: + * Since the beginning, these drivers fenced availability of *either* + `load.*` *or* `shutdown.return` instant commands based on current + power situation (which was also unknown when the `drivername -k` mode + was used to shut down the system). There seems to be little reason for + such separation, so it is now avoided and the current device status + is queried when starting to handle the UPS poweroff, as a means to + verify communication ability. [#1962] + - `snmp-ups` driver updates: * Define an internal `SU_FLAG_MAPPING_HANDLED` to check if the subdriver code (mapping table) and the data found from device walk sit together diff --git a/drivers/riello_ser.c b/drivers/riello_ser.c index 49a94a409d..c101df0a3b 100644 --- a/drivers/riello_ser.c +++ b/drivers/riello_ser.c @@ -6,6 +6,7 @@ * and "https://www.networkupstools.org/protocols/riello/PSSENTR-0100.pdf". * * Copyright (C) 2012 - Elio Parisi + * Copyright (C) 2022-2025 Jim Klimov * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -48,7 +49,7 @@ #include "riello.h" #define DRIVER_NAME "Riello serial driver" -#define DRIVER_VERSION "0.16" +#define DRIVER_VERSION "0.17" #define DEFAULT_OFFDELAY 5 /*!< seconds (max 0xFF) */ #define DEFAULT_BOOTDELAY 5 /*!< seconds (max 0xFF) */ @@ -291,6 +292,63 @@ static int get_ups_status(void) return 0; } +static int parse_ups_status(int doQuery) { + if (doQuery) { + int stat = get_ups_status(); + + upsdebugx(1, "get_ups_status() %d",stat ); + + if (stat < 0) { + return -1; + } + } + + status_init(); + + /* AC Fail */ + if (riello_test_bit(&DevData.StatusCode[0], 1)) + status_set("OB"); + else + status_set("OL"); + + /* LowBatt */ + if ((riello_test_bit(&DevData.StatusCode[0], 1)) && + (riello_test_bit(&DevData.StatusCode[0], 0))) + status_set("LB"); + + /* Standby */ + if (!riello_test_bit(&DevData.StatusCode[0], 3)) + status_set("OFF"); + + /* On Bypass */ + if (riello_test_bit(&DevData.StatusCode[1], 3)) + status_set("BYPASS"); + + /* Overload */ + if (riello_test_bit(&DevData.StatusCode[4], 2)) + status_set("OVER"); + + /* Buck */ + if (riello_test_bit(&DevData.StatusCode[1], 0)) + status_set("TRIM"); + + /* Boost */ + if (riello_test_bit(&DevData.StatusCode[1], 1)) + status_set("BOOST"); + + /* Replace battery */ + if (riello_test_bit(&DevData.StatusCode[2], 0)) + status_set("RB"); + + /* Charging battery */ + if (riello_test_bit(&DevData.StatusCode[2], 2)) + status_set("CHRG"); + + status_commit(); + + return 0; +} + static int get_ups_extended(void) { uint8_t length; @@ -411,7 +469,25 @@ static int riello_instcmd(const char *cmdname, const char *extra) NUT_UNUSED_VARIABLE(extra); upsdebug_INSTCMD_STARTING(cmdname, extra); + if (!strncasecmp(cmdname, "load.", 5) || !strncasecmp(cmdname, "shutdown.", 9)) { + if (DevData.StatusCode[0] == 0 && handling_upsdrv_shutdown > 0) { + /* With a quick init, we may have skipped the + * long device data walk. At least query current + * state to check that we can contact it. */ + if (parse_ups_status(1) < 0) + upsdebugx(1, "%s: failed to query and parse ups.status", __func__); + } + + upslogx(LOG_INFO, "Processing command '%s' while ups.status is '%s'", + cmdname, NUT_STRARG(dstate_getinfo("ups.status"))); + } + +#ifdef RIELLO_SHUTDOWN_DEPENDS_ON_POWERSTATE + /* NOTE: Historically, this code allowed either "load.*" commands + * when we are "OL" or "shutdown.return" when we are "OB", but + * we found no requirement for that in the protocol docs. */ if (!riello_test_bit(&DevData.StatusCode[0], 1)) { +#endif if (!strcasecmp(cmdname, "load.off")) { upslog_INSTCMD_POWERSTATE_CHANGE(cmdname, extra); @@ -584,8 +660,10 @@ static int riello_instcmd(const char *cmdname, const char *extra) upsdebugx (3, "Command load.on delay Ok"); return STAT_INSTCMD_HANDLED; } +#ifdef RIELLO_SHUTDOWN_DEPENDS_ON_POWERSTATE } else { +#endif if (!strcasecmp(cmdname, "shutdown.return")) { int ipv; @@ -622,7 +700,9 @@ static int riello_instcmd(const char *cmdname, const char *extra) upsdebugx (3, "Command shutdown.return Ok"); return STAT_INSTCMD_HANDLED; } +#ifdef RIELLO_SHUTDOWN_DEPENDS_ON_POWERSTATE } +#endif if (!strcasecmp(cmdname, "shutdown.stop")) { upslog_INSTCMD_POWERSTATE_MAYBE(cmdname, extra); @@ -1112,48 +1192,7 @@ void upsdrv_updateinfo(void) dstate_setinfo("ups.load", "%u", (unsigned int)(DevData.Pout1+DevData.Pout2+DevData.Pout3)/3); } - status_init(); - - /* AC Fail */ - if (riello_test_bit(&DevData.StatusCode[0], 1)) - status_set("OB"); - else - status_set("OL"); - - /* LowBatt */ - if ((riello_test_bit(&DevData.StatusCode[0], 1)) && - (riello_test_bit(&DevData.StatusCode[0], 0))) - status_set("LB"); - - /* Standby */ - if (!riello_test_bit(&DevData.StatusCode[0], 3)) - status_set("OFF"); - - /* On Bypass */ - if (riello_test_bit(&DevData.StatusCode[1], 3)) - status_set("BYPASS"); - - /* Overload */ - if (riello_test_bit(&DevData.StatusCode[4], 2)) - status_set("OVER"); - - /* Buck */ - if (riello_test_bit(&DevData.StatusCode[1], 0)) - status_set("TRIM"); - - /* Boost */ - if (riello_test_bit(&DevData.StatusCode[1], 1)) - status_set("BOOST"); - - /* Replace battery */ - if (riello_test_bit(&DevData.StatusCode[2], 0)) - status_set("RB"); - - /* Charging battery */ - if (riello_test_bit(&DevData.StatusCode[2], 2)) - status_set("CHRG"); - - status_commit(); + parse_ups_status(0); dstate_dataok(); @@ -1172,6 +1211,7 @@ void upsdrv_updateinfo(void) poll_interval = 2; countlost = 0; + /* if (get_ups_statuscode() != 0) upsdebugx(2, "Communication is lost"); else { diff --git a/drivers/riello_usb.c b/drivers/riello_usb.c index 13cb89e7ed..4e47b6ae4d 100644 --- a/drivers/riello_usb.c +++ b/drivers/riello_usb.c @@ -9,7 +9,7 @@ * Copyright (C) 2012 - Elio Parisi * Copyright (C) 2016 Eaton * Copyright (C) 2022-2024 "amikot" - * Copyright (C) 2022-2024 Jim Klimov + * Copyright (C) 2022-2025 Jim Klimov * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -36,7 +36,7 @@ #include "riello.h" #define DRIVER_NAME "Riello USB driver" -#define DRIVER_VERSION "0.16" +#define DRIVER_VERSION "0.17" #define DEFAULT_OFFDELAY 5 /*!< seconds (max 0xFF) */ #define DEFAULT_BOOTDELAY 5 /*!< seconds (max 0xFF) */ @@ -517,6 +517,63 @@ static int get_ups_status(void) return 0; } +static int parse_ups_status(int doQuery) { + if (doQuery) { + int stat = get_ups_status(); + + upsdebugx(1, "get_ups_status() %d",stat ); + + if (stat < 0) { + return -1; + } + } + + status_init(); + + /* AC Fail */ + if (riello_test_bit(&DevData.StatusCode[0], 1)) + status_set("OB"); + else + status_set("OL"); + + /* LowBatt */ + if ((riello_test_bit(&DevData.StatusCode[0], 1)) && + (riello_test_bit(&DevData.StatusCode[0], 0))) + status_set("LB"); + + /* Standby */ + if (!riello_test_bit(&DevData.StatusCode[0], 3)) + status_set("OFF"); + + /* On Bypass */ + if (riello_test_bit(&DevData.StatusCode[1], 3)) + status_set("BYPASS"); + + /* Overload */ + if (riello_test_bit(&DevData.StatusCode[4], 2)) + status_set("OVER"); + + /* Buck */ + if (riello_test_bit(&DevData.StatusCode[1], 0)) + status_set("TRIM"); + + /* Boost */ + if (riello_test_bit(&DevData.StatusCode[1], 1)) + status_set("BOOST"); + + /* Replace battery */ + if (riello_test_bit(&DevData.StatusCode[2], 0)) + status_set("RB"); + + /* Charging battery */ + if (riello_test_bit(&DevData.StatusCode[2], 2)) + status_set("CHRG"); + + status_commit(); + + return 0; +} + static int get_ups_extended(void) { uint8_t length; @@ -593,8 +650,25 @@ static int riello_instcmd(const char *cmdname, const char *extra) NUT_UNUSED_VARIABLE(extra); upsdebug_INSTCMD_STARTING(cmdname, extra); - if (!riello_test_bit(&DevData.StatusCode[0], 1)) { + if (!strncasecmp(cmdname, "load.", 5) || !strncasecmp(cmdname, "shutdown.", 9)) { + if (DevData.StatusCode[0] == 0 && handling_upsdrv_shutdown > 0) { + /* With a quick init, we may have skipped the + * long device data walk. At least query current + * state to check that we can contact it. */ + if (parse_ups_status(1) < 0) + upsdebugx(1, "%s: failed to query and parse ups.status", __func__); + } + + upslogx(LOG_INFO, "Processing command '%s' while ups.status is '%s'", + cmdname, NUT_STRARG(dstate_getinfo("ups.status"))); + } +#ifdef RIELLO_SHUTDOWN_DEPENDS_ON_POWERSTATE + /* NOTE: Historically, this code allowed either "load.*" commands + * when we are "OL" or "shutdown.return" when we are "OB", but + * we found no requirement for that in the protocol docs. */ + if (!riello_test_bit(&DevData.StatusCode[0], 1)) { +#endif if (!strcasecmp(cmdname, "load.off")) { upslog_INSTCMD_POWERSTATE_CHANGE(cmdname, extra); @@ -714,8 +788,10 @@ static int riello_instcmd(const char *cmdname, const char *extra) upsdebugx (3, "Command load.on.delay Ok: read byte: %d", recv); return STAT_INSTCMD_HANDLED; } +#ifdef RIELLO_SHUTDOWN_DEPENDS_ON_POWERSTATE } else { +#endif if (!strcasecmp(cmdname, "shutdown.return")) { int ipv; @@ -748,9 +824,12 @@ static int riello_instcmd(const char *cmdname, const char *extra) upsdebugx (3, "Command shutdown.return Ok: read byte: %d", recv); return STAT_INSTCMD_HANDLED; } +#ifdef RIELLO_SHUTDOWN_DEPENDS_ON_POWERSTATE } +#endif if (!strcasecmp(cmdname, "shutdown.stop")) { + /* Abort a pending shutdown request */ upslog_INSTCMD_POWERSTATE_MAYBE(cmdname, extra); length = riello_prepare_cd(bufOut, gpser_error_control); @@ -1343,48 +1422,7 @@ void upsdrv_updateinfo(void) dstate_setinfo("ups.load", "%u", (unsigned int)(DevData.Pout1+DevData.Pout2+DevData.Pout3)/3); } - status_init(); - - /* AC Fail */ - if (riello_test_bit(&DevData.StatusCode[0], 1)) - status_set("OB"); - else - status_set("OL"); - - /* LowBatt */ - if ((riello_test_bit(&DevData.StatusCode[0], 1)) && - (riello_test_bit(&DevData.StatusCode[0], 0))) - status_set("LB"); - - /* Standby */ - if (!riello_test_bit(&DevData.StatusCode[0], 3)) - status_set("OFF"); - - /* On Bypass */ - if (riello_test_bit(&DevData.StatusCode[1], 3)) - status_set("BYPASS"); - - /* Overload */ - if (riello_test_bit(&DevData.StatusCode[4], 2)) - status_set("OVER"); - - /* Buck */ - if (riello_test_bit(&DevData.StatusCode[1], 0)) - status_set("TRIM"); - - /* Boost */ - if (riello_test_bit(&DevData.StatusCode[1], 1)) - status_set("BOOST"); - - /* Replace battery */ - if (riello_test_bit(&DevData.StatusCode[2], 0)) - status_set("RB"); - - /* Charging battery */ - if (riello_test_bit(&DevData.StatusCode[2], 2)) - status_set("CHRG"); - - status_commit(); + parse_ups_status(0); dstate_dataok(); From 2413c9d286175f90637e26769a98c93ee70d67a6 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Sun, 12 Oct 2025 17:43:49 +0200 Subject: [PATCH 263/805] drivers/riello_ser.c: relocate methods to match structure of riello_usb.c to ease the comparisons Signed-off-by: Jim Klimov --- drivers/riello_ser.c | 213 +++++++++++++++++++++---------------------- 1 file changed, 106 insertions(+), 107 deletions(-) diff --git a/drivers/riello_ser.c b/drivers/riello_ser.c index c101df0a3b..f553362071 100644 --- a/drivers/riello_ser.c +++ b/drivers/riello_ser.c @@ -832,8 +832,70 @@ static int start_ups_comm(void) } upsdebugx (3, "Get identif Ok: received byte %u", buf_ptr_length); + return 0; +} +void upsdrv_help(void) +{ +} + +/* optionally tweak prognames[] entries */ +void upsdrv_tweak_prognames(void) +{ +} + +/* list flags and values that you want to receive via -x */ +void upsdrv_makevartable(void) +{ + /* allow '-x xyzzy' */ + /* addvar(VAR_FLAG, "xyzzy", "Enable xyzzy mode"); */ + + /* allow '-x foo=' */ + /* addvar(VAR_VALUE, "foo", "Override foo setting"); */ + + addvar(VAR_FLAG, "localcalculation", "Calculate battery charge and runtime locally"); +} + +void upsdrv_initups(void) +{ + upsdebugx(2, "entering upsdrv_initups()"); + + upsfd = ser_open(device_path); + + riello_comm_setup(device_path); + + /* probe ups type */ + + /* to get variables and flags from the command line, use this: + * + * first populate with upsdrv_buildvartable above, then... + * + * set flag foo : /bin/driver -x foo + * set variable 'cable' to '1234' : /bin/driver -x cable=1234 + * + * to test flag foo in your code: + * + * if (testvar("foo")) + * do_something(); + * + * to show the value of cable: + * + * if ((cable = getval("cable"))) + * printf("cable is set to %s\n", cable); + * else + * printf("cable is not set!\n"); + * + * don't use NULL pointers - test the return result first! + */ + + /* the upsh handlers can't be done here, as they get initialized + * shortly after upsdrv_initups returns to main. + */ + + /* don't try to detect the UPS here */ + + /* initialise communication */ } void upsdrv_initinfo(void) @@ -1040,6 +1102,50 @@ void upsdrv_initinfo(void) upsh.instcmd = riello_instcmd; } +void upsdrv_shutdown(void) +{ + /* Only implement "shutdown.default"; do not invoke + * general handling of other `sdcommands` here */ + + /* tell the UPS to shut down, then return - DO NOT SLEEP HERE */ + int retry; + + /* maybe try to detect the UPS here, but try a shutdown even if + it doesn't respond at first if possible */ + + /* replace with a proper shutdown function */ + + + /* you may have to check the line status since the commands + for toggling power are frequently different for OL vs. OB */ + + /* OL: this must power cycle the load if possible */ + + /* OB: the load must remain off until the power returns */ + upsdebugx(2, "upsdrv Shutdown execute"); + + for (retry = 1; retry <= MAXTRIES; retry++) { + /* By default, abort a previously requested shutdown + * (if any) and schedule a new one from this moment. */ + if (riello_instcmd("shutdown.stop", NULL) != STAT_INSTCMD_HANDLED) { + continue; + } + + if (riello_instcmd("shutdown.return", NULL) != STAT_INSTCMD_HANDLED) { + continue; + } + + upslogx(LOG_ERR, "Shutting down"); + if (handling_upsdrv_shutdown > 0) + set_exit_flag(EF_EXIT_SUCCESS); + return; + } + + upslogx(LOG_ERR, "Shutdown failed!"); + if (handling_upsdrv_shutdown > 0) + set_exit_flag(EF_EXIT_FAILURE); +} + void upsdrv_updateinfo(void) { uint8_t getextendedOK; @@ -1222,51 +1328,6 @@ void upsdrv_updateinfo(void) */ } -void upsdrv_shutdown(void) -{ - /* Only implement "shutdown.default"; do not invoke - * general handling of other `sdcommands` here */ - - /* tell the UPS to shut down, then return - DO NOT SLEEP HERE */ - int retry; - - /* maybe try to detect the UPS here, but try a shutdown even if - it doesn't respond at first if possible */ - - /* replace with a proper shutdown function */ - - - /* you may have to check the line status since the commands - for toggling power are frequently different for OL vs. OB */ - - /* OL: this must power cycle the load if possible */ - - /* OB: the load must remain off until the power returns */ - upsdebugx(2, "upsdrv Shutdown execute"); - - for (retry = 1; retry <= MAXTRIES; retry++) { - /* By default, abort a previously requested shutdown - * (if any) and schedule a new one from this moment. */ - if (riello_instcmd("shutdown.stop", NULL) != STAT_INSTCMD_HANDLED) { - continue; - } - - if (riello_instcmd("shutdown.return", NULL) != STAT_INSTCMD_HANDLED) { - continue; - } - - upslogx(LOG_ERR, "Shutting down"); - if (handling_upsdrv_shutdown > 0) - set_exit_flag(EF_EXIT_SUCCESS); - return; - } - - upslogx(LOG_ERR, "Shutdown failed!"); - if (handling_upsdrv_shutdown > 0) - set_exit_flag(EF_EXIT_FAILURE); -} - - /* static int setvar(const char *varname, const char *val) { @@ -1282,68 +1343,6 @@ static int setvar(const char *varname, const char *val) } */ -void upsdrv_help(void) -{ -} - -/* optionally tweak prognames[] entries */ -void upsdrv_tweak_prognames(void) -{ -} - -/* list flags and values that you want to receive via -x */ -void upsdrv_makevartable(void) -{ - /* allow '-x xyzzy' */ - /* addvar(VAR_FLAG, "xyzzy", "Enable xyzzy mode"); */ - - /* allow '-x foo=' */ - /* addvar(VAR_VALUE, "foo", "Override foo setting"); */ - - addvar(VAR_FLAG, "localcalculation", "Calculate battery charge and runtime locally"); -} - -void upsdrv_initups(void) -{ - upsdebugx(2, "entering upsdrv_initups()"); - - upsfd = ser_open(device_path); - - riello_comm_setup(device_path); - - /* probe ups type */ - - /* to get variables and flags from the command line, use this: - * - * first populate with upsdrv_buildvartable above, then... - * - * set flag foo : /bin/driver -x foo - * set variable 'cable' to '1234' : /bin/driver -x cable=1234 - * - * to test flag foo in your code: - * - * if (testvar("foo")) - * do_something(); - * - * to show the value of cable: - * - * if ((cable = getval("cable"))) - * printf("cable is set to %s\n", cable); - * else - * printf("cable is not set!\n"); - * - * don't use NULL pointers - test the return result first! - */ - - /* the upsh handlers can't be done here, as they get initialized - * shortly after upsdrv_initups returns to main. - */ - - /* don't try to detect the UPS here */ - - /* initialise communication */ -} - void upsdrv_cleanup(void) { /* free(dynamic_mem); */ From bf476603d3af15c7362dc7124a5363cf5a2fd4ff Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Sun, 12 Oct 2025 20:32:57 +0200 Subject: [PATCH 264/805] drivers/main.c: better log the progress for killpower via running driver instance Signed-off-by: Jim Klimov --- drivers/main.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/main.c b/drivers/main.c index dba8ee113e..9f14cf8f2e 100644 --- a/drivers/main.c +++ b/drivers/main.c @@ -2479,10 +2479,13 @@ int main(int argc, char **argv) ssize_t cmdret = -1; struct timeval tv; + upslogx(LOG_INFO, "Checking if an already running driver instance can handle the shutdown command for us"); + /* Post the query and wait for reply */ /* FIXME: coordinate with pollfreq? */ tv.tv_sec = 15; tv.tv_usec = 0; + upsdebugx(1, "Make sure the other driver instance is allowed to kill power"); cmdret = upsdrvquery_oneshot(progname, upsname, "SET driver.flag.allow_killpower 1\n", NULL, 0, &tv); @@ -2491,6 +2494,7 @@ int main(int argc, char **argv) /* FIXME: somehow mark drivers expected to loop infinitely? */ tv.tv_sec = -1; tv.tv_usec = -1; + upsdebugx(1, "Send the actual command to the other driver instance"); cmdret = upsdrvquery_oneshot(progname, upsname, "INSTCMD driver.killpower\n", NULL, 0, &tv); @@ -2498,7 +2502,7 @@ int main(int argc, char **argv) if (cmdret < 0) { upsdebug_with_errno(1, "Socket dialog with the other driver instance"); } else { - upslogx(LOG_INFO, "Request to killpower via running driver returned code %" PRIiSIZE, cmdret); + upslogx(LOG_INFO, "Request to killpower via running driver instance returned code %" PRIiSIZE, cmdret); if (cmdret == 0) /* Note: many drivers would abort with * "shutdown not supported" at this From 968598eec497f4944810953ddd9f1f5bf2f25484 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Sun, 12 Oct 2025 23:28:46 +0200 Subject: [PATCH 265/805] drivers/metasys.c: avoid spurious void return at end of upsdrv_initinfo() [#1962] Signed-off-by: Jim Klimov --- drivers/metasys.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/metasys.c b/drivers/metasys.c index 704a6364ea..591538c0a7 100644 --- a/drivers/metasys.c +++ b/drivers/metasys.c @@ -612,8 +612,8 @@ void upsdrv_initinfo(void) dstate_addcmd("beeper.mute"); dstate_addcmd("beeper.on"); dstate_addcmd("beeper.off"); + upsh.instcmd = instcmd; - return; } #if (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP_BESIDEFUNC) && (!defined HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP_INSIDEFUNC) && ( (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TYPE_LIMITS_BESIDEFUNC) || (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TAUTOLOGICAL_CONSTANT_OUT_OF_RANGE_COMPARE_BESIDEFUNC) ) # pragma GCC diagnostic pop From 3f821f7de12f3e055c97d78dae72c5f7b306de17 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Sun, 12 Oct 2025 23:29:24 +0200 Subject: [PATCH 266/805] drivers/oneac.c: fix setcmd()->setvar() for consistency [#1962] Signed-off-by: Jim Klimov --- drivers/oneac.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/oneac.c b/drivers/oneac.c index fc4a9492d3..5f99e2a46c 100644 --- a/drivers/oneac.c +++ b/drivers/oneac.c @@ -47,7 +47,7 @@ #include "nut_stdint.h" /* Prototypes to allow setting pointer before function is defined */ -int setcmd(const char* varname, const char* setvalue); +int setvar(const char* varname, const char* setvalue); int instcmd(const char *cmdname, const char *extra); #define DRIVER_NAME "Oneac EG/ON/OZ/OB UPS driver" @@ -252,7 +252,7 @@ void upsdrv_initinfo(void) dstate_addcmd("shutdown.stop"); dstate_addcmd("shutdown.reboot"); - upsh.setvar = setcmd; + upsh.setvar = setvar; upsh.instcmd = instcmd; /* set some stuff that shouldn't change after initialization */ @@ -967,7 +967,7 @@ int instcmd(const char *cmdname, const char *extra) } -int setcmd(const char* varname, const char* setvalue) +int setvar(const char* varname, const char* setvalue) { upsdebug_SET_STARTING(varname, setvalue); From 9ef9f265c89c92ca489c9f8fa9f9d75d25ced780 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Sun, 12 Oct 2025 23:30:10 +0200 Subject: [PATCH 267/805] drivers/optiups.c: fix indentation broken in white-space refactoring of early NUT v2.8.x evolution [#1962] Signed-off-by: Jim Klimov --- drivers/optiups.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/optiups.c b/drivers/optiups.c index 6cd95327a0..4a81ad1fb5 100644 --- a/drivers/optiups.c +++ b/drivers/optiups.c @@ -424,8 +424,9 @@ void upsdrv_initinfo(void) dstate_addcmd("test.failure.start"); dstate_addcmd("load.off"); dstate_addcmd("load.on"); - if( optimodel != OPTIMODEL_ZINTO ) - dstate_addcmd("shutdown.stop"); + if (optimodel != OPTIMODEL_ZINTO) { + dstate_addcmd("shutdown.stop"); + } dstate_addcmd("shutdown.return"); dstate_addcmd("shutdown.stayoff"); upsh.instcmd = instcmd; From d145967806bed7dd782d521ef34192243fd24f18 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Sun, 12 Oct 2025 23:30:59 +0200 Subject: [PATCH 268/805] drivers/powerp-{txt,bin}.c: install instcmd and setvar handlers [#1962] Signed-off-by: Jim Klimov --- NEWS.adoc | 7 +++++++ docs/nut.dict | 3 ++- drivers/powerp-bin.c | 6 +++++- drivers/powerp-txt.c | 6 +++++- 4 files changed, 19 insertions(+), 3 deletions(-) diff --git a/NEWS.adoc b/NEWS.adoc index b9fa32201e..d49292ed41 100644 --- a/NEWS.adoc +++ b/NEWS.adoc @@ -63,6 +63,13 @@ https://github.com/networkupstools/nut/milestone/12 mappings. Suggest how user can help improve the driver if too few data points were seen. [PR #3095] + - `powerp-bin` and `powerp-txt` driver updates: + * Their `upsdrv_initinfo()` methods did not explicitly reference the + `INSTCMD` and `SETVAR` handler methods (it is unknown whether this + actually broke anything, or the needed values were deduced from + subdriver definition then). For consistency, these pointers are now + assigned. [#1962] + - `snmp-ups` driver updates: * Define an internal `SU_FLAG_MAPPING_HANDLED` to check if the subdriver code (mapping table) and the data found from device walk sit together diff --git a/docs/nut.dict b/docs/nut.dict index 788742fdef..2b72fc4f04 100644 --- a/docs/nut.dict +++ b/docs/nut.dict @@ -1,4 +1,4 @@ -personal_ws-1.1 en 3558 utf-8 +personal_ws-1.1 en 3560 utf-8 AAC AAS ABI @@ -2837,6 +2837,7 @@ powermand powermust powernet poweroff +powerp powerpal powerpanel powershell diff --git a/drivers/powerp-bin.c b/drivers/powerp-bin.c index f7e01238da..67d2d94be9 100644 --- a/drivers/powerp-bin.c +++ b/drivers/powerp-bin.c @@ -36,7 +36,7 @@ #include -#define POWERPANEL_BIN_VERSION "Powerpanel-Binary 0.64" +#define POWERPANEL_BIN_VERSION "Powerpanel-Binary 0.65" typedef struct { unsigned char start; @@ -415,6 +415,10 @@ static void powpan_initinfo(void) dstate_addcmd("shutdown.stayoff"); dstate_addcmd("shutdown.reboot"); + + /* install handlers */ + upsh.instcmd = powpan_instcmd; + upsh.setvar = powpan_setvar; } static ssize_t powpan_status(status_t *status) diff --git a/drivers/powerp-txt.c b/drivers/powerp-txt.c index 7f32d89cf7..9721622932 100644 --- a/drivers/powerp-txt.c +++ b/drivers/powerp-txt.c @@ -36,7 +36,7 @@ #include -#define POWERPANEL_TEXT_VERSION "Powerpanel-Text 0.64" +#define POWERPANEL_TEXT_VERSION "Powerpanel-Text 0.65" typedef struct { float i_volt; @@ -378,6 +378,10 @@ static void powpan_initinfo(void) dstate_addcmd("shutdown.return"); dstate_addcmd("shutdown.stayoff"); dstate_addcmd("shutdown.reboot"); + + /* install handlers */ + upsh.instcmd = powpan_instcmd; + upsh.setvar = powpan_setvar; } static ssize_t powpan_status(status_t *status) From 3cb1dc187397d2f2e5fe7858cdb4d0d168bfd75e Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Sun, 12 Oct 2025 23:37:06 +0200 Subject: [PATCH 269/805] drivers/powervar_cx.{c,h}: fix setcmd()->setvar() for consistency [#1962] Signed-off-by: Jim Klimov --- drivers/powervar_cx.c | 8 ++++---- drivers/powervar_cx.h | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/powervar_cx.c b/drivers/powervar_cx.c index 529550b6ce..53e2082065 100644 --- a/drivers/powervar_cx.c +++ b/drivers/powervar_cx.c @@ -853,7 +853,7 @@ void PvarCommon_Initinfo (void) dstate_setflags("ups.delay.start", ST_FLAG_STRING | ST_FLAG_RW); dstate_setaux("ups.delay.start", GET_STARTDELAY_RESP_SIZE); - upsh.setvar = setcmd; + upsh.setvar = setvar; upsh.instcmd = instcmd; } @@ -1315,9 +1315,9 @@ int instcmd(const char *cmdname, const char *extra) return STAT_INSTCMD_UNKNOWN; } -int setcmd(const char* varname, const char* setvalue) +int setvar(const char* varname, const char* setvalue) { - upsdebugx(2, "In setcmd for %s with %s...", varname, setvalue); + upsdebugx(2, "In setvar for %s with %s...", varname, setvalue); if (!strcasecmp(varname, "ups.delay.shutdown")) { @@ -1380,7 +1380,7 @@ int setcmd(const char* varname, const char* setvalue) return STAT_SET_UNKNOWN; } - upslogx(LOG_NOTICE, "setcmd: unknown command [%s]", varname); + upslogx(LOG_NOTICE, "setvar: unknown command [%s]", varname); return STAT_SET_UNKNOWN; } diff --git a/drivers/powervar_cx.h b/drivers/powervar_cx.h index e332f38e06..aabd682700 100644 --- a/drivers/powervar_cx.h +++ b/drivers/powervar_cx.h @@ -40,7 +40,7 @@ void GetInitFormatAndOrData (const char* sReq, char* sF, const size_t sFSize, char* sD, const size_t sDSize); uint8_t GetUPSData (char* sReq, char* sD, const size_t sDSize); int instcmd(const char *cmdname, const char *extra); -int setcmd(const char* varname, const char* setvalue); +int setvar(const char* varname, const char* setvalue); size_t GetSubstringPosition (const char* chResponse, const char* chSub); From 2a6b53b65e2be8e640fb6fd26caed95af8b6da73 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Sun, 12 Oct 2025 23:37:20 +0200 Subject: [PATCH 270/805] drivers/upscode2.c: fix indentation Signed-off-by: Jim Klimov --- drivers/upscode2.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/upscode2.c b/drivers/upscode2.c index df94e4dc24..df3a49a26b 100644 --- a/drivers/upscode2.c +++ b/drivers/upscode2.c @@ -1124,7 +1124,7 @@ static int upsc_commandlist(void) upsdebugx(1, "instcmd: %s %s", cp->cmd, cp->upsc); dstate_addcmd(cp->cmd); cp->enabled = 1; - break; + break; } } From cc12667cfb2158a2c8e52bc7f23f2358ccbbd453 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Sun, 12 Oct 2025 23:58:44 +0200 Subject: [PATCH 271/805] drivers/asem.c, NEWS.adoc: reshuffle code -- upsdrv_initups() is for preparing comms; upsdrv_initinfo() is for first using them [#1962] Signed-off-by: Jim Klimov --- NEWS.adoc | 5 ++ drivers/asem.c | 123 +++++++++++++++++++++---------------------------- 2 files changed, 58 insertions(+), 70 deletions(-) diff --git a/NEWS.adoc b/NEWS.adoc index d49292ed41..15a5cb2b34 100644 --- a/NEWS.adoc +++ b/NEWS.adoc @@ -56,6 +56,11 @@ https://github.com/networkupstools/nut/milestone/12 framework introduced a `upsdrv_tweak_prognames()` hook method to let them manipulate the array of `prognames[]` aliases. [PR #3101] + - `asem` driver updates: + * Moved code to align with NUT driver architecture, so `upsdrv_initups()` + would focus on preparing communications, and `upsdrv_initinfo()` would + actually talk to the device and set initial critical data values. [#1962] + - `nutdrv_qx` driver updates: * Define an internal `QX_FLAG_MAPPING_HANDLED` to check if the subdriver code (mapping table) and the data found from device walk sit together diff --git a/drivers/asem.c b/drivers/asem.c index d5caebad7b..6b530db70f 100644 --- a/drivers/asem.c +++ b/drivers/asem.c @@ -67,7 +67,7 @@ #endif #define DRIVER_NAME "ASEM" -#define DRIVER_VERSION "0.16" +#define DRIVER_VERSION "0.17" /* Valid on ASEM PB1300 UPS */ #define BQ2060_ADDRESS 0x0B @@ -101,9 +101,12 @@ upsdrv_info_t upsdrv_info = { void upsdrv_initinfo(void) { - __s32 i2c_status; - __u8 buffer[10]; - unsigned short year, month, day; + __s32 i2c_status; + __u8 buffer[10], DeviceName_buffer[10]; + char *DeviceName, *option; + unsigned short year, month, day; + unsigned int i; + unsigned long x; #if (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP) && (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_EXTRA_SEMI_STMT) # pragma GCC diagnostic push @@ -118,6 +121,52 @@ void upsdrv_initinfo(void) # pragma GCC diagnostic pop #endif + /* Get ManufacturerName */ + memset(DeviceName_buffer, 0, 10); + i2c_status = i2c_smbus_read_block_data(upsfd, 0x20, DeviceName_buffer); + if (i2c_status == -1) { + fatal_with_errno(EXIT_FAILURE, "Could not read DeviceName block data"); + } + i = 0; + while ( (DeviceName = valid_devicename_data[i++]) ) { + if (0 == memcmp(DeviceName, DeviceName_buffer, i2c_status)) + break; + } + if (!DeviceName) { + fatal_with_errno(EXIT_FAILURE, "Device '%s' unknown", (char *) DeviceName_buffer); + } + upsdebugx(1, "Found device '%s' on port '%s'", (char *) DeviceName, device_path); + dstate_setinfo("ups.mfr", "%s", (char *) DeviceName); + + option = getval("lb"); + if (option) { + x = strtoul(option, NULL, 0); + if ((x == 0) && (errno != 0)) { + upslogx(LOG_WARNING, "Invalid value specified for low battery threshold: '%s'", option); + } else { + lb_threshold = x; + } + } + option = getval("hb"); + if (option) { + x = strtoul(option, NULL, 0); + if ((x == 0) && (errno != 0)) { + upslogx(LOG_WARNING, "Invalid value specified for high battery threshold: '%s'", option); + } else if ((x < 1) || (x > 100)) { + upslogx(LOG_WARNING, "Invalid value specified for high battery threshold: '%s' (must be 1 < hb <= 100)", option); + } else { + hb_threshold = x; + } + } + /* Invalid values specified */ + if (lb_threshold > hb_threshold) { + upslogx(LOG_WARNING, "lb > hb specified in options. Returning to defaults."); + lb_threshold = LOW_BATTERY_THRESHOLD; + hb_threshold = HIGH_BATTERY_THRESHOLD; + } + + upslogx(LOG_NOTICE, "High battery threshold is %lu, low battery threshold is %lu", lb_threshold, hb_threshold); + /* Set capacity mode in mA(h) */ i2c_status = i2c_smbus_read_word_data(upsfd, 0x03); if (i2c_status == -1) { @@ -370,76 +419,10 @@ void upsdrv_makevartable(void) void upsdrv_initups(void) { - __s32 i2c_status; - __u8 DeviceName_buffer[10]; - unsigned int i; - unsigned long x; - char *DeviceName; - char *option; - upsfd = open(device_path, O_RDWR); if (upsfd < 0) { fatal_with_errno(EXIT_FAILURE, "Could not open device port '%s'", device_path); } - -#if (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP) && (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_EXTRA_SEMI_STMT) -# pragma GCC diagnostic push -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_EXTRA_SEMI_STMT -# pragma GCC diagnostic ignored "-Wextra-semi-stmt" -#endif - /* Current definition of this macro ends with a brace; - * we keep the useless trailing ";" for readability */ - ACCESS_DEVICE(upsfd, BQ2060_ADDRESS); -#if (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP) && (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_EXTRA_SEMI_STMT) -# pragma GCC diagnostic pop -#endif - - /* Get ManufacturerName */ - memset(DeviceName_buffer, 0, 10); - i2c_status = i2c_smbus_read_block_data(upsfd, 0x20, DeviceName_buffer); - if (i2c_status == -1) { - fatal_with_errno(EXIT_FAILURE, "Could not read DeviceName block data"); - } - i = 0; - while ( (DeviceName = valid_devicename_data[i++]) ) { - if (0 == memcmp(DeviceName, DeviceName_buffer, i2c_status)) - break; - } - if (!DeviceName) { - fatal_with_errno(EXIT_FAILURE, "Device '%s' unknown", (char *) DeviceName_buffer); - } - upsdebugx(1, "Found device '%s' on port '%s'", (char *) DeviceName, device_path); - dstate_setinfo("ups.mfr", "%s", (char *) DeviceName); - - option = getval("lb"); - if (option) { - x = strtoul(option, NULL, 0); - if ((x == 0) && (errno != 0)) { - upslogx(LOG_WARNING, "Invalid value specified for low battery threshold: '%s'", option); - } else { - lb_threshold = x; - } - } - option = getval("hb"); - if (option) { - x = strtoul(option, NULL, 0); - if ((x == 0) && (errno != 0)) { - upslogx(LOG_WARNING, "Invalid value specified for high battery threshold: '%s'", option); - } else if ((x < 1) || (x > 100)) { - upslogx(LOG_WARNING, "Invalid value specified for high battery threshold: '%s' (must be 1 < hb <= 100)", option); - } else { - hb_threshold = x; - } - } - /* Invalid values specified */ - if (lb_threshold > hb_threshold) { - upslogx(LOG_WARNING, "lb > hb specified in options. Returning to defaults."); - lb_threshold = LOW_BATTERY_THRESHOLD; - hb_threshold = HIGH_BATTERY_THRESHOLD; - } - - upslogx(LOG_NOTICE, "High battery threshold is %lu, low battery threshold is %lu", lb_threshold, hb_threshold); } void upsdrv_cleanup(void) From 7af05a4f56003f8eb96c45345c07268f59921436 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Mon, 13 Oct 2025 00:01:32 +0200 Subject: [PATCH 272/805] drivers/bestfortress.c, NEWS.adoc: reshuffle code -- upsdrv_initups() is for preparing comms; upsdrv_initinfo() is for first using them [#1962] Signed-off-by: Jim Klimov --- NEWS.adoc | 2 +- drivers/bestfortress.c | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/NEWS.adoc b/NEWS.adoc index 15a5cb2b34..4ccf337ae9 100644 --- a/NEWS.adoc +++ b/NEWS.adoc @@ -56,7 +56,7 @@ https://github.com/networkupstools/nut/milestone/12 framework introduced a `upsdrv_tweak_prognames()` hook method to let them manipulate the array of `prognames[]` aliases. [PR #3101] - - `asem` driver updates: + - `asem`, `bestfortress` driver updates: * Moved code to align with NUT driver architecture, so `upsdrv_initups()` would focus on preparing communications, and `upsdrv_initinfo()` would actually talk to the device and set initial critical data values. [#1962] diff --git a/drivers/bestfortress.c b/drivers/bestfortress.c index c9744a07d0..174009a9f6 100644 --- a/drivers/bestfortress.c +++ b/drivers/bestfortress.c @@ -35,7 +35,7 @@ #endif #define DRIVER_NAME "Best Fortress UPS driver" -#define DRIVER_VERSION "0.14" +#define DRIVER_VERSION "0.15" /* driver description structure */ upsdrv_info_t upsdrv_info = { @@ -120,6 +120,9 @@ void upsdrv_initinfo(void) dstate_setflags("battery.runtime.low", ST_FLAG_STRING | ST_FLAG_RW); dstate_setaux("battery.runtime.low", 3); + /* Set early so that it is in place for shutdown. */ + dstate_setinfo("ups.delay.shutdown", "%s", shutdown_delay); + upsh.instcmd = instcmd; upsh.setvar = upsdrv_setvar; @@ -632,9 +635,6 @@ void upsdrv_initups(void) upsdebugx(1, "%s: opened %s speed %s upsfd %d", __func__, device_path, speed_val ? speed_val : "DEFAULT", upsfd); - /* Set early so that it is in place for shutdown. */ - dstate_setinfo("ups.delay.shutdown", "%s", shutdown_delay); - upsdebugx(1, "%s: end", __func__); } From 3192b2c6c38f337666cc13bd89e6b5218e88ee7c Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Mon, 13 Oct 2025 00:05:20 +0200 Subject: [PATCH 273/805] drivers/bestuferrups.c, NEWS.adoc: reshuffle code -- upsdrv_initups() is for preparing comms; upsdrv_initinfo() is for first using them [#1962] Signed-off-by: Jim Klimov --- NEWS.adoc | 2 +- drivers/bestuferrups.c | 183 +++++++++++++++++++++-------------------- 2 files changed, 93 insertions(+), 92 deletions(-) diff --git a/NEWS.adoc b/NEWS.adoc index 4ccf337ae9..e5bc667f67 100644 --- a/NEWS.adoc +++ b/NEWS.adoc @@ -56,7 +56,7 @@ https://github.com/networkupstools/nut/milestone/12 framework introduced a `upsdrv_tweak_prognames()` hook method to let them manipulate the array of `prognames[]` aliases. [PR #3101] - - `asem`, `bestfortress` driver updates: + - `asem`, `bestfortress`, `bestuferrups` driver updates: * Moved code to align with NUT driver architecture, so `upsdrv_initups()` would focus on preparing communications, and `upsdrv_initinfo()` would actually talk to the device and set initial critical data values. [#1962] diff --git a/drivers/bestuferrups.c b/drivers/bestuferrups.c index 25d0b8512b..6ae94ac6cc 100644 --- a/drivers/bestuferrups.c +++ b/drivers/bestuferrups.c @@ -33,7 +33,7 @@ #include "serial.h" #define DRIVER_NAME "Best Ferrups Series ME/RE/MD driver" -#define DRIVER_VERSION "0.09" +#define DRIVER_VERSION "0.10" /* driver description structure */ upsdrv_info_t upsdrv_info = { @@ -77,12 +77,103 @@ static struct { /* Forward decls */ +static ssize_t execute(const char *cmd, char *result, size_t resultsize); static int instcmd(const char *cmdname, const char *extra); +static void sync_serial(void); +static void ups_sync(void); /* Set up all the funky shared memory stuff used to communicate with upsd */ void upsdrv_initinfo (void) { + char temp[256], fcstring[512]; + /* now set up room for all future variables that are supported */ + sync_serial(); + ups_sync(); + + fc.model = UNKNOWN; + /* Obtain Model */ + if (execute("id\r", fcstring, sizeof(fcstring)) < 1) { + fatalx(EXIT_FAILURE, "Failed execute in ups_ident()"); + } + + /* response is a one-line packed string starting with $ */ + if (memcmp(fcstring, "Unit", 4)) { + fatalx(EXIT_FAILURE, + "Bad response from formatconfig command in ups_ident()\n" + "id: %s\n", fcstring + ); + } + + /* FIXME: upsdebugx() */ + if (debugging) + fprintf(stderr, "id: %s\n", fcstring); + + /* chars 4:2 are a two-digit ascii hex enumerated model code */ + memcpy(temp, fcstring+9, 2); + temp[2] = '\0'; + + if (memcmp(temp, "ME", 2) == 0) { + fc.model = ME3100; + } else if ((memcmp(temp, "RE", 2) == 0)) { + fc.model = RE1800; + } else if (memcmp(temp, "C1", 2) == 0) { + /* Better way to identify unit is using "d 15\r", which results in + "15 M# MD1KVA", "id\r" yields "Unit ID "C1K03588"" */ + fc.model = MD1KVA; + } + + switch(fc.model) { + case ME3100: + fc.va = 3100; + fc.watts = 2200; + /* determine shutdown battery voltage */ + if (execute("d 29\r", fcstring, sizeof(fcstring)) > 0) { + sscanf(fcstring, "29 LowBat %f", &fc.emptyvolts); + } + /* determine fully charged battery voltage */ + if (execute("d 31\r", fcstring, sizeof(fcstring)) > 0) { + sscanf(fcstring, "31 HiBatt %f", &fc.fullvolts); + } + fc.fullvolts = 54.20; + /* determine "ideal" voltage by a guess */ + fc.idealbvolts = ((fc.fullvolts - fc.emptyvolts) * 0.7) + fc.emptyvolts; + break; + case RE1800: + fc.va = 1800; + fc.watts = 1200; + /* determine shutdown battery voltage */ + if (execute("d 29\r", fcstring, sizeof(fcstring)) > 0) { + sscanf(fcstring, "29 LowBat %f", &fc.emptyvolts); + } + /* determine fully charged battery voltage */ + if (execute("d 31\r", fcstring, sizeof(fcstring)) > 0) { + sscanf(fcstring, "31 HiBatt %f", &fc.fullvolts); + } + fc.fullvolts = 54.20; + /* determine "ideal" voltage by a guess */ + fc.idealbvolts = ((fc.fullvolts - fc.emptyvolts) * 0.7) + fc.emptyvolts; + break; + case MD1KVA: + fc.va = 1100; + fc.watts = 770; /* Approximate, based on 0.7 power factor */ + /* determine shutdown battery voltage */ + if (execute("d 27\r", fcstring, sizeof(fcstring)) > 0) { + sscanf(fcstring, "27 LowBatt %f", &fc.emptyvolts); + } + /* determine fully charged battery voltage */ + if (execute("d 28\r", fcstring, sizeof(fcstring)) > 0) { + sscanf(fcstring, "28 Hi Batt %f", &fc.fullvolts); + } + fc.fullvolts = 13.70; + /* determine "ideal" voltage by a guess */ + fc.idealbvolts = ((fc.fullvolts - fc.emptyvolts) * 0.7) + fc.emptyvolts; + break; + default: + fatalx(EXIT_FAILURE, "Unknown model %s in ups_ident()", temp); + } + + fc.valid = 1; dstate_setinfo("ups.mfr", "%s", "Best Power"); switch(fc.model) @@ -453,104 +544,14 @@ static void setup_serial(void) if (tcsetattr(upsfd, TCSANOW, &tio) == -1) fatal_with_errno(EXIT_FAILURE, "tcsetattr"); /* end code stolen from bestups.c */ - - sync_serial(); } void upsdrv_initups (void) { - char temp[256], fcstring[512]; - upsfd = ser_open(device_path); ser_set_speed(upsfd, device_path, B1200); setup_serial(); - ups_sync(); - - fc.model = UNKNOWN; - /* Obtain Model */ - if (execute("id\r", fcstring, sizeof(fcstring)) < 1) { - fatalx(EXIT_FAILURE, "Failed execute in ups_ident()"); - } - - /* response is a one-line packed string starting with $ */ - if (memcmp(fcstring, "Unit", 4)) { - fatalx(EXIT_FAILURE, - "Bad response from formatconfig command in ups_ident()\n" - "id: %s\n", fcstring - ); - } - - /* FIXME: upsdebugx() */ - if (debugging) - fprintf(stderr, "id: %s\n", fcstring); - - /* chars 4:2 are a two-digit ascii hex enumerated model code */ - memcpy(temp, fcstring+9, 2); - temp[2] = '\0'; - - if (memcmp(temp, "ME", 2) == 0) { - fc.model = ME3100; - } else if ((memcmp(temp, "RE", 2) == 0)) { - fc.model = RE1800; - } else if (memcmp(temp, "C1", 2) == 0) { - /* Better way to identify unit is using "d 15\r", which results in - "15 M# MD1KVA", "id\r" yields "Unit ID "C1K03588"" */ - fc.model = MD1KVA; - } - - switch(fc.model) { - case ME3100: - fc.va = 3100; - fc.watts = 2200; - /* determine shutdown battery voltage */ - if (execute("d 29\r", fcstring, sizeof(fcstring)) > 0) { - sscanf(fcstring, "29 LowBat %f", &fc.emptyvolts); - } - /* determine fully charged battery voltage */ - if (execute("d 31\r", fcstring, sizeof(fcstring)) > 0) { - sscanf(fcstring, "31 HiBatt %f", &fc.fullvolts); - } - fc.fullvolts = 54.20; - /* determine "ideal" voltage by a guess */ - fc.idealbvolts = ((fc.fullvolts - fc.emptyvolts) * 0.7) + fc.emptyvolts; - break; - case RE1800: - fc.va = 1800; - fc.watts = 1200; - /* determine shutdown battery voltage */ - if (execute("d 29\r", fcstring, sizeof(fcstring)) > 0) { - sscanf(fcstring, "29 LowBat %f", &fc.emptyvolts); - } - /* determine fully charged battery voltage */ - if (execute("d 31\r", fcstring, sizeof(fcstring)) > 0) { - sscanf(fcstring, "31 HiBatt %f", &fc.fullvolts); - } - fc.fullvolts = 54.20; - /* determine "ideal" voltage by a guess */ - fc.idealbvolts = ((fc.fullvolts - fc.emptyvolts) * 0.7) + fc.emptyvolts; - break; - case MD1KVA: - fc.va = 1100; - fc.watts = 770; /* Approximate, based on 0.7 power factor */ - /* determine shutdown battery voltage */ - if (execute("d 27\r", fcstring, sizeof(fcstring)) > 0) { - sscanf(fcstring, "27 LowBatt %f", &fc.emptyvolts); - } - /* determine fully charged battery voltage */ - if (execute("d 28\r", fcstring, sizeof(fcstring)) > 0) { - sscanf(fcstring, "28 Hi Batt %f", &fc.fullvolts); - } - fc.fullvolts = 13.70; - /* determine "ideal" voltage by a guess */ - fc.idealbvolts = ((fc.fullvolts - fc.emptyvolts) * 0.7) + fc.emptyvolts; - break; - default: - fatalx(EXIT_FAILURE, "Unknown model %s in ups_ident()", temp); - } - - fc.valid = 1; - return; } void upsdrv_cleanup(void) From b69d2ca47d36eb0147c7d1606fd495837f8fa97a Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Mon, 13 Oct 2025 00:11:57 +0200 Subject: [PATCH 274/805] drivers/bicker_ser.c, NEWS.adoc: reshuffle code -- upsdrv_initups() is for preparing comms; upsdrv_initinfo() is for first using them [#1962] Signed-off-by: Jim Klimov --- NEWS.adoc | 2 +- drivers/bicker_ser.c | 62 +++++++++++++++++++++----------------------- 2 files changed, 31 insertions(+), 33 deletions(-) diff --git a/NEWS.adoc b/NEWS.adoc index e5bc667f67..0aa3353442 100644 --- a/NEWS.adoc +++ b/NEWS.adoc @@ -56,7 +56,7 @@ https://github.com/networkupstools/nut/milestone/12 framework introduced a `upsdrv_tweak_prognames()` hook method to let them manipulate the array of `prognames[]` aliases. [PR #3101] - - `asem`, `bestfortress`, `bestuferrups` driver updates: + - `asem`, `bestfortress`, `bestuferrups`, `bicker_ser` driver updates: * Moved code to align with NUT driver architecture, so `upsdrv_initups()` would focus on preparing communications, and `upsdrv_initinfo()` would actually talk to the device and set initial critical data values. [#1962] diff --git a/drivers/bicker_ser.c b/drivers/bicker_ser.c index 48c72e19fa..d9a14cf760 100644 --- a/drivers/bicker_ser.c +++ b/drivers/bicker_ser.c @@ -108,7 +108,7 @@ #include "serial.h" #define DRIVER_NAME "Bicker serial protocol" -#define DRIVER_VERSION "0.05" +#define DRIVER_VERSION "0.06" #define BICKER_SOH 0x01 #define BICKER_EOT 0x04 @@ -731,6 +731,35 @@ static int bicker_setvar(const char *varname, const char *val) void upsdrv_initinfo(void) { char string[BICKER_MAXDATA + 1]; + BickerParameter parameter; + const BickerMapping *mapping; + unsigned i; + + if (bicker_read_string(0x01, 0x63, string) >= 0) { + dstate_setinfo("ups.firmware", "%s", string); + } + + if (bicker_read_string(0x01, 0x64, string) >= 0) { + dstate_setinfo("battery.type", "%s", string); + } + + /* Not implemented on all UPSes */ + if (bicker_read_string(0x01, 0x65, string) >= 0) { + dstate_setinfo("ups.firmware.aux", "%s", string); + } + + /* Initialize mapped parameters */ + for (i = 0; i < SIZEOF_ARRAY(bicker_mappings); ++i) { + mapping = &bicker_mappings[i]; + if (bicker_get(mapping->bicker_id, ¶meter) >= 0) { + bicker_new(¶meter, mapping); + } + } + + /* Ensure "battery.charge.low" variable is defined */ + if (dstate_getinfo("battery.charge.low") == NULL) { + dstate_setinfo("battery.charge.low", "%d", 20); + } dstate_setinfo("device.type", "ups"); @@ -899,40 +928,9 @@ void upsdrv_makevartable(void) void upsdrv_initups(void) { - char string[BICKER_MAXDATA + 1]; - BickerParameter parameter; - const BickerMapping *mapping; - unsigned i; - upsfd = ser_open(device_path); ser_set_speed(upsfd, device_path, B38400); ser_set_dtr(upsfd, 1); - - if (bicker_read_string(0x01, 0x63, string) >= 0) { - dstate_setinfo("ups.firmware", "%s", string); - } - - if (bicker_read_string(0x01, 0x64, string) >= 0) { - dstate_setinfo("battery.type", "%s", string); - } - - /* Not implemented on all UPSes */ - if (bicker_read_string(0x01, 0x65, string) >= 0) { - dstate_setinfo("ups.firmware.aux", "%s", string); - } - - /* Initialize mapped parameters */ - for (i = 0; i < SIZEOF_ARRAY(bicker_mappings); ++i) { - mapping = &bicker_mappings[i]; - if (bicker_get(mapping->bicker_id, ¶meter) >= 0) { - bicker_new(¶meter, mapping); - } - } - - /* Ensure "battery.charge.low" variable is defined */ - if (dstate_getinfo("battery.charge.low") == NULL) { - dstate_setinfo("battery.charge.low", "%d", 20); - } } void upsdrv_cleanup(void) From aff18f60772c70a7085122e50d616afd557e8da3 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Mon, 13 Oct 2025 00:17:04 +0200 Subject: [PATCH 275/805] drivers/everups.c, NEWS.adoc: reshuffle code -- upsdrv_initups() is for preparing comms; upsdrv_initinfo() is for first using them [#1962] Signed-off-by: Jim Klimov --- NEWS.adoc | 3 ++- drivers/everups.c | 5 +++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/NEWS.adoc b/NEWS.adoc index 0aa3353442..f20ef547c4 100644 --- a/NEWS.adoc +++ b/NEWS.adoc @@ -56,7 +56,8 @@ https://github.com/networkupstools/nut/milestone/12 framework introduced a `upsdrv_tweak_prognames()` hook method to let them manipulate the array of `prognames[]` aliases. [PR #3101] - - `asem`, `bestfortress`, `bestuferrups`, `bicker_ser` driver updates: + - `asem`, `bestfortress`, `bestuferrups`, `bicker_ser`, `everups` + driver updates: * Moved code to align with NUT driver architecture, so `upsdrv_initups()` would focus on preparing communications, and `upsdrv_initinfo()` would actually talk to the device and set initial critical data values. [#1962] diff --git a/drivers/everups.c b/drivers/everups.c index 35896e696d..1401e82067 100644 --- a/drivers/everups.c +++ b/drivers/everups.c @@ -21,7 +21,7 @@ #include "serial.h" #define DRIVER_NAME "Ever UPS driver (serial)" -#define DRIVER_VERSION "0.09" +#define DRIVER_VERSION "0.10" /* driver description structure */ upsdrv_info_t upsdrv_info = { @@ -87,6 +87,8 @@ static const char *GetTypeUpsName(void) void upsdrv_initinfo(void) { + InitUpsType(); + dstate_setinfo("ups.mfr", "Ever"); dstate_setinfo("ups.model", "%s", GetTypeUpsName()); @@ -238,7 +240,6 @@ void upsdrv_initups(void) ser_set_speed(upsfd, device_path, B300); init_serial(); - InitUpsType(); } void upsdrv_cleanup(void) From d56c97547c3425f03b3925a89dc081b995d36d3c Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Mon, 13 Oct 2025 00:21:20 +0200 Subject: [PATCH 276/805] drivers/gamatronic.c: upsdrv_initups(): update comments [#1962] Signed-off-by: Jim Klimov --- drivers/gamatronic.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/gamatronic.c b/drivers/gamatronic.c index 4a2608a481..5d836c6764 100644 --- a/drivers/gamatronic.c +++ b/drivers/gamatronic.c @@ -434,7 +434,7 @@ void upsdrv_initups(void) /* upsfd = ser_open(device_path); */ /* ser_set_speed(upsfd, device_path, B1200); */ - /* probe ups type */ + /* probe ups type later, in upsdrv_initinfo() */ /* to get variables and flags from the command line, use this: * @@ -459,7 +459,8 @@ void upsdrv_initups(void) */ /* the upsh handlers can't be done here, as they get initialized - * shortly after upsdrv_initups returns to main. + * shortly after upsdrv_initups() returns to main, and goes back + * to upsdrv_initinfo(). */ } From 2f31de6909c7938377a659e6dd25ef7114f0dcca Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Mon, 13 Oct 2025 00:28:58 +0200 Subject: [PATCH 277/805] drivers/masterguard.c, NEWS.adoc: reshuffle code -- upsdrv_initups() is for preparing comms; upsdrv_initinfo() is for first using them [#1962] Signed-off-by: Jim Klimov --- NEWS.adoc | 4 +-- drivers/masterguard.c | 74 +++++++++++++++++++++---------------------- 2 files changed, 39 insertions(+), 39 deletions(-) diff --git a/NEWS.adoc b/NEWS.adoc index f20ef547c4..f0534226df 100644 --- a/NEWS.adoc +++ b/NEWS.adoc @@ -56,8 +56,8 @@ https://github.com/networkupstools/nut/milestone/12 framework introduced a `upsdrv_tweak_prognames()` hook method to let them manipulate the array of `prognames[]` aliases. [PR #3101] - - `asem`, `bestfortress`, `bestuferrups`, `bicker_ser`, `everups` - driver updates: + - `asem`, `bestfortress`, `bestuferrups`, `bicker_ser`, `everups`, + `masterguard` driver updates: * Moved code to align with NUT driver architecture, so `upsdrv_initups()` would focus on preparing communications, and `upsdrv_initinfo()` would actually talk to the device and set initial critical data values. [#1962] diff --git a/drivers/masterguard.c b/drivers/masterguard.c index 0cca74c520..ae067443f6 100644 --- a/drivers/masterguard.c +++ b/drivers/masterguard.c @@ -31,7 +31,7 @@ #include "nut_stdint.h" #define DRIVER_NAME "MASTERGUARD UPS driver" -#define DRIVER_VERSION "0.30" +#define DRIVER_VERSION "0.31" /* driver description structure */ upsdrv_info_t upsdrv_info = { @@ -468,6 +468,42 @@ void upsdrv_tweak_prognames(void) ********************************************************************/ void upsdrv_initinfo(void) { + int count = 0; + int fail = 0; + int good = 0; + + name[0] = '\0'; + firmware[0] = '\0'; + + /* probe ups type */ + do + { + count++; + + if( ups_ident( ) != 1 ) + fail++; + /* at least two good identifications */ + if( (count - fail) == 2 ) + { + good = 1; + break; + } + } while( (count Date: Mon, 13 Oct 2025 00:31:26 +0200 Subject: [PATCH 278/805] drivers/metasys.c, NEWS.adoc: reshuffle code -- upsdrv_initups() is for preparing comms; upsdrv_initinfo() is for first using them [#1962] Signed-off-by: Jim Klimov --- NEWS.adoc | 2 +- drivers/metasys.c | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/NEWS.adoc b/NEWS.adoc index f0534226df..56b53935e4 100644 --- a/NEWS.adoc +++ b/NEWS.adoc @@ -56,7 +56,7 @@ https://github.com/networkupstools/nut/milestone/12 framework introduced a `upsdrv_tweak_prognames()` hook method to let them manipulate the array of `prognames[]` aliases. [PR #3101] - - `asem`, `bestfortress`, `bestuferrups`, `bicker_ser`, `everups`, + - `asem`, `bestfortress`, `bestuferrups`, `bicker_ser`, `everups`, `metasys`, `masterguard` driver updates: * Moved code to align with NUT driver architecture, so `upsdrv_initups()` would focus on preparing communications, and `upsdrv_initinfo()` would diff --git a/drivers/metasys.c b/drivers/metasys.c index 591538c0a7..4dab002167 100644 --- a/drivers/metasys.c +++ b/drivers/metasys.c @@ -28,7 +28,7 @@ #include "nut_stdint.h" #define DRIVER_NAME "Metasystem UPS driver" -#define DRIVER_VERSION "0.13" +#define DRIVER_VERSION "0.14" /* driver description structure */ upsdrv_info_t upsdrv_info = { @@ -61,6 +61,7 @@ static int nominal_power = 0; #define UPS_SET_BATTERY_TEST 0x0e static int instcmd(const char *cmdname, const char *extra); +static void send_zeros(void); /* Metasystem UPS data transfer are made with packet of the format: @@ -113,7 +114,6 @@ static void send_zeros(void) { /* send 100 times the value 0x00.....it seems memset(buf, '\0', sizeof(buf)); ser_send_buf(upsfd, buf, sizeof(buf)); - return; } @@ -289,6 +289,9 @@ void upsdrv_initinfo(void) char serial[13]; int res, i; + /* Reset comms */ + send_zeros(); + /* Initial setup of variables */ #ifdef EXTRADATA dstate_setinfo("output.power", "%d", -1); @@ -1122,7 +1125,6 @@ void upsdrv_initups(void) { upsfd = ser_open(device_path); ser_set_speed(upsfd, device_path, B2400); - send_zeros(); } void upsdrv_cleanup(void) From 23152739bde3aa60a3f91c3879c496330e258102 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Mon, 13 Oct 2025 00:37:15 +0200 Subject: [PATCH 279/805] drivers/mge-utalk.c, NEWS.adoc: reshuffle code -- upsdrv_initups() is for preparing comms; upsdrv_initinfo() is for first using them [#1962] Signed-off-by: Jim Klimov --- NEWS.adoc | 2 +- drivers/mge-utalk.c | 52 ++++++++++++++++++++++++--------------------- 2 files changed, 29 insertions(+), 25 deletions(-) diff --git a/NEWS.adoc b/NEWS.adoc index 56b53935e4..1abe44e610 100644 --- a/NEWS.adoc +++ b/NEWS.adoc @@ -57,7 +57,7 @@ https://github.com/networkupstools/nut/milestone/12 them manipulate the array of `prognames[]` aliases. [PR #3101] - `asem`, `bestfortress`, `bestuferrups`, `bicker_ser`, `everups`, `metasys`, - `masterguard` driver updates: + `masterguard`, `mge-utalk` driver updates: * Moved code to align with NUT driver architecture, so `upsdrv_initups()` would focus on preparing communications, and `upsdrv_initinfo()` would actually talk to the device and set initial critical data values. [#1962] diff --git a/drivers/mge-utalk.c b/drivers/mge-utalk.c index 9b27956e2d..82b3a351ae 100644 --- a/drivers/mge-utalk.c +++ b/drivers/mge-utalk.c @@ -69,7 +69,7 @@ /* --------------------------------------------------------------- */ #define DRIVER_NAME "MGE UPS SYSTEMS/U-Talk driver" -#define DRIVER_VERSION "0.100" +#define DRIVER_VERSION "0.101" /* driver description structure */ @@ -166,7 +166,6 @@ void upsdrv_makevartable(void) void upsdrv_initups(void) { - char buf[BUFFLEN]; #ifndef WIN32 int RTS = TIOCM_RTS; #endif /* !WIN32 */ @@ -179,6 +178,11 @@ void upsdrv_initups(void) if (testvar ("oldmac")) RTS = ~TIOCM_RTS; + /* TOTHINK: This looks like comms with the device and may belong in + * upsdrv_initinfo(). But in upsdrv_cleanup() we have disable_ups_comm() + * at least, which gets registered and might get called before initinfo. + */ + /* Init serial line */ ioctl(upsfd, TIOCMBIC, &RTS); #else /* WIN32 */ @@ -190,6 +194,28 @@ void upsdrv_initups(void) } #endif /* WIN32 */ enable_ups_comm(); +} + +/* --------------------------------------------------------------- */ + +void upsdrv_initinfo(void) +{ + char buf[BUFFLEN]; + const char *model = NULL; + char *firmware = NULL; + char *p; + char *v = NULL; /* for parsing Si output, get Version ID */ + int table; + int tries; + int status_ok = 0; + ssize_t bytes_rcvd; + int si_data1 = 0; + int si_data2 = 0; + mge_info_item_t *item; + models_name_t *model_info; + mge_model_info_t *legacy_model; + char infostr[32]; + ssize_t chars_rcvd; /* Try to set "Low Battery Level" (if supported and given) */ if (getval ("lowbatt")) @@ -226,28 +252,6 @@ void upsdrv_initups(void) else upsdebugx(1, "initups: OffDelay unavailable"); } -} - -/* --------------------------------------------------------------- */ - -void upsdrv_initinfo(void) -{ - char buf[BUFFLEN]; - const char *model = NULL; - char *firmware = NULL; - char *p; - char *v = NULL; /* for parsing Si output, get Version ID */ - int table; - int tries; - int status_ok = 0; - ssize_t bytes_rcvd; - int si_data1 = 0; - int si_data2 = 0; - mge_info_item_t *item; - models_name_t *model_info; - mge_model_info_t *legacy_model; - char infostr[32]; - ssize_t chars_rcvd; /* manufacturer -------------------------------------------- */ dstate_setinfo("ups.mfr", "MGE UPS SYSTEMS"); From 0a21de4a0888bec9baee1fe164fa7bf333720f7c Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Mon, 13 Oct 2025 00:41:53 +0200 Subject: [PATCH 280/805] drivers/oneac.c, NEWS.adoc: reshuffle code -- upsdrv_initups() is for preparing comms; upsdrv_initinfo() is for first using them [#1962] Signed-off-by: Jim Klimov --- NEWS.adoc | 2 +- drivers/oneac.c | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/NEWS.adoc b/NEWS.adoc index 1abe44e610..c77ae39e7d 100644 --- a/NEWS.adoc +++ b/NEWS.adoc @@ -57,7 +57,7 @@ https://github.com/networkupstools/nut/milestone/12 them manipulate the array of `prognames[]` aliases. [PR #3101] - `asem`, `bestfortress`, `bestuferrups`, `bicker_ser`, `everups`, `metasys`, - `masterguard`, `mge-utalk` driver updates: + `masterguard`, `mge-utalk`, `oneac` driver updates: * Moved code to align with NUT driver architecture, so `upsdrv_initups()` would focus on preparing communications, and `upsdrv_initinfo()` would actually talk to the device and set initial critical data values. [#1962] diff --git a/drivers/oneac.c b/drivers/oneac.c index 5f99e2a46c..285609b46e 100644 --- a/drivers/oneac.c +++ b/drivers/oneac.c @@ -51,7 +51,7 @@ int setvar(const char* varname, const char* setvalue); int instcmd(const char *cmdname, const char *extra); #define DRIVER_NAME "Oneac EG/ON/OZ/OB UPS driver" -#define DRIVER_VERSION "0.86" +#define DRIVER_VERSION "0.87" /* driver description structure */ upsdrv_info_t upsdrv_info = { @@ -200,11 +200,6 @@ void upsdrv_initups(void) { upsfd = ser_open(device_path); ser_set_speed(upsfd, device_path, B9600); - - /*get the UPS in the right frame of mind*/ - ser_send_pace(upsfd, 100, "%s", COMMAND_END); - ser_send_pace(upsfd, 100, "%s", COMMAND_END); - sleep (1); } void upsdrv_initinfo(void) @@ -215,6 +210,11 @@ void upsdrv_initinfo(void) ssize_t RetValue; char buffer[256], buffer2[32]; + /* Get the UPS in the right frame of mind */ + ser_send_pace(upsfd, 100, "%s", COMMAND_END); + ser_send_pace(upsfd, 100, "%s", COMMAND_END); + sleep (1); + /* All families should reply to this request so we can confirm that it is * an ONEAC UPS */ From 83690ca10eae0f4a6a79a0f2bd2417eba7fe00fe Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Mon, 13 Oct 2025 00:46:01 +0200 Subject: [PATCH 281/805] drivers/phoenixcontact_modbus.c, NEWS.adoc: reshuffle code -- upsdrv_initups() is for preparing comms; upsdrv_initinfo() is for first using them [#1962] Signed-off-by: Jim Klimov --- NEWS.adoc | 2 +- drivers/phoenixcontact_modbus.c | 13 +++++++------ 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/NEWS.adoc b/NEWS.adoc index c77ae39e7d..46f28c9669 100644 --- a/NEWS.adoc +++ b/NEWS.adoc @@ -57,7 +57,7 @@ https://github.com/networkupstools/nut/milestone/12 them manipulate the array of `prognames[]` aliases. [PR #3101] - `asem`, `bestfortress`, `bestuferrups`, `bicker_ser`, `everups`, `metasys`, - `masterguard`, `mge-utalk`, `oneac` driver updates: + `masterguard`, `mge-utalk`, `oneac`, `phoenixcontact_modbus` driver updates: * Moved code to align with NUT driver architecture, so `upsdrv_initups()` would focus on preparing communications, and `upsdrv_initinfo()` would actually talk to the device and set initial critical data values. [#1962] diff --git a/drivers/phoenixcontact_modbus.c b/drivers/phoenixcontact_modbus.c index df447bda62..20edb9569c 100644 --- a/drivers/phoenixcontact_modbus.c +++ b/drivers/phoenixcontact_modbus.c @@ -32,7 +32,7 @@ #endif #define DRIVER_NAME "NUT PhoenixContact Modbus driver (libmodbus link type: " NUT_MODBUS_LINKTYPE_STR ")" -#define DRIVER_VERSION "0.10" +#define DRIVER_VERSION "0.11" #define CHECK_BIT(var,pos) ((var) & (1<<(pos))) #define MODBUS_SLAVE_ID 192 @@ -225,13 +225,15 @@ void upsdrv_initinfo(void) uint64_t PartNumber = 0; size_t i; + upsdebugx(2, "upsdrv_initinfo"); + + phoenixcontact_apply_advanced_config(modbus_ctx); + for (i = 0; i < (sizeof(tab_reg) / sizeof(tab_reg[0])); i++) { tab_reg[i] = 0; } - upsdebugx(2, "upsdrv_initinfo"); - dstate_setinfo("device.mfr", "Phoenix Contact"); /* upsh.instcmd = instcmd; */ @@ -841,6 +843,7 @@ void upsdrv_initups(void) result = mrir(modbus_ctx, 0x0004, 1, &FWVersion); if (result == -1) { + /* Try to go slower... */ modbus_close(modbus_ctx); modbus_free(modbus_ctx); @@ -865,12 +868,10 @@ void upsdrv_initups(void) if (r < 0) { - fatalx(EXIT_FAILURE, "UPS does not repond to read requests."); + fatalx(EXIT_FAILURE, "UPS does not respond to read requests."); } - } - phoenixcontact_apply_advanced_config(modbus_ctx); dstate_setinfo("ups.firmware", "%" PRIu16, FWVersion); } From 0a18ee0e41535910c97f74720a8176469f8b146e Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Mon, 13 Oct 2025 00:47:13 +0200 Subject: [PATCH 282/805] drivers/pijuice.c, NEWS.adoc: reshuffle code -- upsdrv_initups() is for preparing comms; upsdrv_initinfo() is for first using them [#1962] Signed-off-by: Jim Klimov --- NEWS.adoc | 3 ++- drivers/pijuice.c | 17 ++++++++--------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/NEWS.adoc b/NEWS.adoc index 46f28c9669..c7618210bb 100644 --- a/NEWS.adoc +++ b/NEWS.adoc @@ -57,7 +57,8 @@ https://github.com/networkupstools/nut/milestone/12 them manipulate the array of `prognames[]` aliases. [PR #3101] - `asem`, `bestfortress`, `bestuferrups`, `bicker_ser`, `everups`, `metasys`, - `masterguard`, `mge-utalk`, `oneac`, `phoenixcontact_modbus` driver updates: + `masterguard`, `mge-utalk`, `oneac`, `phoenixcontact_modbus`, `pijuice` + driver updates: * Moved code to align with NUT driver architecture, so `upsdrv_initups()` would focus on preparing communications, and `upsdrv_initinfo()` would actually talk to the device and set initial critical data values. [#1962] diff --git a/drivers/pijuice.c b/drivers/pijuice.c index f1775160dc..bc815ec5d7 100644 --- a/drivers/pijuice.c +++ b/drivers/pijuice.c @@ -23,7 +23,7 @@ #include "nut_stdint.h" #define DRIVER_NAME "PiJuice UPS driver" -#define DRIVER_VERSION "0.16" +#define DRIVER_VERSION "0.17" /* * Linux I2C userland is a bit of a mess until distros refresh to @@ -775,6 +775,13 @@ static void get_i2c_address(void) void upsdrv_initinfo(void) { + /* probe ups type */ + get_firmware_version(); + + /* get variables and flags from the command line */ + + if (getval("i2c_address")) + i2c_address = atoi(getval("i2c_address")); dstate_setinfo( "ups.mfr", "%s", "PiJuice" ); dstate_setinfo( "ups.type", "%s", "HAT" ); @@ -877,14 +884,6 @@ void upsdrv_makevartable(void) void upsdrv_initups(void) { upsfd = open_i2c_bus( device_path, i2c_address ); - - /* probe ups type */ - get_firmware_version(); - - /* get variables and flags from the command line */ - - if (getval("i2c_address")) - i2c_address = atoi(getval("i2c_address")); } void upsdrv_cleanup(void) From 95b82d44c6c74339459647eee94cbfd059a6201b Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Mon, 13 Oct 2025 00:52:54 +0200 Subject: [PATCH 283/805] drivers/powercom.c, NEWS.adoc: reshuffle code -- upsdrv_initups() is for preparing comms; upsdrv_initinfo() is for first using them [#1962] Signed-off-by: Jim Klimov --- NEWS.adoc | 4 +- drivers/powercom.c | 160 ++++++++++++++++++++++----------------------- 2 files changed, 82 insertions(+), 82 deletions(-) diff --git a/NEWS.adoc b/NEWS.adoc index c7618210bb..7706d78515 100644 --- a/NEWS.adoc +++ b/NEWS.adoc @@ -57,8 +57,8 @@ https://github.com/networkupstools/nut/milestone/12 them manipulate the array of `prognames[]` aliases. [PR #3101] - `asem`, `bestfortress`, `bestuferrups`, `bicker_ser`, `everups`, `metasys`, - `masterguard`, `mge-utalk`, `oneac`, `phoenixcontact_modbus`, `pijuice` - driver updates: + `masterguard`, `mge-utalk`, `oneac`, `phoenixcontact_modbus`, `pijuice`, + `powercom` driver updates: * Moved code to align with NUT driver architecture, so `upsdrv_initups()` would focus on preparing communications, and `upsdrv_initinfo()` would actually talk to the device and set initial critical data values. [#1962] diff --git a/drivers/powercom.c b/drivers/powercom.c index 81bbaf0142..9426f2c788 100644 --- a/drivers/powercom.c +++ b/drivers/powercom.c @@ -86,7 +86,7 @@ #include "nut_float.h" #define DRIVER_NAME "PowerCom protocol UPS driver" -#define DRIVER_VERSION "0.26" +#define DRIVER_VERSION "0.27" /* driver description structure */ upsdrv_info_t upsdrv_info = { @@ -866,9 +866,7 @@ void upsdrv_shutdown(void) void upsdrv_initups(void) { int tmp; - unsigned int model = 0; unsigned int i; - static char buf[20]; /* check manufacturer name from arguments */ if (testvar("manufacturer")) @@ -1007,6 +1005,85 @@ void upsdrv_initups(void) /* setup flow control */ types[type].flowControl.setup_flow_control(); +} + +/* display help */ +void upsdrv_help(void) +{ + /* 1 2 3 4 5 6 7 8 */ + /* 12345678901234567890123456789012345678901234567890123456789012345678901234567890 MAX */ + printf("\n"); + printf("Specify UPS information in the ups.conf file.\n"); + printf(" type: Type of UPS: 'Trust','Egys','KP625AP','IMP','KIN','BNT',\n"); + printf(" 'BNT-other', 'OPTI' (default: 'Trust')\n"); + printf(" 'BNT-other' is a special type intended for BNT 100-120V models,\n"); + printf(" but can be used to override ALL models.\n"); + printf("You can additional specify these variables:\n"); + printf(" manufacturer: Manufacturer name (default: 'PowerCom')\n"); + printf(" modelname: Model name (default: 'Unknown' or autodetected)\n"); + printf(" serialnumber: Serial number (default: Unknown)\n"); + printf(" shutdownArguments: 3 delay arguments for the shutdown operation:\n"); + printf(" {{Minutes,Seconds},UseMinutes?}\n"); + printf(" where Minutes and Seconds are integer, UseMinutes? is either\n"); + printf(" 'y' or 'n'.\n"); + printf("You can specify these variables if not automagically detected for types\n"); + printf(" 'IMP','KIN','BNT'\n"); + printf(" linevoltage: Line voltage: 110-120 or 220-240 (default: 230)\n"); + printf(" numOfBytesFromUPS: Number of bytes in a UPS frame: 16 is common, 11 for 'Trust'\n"); + printf(" methodOfFlowControl: Flow control method for UPS:\n"); + printf(" 'dtr0rts1', 'dtr1' or 'no_flow_control'\n"); + printf(" validationSequence: 3 pairs of validation values: {{I,V},{I,V},{I,V}}\n"); + printf(" where I is the index into BytesFromUPS (see numOfBytesFromUPS)\n"); + printf(" and V is the value for the ByteIndex to match.\n"); + printf(" frequency: Input & Output Frequency conversion values: {A, B}\n"); + printf(" used in function: 1/(A*x+B)\n"); + printf(" If the raw value x IS the frequency, then A=1/(x^2), B=0\n"); + printf(" loadPercentage: Load conversion values for Battery and Line load: {BA,BB,LA,LB}\n"); + printf(" used in function: A*x+B\n"); + printf(" If the raw value x IS the Load Percent, then A=1, B=0\n"); + printf(" batteryPercentage: Battery conversion values for Battery and Line power:\n"); + printf(" {A,B,C,D,E}\n"); + printf(" used in functions: (Battery) A*x+B*y+C, (Line) D*x+E\n"); + printf(" If the raw value x IS the Battery Percent, then\n"); + printf(" A=1, B=0, C=0, D=1, E=0\n"); + printf(" voltage: Voltage conversion values for 240 and 120 voltage:\n"); + printf(" {240A,240B,120A,120B}\n"); + printf(" used in function: A*x+B\n"); + printf(" If the raw value x IS HALF the Voltage, then A=2, B=0\n"); + printf(" nobt: Flag to skip battery check on init/startup.\n\n"); + + printf("Example for BNT1500AP in ups.conf:\n"); + printf("[BNT1500AP]\n"); + printf(" driver = powercom\n"); + printf(" port = /dev/ttyS0\n"); + printf(" desc = \"PowerCom BNT 1500 AP\"\n"); + printf(" manufacturer = PowerCom\n"); + printf(" modelname = BNT1500AP\n"); + printf(" serialnumber = 13245678900\n"); + printf(" type = BNT-other\n"); + printf("# linevoltage = 120\n"); + printf("# numOfBytesFromUPS = 16\n"); + printf("# methodOfFlowControl = no_flow_control\n"); + printf("# validationSequence = {{8,0},{8,0},{8,0}}\n"); + printf("# shutdownArguments = {{1,30},y}\n"); + printf("# frequency = {0.00027778,0.0000}\n"); + printf("# loadPercentage = {1.0000,0.0,1.0000,0.0}\n"); + printf("# batteryPercentage = {1.0000,0.0000,0.0000,1.0000,0.0000}\n"); + printf("# voltage = {2.0000,0.0000,2.0000,0.0000}\n"); + printf(" nobt\n"); + return; +} + +/* optionally tweak prognames[] entries */ +void upsdrv_tweak_prognames(void) +{ +} + +/* initialize information */ +void upsdrv_initinfo(void) +{ + unsigned int model = 0; + static char buf[20]; /* Setup Model and LineVoltage */ if (!strncmp(types[type].name, "BNT",3) || !strcmp(types[type].name, "KIN") || !strcmp(types[type].name, "IMP") || !strcmp(types[type].name, "OPTI")) { @@ -1096,83 +1173,6 @@ void upsdrv_initups(void) types[type].voltage[2], types[type].voltage[3]); } -} - -/* display help */ -void upsdrv_help(void) -{ - /* 1 2 3 4 5 6 7 8 */ - /* 12345678901234567890123456789012345678901234567890123456789012345678901234567890 MAX */ - printf("\n"); - printf("Specify UPS information in the ups.conf file.\n"); - printf(" type: Type of UPS: 'Trust','Egys','KP625AP','IMP','KIN','BNT',\n"); - printf(" 'BNT-other', 'OPTI' (default: 'Trust')\n"); - printf(" 'BNT-other' is a special type intended for BNT 100-120V models,\n"); - printf(" but can be used to override ALL models.\n"); - printf("You can additional specify these variables:\n"); - printf(" manufacturer: Manufacturer name (default: 'PowerCom')\n"); - printf(" modelname: Model name (default: 'Unknown' or autodetected)\n"); - printf(" serialnumber: Serial number (default: Unknown)\n"); - printf(" shutdownArguments: 3 delay arguments for the shutdown operation:\n"); - printf(" {{Minutes,Seconds},UseMinutes?}\n"); - printf(" where Minutes and Seconds are integer, UseMinutes? is either\n"); - printf(" 'y' or 'n'.\n"); - printf("You can specify these variables if not automagically detected for types\n"); - printf(" 'IMP','KIN','BNT'\n"); - printf(" linevoltage: Line voltage: 110-120 or 220-240 (default: 230)\n"); - printf(" numOfBytesFromUPS: Number of bytes in a UPS frame: 16 is common, 11 for 'Trust'\n"); - printf(" methodOfFlowControl: Flow control method for UPS:\n"); - printf(" 'dtr0rts1', 'dtr1' or 'no_flow_control'\n"); - printf(" validationSequence: 3 pairs of validation values: {{I,V},{I,V},{I,V}}\n"); - printf(" where I is the index into BytesFromUPS (see numOfBytesFromUPS)\n"); - printf(" and V is the value for the ByteIndex to match.\n"); - printf(" frequency: Input & Output Frequency conversion values: {A, B}\n"); - printf(" used in function: 1/(A*x+B)\n"); - printf(" If the raw value x IS the frequency, then A=1/(x^2), B=0\n"); - printf(" loadPercentage: Load conversion values for Battery and Line load: {BA,BB,LA,LB}\n"); - printf(" used in function: A*x+B\n"); - printf(" If the raw value x IS the Load Percent, then A=1, B=0\n"); - printf(" batteryPercentage: Battery conversion values for Battery and Line power:\n"); - printf(" {A,B,C,D,E}\n"); - printf(" used in functions: (Battery) A*x+B*y+C, (Line) D*x+E\n"); - printf(" If the raw value x IS the Battery Percent, then\n"); - printf(" A=1, B=0, C=0, D=1, E=0\n"); - printf(" voltage: Voltage conversion values for 240 and 120 voltage:\n"); - printf(" {240A,240B,120A,120B}\n"); - printf(" used in function: A*x+B\n"); - printf(" If the raw value x IS HALF the Voltage, then A=2, B=0\n"); - printf(" nobt: Flag to skip battery check on init/startup.\n\n"); - - printf("Example for BNT1500AP in ups.conf:\n"); - printf("[BNT1500AP]\n"); - printf(" driver = powercom\n"); - printf(" port = /dev/ttyS0\n"); - printf(" desc = \"PowerCom BNT 1500 AP\"\n"); - printf(" manufacturer = PowerCom\n"); - printf(" modelname = BNT1500AP\n"); - printf(" serialnumber = 13245678900\n"); - printf(" type = BNT-other\n"); - printf("# linevoltage = 120\n"); - printf("# numOfBytesFromUPS = 16\n"); - printf("# methodOfFlowControl = no_flow_control\n"); - printf("# validationSequence = {{8,0},{8,0},{8,0}}\n"); - printf("# shutdownArguments = {{1,30},y}\n"); - printf("# frequency = {0.00027778,0.0000}\n"); - printf("# loadPercentage = {1.0000,0.0,1.0000,0.0}\n"); - printf("# batteryPercentage = {1.0000,0.0000,0.0000,1.0000,0.0000}\n"); - printf("# voltage = {2.0000,0.0000,2.0000,0.0000}\n"); - printf(" nobt\n"); - return; -} - -/* optionally tweak prognames[] entries */ -void upsdrv_tweak_prognames(void) -{ -} - -/* initialize information */ -void upsdrv_initinfo(void) -{ /* write constant data for this model */ dstate_setinfo ("ups.mfr", "%s", manufacturer); dstate_setinfo ("ups.model", "%s", modelname); From bac3c7dbc062780562e13ff0f62236755343dd8c Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Mon, 13 Oct 2025 00:54:58 +0200 Subject: [PATCH 284/805] drivers/powervar_cx_ser.c, NEWS.adoc: reshuffle code -- upsdrv_initups() is for preparing comms; upsdrv_initinfo() is for first using them [#1962] Signed-off-by: Jim Klimov --- NEWS.adoc | 2 +- drivers/powervar_cx_ser.c | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/NEWS.adoc b/NEWS.adoc index 7706d78515..920f5237a5 100644 --- a/NEWS.adoc +++ b/NEWS.adoc @@ -58,7 +58,7 @@ https://github.com/networkupstools/nut/milestone/12 - `asem`, `bestfortress`, `bestuferrups`, `bicker_ser`, `everups`, `metasys`, `masterguard`, `mge-utalk`, `oneac`, `phoenixcontact_modbus`, `pijuice`, - `powercom` driver updates: + `powercom`, `powervar_cx_ser` driver updates: * Moved code to align with NUT driver architecture, so `upsdrv_initups()` would focus on preparing communications, and `upsdrv_initinfo()` would actually talk to the device and set initial critical data values. [#1962] diff --git a/drivers/powervar_cx_ser.c b/drivers/powervar_cx_ser.c index 6c3f45327e..d2be363c21 100644 --- a/drivers/powervar_cx_ser.c +++ b/drivers/powervar_cx_ser.c @@ -39,7 +39,7 @@ #include "powervar_cx.h" /* Common driver defines, variables, and functions */ #define DRIVER_NAME "Powervar-CUSSP UPS driver (Serial)" -#define DRIVER_VERSION "1.01" +#define DRIVER_VERSION "1.02" /* driver description structure */ upsdrv_info_t upsdrv_info = { @@ -157,16 +157,16 @@ void upsdrv_initups(void) upsdebugx (4, "Serial baud not set!! (%" PRIu32 ").", ulBaud); } } - - /*get the UPS in the right frame of mind */ - ser_send_pace(upsfd, 100, "%s", COMMAND_END); - ser_send_pace(upsfd, 100, "%s", COMMAND_END); - sleep (1); } /* This function is called on driver startup to initialize variables/commands */ void upsdrv_initinfo(void) { + /* Get the UPS in the right frame of mind */ + ser_send_pace(upsfd, 100, "%s", COMMAND_END); + ser_send_pace(upsfd, 100, "%s", COMMAND_END); + sleep (1); + /* Get serial port ready */ ser_flush_in(upsfd, "", 0); From 1b2ce0b21d9163e007abe0c363cfcf8e163a3281 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Mon, 13 Oct 2025 01:00:43 +0200 Subject: [PATCH 285/805] drivers/usbhid-ups.c, NEWS.adoc: reshuffle code -- upsdrv_initups() is for preparing comms; upsdrv_initinfo() is for first using them [#1962] Signed-off-by: Jim Klimov --- NEWS.adoc | 2 +- drivers/usbhid-ups.c | 160 +++++++++++++++++++++---------------------- 2 files changed, 81 insertions(+), 81 deletions(-) diff --git a/NEWS.adoc b/NEWS.adoc index 920f5237a5..80d28c210f 100644 --- a/NEWS.adoc +++ b/NEWS.adoc @@ -58,7 +58,7 @@ https://github.com/networkupstools/nut/milestone/12 - `asem`, `bestfortress`, `bestuferrups`, `bicker_ser`, `everups`, `metasys`, `masterguard`, `mge-utalk`, `oneac`, `phoenixcontact_modbus`, `pijuice`, - `powercom`, `powervar_cx_ser` driver updates: + `powercom`, `powervar_cx_ser`, `usbhid-ups` driver updates: * Moved code to align with NUT driver architecture, so `upsdrv_initups()` would focus on preparing communications, and `upsdrv_initinfo()` would actually talk to the device and set initial critical data values. [#1962] diff --git a/drivers/usbhid-ups.c b/drivers/usbhid-ups.c index 9fea7c9ab7..b4460ed43c 100644 --- a/drivers/usbhid-ups.c +++ b/drivers/usbhid-ups.c @@ -29,7 +29,7 @@ */ #define DRIVER_NAME "Generic HID driver" -#define DRIVER_VERSION "0.69" +#define DRIVER_VERSION "0.70" #define HU_VAR_WAITBEFORERECONNECT "waitbeforereconnect" @@ -1552,6 +1552,85 @@ void upsdrv_initinfo(void) dstate_setinfo("driver.version.data", "%s", subdriver->name); + upsdebugx(1, "%s: Performing an initial UPS data walk with subdriver %s...", + __func__, subdriver->name); + if (hid_ups_walk(HU_WALKMODE_INIT) == FALSE) { + fatalx(EXIT_FAILURE, "Can't initialize data from HID UPS"); + } else { + analyze_mapping_usage(); + } + + if (!ups_status) + upslogx(LOG_WARNING, "%s: No flag bits for 'ups.status' were explicitly reported; " + "it is possible a wrong 'subdriver' option was requested or detected " + "(in case of problems with device data, consider testing with other " + "explicit driver option 'subdriver' values)", + __func__); + + upsdebugx(1, "%s: Optionally adjust some threshold values, if applicable and requested to...", __func__); + + /* Set values below from user settings only if supported by UPS */ + if (dstate_getinfo("battery.charge.low")) { + /* Retrieve user defined battery settings */ + val = getval(HU_VAR_LOWBATT); + if (val) { + dstate_setinfo("battery.charge.low", "%ld", strtol(val, NULL, 10)); + } + } + + if (dstate_getinfo("ups.delay.start")) { + /* Retrieve user defined delay settings */ + val = getval(HU_VAR_ONDELAY); + if (val) { + long l = strtol(val, NULL, 10); +#if !((defined SHUT_MODE) && SHUT_MODE) + if (subdriver == &cps_subdriver + && (l < 60 || l % 60) + ) { + upslogx(LOG_WARNING, "CPS devices tend to round delays by 60 sec down (ondelay=120 is the suggested minimum; see more in the man page)"); + } +#endif + dstate_setinfo("ups.delay.start", "%ld", l); + } + } + + if (dstate_getinfo("ups.delay.shutdown")) { + /* Retrieve user defined delay settings */ + val = getval(HU_VAR_OFFDELAY); + if (val) { + long l = strtol(val, NULL, 10); +#if !((defined SHUT_MODE) && SHUT_MODE) + if (subdriver == &cps_subdriver + && (l > 0 && (l < 60 || l % 60)) + ) { + /* Note: zero and negative values may + * have special meanings for the firmware */ + upslogx(LOG_WARNING, "CPS devices tend to round delays by 60 sec down (offdelay=60 is the suggested minimum; see more in the man page)"); + } +#endif + dstate_setinfo("ups.delay.shutdown", "%ld", l); + } + } + + upsdebugx(1, "%s: Optionally enable instant commands related to shutdown, if applicable...", __func__); + + /* Enable instant commands below only if supported by UPS */ + if (find_nut_info("load.off.delay")) { + /* Adds default with a delay value of '0' (= immediate) */ + dstate_addcmd("load.off"); + } + + if (find_nut_info("load.on.delay")) { + /* Adds default with a delay value of '0' (= immediate) */ + dstate_addcmd("load.on"); + } + + if (find_nut_info("load.off.delay") && find_nut_info("load.on.delay")) { + /* Add composite instcmds (require setting multiple HID values) */ + dstate_addcmd("shutdown.return"); + dstate_addcmd("shutdown.stayoff"); + } + /* init polling frequency for full updates */ val = getval(HU_VAR_POLLFREQ); if (val) { @@ -1854,85 +1933,6 @@ void upsdrv_initups(void) lbrb_log_delay_without_calibrating = 1; } - upsdebugx(1, "%s: Performing an initial UPS data walk with subdriver %s...", - __func__, subdriver->name); - if (hid_ups_walk(HU_WALKMODE_INIT) == FALSE) { - fatalx(EXIT_FAILURE, "Can't initialize data from HID UPS"); - } else { - analyze_mapping_usage(); - } - - if (!ups_status) - upslogx(LOG_WARNING, "%s: No flag bits for 'ups.status' were explicitly reported; " - "it is possible a wrong 'subdriver' option was requested or detected " - "(in case of problems with device data, consider testing with other " - "explicit driver option 'subdriver' values)", - __func__); - - upsdebugx(1, "%s: Optionally adjust some threshold values, if applicable and requested to...", __func__); - - /* Set values below from user settings only if supported by UPS */ - if (dstate_getinfo("battery.charge.low")) { - /* Retrieve user defined battery settings */ - val = getval(HU_VAR_LOWBATT); - if (val) { - dstate_setinfo("battery.charge.low", "%ld", strtol(val, NULL, 10)); - } - } - - if (dstate_getinfo("ups.delay.start")) { - /* Retrieve user defined delay settings */ - val = getval(HU_VAR_ONDELAY); - if (val) { - long l = strtol(val, NULL, 10); -#if !((defined SHUT_MODE) && SHUT_MODE) - if (subdriver == &cps_subdriver - && (l < 60 || l % 60) - ) { - upslogx(LOG_WARNING, "CPS devices tend to round delays by 60 sec down (ondelay=120 is the suggested minimum; see more in the man page)"); - } -#endif - dstate_setinfo("ups.delay.start", "%ld", l); - } - } - - if (dstate_getinfo("ups.delay.shutdown")) { - /* Retrieve user defined delay settings */ - val = getval(HU_VAR_OFFDELAY); - if (val) { - long l = strtol(val, NULL, 10); -#if !((defined SHUT_MODE) && SHUT_MODE) - if (subdriver == &cps_subdriver - && (l > 0 && (l < 60 || l % 60)) - ) { - /* Note: zero and negative values may - * have special meanings for the firmware */ - upslogx(LOG_WARNING, "CPS devices tend to round delays by 60 sec down (offdelay=60 is the suggested minimum; see more in the man page)"); - } -#endif - dstate_setinfo("ups.delay.shutdown", "%ld", l); - } - } - - upsdebugx(1, "%s: Optionally enable instant commands related to shutdown, if applicable...", __func__); - - /* Enable instant commands below only if supported by UPS */ - if (find_nut_info("load.off.delay")) { - /* Adds default with a delay value of '0' (= immediate) */ - dstate_addcmd("load.off"); - } - - if (find_nut_info("load.on.delay")) { - /* Adds default with a delay value of '0' (= immediate) */ - dstate_addcmd("load.on"); - } - - if (find_nut_info("load.off.delay") && find_nut_info("load.on.delay")) { - /* Add composite instcmds (require setting multiple HID values) */ - dstate_addcmd("shutdown.return"); - dstate_addcmd("shutdown.stayoff"); - } - upsdebugx(1, "%s: finished", __func__); } From a231b87164ac5825a12a7a3c1878ce1e547121e3 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Mon, 13 Oct 2025 01:04:31 +0200 Subject: [PATCH 286/805] drivers/victronups.c, NEWS.adoc: reshuffle code -- upsdrv_initups() is for preparing comms; upsdrv_initinfo() is for first using them [#1962] Signed-off-by: Jim Klimov --- NEWS.adoc | 2 +- drivers/victronups.c | 40 ++++++++++++++++------------------------ 2 files changed, 17 insertions(+), 25 deletions(-) diff --git a/NEWS.adoc b/NEWS.adoc index 80d28c210f..80c034c5b7 100644 --- a/NEWS.adoc +++ b/NEWS.adoc @@ -58,7 +58,7 @@ https://github.com/networkupstools/nut/milestone/12 - `asem`, `bestfortress`, `bestuferrups`, `bicker_ser`, `everups`, `metasys`, `masterguard`, `mge-utalk`, `oneac`, `phoenixcontact_modbus`, `pijuice`, - `powercom`, `powervar_cx_ser`, `usbhid-ups` driver updates: + `powercom`, `powervar_cx_ser`, `usbhid-ups`, `victronups` driver updates: * Moved code to align with NUT driver architecture, so `upsdrv_initups()` would focus on preparing communications, and `upsdrv_initinfo()` would actually talk to the device and set initial critical data values. [#1962] diff --git a/drivers/victronups.c b/drivers/victronups.c index 96d1920af7..37f23a3b41 100644 --- a/drivers/victronups.c +++ b/drivers/victronups.c @@ -32,7 +32,7 @@ #include "serial.h" #define DRIVER_NAME "GE/IMV/Victron UPS driver" -#define DRIVER_VERSION "0.26" +#define DRIVER_VERSION "0.27" /* driver description structure */ upsdrv_info_t upsdrv_info = { @@ -227,6 +227,20 @@ static int instcmd(const char *cmdname, const char *extra) void upsdrv_initinfo(void) { + char temp[LENGTH_TEMP]; + + /* inicializace a synchronizace UPS */ + ser_send_char(upsfd, ENDCHAR); + usleep (UPS_LONG_DELAY); + ser_send(upsfd, "?%c", ENDCHAR); + usleep (UPS_LONG_DELAY); + ser_get_line(upsfd, temp, sizeof(temp), ENDCHAR, IGNCHARS, 3, 0); + ser_send(upsfd, "?%c", ENDCHAR); + usleep (UPS_LONG_DELAY); + ser_get_line(upsfd, temp, sizeof(temp), ENDCHAR, IGNCHARS, 3, 0); + ser_send(upsfd, "?%c", ENDCHAR); + usleep (UPS_DELAY); + ser_get_line(upsfd, temp, sizeof(temp), ENDCHAR, IGNCHARS, 3, 0); if (model_name) dstate_setinfo("ups.model", "%s", model_name); @@ -284,9 +298,6 @@ void upsdrv_updateinfo(void) start_is_datastale = 0; } - - - /* ups.status */ if (get_data("vAa?",temp)) return; flags = atoi (temp+3); @@ -366,8 +377,6 @@ void upsdrv_updateinfo(void) upsdebugx(1, "ups.model >%s<>%s<\n",temp,temp+3); } - - /* ups.mfr */ if (get_data("vDm?",temp)) return; dstate_setinfo("ups.mfr", "%s", temp+3); @@ -535,13 +544,11 @@ void upsdrv_makevartable(void) void upsdrv_initups(void) { - char temp[ LENGTH_TEMP ], *usd = NULL; /* = NULL je dulezite jen pro prekladac */ - + char *usd = NULL; /* = NULL je dulezite jen pro prekladac */ upsfd = ser_open(device_path); ser_set_speed(upsfd, device_path, B1200); - if ((usd = getval("usd"))) { sdwdelay=atoi(usd); @@ -554,21 +561,6 @@ void upsdrv_initups(void) upsdebugx(1, "(-x) UPS Name %s",model_name); } - /* inicializace a synchronizace UPS */ - - ser_send_char(upsfd, ENDCHAR); - usleep (UPS_LONG_DELAY); - ser_send(upsfd, "?%c", ENDCHAR); - usleep (UPS_LONG_DELAY); - ser_get_line(upsfd, temp, sizeof(temp), ENDCHAR, IGNCHARS, 3, 0); - ser_send(upsfd, "?%c", ENDCHAR); - usleep (UPS_LONG_DELAY); - ser_get_line(upsfd, temp, sizeof(temp), ENDCHAR, IGNCHARS, 3, 0); - ser_send(upsfd, "?%c", ENDCHAR); - usleep (UPS_DELAY); - ser_get_line(upsfd, temp, sizeof(temp), ENDCHAR, IGNCHARS, 3, 0); - - /* the upsh handlers can't be done here, as they get initialized * shortly after upsdrv_initups returns to main. */ From ced34c3bb91abb4ca99eb3119091c50abe4e8e1e Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Mon, 13 Oct 2025 01:12:26 +0200 Subject: [PATCH 287/805] drivers/victronups.c: fix whitespace markup; translate comments Signed-off-by: Jim Klimov --- drivers/victronups.c | 228 ++++++++++++++++++++++--------------------- 1 file changed, 117 insertions(+), 111 deletions(-) diff --git a/drivers/victronups.c b/drivers/victronups.c index 37f23a3b41..9a9b141bae 100644 --- a/drivers/victronups.c +++ b/drivers/victronups.c @@ -84,7 +84,8 @@ static int test_in_progress = VICTRON_NO_TEST; static int get_data (const char *out_string, char *in_string) { - ssize_t ret_code; + ssize_t ret_code; + ser_send(upsfd, "%s%c", out_string, ENDCHAR); usleep (UPS_DELAY); ret_code = ser_get_line(upsfd, in_string, LENGTH_TEMP, ENDCHAR, @@ -98,16 +99,16 @@ static int get_data (const char *out_string, char *in_string) static int instcmd(const char *cmdname, const char *extra) { - char temp[ LENGTH_TEMP ]; + char temp[LENGTH_TEMP]; /* May be used in logging below, but not as a command argument */ NUT_UNUSED_VARIABLE(extra); upsdebug_INSTCMD_STARTING(cmdname, extra); - if(!strcasecmp(cmdname, "calibrate.start")) + if (!strcasecmp(cmdname, "calibrate.start")) { upslog_INSTCMD_POWERSTATE_MAYBE(cmdname, extra); - if(get_data("vTi5!",temp)) + if (get_data("vTi5!", temp)) { upsdebugx(1, "instcmd: ser_send calibrate.start failed"); return STAT_INSTCMD_UNKNOWN; /* Or Failed when it get defined */ @@ -119,10 +120,10 @@ static int instcmd(const char *cmdname, const char *extra) return STAT_INSTCMD_HANDLED; } } - else if(!strcasecmp(cmdname, "calibrate.stop")) + else if (!strcasecmp(cmdname, "calibrate.stop")) { upslog_INSTCMD_POWERSTATE_MAYBE(cmdname, extra); - if(get_data("vTi2!",temp)) + if (get_data("vTi2!", temp)) { upsdebugx(1, "instcmd: ser_send calibrate.stop failed"); return STAT_INSTCMD_UNKNOWN; /* Or Failed when it get defined */ @@ -133,10 +134,10 @@ static int instcmd(const char *cmdname, const char *extra) return STAT_INSTCMD_HANDLED; } } - else if(!strcasecmp(cmdname, "test.battery.stop")) + else if (!strcasecmp(cmdname, "test.battery.stop")) { upslog_INSTCMD_POWERSTATE_MAYBE(cmdname, extra); - if(get_data("vTi2!",temp)) + if (get_data("vTi2!", temp)) { upsdebugx(1, "instcmd: ser_send test.battery.stop failed"); return STAT_INSTCMD_UNKNOWN; /* Or Failed when it get defined */ @@ -147,10 +148,10 @@ static int instcmd(const char *cmdname, const char *extra) return STAT_INSTCMD_HANDLED; } } - else if(!strcasecmp(cmdname, "test.battery.start")) + else if (!strcasecmp(cmdname, "test.battery.start")) { upslog_INSTCMD_POWERSTATE_MAYBE(cmdname, extra); - if(get_data("vTi4!",temp)) + if (get_data("vTi4!", temp)) { upsdebugx(1, "instcmd: ser_send test.battery.start failed"); return STAT_INSTCMD_UNKNOWN; /* Or Failed when it get defined */ @@ -162,9 +163,9 @@ static int instcmd(const char *cmdname, const char *extra) return STAT_INSTCMD_HANDLED; } } - else if(!strcasecmp(cmdname, "test.panel.stop")) + else if (!strcasecmp(cmdname, "test.panel.stop")) { - if(get_data("vTi2!",temp)) + if (get_data("vTi2!", temp)) { upsdebugx(1, "instcmd: ser_send test.panel.stop failed"); return STAT_INSTCMD_UNKNOWN; /* Or Failed when it get defined */ @@ -175,9 +176,9 @@ static int instcmd(const char *cmdname, const char *extra) return STAT_INSTCMD_HANDLED; } } - else if(!strcasecmp(cmdname, "test.panel.start")) + else if (!strcasecmp(cmdname, "test.panel.start")) { - if(get_data("vTi3!",temp)) + if (get_data("vTi3!", temp)) { upsdebugx(1, "instcmd: ser_send test.panel.start failed"); return STAT_INSTCMD_UNKNOWN; /* Or Failed when it get defined */ @@ -189,10 +190,10 @@ static int instcmd(const char *cmdname, const char *extra) return STAT_INSTCMD_HANDLED; } } - else if(!strcasecmp(cmdname, "bypass.stop")) + else if (!strcasecmp(cmdname, "bypass.stop")) { upslog_INSTCMD_POWERSTATE_MAYBE(cmdname, extra); - if(get_data("vTi2!",temp)) + if (get_data("vTi2!", temp)) { upsdebugx(1, "instcmd: ser_send bypass.stop failed"); return STAT_INSTCMD_UNKNOWN; /* Or Failed when it get defined */ @@ -203,10 +204,10 @@ static int instcmd(const char *cmdname, const char *extra) return STAT_INSTCMD_HANDLED; } } - else if(!strcasecmp(cmdname, "bypass.start")) + else if (!strcasecmp(cmdname, "bypass.start")) { upslog_INSTCMD_POWERSTATE_MAYBE(cmdname, extra); - if(get_data("vTi101!",temp)) + if (get_data("vTi101!", temp)) { upsdebugx(1, "instcmd: ser_send bypass.start failed"); return STAT_INSTCMD_UNKNOWN; /* Or Failed when it get defined */ @@ -229,7 +230,7 @@ void upsdrv_initinfo(void) { char temp[LENGTH_TEMP]; - /* inicializace a synchronizace UPS */ + /* initialization and synchronization of the UPS */ ser_send_char(upsfd, ENDCHAR); usleep (UPS_LONG_DELAY); ser_send(upsfd, "?%c", ENDCHAR); @@ -260,47 +261,47 @@ void upsdrv_initinfo(void) void upsdrv_updateinfo(void) { - int flags; - char temp[ LENGTH_TEMP ]; - char test_result[ LENGTH_TEMP ]; - long runtime_sec = -1; + int flags; + char temp[LENGTH_TEMP]; + char test_result[LENGTH_TEMP]; + long runtime_sec = -1; if (start_is_datastale) { - if (get_data("vDS?",temp)) return; - if (strcmp(temp+3,"NA")) + if (get_data("vDS?", temp)) return; + if (strcmp(temp + 3,"NA")) exist_ups_serial=1; - if (get_data("vBT?",temp)) return; - if (strcmp(temp+3,"NA")) + if (get_data("vBT?", temp)) return; + if (strcmp(temp + 3,"NA")) exist_ups_temperature =1; - if (get_data("vO0I?",temp)) return; - if (strcmp(temp+4,"NA")) + if (get_data("vO0I?", temp)) return; + if (strcmp(temp + 4,"NA")) exist_output_current =1; - if (get_data("vBC?",temp)) return; - if (strcmp(temp+3,"NA")) + if (get_data("vBC?", temp)) return; + if (strcmp(temp + 3,"NA")) exist_battery_charge = 1; - if (get_data("vBI?",temp)) return; - if (strcmp(temp+3,"NA")) + if (get_data("vBI?", temp)) return; + if (strcmp(temp + 3,"NA")) exist_battery_charge = 1; - if (get_data("vBT?",temp)) return; - if (strcmp(temp+3,"NA")) + if (get_data("vBT?", temp)) return; + if (strcmp(temp + 3,"NA")) exist_battery_temperature = 1; - if (get_data("vBt?",temp)) return; - if (strcmp(temp+3,"NA")) + if (get_data("vBt?", temp)) return; + if (strcmp(temp + 3,"NA")) exist_battery_runtime = 1; start_is_datastale = 0; } /* ups.status */ - if (get_data("vAa?",temp)) return; - flags = atoi (temp+3); + if (get_data("vAa?", temp)) return; + flags = atoi (temp + 3); status_init(); @@ -319,45 +320,50 @@ void upsdrv_updateinfo(void) status_set("OL"); /* Get UPS test results */ - if (get_data("vTr?",temp)) return; - if (get_data("vTd?",test_result)) return; + if (get_data("vTr?", temp)) return; + if (get_data("vTd?", test_result)) return; - switch(atoi(temp+3)) + switch(atoi(temp + 3)) { case 1: - upsdebugx(1, "upsdrv_updateinfo: test %i result = Done, Passed: %s",test_in_progress,test_result+3); + upsdebugx(1, "upsdrv_updateinfo: test %i result = Done, Passed: %s", + test_in_progress, test_result + 3); test_in_progress = VICTRON_NO_TEST; break; case 2: - upsdebugx(1, "upsdrv_updateinfo: test %i result = Done, Warning: %s",test_in_progress,test_result+3); + upsdebugx(1, "upsdrv_updateinfo: test %i result = Done, Warning: %s", + test_in_progress, test_result + 3); test_in_progress = VICTRON_NO_TEST; break; case 3: - upsdebugx(1, "upsdrv_updateinfo: test %i result = Done, Error: %s",test_in_progress,test_result+3); + upsdebugx(1, "upsdrv_updateinfo: test %i result = Done, Error: %s", + test_in_progress, test_result + 3); test_in_progress = VICTRON_NO_TEST; break; case 4: - upsdebugx(1, "upsdrv_updateinfo: test %i result = Aborted: %s",test_in_progress,test_result+3); + upsdebugx(1, "upsdrv_updateinfo: test %i result = Aborted: %s", + test_in_progress, test_result + 3); test_in_progress = VICTRON_NO_TEST; break; case 5: - if(test_in_progress==VICTRON_CALIBRATION) + if (test_in_progress==VICTRON_CALIBRATION) status_set("CAL"); /* calibration in progress */ upsdebugx(1, "upsdrv_updateinfo: test %i result = In Progress: %s", - test_in_progress,test_result+3); + test_in_progress, test_result + 3); break; case 6: upsdebugx(1, "upsdrv_updateinfo: test result = No test initiated: %s", - test_result+3); + test_result + 3); break; default: - upsdebugx(1, "upsdrv_updateinfo: unknown test result: %s / %s",temp+3,test_result+3); + upsdebugx(1, "upsdrv_updateinfo: unknown test result: %s / %s", + temp + 3, test_result + 3); break; } @@ -372,101 +378,101 @@ void upsdrv_updateinfo(void) /* ups model */ if (!model_name) { - if (get_data("vDM?",temp)) return; - dstate_setinfo("ups.model", "%s", temp+3); - upsdebugx(1, "ups.model >%s<>%s<\n",temp,temp+3); + if (get_data("vDM?", temp)) return; + dstate_setinfo("ups.model", "%s", temp + 3); + upsdebugx(1, "ups.model >%s<>%s<\n", temp, temp + 3); } /* ups.mfr */ - if (get_data("vDm?",temp)) return; - dstate_setinfo("ups.mfr", "%s", temp+3); - upsdebugx(1, "ups.mfr >%s<>%s<\n",temp,temp+3); + if (get_data("vDm?", temp)) return; + dstate_setinfo("ups.mfr", "%s", temp + 3); + upsdebugx(1, "ups.mfr >%s<>%s<\n", temp, temp + 3); /* ups.serial */ if (exist_ups_serial) { - if (get_data("vDS?",temp)) return; - dstate_setinfo("ups.serial", "%s", temp+3); + if (get_data("vDS?", temp)) return; + dstate_setinfo("ups.serial", "%s", temp + 3); } - upsdebugx(1, "ups.serial >%s<>%s<\n",temp,temp+3); + upsdebugx(1, "ups.serial >%s<>%s<\n", temp, temp + 3); /* ups.firmware */ - if (get_data("vDV?",temp)) return; - dstate_setinfo("ups.firmware", "%s", temp+3); - upsdebugx(1, "ups.firmware >%s<>%s<\n",temp,temp+3); + if (get_data("vDV?", temp)) return; + dstate_setinfo("ups.firmware", "%s", temp + 3); + upsdebugx(1, "ups.firmware >%s<>%s<\n", temp, temp + 3); /* ups.temperature */ if (exist_ups_temperature) { - if (get_data("vBT?",temp)) return; - dstate_setinfo("ups.temperature", "%s", temp+3); + if (get_data("vBT?", temp)) return; + dstate_setinfo("ups.temperature", "%s", temp + 3); } - upsdebugx(1, "ups.temperature >%s<>%s<\n",temp,temp+3); + upsdebugx(1, "ups.temperature >%s<>%s<\n", temp, temp + 3); /* ups.load */ - if (get_data("vO0L?",temp)) return; - dstate_setinfo("ups.load", "%s", temp+4); - upsdebugx(1, "ups.load >%s<>%s<\n",temp,temp+4); + if (get_data("vO0L?", temp)) return; + dstate_setinfo("ups.load", "%s", temp + 4); + upsdebugx(1, "ups.load >%s<>%s<\n", temp, temp + 4); /* ups protocol */ /* - if (get_data("vDC?",temp)) return; - dstate_setinfo("ups.protocol", "%s", temp+3; - upsdebugx(1, "ups.protocol >%s<>%s<\n",temp,temp+3; + if (get_data("vDC?", temp)) return; + dstate_setinfo("ups.protocol", "%s", temp + 3; + upsdebugx(1, "ups.protocol >%s<>%s<\n", temp, temp + 3; */ /************** input.x *****************/ /* input.voltage */ - if (get_data("vI0U?",temp)) return; - dstate_setinfo("input.voltage", "%s", temp+4); - upsdebugx(1, "input.voltage >%s<>%s<\n",temp,temp+4); + if (get_data("vI0U?", temp)) return; + dstate_setinfo("input.voltage", "%s", temp + 4); + upsdebugx(1, "input.voltage >%s<>%s<\n", temp, temp + 4); /* input.transfer.low */ - if (get_data("vFi?",temp)) return; - dstate_setinfo("input.transfer.low", "%s", temp+3); - upsdebugx(1, "input.transfer.low >%s<>%s<\n",temp,temp+3); + if (get_data("vFi?", temp)) return; + dstate_setinfo("input.transfer.low", "%s", temp + 3); + upsdebugx(1, "input.transfer.low >%s<>%s<\n", temp, temp + 3); /* input.transfer.high */ - if (get_data("vFj?",temp)) return; - dstate_setinfo("input.transfer.high", "%s", temp+3); - upsdebugx(1, "input.transfer.high >%s<>%s<\n",temp,temp+3); + if (get_data("vFj?", temp)) return; + dstate_setinfo("input.transfer.high", "%s", temp + 3); + upsdebugx(1, "input.transfer.high >%s<>%s<\n", temp, temp + 3); /* input.frequency */ - if (get_data("vI0f?",temp)) return; - dstate_setinfo("input.frequency", "%2.1f", atof(temp+4) / 10.0); - upsdebugx(1, "input.frequency >%s<>%s<\n",temp,temp+4); + if (get_data("vI0f?", temp)) return; + dstate_setinfo("input.frequency", "%2.1f", atof(temp + 4) / 10.0); + upsdebugx(1, "input.frequency >%s<>%s<\n", temp, temp + 4); /*************** output.x ********************************/ /* output.voltage */ - if (get_data("vO0U?",temp)) return; - dstate_setinfo("output.voltage", "%s", temp+4); - upsdebugx(1, "output.voltage >%s<>%s<\n",temp,temp+4); + if (get_data("vO0U?", temp)) return; + dstate_setinfo("output.voltage", "%s", temp + 4); + upsdebugx(1, "output.voltage >%s<>%s<\n", temp, temp + 4); /* output.frequency */ - if (get_data("vOf?",temp)) return; - dstate_setinfo("output.frequency", "%2.1f", atof(temp+3) / 10.0); - upsdebugx(1, "output.frequency >%s<>%s<\n",temp,temp+3); + if (get_data("vOf?", temp)) return; + dstate_setinfo("output.frequency", "%2.1f", atof(temp + 3) / 10.0); + upsdebugx(1, "output.frequency >%s<>%s<\n", temp, temp + 3); /* output.current */ if (exist_output_current) { - if (get_data("vO0I?",temp)) return; - dstate_setinfo("output.current", "%2.1f", atof(temp+4) / 10.0); + if (get_data("vO0I?", temp)) return; + dstate_setinfo("output.current", "%2.1f", atof(temp + 4) / 10.0); } - upsdebugx(1, "output.current >%s<>%s<\n",temp,temp+4); + upsdebugx(1, "output.current >%s<>%s<\n", temp, temp + 4); /*************** battery.x *******************************/ @@ -474,43 +480,43 @@ void upsdrv_updateinfo(void) /* battery charge */ if (exist_battery_charge) { - if (get_data("vBC?",temp)) return; - dstate_setinfo("battery.charge", "%s", temp+3); + if (get_data("vBC?", temp)) return; + dstate_setinfo("battery.charge", "%s", temp + 3); } - upsdebugx(1, "battery.charge >%s<>%s<\n",temp,temp+3); + upsdebugx(1, "battery.charge >%s<>%s<\n", temp, temp + 3); /* battery.voltage */ - if (get_data("vBU?",temp)) return; - dstate_setinfo("battery.voltage", "%2.1f", atof(temp+3) / 10.0); - upsdebugx(1, "battery.voltage >%s<>%s<\n",temp,temp+3); + if (get_data("vBU?", temp)) return; + dstate_setinfo("battery.voltage", "%2.1f", atof(temp + 3) / 10.0); + upsdebugx(1, "battery.voltage >%s<>%s<\n", temp, temp + 3); /* battery.current */ if (exist_battery_current) { - if (get_data("vBI?",temp)) return; - dstate_setinfo("battery.current", "%2.1f", atof(temp+3) / 10.0); + if (get_data("vBI?", temp)) return; + dstate_setinfo("battery.current", "%2.1f", atof(temp + 3) / 10.0); } - upsdebugx(1, "battery.current >%s<>%s<\n",temp,temp+3); + upsdebugx(1, "battery.current >%s<>%s<\n", temp, temp + 3); /* battery.temperature */ if (exist_battery_temperature) { - if (get_data("vBT?",temp)) return; - dstate_setinfo("battery.temperature", "%s", temp+3); + if (get_data("vBT?", temp)) return; + dstate_setinfo("battery.temperature", "%s", temp + 3); } - upsdebugx(1, "battery.temperature >%s<>%s<\n",temp,temp+3); + upsdebugx(1, "battery.temperature >%s<>%s<\n", temp, temp + 3); /* battery.runtime */ if (exist_battery_runtime) { - if (get_data("vBt?",temp)) return; - runtime_sec = strtol(temp+3, NULL, 10)*60; + if (get_data("vBt?", temp)) return; + runtime_sec = strtol(temp + 3, NULL, 10)*60; snprintf(temp, sizeof(temp), "%ld", runtime_sec); dstate_setinfo("battery.runtime", "%s", temp); } - upsdebugx(1, "battery.runtime >%s<>%ld<\n",temp,runtime_sec); + upsdebugx(1, "battery.runtime >%s<>%ld<\n", temp, runtime_sec); dstate_dataok(); } @@ -544,7 +550,7 @@ void upsdrv_makevartable(void) void upsdrv_initups(void) { - char *usd = NULL; /* = NULL je dulezite jen pro prekladac */ + char *usd = NULL; /* = NULL is important for compiler */ upsfd = ser_open(device_path); ser_set_speed(upsfd, device_path, B1200); @@ -552,13 +558,13 @@ void upsdrv_initups(void) if ((usd = getval("usd"))) { sdwdelay=atoi(usd); - upsdebugx(1, "(-x) Delay before shutdown %i",sdwdelay); + upsdebugx(1, "(-x) Delay before shutdown %i", sdwdelay); } if ((model_name = getval("modelname"))) { - /* kdyz modelname nebylo zadano je vraceno NULL*/ - upsdebugx(1, "(-x) UPS Name %s",model_name); + /* if modelname were not specified, NULL is returned */ + upsdebugx(1, "(-x) UPS Name %s", model_name); } /* the upsh handlers can't be done here, as they get initialized From e2aaeacdc8de9079b6ed1a3cca781428891dfb18 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Mon, 13 Oct 2025 01:15:04 +0200 Subject: [PATCH 288/805] Revert "NEWS.adoc: Fallout of the refactoring of drivers to use `shutdown.*` commands consistently [#1962]" This reverts commit 15bc72b0ae7952fe30b013b48eebfd7a6c9bf0a7 prepared problem log was not a problem after all. Signed-off-by: Jim Klimov --- NEWS.adoc | 6 ------ 1 file changed, 6 deletions(-) diff --git a/NEWS.adoc b/NEWS.adoc index 80c034c5b7..6dbb62a63c 100644 --- a/NEWS.adoc +++ b/NEWS.adoc @@ -39,12 +39,6 @@ https://github.com/networkupstools/nut/milestone/12 - (expected) CI automation for use of data points in drivers that conform to patterns defined in link:docs/nut-names.txt[] - - Fix fallout of development in recent NUT v2.8.x releases: - * Refactoring of drivers to use `shutdown.*` commands consistently (in NUT - v2.8.3 and v2.8.4) may have skipped executions of `INSTCMD` initialization - when the driver is quickly started to power down or cycle an UPS during - systems shutdown. [#1962] - - common code: * Introduced `setproctag()` and `getproctag()` (see examples in `upsmon`) to help track the log messages from massively-forking NUT daemons. [#3084] From 6c38cef4cf2760e9e66b1a45987d45c553e075d5 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Mon, 13 Oct 2025 13:26:35 +0200 Subject: [PATCH 289/805] configure.ac: when we suggest to "make" after "configure" is done, have a fallback if MAKE was not defined/exported Signed-off-by: Jim Klimov --- configure.ac | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index 06174b8ddc..6a83d80a8f 100644 --- a/configure.ac +++ b/configure.ac @@ -6940,7 +6940,9 @@ AS_IF([test x"${NUT_VERSION_DEPLOYED-}" = x""], [ AC_MSG_NOTICE([==========================================================]) ]) +theMAKE="${MAKE-}" +AS_IF([test x"${theMAKE}" = x], [theMAKE="make"]) AC_MSG_NOTICE([==========================================================]) -AC_MSG_NOTICE([Configuration complete: Run '$MAKE' to build ${NUT_SOURCE_VERSION_REPORT} now.]) -AC_MSG_NOTICE([You may use parallelism if supported by your hardware and 'make' implementation, e.g. '$MAKE -j 8']) +AC_MSG_NOTICE([Configuration complete: Run '$theMAKE' to build ${NUT_SOURCE_VERSION_REPORT} now.]) +AC_MSG_NOTICE([You may use parallelism if supported by your hardware and 'make' implementation, e.g. '$theMAKE -j 8']) AC_MSG_NOTICE([==========================================================]) From a44a87cf9f0f0573a12b7fe5407b631a8e2b8917 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Mon, 13 Oct 2025 13:28:16 +0200 Subject: [PATCH 290/805] drivers/snmp-ups.c: comment about us not parsing the port from device_path Signed-off-by: Jim Klimov --- drivers/snmp-ups.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/snmp-ups.c b/drivers/snmp-ups.c index 94e1b0b013..c16d75c312 100644 --- a/drivers/snmp-ups.c +++ b/drivers/snmp-ups.c @@ -1004,6 +1004,7 @@ void nut_snmp_init(const char *type, const char *hostname) /* Initialize session */ snmp_sess_init(&g_snmp_sess); + /* peername may include the port, transport, etc. and will be parsed by the SNMP library */ g_snmp_sess.peername = xstrdup(hostname); /* Net-SNMP timeout and retries */ From 8ad2288e88e5e3b441c3ce48a6eb80838956e4e9 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Mon, 13 Oct 2025 15:16:54 +0200 Subject: [PATCH 291/805] Makefile.am: spellcheck-interactive: follow-up with a spellcheck-quick to soak up timestamp changes of the dictionary file Signed-off-by: Jim Klimov --- Makefile.am | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Makefile.am b/Makefile.am index 2a11360eef..d5d2627fb8 100644 --- a/Makefile.am +++ b/Makefile.am @@ -698,9 +698,13 @@ spellcheck spellcheck-interactive: SUBDIR_MAKE_VERBOSE=0 ; \ fi ; \ export SUBDIR_MAKE_VERBOSE ; \ - $(MAKE) $(AM_MAKEFLAGS) SPELLCHECK_TGT='$@' SUBDIR_MAKE_VERBOSE="$${SUBDIR_MAKE_VERBOSE}" -k -s $(SPELLCHECK_DIRS) && exit ; \ + ( $(MAKE) $(AM_MAKEFLAGS) SPELLCHECK_TGT='$@' SUBDIR_MAKE_VERBOSE="$${SUBDIR_MAKE_VERBOSE}" -k -s $(SPELLCHECK_DIRS) && exit ; \ echo "WARNING: FAILED fanned-out attempt in $@, retrying with NUT_MAKE_SKIP_FANOUT" >&2 ; \ - $(MAKE) $(AM_MAKEFLAGS) NUT_MAKE_SKIP_FANOUT=true SPELLCHECK_TGT='$@' -k -s $(SPELLCHECK_DIRS) + $(MAKE) $(AM_MAKEFLAGS) NUT_MAKE_SKIP_FANOUT=true SPELLCHECK_TGT='$@' -k -s $(SPELLCHECK_DIRS) ) || exit ; \ + if [ x"$@" = xspellcheck-interactive ] ; then \ + echo "SUCCESS: $@: follow up with spellcheck-quick to revise and update timestamps"; \ + $(MAKE) $(AM_MAKEFLAGS) spellcheck-quick ; \ + fi # Auto-parallel recipe (if current 'make' implementation supports the "-j N" # syntax; the optional MAXPARMAKES may be set in NUT CI farm style builds): From c342da5a0e5f073c5a2f3117dbc99a8581497185 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Mon, 13 Oct 2025 16:49:37 +0200 Subject: [PATCH 292/805] docs/configure.txt: clarify that --with-group is barely used directly by daemons [#3120] Signed-off-by: Jim Klimov --- docs/configure.txt | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/docs/configure.txt b/docs/configure.txt index 1572277b7d..ece1844eaa 100644 --- a/docs/configure.txt +++ b/docs/configure.txt @@ -788,11 +788,6 @@ initiate a shutdown. There is always at least a stub process remaining with `root` powers. The network code runs in another (separate) process as the new user. -The `` is used for the permissions of some files, -particularly the hotplugging rules for USB. The idea is that the -device files for any UPS devices should be readable and writable by -members of that group. - The default value for both the username and groupname is `nobody` (or `nogroup` on systems that have it when `configure` script runs). This was done since it's slightly better than staying around as @@ -800,6 +795,21 @@ This was done since it's slightly better than staying around as hack for NFS access. You should create at least one separate user for this software. +When such NUT daemons `setuid()` to some user account (whether built-in, +or specified in configuration files, or passed on command line), they +also typically assume that account's primary group via `setgid()`. +With default installation or packaging approaches, the dedicated user +account "coincidentally" has the group specified here as its primary. + +The specified `` is used for the permissions of some files, +particularly the hotplugging rules for USB. The idea is that the +device files for any UPS devices should be readable and writable by +members of that group. It also allows to run the drivers and the data +server as different user accounts, which have some group in common +(it should be the primary group for the user linkman:upsd[8] runs as, +and such deployment would be using explicit user/group account settings +beyond the one built-in value configurable here). + If you use one of the `--with-user` and `--with-group` options, then you have to use the other one too. From 0c22febd3e7c19eca0610b80cb2009f01ec805db Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Tue, 14 Oct 2025 15:47:26 +0200 Subject: [PATCH 293/805] configure.ac: warn if several python versions were AUTO-detected and configured [#1792] Signed-off-by: Jim Klimov --- NEWS.adoc | 4 ++++ configure.ac | 21 +++++++++++++++++++++ 2 files changed, 25 insertions(+) diff --git a/NEWS.adoc b/NEWS.adoc index 9cb118e193..344b3e6e55 100644 --- a/NEWS.adoc +++ b/NEWS.adoc @@ -159,6 +159,10 @@ several `FSD` notifications into one executed action. [PR #3097] it), if not bundling with NUT-Monitor UI app. By default the respective interpreter's 'site-packages' or 'dist-packages' location will be used, so you may have to adjust search paths for any other values. [#3062] + * The script would now warn the caller if several different Python program + paths or module locations were discovered (at least one automatically), + in case this was not something the callers wanted -- just so they know. + [#1792] - Fixed CI recipes for PyPI publication of PyNUT(Client) module to also include the source distribution (was posted for NUT v2.8.1 and v2.8.2 diff --git a/configure.ac b/configure.ac index 6a83d80a8f..4974e65d79 100644 --- a/configure.ac +++ b/configure.ac @@ -6940,6 +6940,27 @@ AS_IF([test x"${NUT_VERSION_DEPLOYED-}" = x""], [ AC_MSG_NOTICE([==========================================================]) ]) +dnl Okay, PYTHON3!=PYTHON2 is a bit of overkill, but better cover all bases, right? +dnl FIXME: Check if corresponding pynut or nut-monitor app default/2/3 were explicitly +dnl requested, and so auto-detection of corresponding multiple locations is intentional? +AS_IF([ (test x"${PYTHON}" != x -a x"${PYTHON2}" != x -a x"${PYTHON2}" != x"${PYTHON}" && test x"${nut_with_python}" = xyes -o x"${nut_with_python}" = xauto -o x"${nut_with_python2}" = xyes -o x"${nut_with_python2}" = xauto) \ + || (test x"${PYTHON}" != x -a x"${PYTHON3}" != x -a x"${PYTHON3}" != x"${PYTHON}" && test x"${nut_with_python}" = xyes -o x"${nut_with_python}" = xauto -o x"${nut_with_python3}" = xyes -o x"${nut_with_python3}" = xauto) \ + || (test x"${PYTHON2}" != x -a x"${PYTHON3}" != x -a x"${PYTHON3}" != x"${PYTHON2}" && test x"${nut_with_python3}" = xyes -o x"${nut_with_python3}" = xauto -o x"${nut_with_python2}" = xyes -o x"${nut_with_python2}" = xauto) \ + || (test x"${PYTHON_SITE_PACKAGES}" != x -a x"${PYTHON2_SITE_PACKAGES}" != x -a x"${PYTHON2_SITE_PACKAGES}" != x"${PYTHON_SITE_PACKAGES}" && test x"${nut_with_python_modules_dir}" = xyes -o x"${nut_with_python_modules_dir}" = xauto -o x"${nut_with_python2_modules_dir}" = xyes -o x"${nut_with_python2_modules_dir}" = xauto) \ + || (test x"${PYTHON_SITE_PACKAGES}" != x -a x"${PYTHON3_SITE_PACKAGES}" != x -a x"${PYTHON3_SITE_PACKAGES}" != x"${PYTHON_SITE_PACKAGES}" && test x"${nut_with_python_modules_dir}" = xyes -o x"${nut_with_python_modules_dir}" = xauto -o x"${nut_with_python3_modules_dir}" = xyes -o x"${nut_with_python3_modules_dir}" = xauto) \ + || (test x"${PYTHON2_SITE_PACKAGES}" != x -a x"${PYTHON3_SITE_PACKAGES}" != x -a x"${PYTHON3_SITE_PACKAGES}" != x"${PYTHON2_SITE_PACKAGES}" && test x"${nut_with_python3_modules_dir}" = xyes -o x"${nut_with_python3_modules_dir}" = xauto -o x"${nut_with_python2_modules_dir}" = xyes -o x"${nut_with_python2_modules_dir}" = xauto) \ +], [ + AC_MSG_NOTICE([==========================================================]) + AC_MSG_NOTICE([You have auto-detected Python interpreter availability and]) + AC_MSG_NOTICE([ended up with more than one interpreter path or directory]) + AC_MSG_NOTICE([for site-packages. This is not a problem for NUT-Monitor GUI]) + AC_MSG_NOTICE([client, nor for installation of PyNUTClient module to be]) + AC_MSG_NOTICE([available in all of those Python ecosystems, but if you did]) + AC_MSG_NOTICE([not mean for that to happen, please revise the build settings]) + AC_MSG_NOTICE([and use --without-python* options as reflects your situation.]) + AC_MSG_NOTICE([==========================================================]) +]) + theMAKE="${MAKE-}" AS_IF([test x"${theMAKE}" = x], [theMAKE="make"]) AC_MSG_NOTICE([==========================================================]) From af41f892594502dee3f7f3ae2b30f99cf549b2a8 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Tue, 14 Oct 2025 15:48:14 +0200 Subject: [PATCH 294/805] docs/configure.txt, docs/nut.dict: revise the section on --with-python* settings [#1792] Signed-off-by: Jim Klimov --- docs/configure.txt | 24 ++++++++++++++++++------ docs/nut.dict | 3 ++- 2 files changed, 20 insertions(+), 7 deletions(-) diff --git a/docs/configure.txt b/docs/configure.txt index ece1844eaa..1cc1d1d25c 100644 --- a/docs/configure.txt +++ b/docs/configure.txt @@ -488,20 +488,30 @@ etc. One exception is generation of NUT-Monitor GUI application, being separated for `NUT-Monitor-py2gtk2`, `NUT-Monitor-py3qt5`, `NUT-Monitor-py3qt6` due -to further backend platform technical differences -- these build products +to further backend platform technical differences -- these build products specifically use `PYTHON2` and `PYTHON3` substitutions. They may also be -co-installed on the same system. A dispatcher shell script `NUT-Monitor` -is used to launch the preferred (newest) or only existing implementation. +co-installed on the same system. A dispatcher shell script `NUT-Monitor` is +used to launch the preferred (newest) or the only existing implementation. Please note that by default NUT tries to make use of everything in your -build environment, so if both Python generation are detected -- the binding +build environment, so if both Python generations are detected -- the binding module will be delivered into both, and two versions of NUT-Monitor GUI application will be installed. If you want to avoid that behaviour on a build system with both interpreters present, you can explicitly specify to build e.g. `--without-python2 --with-python=/usr/bin/python-3.9`. +IMPORTANT: It should be stressed that specifying an explicit `--with-python` +value does not implicitly mean `--without-python2` nor `--without-python3`, +and those would be discovered and configured for, if possible. +Conversely, an explicit e.g. `--with-python2` setting does not automatically +mean `--without-python` nor `--without-python3`. +Since this may come across surprising to some people, the `configure` script +would warn in the end if several Python versions were auto-detected one way +or another. + The settings below may be of particular interest to non-distribution -packaging efforts with their own dedicated directory trees: +packaging efforts with their own dedicated directory trees (like pkgsrc), +or where all packages have dedicated sub-trees (like NixOS): --with-python=SHEBANG_PATH @@ -510,8 +520,10 @@ code (except version-dependent scripts, see above). The `SHEBANG_PATH` should be a full program pathname, optionally with one argument, e.g. `/usr/bin/python-3.9` or `/usr/bin/env python2`. +Note that packaging distributions generally aim for predictable setups, +and disapprove of `/usr/bin/env` in shebangs for packaged scripts. -Defaults (in order): +Defaults for `--with-python` if it was not specified (in order): * `python`, `python3` or `python2` program if present in `PATH` by such name, * or the newest of `PYTHON3` or `PYTHON2` values (specified or detected below). diff --git a/docs/nut.dict b/docs/nut.dict index cdec3df402..30a83563d3 100644 --- a/docs/nut.dict +++ b/docs/nut.dict @@ -1,4 +1,4 @@ -personal_ws-1.1 en 3562 utf-8 +personal_ws-1.1 en 3563 utf-8 AAC AAS ABI @@ -836,6 +836,7 @@ Neus Niels Niklas Niro +NixOS Nobreak Nobreaks Nom From 82bdff3c930eb7af9360b5e50e6fa8d05de0444d Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Tue, 14 Oct 2025 15:49:32 +0200 Subject: [PATCH 295/805] INSTALL.nut.adoc: mention some surprising configure options, like the many --with-python* settings, and a --sysconfdir override [#1792] Signed-off-by: Jim Klimov --- INSTALL.nut.adoc | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/INSTALL.nut.adoc b/INSTALL.nut.adoc index fc78f7ed5d..842233e145 100644 --- a/INSTALL.nut.adoc +++ b/INSTALL.nut.adoc @@ -298,6 +298,16 @@ See <> from the User Manual, docs/configure.txt or './configure --help' for all the available options. +NOTE: Due to various historic or architectural reasons, some of the option +usages may be surprising (compared to other autotools-driven projects), but +those choices remain in place to minimize the surprise for people who rebuild +NUT regularly. A few cases worth mentioning include the use of `--sysconfdir` +as `/etc/nut` directly (rather than keeping `/etc` and having another option +to append `/nut`), and multiple `--with-python*` settings for its different +major version ecosystems which are all auto-detected independently (so you +may need certain `--without-python2` etc. options if you want to disable some +module installation paths that your system is eager to support). + If you alter paths with additional switches, be sure to use those new paths while reading the rest of the steps. From a8156d46bcfaf203779074b3105e6d3ad814a787 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Wed, 15 Oct 2025 22:25:34 +0200 Subject: [PATCH 296/805] m4/nut_check_python.m4, NEWS.adoc, UPGRADING.adoc, INSTALL.nut.adoc, docs/configure.txt, docs/nut.dict: change default to auto-prioritize some one available python interpreter [#1792] Signed-off-by: Jim Klimov --- INSTALL.nut.adoc | 2 +- NEWS.adoc | 5 +++++ UPGRADING.adoc | 9 +++++++++ docs/configure.txt | 18 ++++++++++++----- docs/nut.dict | 3 ++- m4/nut_check_python.m4 | 46 +++++++++++++++++++++++++++++++++--------- 6 files changed, 67 insertions(+), 16 deletions(-) diff --git a/INSTALL.nut.adoc b/INSTALL.nut.adoc index 842233e145..a1833d4d29 100644 --- a/INSTALL.nut.adoc +++ b/INSTALL.nut.adoc @@ -304,7 +304,7 @@ those choices remain in place to minimize the surprise for people who rebuild NUT regularly. A few cases worth mentioning include the use of `--sysconfdir` as `/etc/nut` directly (rather than keeping `/etc` and having another option to append `/nut`), and multiple `--with-python*` settings for its different -major version ecosystems which are all auto-detected independently (so you +major version ecosystems which can be all auto-detected independently (so you may need certain `--without-python2` etc. options if you want to disable some module installation paths that your system is eager to support). diff --git a/NEWS.adoc b/NEWS.adoc index 344b3e6e55..22fe3a6072 100644 --- a/NEWS.adoc +++ b/NEWS.adoc @@ -163,6 +163,11 @@ several `FSD` notifications into one executed action. [PR #3097] paths or module locations were discovered (at least one automatically), in case this was not something the callers wanted -- just so they know. [#1792] + * New supported values were introduced for `--with-python{,2,3}=auto-prio=NUM`: + this allows to auto-prioritize some *one* available Python interpreter. + Default settings were changed from plain `auto` (allowing for multiple + `python*` interpreters and `site-package` locations to be used), to + prefer a `python3` if available, else `python2`, else `python`. [#1792] - Fixed CI recipes for PyPI publication of PyNUT(Client) module to also include the source distribution (was posted for NUT v2.8.1 and v2.8.2 diff --git a/UPGRADING.adoc b/UPGRADING.adoc index 037d4654e7..01c4e1d745 100644 --- a/UPGRADING.adoc +++ b/UPGRADING.adoc @@ -56,6 +56,15 @@ Changes from 2.8.4 to 2.8.5 the "purelib" location as `PYTHON*_SITE_PACKAGES`. Packaging recipes may have to be updated. [#1209] +- New supported values were introduced for `--with-python{,2,3}=auto-prio=NUM`: + this allows to auto-prioritize some *one* available Python interpreter. + Default settings were changed from plain `auto` (allowing for multiple + `python*` interpreters and `site-package` locations to be used), to + prefer a `python3` if available, else `python2`, else `python`, and + forget about others even if discovered. Packaging recipes may have to be + updated, either to explicitly package the binding for several versions, + or to not-deliver files no longer installed into the prototype area. [#1792] + Changes from 2.8.3 to 2.8.4 --------------------------- diff --git a/docs/configure.txt b/docs/configure.txt index 1cc1d1d25c..82949d9ffa 100644 --- a/docs/configure.txt +++ b/docs/configure.txt @@ -500,11 +500,19 @@ application will be installed. If you want to avoid that behaviour on a build system with both interpreters present, you can explicitly specify to build e.g. `--without-python2 --with-python=/usr/bin/python-3.9`. -IMPORTANT: It should be stressed that specifying an explicit `--with-python` -value does not implicitly mean `--without-python2` nor `--without-python3`, -and those would be discovered and configured for, if possible. -Conversely, an explicit e.g. `--with-python2` setting does not automatically -mean `--without-python` nor `--without-python3`. +Default values are currently prioritized for auto-detection to result in +some one Python interpreter version to be chosen even if several were +discovered (in order: '3', '2', or not numbered), using `auto-prio=NUM` +syntax. If some of these options specify a particular interpreter, none +of the `auto-prio` hits are considered. + +NOTE: Previous default (from NUT v2.8.0 to v2.8.4) was `auto` to allow all up +to three hits to be considered as script shebang and as `make install` targets. +When using `auto` values, specifying an explicit `--with-python` value does +not implicitly mean `--without-python2` nor `--without-python3`, and those +would be discovered and configured for, if possible. Conversely, an explicit +e.g. `--with-python2` setting does not automatically mean `--without-python` +nor `--without-python3`. Since this may come across surprising to some people, the `configure` script would warn in the end if several Python versions were auto-detected one way or another. diff --git a/docs/nut.dict b/docs/nut.dict index 30a83563d3..9f7fa28997 100644 --- a/docs/nut.dict +++ b/docs/nut.dict @@ -1,4 +1,4 @@ -personal_ws-1.1 en 3563 utf-8 +personal_ws-1.1 en 3564 utf-8 AAC AAS ABI @@ -2865,6 +2865,7 @@ prereqs pretentiousVariableNamingSchemes prgshut printf +prio priv privPassword privProtocol diff --git a/m4/nut_check_python.m4 b/m4/nut_check_python.m4 index ef1a020bc0..7a4c85a96c 100644 --- a/m4/nut_check_python.m4 +++ b/m4/nut_check_python.m4 @@ -4,6 +4,9 @@ dnl to embed into scripts and Make rules AC_DEFUN([NUT_CHECK_PYTHON_DEFAULT], [ dnl Check for all present variants and pick the default PYTHON + dnl Note that the --with... values may involve "auto-prio=NUM" + dnl which then sets only one of the values (lowest prio number + dnl wins) and discards the others even if detected. AC_REQUIRE([NUT_CHECK_PYTHON]) AC_REQUIRE([NUT_CHECK_PYTHON2]) AC_REQUIRE([NUT_CHECK_PYTHON3]) @@ -34,6 +37,31 @@ AC_DEFUN([NUT_CHECK_PYTHON_DEFAULT], AS_IF([test -z "${PYTHON}" && test x"${nut_with_python}" = xyes], [ AC_MSG_ERROR([A python interpreter was required but not found or validated]) ]) + + dnl Pick the top-most hit (smallest prio number) + BEST_AUTO="`( echo "${nut_with_python}|${PYTHON}"; echo "${nut_with_python2}|${PYTHON2}"; echo "${nut_with_python3}|${PYTHON3}" ) | ${EGREP} "^auto-prio=" | ${EGREP} -v '\|$' | sort -n | head -1`" + BEST_AUTO_PRIO="`echo "${BEST_AUTO}" | sed 's,|.*$,,'`" + BEST_AUTO_PYTHON="`echo "${BEST_AUTO}" | sed 's,^.*|,,'`" + AS_IF([test x"${BEST_AUTO_PYTHON}" != x], [ + AC_MSG_NOTICE([Got an auto-priority preferred hit: ${BEST_AUTO_PRIO} => ${BEST_AUTO_PYTHON}"]) + AS_CASE([x"${nut_with_python3}"], + [x"${BEST_AUTO_PRIO}"], [AC_MSG_NOTICE([Forgetting PYTHON2='${PYTHON2}' and PYTHON='${PYTHON}' (if any were detected as auto-prio too)]) + AS_CASE([x"${nut_with_python2}"], [xauto-prio=*], [PYTHON2="no"]) + AS_CASE([x"${nut_with_python}"], [xauto-prio=*], [PYTHON="no"]) + ],[AS_CASE([x"${nut_with_python2}"], + [x"${BEST_AUTO_PRIO}"], [AC_MSG_NOTICE([Forgetting PYTHON3='${PYTHON3}' and PYTHON='${PYTHON}' (if any were detected as auto-prio too)]) + AS_CASE([x"${nut_with_python3}"], [xauto-prio=*], [PYTHON3="no"]) + AS_CASE([x"${nut_with_python}"], [xauto-prio=*], [PYTHON="no"]) + ],[AS_CASE([x"${nut_with_python}"], + [x"${BEST_AUTO_PRIO}"], [AC_MSG_NOTICE([Forgetting PYTHON3='${PYTHON3}' and PYTHON2='${PYTHON2}' (if any were detected as auto-prio too)]) + AS_CASE([x"${nut_with_python2}"], [xauto-prio=*], [PYTHON2="no"]) + AS_CASE([x"${nut_with_python3}"], [xauto-prio=*], [PYTHON3="no"]) + ]) + ]) + ]) + ]) + unset BEST_AUTO_PYTHON + unset BEST_AUTO ]) dnl Note: this checks for default/un-versioned python version @@ -42,7 +70,7 @@ dnl variable; it may be further tweaked by NUT_CHECK_PYTHON_DEFAULT AC_DEFUN([NUT_CHECK_PYTHON], [ AS_IF([test -z "${nut_with_python}"], [ - NUT_ARG_WITH([python], [Use a particular program name of the python interpeter], [auto]) + NUT_ARG_WITH([python], [Use a particular program name of the python interpeter], [auto-prio=3]) PYTHON="" PYTHON_SITE_PACKAGES="" @@ -50,7 +78,7 @@ AC_DEFUN([NUT_CHECK_PYTHON], PYTHON_VERSION_INFO_REPORT="" PYTHON_SYSPATH_REPORT="" AS_CASE([${nut_with_python}], - [auto|yes|""], [AC_CHECK_PROGS([PYTHON], [python python3 python2], [_python_runtime])], + [auto|auto-prio=*|yes|""], [AC_CHECK_PROGS([PYTHON], [python python3 python2], [_python_runtime])], [no], [PYTHON="no"], [PYTHON="${nut_with_python}"] ) @@ -108,7 +136,7 @@ AC_DEFUN([NUT_CHECK_PYTHON], dnl Unfulfilled "yes" is re-tested in NUT_CHECK_PYTHON_DEFAULT AS_IF([test -z "${PYTHON}" || test "${PYTHON}" = "no"], [ AS_CASE([${nut_with_python}], - [auto|yes|no|""], [], + [auto|auto-prio=*|yes|no|""], [], [AC_MSG_ERROR([A python interpreter was required but not found or validated: ${nut_with_python}])]) ]) @@ -162,7 +190,7 @@ AC_DEFUN([NUT_CHECK_PYTHON], AC_DEFUN([NUT_CHECK_PYTHON2], [ AS_IF([test -z "${nut_with_python2}"], [ - NUT_ARG_WITH([python2], [Use a particular program name of the python2 interpeter for code that needs that version and is not compatible with python3], [auto]) + NUT_ARG_WITH([python2], [Use a particular program name of the python2 interpeter for code that needs that version and is not compatible with python3], [auto-prio=2]) PYTHON2="" PYTHON2_SITE_PACKAGES="" @@ -170,7 +198,7 @@ AC_DEFUN([NUT_CHECK_PYTHON2], PYTHON2_VERSION_INFO_REPORT="" PYTHON2_SYSPATH_REPORT="" AS_CASE([${nut_with_python2}], - [auto|yes|""], [ + [auto|auto-prio=*|yes|""], [ dnl Cross check --with-python results: AS_CASE(["${PYTHON_VERSION_INFO_REPORT}"], [*major=2,*], [ @@ -248,7 +276,7 @@ AC_DEFUN([NUT_CHECK_PYTHON2], dnl Unfulfilled "yes" is re-tested in NUT_CHECK_PYTHON_DEFAULT AS_IF([test -z "${PYTHON2}" || test "${PYTHON2}" = "no"], [ AS_CASE([${nut_with_python2}], - [auto|yes|no|""], [], + [auto|auto-prio=*|yes|no|""], [], [AC_MSG_ERROR([A python2 interpreter was required but not found or validated: ${nut_with_python2}])]) ]) @@ -300,7 +328,7 @@ AC_DEFUN([NUT_CHECK_PYTHON2], AC_DEFUN([NUT_CHECK_PYTHON3], [ AS_IF([test -z "${nut_with_python3}"], [ - NUT_ARG_WITH([python3], [Use a particular program name of the python3 interpeter for code that needs that version and is not compatible with python2], [auto]) + NUT_ARG_WITH([python3], [Use a particular program name of the python3 interpeter for code that needs that version and is not compatible with python2], [auto-prio=1]) PYTHON3="" PYTHON3_SITE_PACKAGES="" @@ -308,7 +336,7 @@ AC_DEFUN([NUT_CHECK_PYTHON3], PYTHON3_VERSION_INFO_REPORT="" PYTHON3_SYSPATH_REPORT="" AS_CASE([${nut_with_python3}], - [auto|yes|""], [ + [auto|auto-prio=*|yes|""], [ dnl Cross check --with-python results: AS_CASE(["${PYTHON_VERSION_INFO_REPORT}"], [*major=3,*], [ @@ -386,7 +414,7 @@ AC_DEFUN([NUT_CHECK_PYTHON3], dnl Unfulfilled "yes" is re-tested in NUT_CHECK_PYTHON_DEFAULT AS_IF([test -z "${PYTHON3}" || test "${PYTHON3}" = "no"], [ AS_CASE([${nut_with_python3}], - [auto|yes|no|""], [], + [auto|auto-prio=*|yes|no|""], [], [AC_MSG_ERROR([A python3 interpreter was required but not found or validated: ${nut_with_python3}])]) ]) From fa6af3b8cbe88031c7841db1395902e8a0871d40 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Wed, 15 Oct 2025 22:56:39 +0200 Subject: [PATCH 297/805] m4/nut_check_python.m4: separate NUT_CHECK_PYTHON*_SITE_PACKAGES into dedicated methods, to honour forgetting of interpreters due to auto-prio [#1792] Signed-off-by: Jim Klimov --- m4/nut_check_python.m4 | 62 ++++++++++++++++++++++++++++++------------ 1 file changed, 44 insertions(+), 18 deletions(-) diff --git a/m4/nut_check_python.m4 b/m4/nut_check_python.m4 index 7a4c85a96c..147508a8a6 100644 --- a/m4/nut_check_python.m4 +++ b/m4/nut_check_python.m4 @@ -62,6 +62,20 @@ AC_DEFUN([NUT_CHECK_PYTHON_DEFAULT], ]) unset BEST_AUTO_PYTHON unset BEST_AUTO + + dnl Only now propagate what we found + AC_SUBST([PYTHON], [${PYTHON}]) + AM_CONDITIONAL([HAVE_PYTHON], [test -n "${PYTHON}" && test "${PYTHON}" != "no"]) + + AC_SUBST([PYTHON2], [${PYTHON2}]) + AM_CONDITIONAL([HAVE_PYTHON2], [test -n "${PYTHON2}" && test "${PYTHON2}" != "no"]) + + AC_SUBST([PYTHON3], [${PYTHON3}]) + AM_CONDITIONAL([HAVE_PYTHON3], [test -n "${PYTHON3}" && test "${PYTHON3}" != "no"]) + + AC_REQUIRE([NUT_CHECK_PYTHON_SITE_PACKAGES]) + AC_REQUIRE([NUT_CHECK_PYTHON2_SITE_PACKAGES]) + AC_REQUIRE([NUT_CHECK_PYTHON3_SITE_PACKAGES]) ]) dnl Note: this checks for default/un-versioned python version @@ -142,9 +156,12 @@ AC_DEFUN([NUT_CHECK_PYTHON], AC_MSG_CHECKING([python interpeter to call]) AC_MSG_RESULT([${PYTHON}${PYTHON_VERSION_INFO_REPORT}]) - AC_SUBST([PYTHON], [${PYTHON}]) - AM_CONDITIONAL([HAVE_PYTHON], [test -n "${PYTHON}" && test "${PYTHON}" != "no"]) - AS_IF([test -n "${PYTHON}" && test "${PYTHON}" != "no"], [ + ]) +]) + +AC_DEFUN([NUT_CHECK_PYTHON_SITE_PACKAGES], +[ + AS_IF([test -n "${PYTHON}" && test "${PYTHON}" != "no"], [ AC_MSG_CHECKING([python build sys.version]) dnl Can have extra lines about compiler used, etc. PYTHON_VERSION_REPORT="`${PYTHON} -c 'import sys; print(sys.version);' | tr '\n' ' '`" \ @@ -181,10 +198,11 @@ AC_DEFUN([NUT_CHECK_PYTHON], ] ) ]) - ]) - AC_SUBST([PYTHON_SITE_PACKAGES], [${nut_cv_PYTHON_SITE_PACKAGES}]) - AM_CONDITIONAL([HAVE_PYTHON_SITE_PACKAGES], [test x"${PYTHON_SITE_PACKAGES}" != "x"]) + ],[ + nut_cv_PYTHON_SITE_PACKAGES="" ]) + AC_SUBST([PYTHON_SITE_PACKAGES], [${nut_cv_PYTHON_SITE_PACKAGES}]) + AM_CONDITIONAL([HAVE_PYTHON_SITE_PACKAGES], [test x"${PYTHON_SITE_PACKAGES}" != "x"]) ]) AC_DEFUN([NUT_CHECK_PYTHON2], @@ -282,9 +300,12 @@ AC_DEFUN([NUT_CHECK_PYTHON2], AC_MSG_CHECKING([python2 interpeter to call]) AC_MSG_RESULT([${PYTHON2}${PYTHON2_VERSION_INFO_REPORT}]) - AC_SUBST([PYTHON2], [${PYTHON2}]) - AM_CONDITIONAL([HAVE_PYTHON2], [test -n "${PYTHON2}" && test "${PYTHON2}" != "no"]) - AS_IF([test -n "${PYTHON2}" && test "${PYTHON2}" != "no"], [ + ]) +]) + +AC_DEFUN([NUT_CHECK_PYTHON2_SITE_PACKAGES], +[ + AS_IF([test -n "${PYTHON2}" && test "${PYTHON2}" != "no"], [ AC_MSG_CHECKING([python2 build sys.version]) dnl Can have extra lines about compiler used, etc. PYTHON2_VERSION_REPORT="`${PYTHON2} -c 'import sys; print(sys.version);' | tr '\n' ' '`" \ @@ -319,10 +340,11 @@ AC_DEFUN([NUT_CHECK_PYTHON2], ] ) ]) - ]) - AC_SUBST([PYTHON2_SITE_PACKAGES], [${nut_cv_PYTHON2_SITE_PACKAGES}]) - AM_CONDITIONAL([HAVE_PYTHON2_SITE_PACKAGES], [test x"${PYTHON2_SITE_PACKAGES}" != "x"]) + ],[ + nut_cv_PYTHON2_SITE_PACKAGES="" ]) + AC_SUBST([PYTHON2_SITE_PACKAGES], [${nut_cv_PYTHON2_SITE_PACKAGES}]) + AM_CONDITIONAL([HAVE_PYTHON2_SITE_PACKAGES], [test x"${PYTHON2_SITE_PACKAGES}" != "x"]) ]) AC_DEFUN([NUT_CHECK_PYTHON3], @@ -420,9 +442,12 @@ AC_DEFUN([NUT_CHECK_PYTHON3], AC_MSG_CHECKING([python3 interpeter to call]) AC_MSG_RESULT([${PYTHON3}${PYTHON3_VERSION_INFO_REPORT}]) - AC_SUBST([PYTHON3], [${PYTHON3}]) - AM_CONDITIONAL([HAVE_PYTHON3], [test -n "${PYTHON3}" && test "${PYTHON3}" != "no"]) - AS_IF([test -n "${PYTHON3}" && test "${PYTHON3}" != "no"], [ + ]) +]) + +AC_DEFUN([NUT_CHECK_PYTHON3_SITE_PACKAGES], +[ + AS_IF([test -n "${PYTHON3}" && test "${PYTHON3}" != "no"], [ AC_MSG_CHECKING([python3 build sys.version]) dnl Can have extra lines about compiler used, etc. PYTHON3_VERSION_REPORT="`${PYTHON3} -c 'import sys; print(sys.version);' | tr '\n' ' '`" \ @@ -457,8 +482,9 @@ AC_DEFUN([NUT_CHECK_PYTHON3], ] ) ]) - ]) - AC_SUBST([PYTHON3_SITE_PACKAGES], [${nut_cv_PYTHON3_SITE_PACKAGES}]) - AM_CONDITIONAL([HAVE_PYTHON3_SITE_PACKAGES], [test x"${PYTHON3_SITE_PACKAGES}" != "x"]) + ],[ + nut_cv_PYTHON3_SITE_PACKAGES="" ]) + AC_SUBST([PYTHON3_SITE_PACKAGES], [${nut_cv_PYTHON3_SITE_PACKAGES}]) + AM_CONDITIONAL([HAVE_PYTHON3_SITE_PACKAGES], [test x"${PYTHON3_SITE_PACKAGES}" != "x"]) ]) From 8f7149fd0e0b971d5c7c582b08d21d514dae2e8f Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Wed, 15 Oct 2025 23:31:12 +0200 Subject: [PATCH 298/805] docs/configure.txt: clarify --with-python*=yes; fix markup [#1792] Signed-off-by: Jim Klimov --- docs/configure.txt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/docs/configure.txt b/docs/configure.txt index 82949d9ffa..04466eda87 100644 --- a/docs/configure.txt +++ b/docs/configure.txt @@ -517,6 +517,10 @@ Since this may come across surprising to some people, the `configure` script would warn in the end if several Python versions were auto-detected one way or another. +A value of `yes` (default if e.g `--with-python` is specified without an +argument) means to search for an implementation, and fail if one was not +located. + The settings below may be of particular interest to non-distribution packaging efforts with their own dedicated directory trees (like pkgsrc), or where all packages have dedicated sub-trees (like NixOS): @@ -556,7 +560,7 @@ availability), and optional `desktop-file-install` integration). --with-pynut Install the PyNUT module files for general consumption into "site-packages" -location of the currently chosen Python interpreter(s): yes, no, auto. +location of the currently chosen Python interpreter(s): `yes`, `no`, `auto`. or dedicated as the required dependency of NUT-Monitor application (app). --with-python-modules-dir=(auto|PATH) From bae981dae8055eabcf96d08f0e30ba90ec32a8cb Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Wed, 15 Oct 2025 23:48:31 +0200 Subject: [PATCH 299/805] m4/nut_check_python.m4: separate NUT_CHECK_PYTHON_DEFAULT_BEST and NUT_CHECK_PYTHON_INTERIM_RESULTS, and implement discarding of "auto-prio" hits if another hit exists (yes, explicit, auto) [#1792] It seems `AC_REQUIRE()` calls have priority over other code lines in a method, and get executed first - so using extra methods (also for clearer code base). Signed-off-by: Jim Klimov --- m4/nut_check_python.m4 | 97 ++++++++++++++++++++++++++++-------------- 1 file changed, 65 insertions(+), 32 deletions(-) diff --git a/m4/nut_check_python.m4 b/m4/nut_check_python.m4 index 147508a8a6..8a143c295a 100644 --- a/m4/nut_check_python.m4 +++ b/m4/nut_check_python.m4 @@ -11,6 +11,29 @@ AC_DEFUN([NUT_CHECK_PYTHON_DEFAULT], AC_REQUIRE([NUT_CHECK_PYTHON2]) AC_REQUIRE([NUT_CHECK_PYTHON3]) + dnl It seems AC REQUIRE calls have priority over other code lines in a method, + dnl and get executed first - so using extra methods (also for clearer code base). + + AC_REQUIRE([NUT_CHECK_PYTHON_INTERIM_RESULTS]) + AC_REQUIRE([NUT_CHECK_PYTHON_DEFAULT_BEST]) + + dnl Only now propagate what we found + AC_SUBST([PYTHON], [${PYTHON}]) + AM_CONDITIONAL([HAVE_PYTHON], [test -n "${PYTHON}" && test "${PYTHON}" != "no"]) + + AC_SUBST([PYTHON2], [${PYTHON2}]) + AM_CONDITIONAL([HAVE_PYTHON2], [test -n "${PYTHON2}" && test "${PYTHON2}" != "no"]) + + AC_SUBST([PYTHON3], [${PYTHON3}]) + AM_CONDITIONAL([HAVE_PYTHON3], [test -n "${PYTHON3}" && test "${PYTHON3}" != "no"]) + + AC_REQUIRE([NUT_CHECK_PYTHON_SITE_PACKAGES]) + AC_REQUIRE([NUT_CHECK_PYTHON2_SITE_PACKAGES]) + AC_REQUIRE([NUT_CHECK_PYTHON3_SITE_PACKAGES]) +]) + +AC_DEFUN([NUT_CHECK_PYTHON_INTERIM_RESULTS], +[ AS_IF([test x"$PYTHON2" = xno], [PYTHON2=""]) AS_IF([test x"$PYTHON3" = xno], [PYTHON3=""]) AS_IF([test x"$PYTHON" = xno], [PYTHON=""]) @@ -37,45 +60,55 @@ AC_DEFUN([NUT_CHECK_PYTHON_DEFAULT], AS_IF([test -z "${PYTHON}" && test x"${nut_with_python}" = xyes], [ AC_MSG_ERROR([A python interpreter was required but not found or validated]) ]) +]) - dnl Pick the top-most hit (smallest prio number) - BEST_AUTO="`( echo "${nut_with_python}|${PYTHON}"; echo "${nut_with_python2}|${PYTHON2}"; echo "${nut_with_python3}|${PYTHON3}" ) | ${EGREP} "^auto-prio=" | ${EGREP} -v '\|$' | sort -n | head -1`" - BEST_AUTO_PRIO="`echo "${BEST_AUTO}" | sed 's,|.*$,,'`" - BEST_AUTO_PYTHON="`echo "${BEST_AUTO}" | sed 's,^.*|,,'`" - AS_IF([test x"${BEST_AUTO_PYTHON}" != x], [ - AC_MSG_NOTICE([Got an auto-priority preferred hit: ${BEST_AUTO_PRIO} => ${BEST_AUTO_PYTHON}"]) - AS_CASE([x"${nut_with_python3}"], - [x"${BEST_AUTO_PRIO}"], [AC_MSG_NOTICE([Forgetting PYTHON2='${PYTHON2}' and PYTHON='${PYTHON}' (if any were detected as auto-prio too)]) - AS_CASE([x"${nut_with_python2}"], [xauto-prio=*], [PYTHON2="no"]) - AS_CASE([x"${nut_with_python}"], [xauto-prio=*], [PYTHON="no"]) - ],[AS_CASE([x"${nut_with_python2}"], - [x"${BEST_AUTO_PRIO}"], [AC_MSG_NOTICE([Forgetting PYTHON3='${PYTHON3}' and PYTHON='${PYTHON}' (if any were detected as auto-prio too)]) - AS_CASE([x"${nut_with_python3}"], [xauto-prio=*], [PYTHON3="no"]) - AS_CASE([x"${nut_with_python}"], [xauto-prio=*], [PYTHON="no"]) - ],[AS_CASE([x"${nut_with_python}"], - [x"${BEST_AUTO_PRIO}"], [AC_MSG_NOTICE([Forgetting PYTHON3='${PYTHON3}' and PYTHON2='${PYTHON2}' (if any were detected as auto-prio too)]) - AS_CASE([x"${nut_with_python2}"], [xauto-prio=*], [PYTHON2="no"]) - AS_CASE([x"${nut_with_python3}"], [xauto-prio=*], [PYTHON3="no"]) +AC_DEFUN([NUT_CHECK_PYTHON_DEFAULT_BEST], +[ + dnl Pick the top-most hit (smallest prio number, to be considered if no explicit variants were requested) + FOUND_PYTHONS="`( echo "${nut_with_python}|${PYTHON}"; echo "${nut_with_python2}|${PYTHON2}"; echo "${nut_with_python3}|${PYTHON3}" ) | ${EGREP} -v '\|\(no\)*$' | ${EGREP} -v '^no\|'`" + AS_IF([test x"${FOUND_PYTHONS}" = x], [ + AC_MSG_NOTICE([No Python interpreter versions were found or requested]) + ], [ + NON_AUTO="`echo "${FOUND_PYTHONS}" | ${EGREP} -v "^auto-prio="`" + BEST_AUTO="`echo "${FOUND_PYTHONS}" | ${EGREP} "^auto-prio=" | sort -n | head -1`" + AS_IF([test x"${NON_AUTO}" = x], [ + dnl All findings were auto-prio, else silently keep what we have + dnl from "auto", "yes" or explicit settings + BEST_AUTO_PRIO="`echo "${BEST_AUTO}" | sed 's,|.*$,,'`" + BEST_AUTO_PYTHON="`echo "${BEST_AUTO}" | sed 's,^.*|,,'`" + AS_IF([test x"${BEST_AUTO_PYTHON}" != x], [ + AC_MSG_NOTICE([Got an auto-priority preferred hit: ${BEST_AUTO_PRIO} => ${BEST_AUTO_PYTHON}"]) + AS_CASE([x"${nut_with_python3}"], + [x"${BEST_AUTO_PRIO}"], [AC_MSG_NOTICE([Forgetting PYTHON2='${PYTHON2}' and PYTHON='${PYTHON}' (if any were detected as auto-prio too)]) + AS_CASE([x"${nut_with_python2}"], [xauto-prio=*], [PYTHON2=""]) + AS_CASE([x"${nut_with_python}"], [xauto-prio=*], [PYTHON=""]) + ],[AS_CASE([x"${nut_with_python2}"], + [x"${BEST_AUTO_PRIO}"], [AC_MSG_NOTICE([Forgetting PYTHON3='${PYTHON3}' and PYTHON='${PYTHON}' (if any were detected as auto-prio too)]) + AS_CASE([x"${nut_with_python3}"], [xauto-prio=*], [PYTHON3=""]) + AS_CASE([x"${nut_with_python}"], [xauto-prio=*], [PYTHON=""]) + ],[AS_CASE([x"${nut_with_python}"], + [x"${BEST_AUTO_PRIO}"], [AC_MSG_NOTICE([Forgetting PYTHON3='${PYTHON3}' and PYTHON2='${PYTHON2}' (if any were detected as auto-prio too)]) + AS_CASE([x"${nut_with_python2}"], [xauto-prio=*], [PYTHON2=""]) + AS_CASE([x"${nut_with_python3}"], [xauto-prio=*], [PYTHON3=""]) + ]) + ]) ]) ]) + ],[ + AS_IF([test x"${BEST_AUTO}" != x], [ + AC_MSG_NOTICE([Got some auto-priority preferred hits and explicitly preferred ones too; forgetting auto-prio ones"]) + AS_CASE([x"${nut_with_python3}"], [xauto-prio=*], [PYTHON3=""]) + AS_CASE([x"${nut_with_python2}"], [xauto-prio=*], [PYTHON2=""]) + AS_CASE([x"${nut_with_python}"], [xauto-prio=*], [PYTHON=""]) + ]) ]) ]) + unset BEST_AUTO_PYTHON + unset BEST_AUTO_PRIO unset BEST_AUTO - - dnl Only now propagate what we found - AC_SUBST([PYTHON], [${PYTHON}]) - AM_CONDITIONAL([HAVE_PYTHON], [test -n "${PYTHON}" && test "${PYTHON}" != "no"]) - - AC_SUBST([PYTHON2], [${PYTHON2}]) - AM_CONDITIONAL([HAVE_PYTHON2], [test -n "${PYTHON2}" && test "${PYTHON2}" != "no"]) - - AC_SUBST([PYTHON3], [${PYTHON3}]) - AM_CONDITIONAL([HAVE_PYTHON3], [test -n "${PYTHON3}" && test "${PYTHON3}" != "no"]) - - AC_REQUIRE([NUT_CHECK_PYTHON_SITE_PACKAGES]) - AC_REQUIRE([NUT_CHECK_PYTHON2_SITE_PACKAGES]) - AC_REQUIRE([NUT_CHECK_PYTHON3_SITE_PACKAGES]) + unset NON_AUTO + unset FOUND_PYTHONS ]) dnl Note: this checks for default/un-versioned python version From 1f5ebe4eb950dc9e6ea5e727c4cd2d9e6721ba3f Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Thu, 16 Oct 2025 01:03:19 +0200 Subject: [PATCH 300/805] m4/nut_check_python.m4, *.am, *.py.in: introduce PYTHON_DEFAULT to track the implementation to substitute into shebangs or use as tool calls [#1792] Signed-off-by: Jim Klimov --- m4/nut_check_python.m4 | 30 ++++++++++++++-------- scripts/Solaris/Makefile.am | 6 ++--- scripts/Solaris/precheck.py.in | 2 +- scripts/augeas/Makefile.am | 10 ++++---- scripts/augeas/gen-nutupsconf-aug.py.in | 2 +- scripts/python/module/Makefile.am | 22 ++++++++-------- scripts/python/module/PyNUT.py.in | 2 +- scripts/python/module/test_nutclient.py.in | 2 +- tools/Makefile.am | 18 ++++++------- tools/gitlog2changelog.py.in | 2 +- tools/nut-snmpinfo.py.in | 6 ++--- 11 files changed, 56 insertions(+), 46 deletions(-) diff --git a/m4/nut_check_python.m4 b/m4/nut_check_python.m4 index 8a143c295a..518035b859 100644 --- a/m4/nut_check_python.m4 +++ b/m4/nut_check_python.m4 @@ -17,16 +17,6 @@ AC_DEFUN([NUT_CHECK_PYTHON_DEFAULT], AC_REQUIRE([NUT_CHECK_PYTHON_INTERIM_RESULTS]) AC_REQUIRE([NUT_CHECK_PYTHON_DEFAULT_BEST]) - dnl Only now propagate what we found - AC_SUBST([PYTHON], [${PYTHON}]) - AM_CONDITIONAL([HAVE_PYTHON], [test -n "${PYTHON}" && test "${PYTHON}" != "no"]) - - AC_SUBST([PYTHON2], [${PYTHON2}]) - AM_CONDITIONAL([HAVE_PYTHON2], [test -n "${PYTHON2}" && test "${PYTHON2}" != "no"]) - - AC_SUBST([PYTHON3], [${PYTHON3}]) - AM_CONDITIONAL([HAVE_PYTHON3], [test -n "${PYTHON3}" && test "${PYTHON3}" != "no"]) - AC_REQUIRE([NUT_CHECK_PYTHON_SITE_PACKAGES]) AC_REQUIRE([NUT_CHECK_PYTHON2_SITE_PACKAGES]) AC_REQUIRE([NUT_CHECK_PYTHON3_SITE_PACKAGES]) @@ -109,6 +99,26 @@ AC_DEFUN([NUT_CHECK_PYTHON_DEFAULT_BEST], unset BEST_AUTO unset NON_AUTO unset FOUND_PYTHONS + dnl Only now propagate what we found + + AC_SUBST([PYTHON], [${PYTHON}]) + AM_CONDITIONAL([HAVE_PYTHON], [test -n "${PYTHON}" && test "${PYTHON}" != "no"]) + + AC_SUBST([PYTHON2], [${PYTHON2}]) + AM_CONDITIONAL([HAVE_PYTHON2], [test -n "${PYTHON2}" && test "${PYTHON2}" != "no"]) + + AC_SUBST([PYTHON3], [${PYTHON3}]) + AM_CONDITIONAL([HAVE_PYTHON3], [test -n "${PYTHON3}" && test "${PYTHON3}" != "no"]) + + AC_MSG_CHECKING([which python can be called for internal use, e.g. shebang substitutions and tool calls]) + PYTHON_DEFAULT="" + AS_IF([test x"$PYTHON2" != x], [PYTHON_DEFAULT="${PYTHON2}"]) + AS_IF([test x"$PYTHON3" != x], [PYTHON_DEFAULT="${PYTHON3}"]) + AS_IF([test x"$PYTHON" != x], [PYTHON_DEFAULT="${PYTHON}"]) + AC_MSG_RESULT([${PYTHON_DEFAULT}]) + + AC_SUBST([PYTHON_DEFAULT], [${PYTHON_DEFAULT}]) + AM_CONDITIONAL([HAVE_PYTHON_DEFAULT], [test -n "${PYTHON_DEFAULT}" && test "${PYTHON_DEFAULT}" != "no"]) ]) dnl Note: this checks for default/un-versioned python version diff --git a/scripts/Solaris/Makefile.am b/scripts/Solaris/Makefile.am index b527c2a3c4..e789c4b4ec 100644 --- a/scripts/Solaris/Makefile.am +++ b/scripts/Solaris/Makefile.am @@ -3,7 +3,7 @@ EXTRA_DIST = makelocal.sh precheck.py.in preproto.pl.in README.adoc PROTOTYPE_DIR = $(DESTDIR)@prefix@ SOLARIS_CHECK_TARGETS = -PYTHON = @PYTHON@ +PYTHON_DEFAULT = @PYTHON_DEFAULT@ SOLARIS_SMF_MANIFESTS = \ nut.xml \ @@ -90,8 +90,8 @@ package-solaris-svr4: $(SOLARIS_PACKAGE_SVR4_HELPERSCRIPTS) $(SOLARIS_PACKAGE_SV cp $(SOLARIS_PACKAGE_SVR4_HELPERSCRIPTS) $(SOLARIS_PACKAGE_SVR4_INSTALLSCRIPTS) $(SOLARIS_PACKAGE_SVR4_INSTALLDATA) $(PROTOTYPE_DIR) || exit ; \ ( cd $(PROTOTYPE_DIR) && chmod +x $(SOLARIS_PACKAGE_SVR4_HELPERSCRIPTS) $(SOLARIS_PACKAGE_SVR4_INSTALLSCRIPTS) ) || exit ; \ ( cd $(PROTOTYPE_DIR) && perl preproto.pl ) || exit ; \ - if test -n '$(PYTHON)' ; then \ - ( cd $(PROTOTYPE_DIR) && $(PYTHON) precheck.py ) || exit ; \ + if test -n '$(PYTHON_DEFAULT)' ; then \ + ( cd $(PROTOTYPE_DIR) && $(PYTHON_DEFAULT) precheck.py ) || exit ; \ fi ; \ ( cd $(PROTOTYPE_DIR) && rm -f prototype1 ) || exit ; \ ( cd $(PROTOTYPE_DIR) && ./makelocal.sh ) || exit ; \ diff --git a/scripts/Solaris/precheck.py.in b/scripts/Solaris/precheck.py.in index 313b9aae54..0c60767dbe 100755 --- a/scripts/Solaris/precheck.py.in +++ b/scripts/Solaris/precheck.py.in @@ -1,4 +1,4 @@ -#!@PYTHON@ +#!@PYTHON_DEFAULT@ import sys diff --git a/scripts/augeas/Makefile.am b/scripts/augeas/Makefile.am index 106a3a3d67..a2781313fa 100644 --- a/scripts/augeas/Makefile.am +++ b/scripts/augeas/Makefile.am @@ -7,16 +7,16 @@ EXTRA_DIST = gen-nutupsconf-aug.py.in nutupsconf.aug.tpl \ # due to inclusion into docs/developer-guide.txt, and the heading # level may be also dictated by that. -PYTHON = @PYTHON@ +PYTHON_DEFAULT = @PYTHON_DEFAULT@ # only call the script to generate Augeas ups.conf lens upon "make dist", # and if Python is present; the distributed gen-nutupsconf-aug.py.in template # is assumed to only differ from a generated gen-nutupsconf-aug.py by the -# @PYTHON@ shebang. +# @PYTHON_DEFAULT@ shebang. dist-hook: - @if [ -n "$(PYTHON)" ] && [ x"no" != x"$(PYTHON)" ] && $(PYTHON) -c "import re,glob,codecs"; then \ - echo "Regenerating Augeas ups.conf lens with '$(PYTHON)'."; \ - $(PYTHON) $(distdir)/gen-nutupsconf-aug.py.in $(distdir)/; \ + @if [ -n "$(PYTHON_DEFAULT)" ] && [ x"no" != x"$(PYTHON_DEFAULT)" ] && $(PYTHON_DEFAULT) -c "import re,glob,codecs"; then \ + echo "Regenerating Augeas ups.conf lens with '$(PYTHON_DEFAULT)'."; \ + $(PYTHON_DEFAULT) $(distdir)/gen-nutupsconf-aug.py.in $(distdir)/; \ else \ echo "----------------------------------------------------------------------"; \ echo "Warning: Python is not available."; \ diff --git a/scripts/augeas/gen-nutupsconf-aug.py.in b/scripts/augeas/gen-nutupsconf-aug.py.in index 705d074db2..07374ac940 100755 --- a/scripts/augeas/gen-nutupsconf-aug.py.in +++ b/scripts/augeas/gen-nutupsconf-aug.py.in @@ -1,4 +1,4 @@ -#!@PYTHON@ +#!@PYTHON_DEFAULT@ # Copyright (C) # 2010 - Arnaud Quette # 2020 - 2024 Jim Klimov diff --git a/scripts/python/module/Makefile.am b/scripts/python/module/Makefile.am index 1d5b8a2fed..b8e854580a 100644 --- a/scripts/python/module/Makefile.am +++ b/scripts/python/module/Makefile.am @@ -23,7 +23,7 @@ tox: dist .pypi-tools-tox EXTRA_DIST = tox.ini MANIFEST.in NUT_SOURCE_GITREV_NUMERIC = @NUT_SOURCE_GITREV_NUMERIC@ -PYTHON = @PYTHON@ +PYTHON_DEFAULT = @PYTHON_DEFAULT@ GENERATED_DIST = dist build *.egg-info GENERATED_SRC = PyNUTClient README.txt LICENSE-GPL3 @@ -84,7 +84,7 @@ upload publish: cp -pf "$${B}" PyNUTClient/ || exit ; \ continue; \ fi ; \ - sed -e "s,[@]PYTHON[@],@PYTHON@," < "$(srcdir)/$${B}.in" > "PyNUTClient/$${B}" || exit ; \ + sed -e "s,[@]PYTHON_DEFAULT[@],@PYTHON_DEFAULT@," < "$(srcdir)/$${B}.in" > "PyNUTClient/$${B}" || exit ; \ if test -x "$(srcdir)/$${B}.in" ; then chmod +x "PyNUTClient/$${B}"; fi ; \ done ; \ cp -pf "$(srcdir)/README.adoc" README.txt || exit ; \ @@ -93,30 +93,30 @@ upload publish: @touch "$@" .pypi-tools-python: - @echo " PYPI Checking that PYTHON variable is defined and usable: $(PYTHON)" - @test -n "$(PYTHON)" && command -v $(PYTHON) + @echo " PYPI Checking that PYTHON_DEFAULT variable is defined and usable: $(PYTHON_DEFAULT)" + @test -n "$(PYTHON_DEFAULT)" && command -v $(PYTHON_DEFAULT) @touch "$@" .pypi-tools-dist-wheel: .pypi-tools-python @echo " PYPI Prepare PyPI tools to generate a distribution (wheel)" - @$(PYTHON) -m pip install wheel + @$(PYTHON_DEFAULT) -m pip install wheel @touch "$@" .pypi-tools-dist-build: .pypi-tools-python @echo " PYPI Prepare PyPI tools to generate a distribution (build)" - @$(PYTHON) -m pip install build + @$(PYTHON_DEFAULT) -m pip install build @touch "$@" .pypi-tools-tox: .pypi-tools-python @echo " PYPI Prepare Python multi-environment testing tools (tox)" - @$(PYTHON) -m pip install tox + @$(PYTHON_DEFAULT) -m pip install tox @touch "$@" # Install via OS packaging or pip? # https://twine.readthedocs.io/en/stable/ .pypi-tools-upload: .pypi-tools-python @echo " PYPI Prepare PyPI tools and resources to upload a distribution (twine)" - @$(PYTHON) -m pip install twine + @$(PYTHON_DEFAULT) -m pip install twine @command -v twine @test -s $(HOME)/.pypirc @touch "$@" @@ -132,7 +132,7 @@ upload publish: .pypi-dist-pip-build: .pypi-tools-dist-build .pypi-src @echo " PYPI Generate PyPI module distribution (using 'build' module)" @rm -rf $(GENERATED_DIST) "$@" - @$(PYTHON) -m build --skip-dependency-check --no-isolation + @$(PYTHON_DEFAULT) -m build --skip-dependency-check --no-isolation @touch "$@" # Using "setup.py" directly causes warnings about its deprecation @@ -142,13 +142,13 @@ upload publish: .pypi-dist-pip-wheel: .pypi-tools-dist-wheel .pypi-src @echo " PYPI Generate PyPI module distribution (using 'pip wheel'; note no 'sdist' here)" @rm -rf $(GENERATED_DIST) "$@" - @$(PYTHON) -m pip wheel --no-deps -w dist . + @$(PYTHON_DEFAULT) -m pip wheel --no-deps -w dist . @touch "$@" .pypi-dist-obsolete: .pypi-tools-dist-wheel .pypi-src @echo " PYPI Generate PyPI module distribution (using setup.py directly)" @rm -rf $(GENERATED_DIST) "$@" - @$(PYTHON) setup.py sdist bdist_wheel + @$(PYTHON_DEFAULT) setup.py sdist bdist_wheel @touch "$@" # These need $HOME/.pypirc prepared with credentials (API tokens) from diff --git a/scripts/python/module/PyNUT.py.in b/scripts/python/module/PyNUT.py.in index 0e136d3669..20ad890613 100644 --- a/scripts/python/module/PyNUT.py.in +++ b/scripts/python/module/PyNUT.py.in @@ -1,4 +1,4 @@ -#!@PYTHON@ +#!@PYTHON_DEFAULT@ # -*- coding: utf-8 -*- # Copyright (C) 2008 David Goncalves diff --git a/scripts/python/module/test_nutclient.py.in b/scripts/python/module/test_nutclient.py.in index 8fc2796c67..ea7957ca9f 100755 --- a/scripts/python/module/test_nutclient.py.in +++ b/scripts/python/module/test_nutclient.py.in @@ -1,4 +1,4 @@ -#!@PYTHON@ +#!@PYTHON_DEFAULT@ # -*- coding: utf-8 -*- # This source code is provided for testing/debuging purpose ;) diff --git a/tools/Makefile.am b/tools/Makefile.am index c1a549fc2a..2982109b24 100644 --- a/tools/Makefile.am +++ b/tools/Makefile.am @@ -22,7 +22,7 @@ # make, to handle developer workflow (editing the *.c sources this uses). SUBDIRS = . nut-scanner nutconf -PYTHON = @PYTHON@ +PYTHON_DEFAULT = @PYTHON_DEFAULT@ EXTRA_DIST = nut-usbinfo.pl nut-recorder.sh nut-ddl-dump.sh nut-dumpdiff.sh \ gitlog2changelog.py.in gitlog2version.sh nut-snmpinfo.py.in driver-list-format.sh @@ -73,13 +73,13 @@ nut-scanner-deps-snmpinfo: $(GENERATED_SNMP_FILES) nut-scanner-deps-usb: $(GENERATED_USB_FILES) # The distributed nut-snmpinfo.py.in template is assumed to only differ from -# a generated nut-snmpinfo.py by the @PYTHON@ shebang. +# a generated nut-snmpinfo.py by the @PYTHON_DEFAULT@ shebang. $(GENERATED_SNMP_FILES): $(top_srcdir)/drivers/*-mib.c $(top_srcdir)/tools/nut-snmpinfo.py.in - @if [ -n "$(PYTHON)" ] && [ x"no" != x"$(PYTHON)" ] && $(PYTHON) -c 1; then \ - echo "Regenerating the SNMP helper files in SRC dir with '$(PYTHON)'."; \ + @if [ -n "$(PYTHON_DEFAULT)" ] && [ x"no" != x"$(PYTHON_DEFAULT)" ] && $(PYTHON_DEFAULT) -c 1; then \ + echo "Regenerating the SNMP helper files in SRC dir with '$(PYTHON_DEFAULT)'."; \ TOP_SRCDIR="$(top_srcdir)" ; export TOP_SRCDIR; \ TOP_BUILDDIR="$(top_builddir)" ; export TOP_BUILDDIR; \ - cd $(builddir) && $(PYTHON) $(top_srcdir)/tools/nut-snmpinfo.py.in; \ + cd $(builddir) && $(PYTHON_DEFAULT) $(top_srcdir)/tools/nut-snmpinfo.py.in; \ else \ echo "----------------------------------------------------------------------"; \ echo "Warning: Python is not available."; \ @@ -136,13 +136,13 @@ $(GENERATED_USB_FILES): $(top_srcdir)/drivers/*-hid.c $(top_srcdir)/drivers/*usb # so it may write the files in "dist" case (read-only sources), but the script # is called from the distdir where its copy is present. # The distributed nut-snmpinfo.py.in template is assumed to only differ from -# a generated nut-snmpinfo.py by the @PYTHON@ shebang. +# a generated nut-snmpinfo.py by the @PYTHON_DEFAULT@ shebang. dist-hook: - @if [ -n "$(PYTHON)" ] && [ x"no" != x"$(PYTHON)" ] && $(PYTHON) -c 1; then \ - echo "Regenerating the SNMP helper files in DIST dir with '$(PYTHON)'."; \ + @if [ -n "$(PYTHON_DEFAULT)" ] && [ x"no" != x"$(PYTHON_DEFAULT)" ] && $(PYTHON_DEFAULT) -c 1; then \ + echo "Regenerating the SNMP helper files in DIST dir with '$(PYTHON_DEFAULT)'."; \ TOP_SRCDIR="$(top_srcdir)" ; export TOP_SRCDIR; \ TOP_BUILDDIR="$(top_builddir)" ; export TOP_BUILDDIR; \ - $(PYTHON) $(distdir)/nut-snmpinfo.py.in; \ + $(PYTHON_DEFAULT) $(distdir)/nut-snmpinfo.py.in; \ else \ echo "----------------------------------------------------------------------"; \ echo "Warning: Python is not available."; \ diff --git a/tools/gitlog2changelog.py.in b/tools/gitlog2changelog.py.in index 67c9c0a169..812468df00 100755 --- a/tools/gitlog2changelog.py.in +++ b/tools/gitlog2changelog.py.in @@ -1,4 +1,4 @@ -#!@PYTHON@ +#!@PYTHON_DEFAULT@ # Copyright 2008 Marcus D. Hanwell # Minor changes for NUT by Charles Lepple # Subsequent maintenance for NUT by Jim Klimov (since 2021) diff --git a/tools/nut-snmpinfo.py.in b/tools/nut-snmpinfo.py.in index c76e9dedf6..5c24c6dfad 100755 --- a/tools/nut-snmpinfo.py.in +++ b/tools/nut-snmpinfo.py.in @@ -1,7 +1,7 @@ -#!@PYTHON@ +#!@PYTHON_DEFAULT@ # Copyright (C) 2011-2021 Eaton -# Authors: Frederic Bohe -# Arnaud Quette +# Authors: Frederic Bohe +# Arnaud Quette # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by From 0b17ed28950b58cf79156b0ae9988f8bf0512cac Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Thu, 16 Oct 2025 02:05:39 +0200 Subject: [PATCH 301/805] Makefile.am: install-as-root: use make variables for paths and package version [#3131] Signed-off-by: Jim Klimov --- Makefile.am | 98 ++++++++++++++++++++++++++--------------------------- 1 file changed, 49 insertions(+), 49 deletions(-) diff --git a/Makefile.am b/Makefile.am index d5d2627fb8..3a02de2d38 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1143,24 +1143,24 @@ endif !WITH_SOLARIS_INIT # distros that do not follow current naming in NUT code base. install-as-root: @+echo "$@: starting (no-op if not root)" >&2 ; \ - case "@target_os@" in *mingw*) echo "$@: SKIP: not supported for this target_os='@target_os@'" >&2 ; exit 0;; esac ; \ - if [ x"@host_os@" != x"@build_os@" ]; then echo "$@: SKIP: build_os='@build_os@' is not host_os='@host_os@'" >&2 ; exit 0 ; fi ; \ - if [ x"@target_os@" != x"@build_os@" ]; then echo "$@: SKIP: build_os='@build_os@' is not target_os='@target_os@'" >&2 ; exit 0 ; fi ; \ + case "$(target_os)" in *mingw*) echo "$@: SKIP: not supported for this target_os='$(target_os)'" >&2 ; exit 0;; esac ; \ + if [ x"$(host_os)" != x"$(build_os)" ]; then echo "$@: SKIP: build_os='$(build_os)' is not host_os='$(host_os)'" >&2 ; exit 0 ; fi ; \ + if [ x"$(target_os)" != x"$(build_os)" ]; then echo "$@: SKIP: build_os='$(build_os)' is not target_os='$(target_os)'" >&2 ; exit 0 ; fi ; \ if (command -v id) && ( [ x"`id -u 2>/dev/null`" = x0 ] || [ x"`id | sed -e 's,(.*$$,,' -e 's,^.*uid=,,'`" = x0 ] ) ; then \ echo "$@: we seem to be root, PROCEEDING" >&2 ; \ else \ echo "$@: SKIP: we seem to NOT be root" >&2 ; \ exit 0 ; \ fi ; \ - prefix="@prefix@"; \ + prefix="$(prefix)"; \ if [ x"$(DESTDIR)" = x -o x"$(DESTDIR)" = x/ ] ; then \ if $(HAVE_SYSTEMD) ; then \ echo "$@: Stop NUT services, if any" >&2 ; \ - @SYSTEMD_SYSTEMCTL_PROGRAM@ stop nut-monitor.service nut-server.service || true ; \ - @SYSTEMD_SYSTEMCTL_PROGRAM@ stop nut-driver.service || true ; \ - @SYSTEMD_SYSTEMCTL_PROGRAM@ stop nut-driver.target || true ; \ - @SYSTEMD_SYSTEMCTL_PROGRAM@ stop nut-udev-settle.service || true ; \ - @SYSTEMD_SYSTEMCTL_PROGRAM@ stop nut.target || true ; \ + $(SYSTEMD_SYSTEMCTL_PROGRAM) stop nut-monitor.service nut-server.service || true ; \ + $(SYSTEMD_SYSTEMCTL_PROGRAM) stop nut-driver.service || true ; \ + $(SYSTEMD_SYSTEMCTL_PROGRAM) stop nut-driver.target || true ; \ + $(SYSTEMD_SYSTEMCTL_PROGRAM) stop nut-udev-settle.service || true ; \ + $(SYSTEMD_SYSTEMCTL_PROGRAM) stop nut.target || true ; \ fi ; \ if $(WITH_SOLARIS_SMF) || $(WITH_SOLARIS_INIT) ; then \ if $(WITH_SOLARIS_SMF) ; then \ @@ -1182,9 +1182,9 @@ install-as-root: exit ; \ fi ; \ fi ; \ - echo " MKDIR $(DESTDIR)/@STATEPATH@ $(DESTDIR)/@STATEPATH@/upssched" >&2 ; \ - $(MKDIR_P) "$(DESTDIR)/@STATEPATH@/upssched" && \ - for D in "@PIDPATH@" "@ALTPIDPATH@" "@ALTSTATEPATH@" "@CONFPATH@" ; do \ + echo " MKDIR $(DESTDIR)/$(STATEPATH) $(DESTDIR)/$(STATEPATH)/upssched" >&2 ; \ + $(MKDIR_P) "$(DESTDIR)/$(STATEPATH)/upssched" && \ + for D in "$(PIDPATH)" "$(ALTPIDPATH)" "$(ALTSTATEPATH)" "$(CONFPATH)" ; do \ case x"$$D" in \ x|x@*) ;; \ *) echo " MKDIR $(DESTDIR)/$$D" >&2 ; \ @@ -1193,10 +1193,10 @@ install-as-root: esac ; \ done ; \ if (command -v chmod) ; then \ - echo " CHMOD(0770) $(DESTDIR)/@STATEPATH@/upssched" >&2 ; \ - chmod 0770 "$(DESTDIR)/@STATEPATH@/upssched" \ + echo " CHMOD(0770) $(DESTDIR)/$(STATEPATH)/upssched" >&2 ; \ + chmod 0770 "$(DESTDIR)/$(STATEPATH)/upssched" \ || exit ; \ - for D in "@STATEPATH@" "@PIDPATH@" "@ALTPIDPATH@" "@ALTSTATEPATH@" ; do \ + for D in "$(STATEPATH)" "$(PIDPATH)" "$(ALTPIDPATH)" "$(ALTSTATEPATH)" ; do \ case x"$$D" in \ x|x@*|x/run|x/var/run|x/tmp|x/var/tmp|x/dev/shm|x/etc|x/var|x/usr|x/usr/local|x/usr/local/etc|x/usr/etc) ;; \ *) echo " CHMOD(0770) $(DESTDIR)/$$D" >&2 ; \ @@ -1204,53 +1204,53 @@ install-as-root: || exit ;; \ esac ; \ done ; \ - case x"@CONFPATH@" in \ + case x"$(CONFPATH)" in \ x|x@*|x/run|x/var/run|x/tmp|x/var/tmp|x/dev/shm|x/etc|x/var|x/usr|x/usr/local|x/usr/local/etc|x/usr/etc) ;; \ - *) echo " CHMOD(0751) $(DESTDIR)/@CONFPATH@" >&2 ; \ - chmod 0751 "$(DESTDIR)/@CONFPATH@" \ + *) echo " CHMOD(0751) $(DESTDIR)/$(CONFPATH)" >&2 ; \ + chmod 0751 "$(DESTDIR)/$(CONFPATH)" \ || exit ;; \ esac ; \ for F in hosts.conf.sample upsstats-single.html.sample upsstats.html.sample upsset.conf.sample ; do \ - echo " CHMOD(0644) CGI: $(DESTDIR)/@CONFPATH@/$$F" >&2 ; \ - chmod 0644 "$(DESTDIR)/@CONFPATH@/$$F" \ + echo " CHMOD(0644) CGI: $(DESTDIR)/$(CONFPATH)/$$F" >&2 ; \ + chmod 0644 "$(DESTDIR)/$(CONFPATH)/$$F" \ || { if $(WITH_CGI) ; then exit 1 ; else true ; fi ; } ; \ done ; \ for F in nut.conf.sample ups.conf.sample upsd.conf.sample upsd.users.sample upsmon.conf.sample upssched.conf.sample ; do \ - echo " CHMOD(0640) $(DESTDIR)/@CONFPATH@/$$F" >&2 ; \ - chmod 0640 "$(DESTDIR)/@CONFPATH@/$$F" \ + echo " CHMOD(0640) $(DESTDIR)/$(CONFPATH)/$$F" >&2 ; \ + chmod 0640 "$(DESTDIR)/$(CONFPATH)/$$F" \ || exit ; \ done ; \ else \ echo "$@: WARNING: Can not CHMOD created locations!" >&2 ; \ fi ; \ - if (command -v chown) && ( test 0 -lt "`id -u '@RUN_AS_USER@' 2>/dev/null`" || test 0 -lt "`id '@RUN_AS_USER@' | sed -e 's,(.*$$,,' -e 's,^.*uid=,,'`" ] ) \ - && ( test 0 -lt "`getent group '@RUN_AS_GROUP@' | awk -F: '{print $$3}'`" || test 0 -lt "`id -g '@RUN_AS_GROUP@'`" ) \ + if (command -v chown) && ( test 0 -lt "`id -u '$(RUN_AS_USER)' 2>/dev/null`" || test 0 -lt "`id '$(RUN_AS_USER)' | sed -e 's,(.*$$,,' -e 's,^.*uid=,,'`" ] ) \ + && ( test 0 -lt "`getent group '$(RUN_AS_GROUP)' | awk -F: '{print $$3}'`" || test 0 -lt "`id -g '$(RUN_AS_GROUP)'`" ) \ ; then \ - echo " CHOWN(@RUN_AS_USER@:@RUN_AS_GROUP@) $(DESTDIR)/@STATEPATH@/upssched" >&2 ; \ - chown "@RUN_AS_USER@:@RUN_AS_GROUP@" "$(DESTDIR)/@STATEPATH@/upssched" \ + echo " CHOWN($(RUN_AS_USER@:@RUN_AS_GROUP@) $(DESTDIR)/@STATEPATH)/upssched" >&2 ; \ + chown "$(RUN_AS_USER@:@RUN_AS_GROUP)" "$(DESTDIR)/$(STATEPATH)/upssched" \ || exit ; \ - for D in "@STATEPATH@" "@PIDPATH@" "@ALTPIDPATH@" "@ALTSTATEPATH@" ; do \ + for D in "$(STATEPATH)" "$(PIDPATH)" "$(ALTPIDPATH)" "$(ALTSTATEPATH)" ; do \ case x"$$D" in \ x|x@*|x/run|x/var/run|x/tmp|x/var/tmp|x/dev/shm|x/etc|x/var|x/usr|x/usr/local|x/usr/local/etc|x/usr/etc) ;; \ - *) echo " CHOWN(@RUN_AS_USER@:@RUN_AS_GROUP@) $(DESTDIR)/$$D" >&2 ; \ - chown "@RUN_AS_USER@:@RUN_AS_GROUP@" "$(DESTDIR)/$$D" \ + *) echo " CHOWN($(RUN_AS_USER@:@RUN_AS_GROUP)) $(DESTDIR)/$$D" >&2 ; \ + chown "$(RUN_AS_USER@:@RUN_AS_GROUP)" "$(DESTDIR)/$$D" \ || exit ;; \ esac ; \ done ; \ - case x"@CONFPATH@" in \ + case x"$(CONFPATH)" in \ x|x@*|x/run|x/var/run|x/tmp|x/var/tmp|x/dev/shm|x/etc|x/var|x/usr|x/usr/local|x/usr/local/etc|x/usr/etc) ;; \ - *) echo " CHOWN(root:@RUN_AS_GROUP@) $(DESTDIR)/@CONFPATH@" >&2 ; \ - chown "root:@RUN_AS_GROUP@" "$(DESTDIR)/@CONFPATH@" \ + *) echo " CHOWN(root:$(RUN_AS_GROUP)) $(DESTDIR)/$(CONFPATH)" >&2 ; \ + chown "root:$(RUN_AS_GROUP)" "$(DESTDIR)/$(CONFPATH)" \ || exit ;; \ esac ; \ for F in hosts.conf.sample upsstats-single.html.sample upsstats.html.sample upsset.conf.sample ; do \ - echo " CHOWN(root:@RUN_AS_GROUP@) CGI: $(DESTDIR)/@CONFPATH@/$$F" >&2 ; \ - chown "root:@RUN_AS_GROUP@" "$(DESTDIR)/@CONFPATH@/$$F" \ + echo " CHOWN(root:$(RUN_AS_GROUP)) CGI: $(DESTDIR)/$(CONFPATH)/$$F" >&2 ; \ + chown "root:$(RUN_AS_GROUP)" "$(DESTDIR)/$(CONFPATH)/$$F" \ || { if $(WITH_CGI) ; then exit 1 ; else true ; fi ; } ; \ done ; \ for F in nut.conf.sample ups.conf.sample upsd.conf.sample upsd.users.sample upsmon.conf.sample upssched.conf.sample ; do \ - echo " CHOWN(root:@RUN_AS_GROUP@) $(DESTDIR)/@CONFPATH@/$$F" >&2 ; \ - chown "root:@RUN_AS_GROUP@" "$(DESTDIR)/@CONFPATH@/$$F" \ + echo " CHOWN(root:$(RUN_AS_GROUP)) $(DESTDIR)/$(CONFPATH)/$$F" >&2 ; \ + chown "root:$(RUN_AS_GROUP)" "$(DESTDIR)/$(CONFPATH)/$$F" \ || exit ; \ done ; \ else \ @@ -1262,28 +1262,28 @@ install-as-root: echo "$@: Activate default systemd layout, restart services:" >&2 ; \ if $(WITH_SYSTEMD_TMPFILES) ; then \ echo "$@: Apply systemd-tmpfiles presets" >&2 ; \ - @SYSTEMD_TMPFILES_PROGRAM@ --create || exit ; \ + $(SYSTEMD_TMPFILES_PROGRAM) --create || exit ; \ fi ; \ echo "$@: Learn systemd definition changes" >&2 ; \ - @SYSTEMD_SYSTEMCTL_PROGRAM@ daemon-reload || exit ; \ + $(SYSTEMD_SYSTEMCTL_PROGRAM) daemon-reload || exit ; \ APPLIED_SYSTEMD_PRESET=false ; \ if $(WITH_SYSTEMD_PRESET) ; then \ echo "$@: Apply systemd enabled/disabled service presets" >&2 ; \ - @SYSTEMD_SYSTEMCTL_PROGRAM@ preset-all && APPLIED_SYSTEMD_PRESET=true || APPLIED_SYSTEMD_PRESET=false ; \ + $(SYSTEMD_SYSTEMCTL_PROGRAM) preset-all && APPLIED_SYSTEMD_PRESET=true || APPLIED_SYSTEMD_PRESET=false ; \ fi ; \ if [ x"$${APPLIED_SYSTEMD_PRESET}" = x"false" ] ; then \ echo "$@: Apply systemd enabled/disabled service defaults in a legacy manner" >&2 ; \ - @SYSTEMD_SYSTEMCTL_PROGRAM@ disable nut.target nut-driver.target nut-udev-settle.service nut-monitor nut-server nut-driver-enumerator.path nut-driver-enumerator.service || exit ; \ - @SYSTEMD_SYSTEMCTL_PROGRAM@ enable nut.target nut-driver.target nut-udev-settle.service nut-monitor nut-server nut-driver-enumerator.path nut-driver-enumerator.service || exit ; \ + $(SYSTEMD_SYSTEMCTL_PROGRAM) disable nut.target nut-driver.target nut-udev-settle.service nut-monitor nut-server nut-driver-enumerator.path nut-driver-enumerator.service || exit ; \ + $(SYSTEMD_SYSTEMCTL_PROGRAM) enable nut.target nut-driver.target nut-udev-settle.service nut-monitor nut-server nut-driver-enumerator.path nut-driver-enumerator.service || exit ; \ fi ; \ - @SYSTEMD_SYSTEMCTL_PROGRAM@ restart udev && applied_udev=true || true ; \ - if [ -s '@sysconfdir@/ups.conf' ] ; then \ + $(SYSTEMD_SYSTEMCTL_PROGRAM) restart udev && applied_udev=true || true ; \ + if [ -s '$(CONFPATH)/ups.conf' ] ; then \ echo "$@: Reconfigure nut-driver-enumerator (service instance wrapping)" >&2 ; \ $(top_builddir)/scripts/upsdrvsvcctl/nut-driver-enumerator.sh --reconfigure || { RES=$$?; if [ $$RES != 42 ] ; then exit $$RES ; fi ; } ; \ fi; \ echo "$@: Restart NUT services" >&2 ; \ - @SYSTEMD_SYSTEMCTL_PROGRAM@ restart nut-driver-enumerator.service nut-monitor.service nut-server.service \ - || if [ -s '@sysconfdir@/ups.conf' -a -s '@sysconfdir@/upsd.conf' -a -s '@sysconfdir@/upsd.users' -a -s '@sysconfdir@/upsmon.conf' ] ; then exit 1 ; \ + $(SYSTEMD_SYSTEMCTL_PROGRAM) restart nut-driver-enumerator.service nut-monitor.service nut-server.service \ + || if [ -s '$(CONFPATH)/ups.conf' -a -s '$(CONFPATH)/upsd.conf' -a -s '$(CONFPATH)/upsd.users' -a -s '$(CONFPATH)/upsmon.conf' ] ; then exit 1 ; \ else echo "$@: some configs are missing, assuming new NUT installation" >&2; fi; \ fi ; \ if $${applied_udev} && (command -v udevadm); then \ @@ -1297,13 +1297,13 @@ install-as-root: # Clean the dist tarball and packages MAINTAINERCLEANFILES_DISTBALL = nut-*.tar.gz # HP-UX: -MAINTAINERCLEANFILES_PACKAGES = NUT_HPUX_package@PACKAGE_VERSION@.depot NUT_HPUX_package-@PACKAGE_VERSION@.depot +MAINTAINERCLEANFILES_PACKAGES = NUT_HPUX_package$(PACKAGE_VERSION).depot NUT_HPUX_package-$(PACKAGE_VERSION).depot # AIX as below, and RedHat-compatible (cover binary and source packages): MAINTAINERCLEANFILES_PACKAGES += nut*rpm # Debian-compatible (cover binary and source packages): MAINTAINERCLEANFILES_PACKAGES += nut*deb # Solaris SVR4 package archives: -MAINTAINERCLEANFILES_PACKAGES += NUT_solaris_*_package@PACKAGE_VERSION@.local.gz NUT_solaris_*_package-@PACKAGE_VERSION@.local.gz +MAINTAINERCLEANFILES_PACKAGES += NUT_solaris_*_package$(PACKAGE_VERSION).local.gz NUT_solaris_*_package-$(PACKAGE_VERSION).local.gz # Newer Solaris IPS (aka "pkg(5)" format archives) MAINTAINERCLEANFILES_PACKAGES += *.p5p @@ -1317,7 +1317,7 @@ package: dist "HP-UX") \ ( cd scripts/HP-UX && \ $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$DESTDIR" package && \ - mv NUT_HPUX_package.depot $(abs_top_builddir)/NUT_HPUX_package-@PACKAGE_VERSION@.depot ) ;; \ + mv NUT_HPUX_package.depot $(abs_top_builddir)/NUT_HPUX_package-$(PACKAGE_VERSION).depot ) ;; \ "SunOS") \ $(MAKE) $(AM_MAKEFLAGS) && \ $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$DESTDIR" install && \ @@ -1331,7 +1331,7 @@ package: dist if test -d /usr/src/packages/SOURCES -a -w /usr/src/packages/SOURCES ; then : ; else echo "Can not write to /usr/src/packages/SOURCES" >&2 ; exit 1; fi ; \ $(MAKE) $(AM_MAKEFLAGS) dist && \ cp scripts/Aix/nut-aix.spec /usr/src/packages/SPECS && \ - cp scripts/Aix/nut.init nut-@PACKAGE_VERSION@.tar.gz /usr/src/packages/SOURCES && \ + cp scripts/Aix/nut.init nut-$(PACKAGE_VERSION).tar.gz /usr/src/packages/SOURCES && \ rpm -ba /usr/src/packages/SPECS/nut-aix.spec && \ mv /usr/src/packages/RPMS/nut*rpm $(abs_top_builddir)/ ;; \ *) echo "Unsupported OS for 'make $@' (no recipe bound)" >&2; exit 1;; \ From a25741011a18444e85ec858c5460913c57cf9db6 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Thu, 16 Oct 2025 02:31:55 +0200 Subject: [PATCH 302/805] configure.ac, docs/configure.txt, lib/*.pc.in, *.am et al: introduce --with-confdir*= options, separate delivery of sample configs [#3131] Signed-off-by: Jim Klimov --- Makefile.am | 16 +-- NEWS.adoc | 13 ++ UPGRADING.adoc | 14 ++ ci_build.sh | 3 +- conf/Makefile.am | 6 +- configure.ac | 136 ++++++++++++++++-- docs/configure.txt | 41 +++++- docs/man/apc_modbus.txt | 2 +- docs/nut.dict | 4 +- docs/packager-guide.txt | 7 +- lib/libnutclient.pc.in | 2 +- lib/libnutclientstub.pc.in | 2 +- lib/libnutconf.pc.in | 2 +- lib/libnutscan.pc.in | 2 +- lib/libupsclient-config.in | 2 +- lib/libupsclient.pc.in | 2 +- scripts/Aix/nut-aix.spec.in | 2 +- .../upsdrvsvcctl/nut-driver-enumerator.sh.in | 2 +- 18 files changed, 225 insertions(+), 33 deletions(-) diff --git a/Makefile.am b/Makefile.am index 3a02de2d38..5998f0606d 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1211,13 +1211,13 @@ install-as-root: || exit ;; \ esac ; \ for F in hosts.conf.sample upsstats-single.html.sample upsstats.html.sample upsset.conf.sample ; do \ - echo " CHMOD(0644) CGI: $(DESTDIR)/$(CONFPATH)/$$F" >&2 ; \ - chmod 0644 "$(DESTDIR)/$(CONFPATH)/$$F" \ + echo " CHMOD(0644) CGI: $(DESTDIR)/$(CONFPATH_EXAMPLES)/$$F" >&2 ; \ + chmod 0644 "$(DESTDIR)/$(CONFPATH_EXAMPLES)/$$F" \ || { if $(WITH_CGI) ; then exit 1 ; else true ; fi ; } ; \ done ; \ for F in nut.conf.sample ups.conf.sample upsd.conf.sample upsd.users.sample upsmon.conf.sample upssched.conf.sample ; do \ - echo " CHMOD(0640) $(DESTDIR)/$(CONFPATH)/$$F" >&2 ; \ - chmod 0640 "$(DESTDIR)/$(CONFPATH)/$$F" \ + echo " CHMOD(0640) $(DESTDIR)/$(CONFPATH_EXAMPLES)/$$F" >&2 ; \ + chmod 0640 "$(DESTDIR)/$(CONFPATH_EXAMPLES)/$$F" \ || exit ; \ done ; \ else \ @@ -1244,13 +1244,13 @@ install-as-root: || exit ;; \ esac ; \ for F in hosts.conf.sample upsstats-single.html.sample upsstats.html.sample upsset.conf.sample ; do \ - echo " CHOWN(root:$(RUN_AS_GROUP)) CGI: $(DESTDIR)/$(CONFPATH)/$$F" >&2 ; \ - chown "root:$(RUN_AS_GROUP)" "$(DESTDIR)/$(CONFPATH)/$$F" \ + echo " CHOWN(root:$(RUN_AS_GROUP)) CGI: $(DESTDIR)/$(CONFPATH_EXAMPLES)/$$F" >&2 ; \ + chown "root:$(RUN_AS_GROUP)" "$(DESTDIR)/$(CONFPATH_EXAMPLES)/$$F" \ || { if $(WITH_CGI) ; then exit 1 ; else true ; fi ; } ; \ done ; \ for F in nut.conf.sample ups.conf.sample upsd.conf.sample upsd.users.sample upsmon.conf.sample upssched.conf.sample ; do \ - echo " CHOWN(root:$(RUN_AS_GROUP)) $(DESTDIR)/$(CONFPATH)/$$F" >&2 ; \ - chown "root:$(RUN_AS_GROUP)" "$(DESTDIR)/$(CONFPATH)/$$F" \ + echo " CHOWN(root:$(RUN_AS_GROUP)) $(DESTDIR)/$(CONFPATH_EXAMPLES)/$$F" >&2 ; \ + chown "root:$(RUN_AS_GROUP)" "$(DESTDIR)/$(CONFPATH_EXAMPLES)/$$F" \ || exit ; \ done ; \ else \ diff --git a/NEWS.adoc b/NEWS.adoc index 9cb118e193..74d1ad5c5d 100644 --- a/NEWS.adoc +++ b/NEWS.adoc @@ -154,6 +154,19 @@ several `FSD` notifications into one executed action. [PR #3097] the ultimately executed `CMDSCRIPT` processes. [#3105] - `configure` script options: + * For ages, most recipes for building NUT had customized the `sysconfdir` to + be `/etc/nut`, which is not exactly the *system* configuration directory. + This is finally deprecated, with new `--with-confdir` configuration option + taking over the role of a full path to configuration files (by default + `${sysconfdir}${confdir_suffix}`), and new `--with-confdir-suffix` allowing + to specify just `/nut` or `/ups` that would be tacked onto the default + `${sysconfdir}` to resolve the `${confdir}`. Default behavior should be + same as with previous builds: if `sysconfdir` is customized (or `prefix` + is kept at built-in default), the `confdir_suffix` will default to empty; + otherwise it assumes the value of `/${PACKAGE_NAME}` to become `/nut` in + most cases. A `--with-confdir-examples` option was also introduced, to + help distributions that place `*.conf.sample` files into docs or other + locations. [#3131] * Introduced `--with-python{,2,3}-modules-dir` to specify PyNUT(Client) module installation location (for module-named dir to be created under it), if not bundling with NUT-Monitor UI app. By default the respective diff --git a/UPGRADING.adoc b/UPGRADING.adoc index 037d4654e7..44943288b3 100644 --- a/UPGRADING.adoc +++ b/UPGRADING.adoc @@ -26,6 +26,20 @@ Changes from 2.8.4 to 2.8.5 - PLANNED: Keep track of any further API clean-up? +- For ages, most recipes for building NUT had customized the `sysconfdir` to + be `/etc/nut`, which is not exactly the *system* configuration directory. + This is finally deprecated, with new `--with-confdir` configuration option + taking over the role of a full path to configuration files (by default + `${sysconfdir}${confdir_suffix}`), and new `--with-confdir-suffix` allowing + to specify just `/nut` or `/ups` that would be tacked onto the default + `${sysconfdir}` to resolve the `${confdir}`. Default behavior should be + same as with previous builds: if `sysconfdir` is customized (or `prefix` + is kept at built-in default), the `confdir_suffix` will default to empty; + otherwise it assumes the value of `/${PACKAGE_NAME}` to become `/nut` in + most cases. A `--with-confdir-examples` option was also introduced, to + help distributions that place `*.conf.sample` files into docs or other + locations. [#3131] + - Dropped the `compile` script from Git sources. It originates from automake and is added to work area (if missing) during `autogen.sh` rituals anyway (as `make` says, `'automake --add-missing' can install 'compile'` when you diff --git a/ci_build.sh b/ci_build.sh index a055c2631e..1ad6bc0332 100755 --- a/ci_build.sh +++ b/ci_build.sh @@ -1584,7 +1584,8 @@ default|default-alldrv|default-alldrv:no-distcheck|default-all-errors|default-al CONFIG_OPTS+=("--enable-keep_nut_report_feature") CONFIG_OPTS+=("--prefix=${BUILD_PREFIX}") - CONFIG_OPTS+=("--sysconfdir=${BUILD_PREFIX}/etc/nut") + #CONFIG_OPTS+=("--sysconfdir=${BUILD_PREFIX}/etc/nut") + CONFIG_OPTS+=("--with-confdir=${BUILD_PREFIX}/etc/nut") CONFIG_OPTS+=("--with-udev-dir=${BUILD_PREFIX}/etc/udev") CONFIG_OPTS+=("--with-devd-dir=${BUILD_PREFIX}/etc/devd") CONFIG_OPTS+=("--with-hotplug-dir=${BUILD_PREFIX}/etc/hotplug") diff --git a/conf/Makefile.am b/conf/Makefile.am index fd384eebbc..f0f200304c 100644 --- a/conf/Makefile.am +++ b/conf/Makefile.am @@ -13,8 +13,10 @@ else CGI_INSTALL = endif -dist_sysconf_DATA = $(SECFILES) $(PUBFILES) $(CGI_INSTALL) -nodist_sysconf_DATA = upssched.conf.sample upsmon.conf.sample +conf_examplesdir = @CONFPATH_EXAMPLES@ + +dist_conf_examples_DATA = $(SECFILES) $(PUBFILES) $(CGI_INSTALL) +nodist_conf_examples_DATA = upssched.conf.sample upsmon.conf.sample SPELLCHECK_SRC = $(dist_sysconf_DATA) \ upssched.conf.sample.in upsmon.conf.sample.in diff --git a/configure.ac b/configure.ac index 6a83d80a8f..363c2aa85c 100644 --- a/configure.ac +++ b/configure.ac @@ -300,6 +300,11 @@ dnl Use "./configure --enable-maintainer-mode" to keep Makefile.in and Makefile dnl in sync after Git updates. AM_MAINTAINER_MODE +dnl TOTHINK: Add a default --with-nutdir-suffix='nut'/'ups'/etc. for different paths we make? +NUT_ARG_WITH([confdir-suffix], [Relative path to NUT configuration files under sysconfdir], [auto]) +NUT_ARG_WITH([confdir], [Complete path to NUT configuration files], [\${sysconfdir}\${confdir_suffix}]) +NUT_ARG_WITH([confdir-examples], [Complete path to NUT configuration file examples (some like it under datadir)], [\${confdir}]) + dnl GNU and BSD make are okay with the syntax, but Sun make/dmake are not: AC_MSG_CHECKING([whether this make implementation supports export VAR=VAL syntax]) dnl # using printf formatting for some funniner shells out there @@ -374,6 +379,47 @@ dnl Fix this early so we can expand with eval later test "${prefix}" = "NONE" && prefix="${ac_default_prefix}" test "${exec_prefix}" = "NONE" && exec_prefix='${prefix}' +AS_CASE([x"${nut_with_confdir}"], + [yes], [AC_MSG_ERROR([--with-confdir should specify a path name or expansible expression])], + [/*|?:\*|?:/*|*/*|*'\'*], [ + AC_MSG_NOTICE([A non-trivial --with-confdir path was specified (${nut_with_confdir}); any --with-confdir-suffix (${nut_with_confdir_suffix}) or --sysconfdir (${sysconfdir}) values are disregarded]) + ], [ + RESULT_COMMENT="" + AC_MSG_CHECKING([confdir-suffix to use after sysconfdir (${sysconfdir})]) + AS_CASE([x"${nut_with_confdir_suffix}"], + [xyes], [AC_MSG_ERROR([--with-confdir-suffix should specify a relative path name under sysconfdir='${sysconfdir}'])], + [x'$'*], [RESULT_COMMENT="expandable expression"], + [xauto|x], [ + dnl Use an empty suffix if either no prefix was specified + dnl (so resolving into /usr/local/ups/etc makes sense), + dnl or if a sysconfdir was specified (legacy build configs). + dnl Otherwise de facto append "/nut" to "${sysconfdir}". + AS_CASE([${CONFIG_FLAGS}], + [*--sysconfdir=*], [nut_with_confdir_suffix=""; RESULT_COMMENT='sysconfdir was customized...'], + [*--prefix=*], [nut_with_confdir_suffix='/${PACKAGE_NAME}'; RESULT_COMMENT='prefix was customized...'], + [nut_with_confdir_suffix=""; RESULT_COMMENT='prefix was not customized...']) + ], [ + RESULT_COMMENT="normalized caller-provided suffix..." + nut_with_confdir_suffix="`echo "/${nut_with_confdir_suffix}" | sed -e 's,^/*,/,' -e 's,/*$,,'`" + ] + ) + AC_MSG_RESULT([${RESULT_COMMENT} '${nut_with_confdir_suffix}']) + ] +) + +dnl For expansions later: +confdir='${nut_with_confdir}' +confdir_suffix='${nut_with_confdir_suffix}' +confdir_examples='${nut_with_confdir_examples}' + +AS_IF([test x"${nut_enable_configure_debug}" = xyes], [ + AC_MSG_NOTICE([(CONFIGURE-DEVEL-DEBUG) prefix='${prefix}']) + AC_MSG_NOTICE([(CONFIGURE-DEVEL-DEBUG) sysconfdir='${sysconfdir}']) + AC_MSG_NOTICE([(CONFIGURE-DEVEL-DEBUG) nut_with_confdir_suffix='${nut_with_confdir_suffix}']) + AC_MSG_NOTICE([(CONFIGURE-DEVEL-DEBUG) nut_with_confdir='${nut_with_confdir}']) + AC_MSG_NOTICE([(CONFIGURE-DEVEL-DEBUG) nut_with_confdir_examples='${nut_with_confdir_examples}']) +]) + dnl Note: for practical and platform-independent use, see AX_REALPATH macro AC_CHECK_PROGS([REALPATH], [realpath], []) @@ -773,15 +819,43 @@ AS_IF([test x"$nut_enable_inplace_runtime" = xyes -a x"${NUT_VERSION_DEPLOYED-}" ]) ]) + HAVE_DEPLOYED_CONFPATH=false AS_CASE(["${CONFIG_FLAGS_DEPLOYED} ${CONFIG_FLAGS}"], [*--sysconfdir=*], [ for F in ${CONFIG_FLAGS_DEPLOYED} ${CONFIG_FLAGS} ; do case "$F" in - "--sysconfdir="*) sysconfdir="`echo "$F" | ( IFS='=' read K V ; echo "$V" )`" ;; + "--sysconfdir="*) sysconfdir="`echo "$F" | ( IFS='=' read K V ; echo "$V" )`" ; HAVE_DEPLOYED_CONFPATH=true ;; esac done - ], - [ + ]) + AS_CASE(["${CONFIG_FLAGS_DEPLOYED} ${CONFIG_FLAGS}"], + [*--with-confdir=*], [ + for F in ${CONFIG_FLAGS_DEPLOYED} ${CONFIG_FLAGS} ; do + case "$F" in + "--with-confdir="*) nut_with_confdir="`echo "$F" | ( IFS='=' read K V ; echo "$V" )`" ; HAVE_DEPLOYED_CONFPATH=true ;; + esac + done + ]) + AS_CASE(["${CONFIG_FLAGS_DEPLOYED} ${CONFIG_FLAGS}"], + [*--with-confdir-suffix=*], [ + for F in ${CONFIG_FLAGS_DEPLOYED} ${CONFIG_FLAGS} ; do + case "$F" in + "--with-confdir-suffix="*) nut_with_confdir_suffix="`echo "$F" | ( IFS='=' read K V ; echo "$V" )`" ; HAVE_DEPLOYED_CONFPATH=true ;; + esac + done + ]) + AS_CASE(["${CONFIG_FLAGS_DEPLOYED} ${CONFIG_FLAGS}"], + [*--with-confdir-examples=*], [ + for F in ${CONFIG_FLAGS_DEPLOYED} ${CONFIG_FLAGS} ; do + case "$F" in + "--with-confdir-examples="*) nut_with_confdir_examples="`echo "$F" | ( IFS='=' read K V ; echo "$V" )`" ;; + esac + done + ],[ + nut_with_confdir_examples='${confdir}' + ]) + + AS_IF([test x"${HAVE_DEPLOYED_CONFPATH}" = xfalse], [ dnl If there was no custom --sysconfdir=/etc/myNUT passed, dnl try to default it to something from existing deployment. dnl NOTE: Single-quotes are correct for autotools default, @@ -794,6 +868,10 @@ AS_IF([test x"$nut_enable_inplace_runtime" = xyes -a x"${NUT_VERSION_DEPLOYED-}" dnl below, after we decide on the sysconfdir value we really like. PREFIX_SYSCONFDIR="${conftemp}" + dnl Default definition + nut_with_confdir_suffix="" + nut_with_confdir='${sysconfdir}${confdir_suffix}' + AC_MSG_CHECKING([for in-place replacement default sysconfdir, better than '${PREFIX_SYSCONFDIR}' ('${sysconfdir}')]) DEPLOYED_SYSCONFDIR="" @@ -831,11 +909,22 @@ AS_IF([test x"$nut_enable_inplace_runtime" = xyes -a x"${NUT_VERSION_DEPLOYED-}" ]) dnl Prepare paths that may be used in user/group searches below: - conftemp="${sysconfdir}" + conftemp="${nut_with_confdir}" + eval conftemp=\"${conftemp}\" + eval conftemp=\"${conftemp}\" + eval conftemp=\"${conftemp}\" eval conftemp=\"${conftemp}\" eval conftemp=\"${conftemp}\" CONFPATH="${conftemp}" + conftemp="${nut_with_confdir_examples}" + eval conftemp=\"${conftemp}\" + eval conftemp=\"${conftemp}\" + eval conftemp=\"${conftemp}\" + eval conftemp=\"${conftemp}\" + eval conftemp=\"${conftemp}\" + CONFPATH_EXAMPLES="${conftemp}" + AS_CASE(["${CONFIG_FLAGS_DEPLOYED} ${CONFIG_FLAGS}"], [*--libdir=*], [ for F in ${CONFIG_FLAGS_DEPLOYED} ${CONFIG_FLAGS} ; do @@ -5728,16 +5817,36 @@ else AC_MSG_RESULT(no) fi -dnl expand ${sysconfdir} and write it out - note that most packages -dnl override it to be /etc/nut, /etc/ups or similar, while the -dnl autotools default would be $prefix/etc -conftemp="${sysconfdir}" +dnl For ages we expanded ${sysconfdir} and wrote it out - note that most +dnl packages overrode it to be /etc/nut, /etc/ups or similar, while the +dnl pure autotools default would be $prefix/etc (and a separate setting +dnl or hard-coded value added on top of that). +dnl Since NUT v2.8.5 we encourage using either a dedicated customization +dnl --with-confdir-suffix (value like '/nut' or empty depends on situation), +dnl or a complete --with-confdir='${sysconfdir}${nut_with_confdir_suffix}' +dnl (for common use-cases matched with legacy usage, there should be no +dnl change: would use sysconfdir (if set) with empty nut_with_confdir_suffix. +conftemp="${nut_with_confdir}" +eval conftemp=\"${conftemp}\" +eval conftemp=\"${conftemp}\" +eval conftemp=\"${conftemp}\" eval conftemp=\"${conftemp}\" eval conftemp=\"${conftemp}\" CONFPATH="${conftemp}" NUT_REPORT_SETTING_PATH([Config file path], CONFPATH, "${conftemp}", [Default path for configuration files]) +dnl Some distros prefer these not in system CONFPATH but in docs or similar +conftemp="${nut_with_confdir_examples}" +eval conftemp=\"${conftemp}\" +eval conftemp=\"${conftemp}\" +eval conftemp=\"${conftemp}\" +eval conftemp=\"${conftemp}\" +eval conftemp=\"${conftemp}\" +CONFPATH_EXAMPLES="${conftemp}" +NUT_REPORT_SETTING_PATH([Config file examples path], + CONFPATH_EXAMPLES, "${conftemp}", [Default path for example configuration files]) + dnl same for datadir conftemp="${datadir}" eval conftemp=\"${conftemp}\" @@ -6108,6 +6217,7 @@ AC_SUBST(STATEPATH) AC_SUBST(ALTPIDPATH) dnl #Not in main codebase yet# AC_SUBST(ALTSTATEPATH) AC_SUBST(CONFPATH) +AC_SUBST(CONFPATH_EXAMPLES) AC_SUBST(POWERDOWNFLAG) AC_SUBST(BINDIR) AC_SUBST(LIBDIR) @@ -6940,6 +7050,16 @@ AS_IF([test x"${NUT_VERSION_DEPLOYED-}" = x""], [ AC_MSG_NOTICE([==========================================================]) ]) +AS_CASE([${CONFIG_FLAGS}], + [*--sysconfdir=*], [ + AC_MSG_NOTICE([==========================================================]) + AC_MSG_NOTICE([This build configuration modifies the --sysconfdir setting.]) + AC_MSG_NOTICE([While this was the way for decades, it was the wrong way.]) + AC_MSG_NOTICE([Consider updating your build recipes to use --with-confdir*]) + AC_MSG_NOTICE([options nowadays.]) + AC_MSG_NOTICE([==========================================================]) +]) + theMAKE="${MAKE-}" AS_IF([test x"${theMAKE}" = x], [theMAKE="make"]) AC_MSG_NOTICE([==========================================================]) diff --git a/docs/configure.txt b/docs/configure.txt index ece1844eaa..6586bf509b 100644 --- a/docs/configure.txt +++ b/docs/configure.txt @@ -95,7 +95,8 @@ Tries to detect and pre-set `configure` defaults for run-time settings (which you can still override if needed, but no longer *must* specify explicitly to be on same page as the existing setup), most notably: -* `--sysconfdir` +* `--sysconfdir` and perhaps `--with-confdir-suffix`, + or `--with-confdir` altogether * `--with-user` * `--with-group` @@ -870,12 +871,46 @@ default, it is the same as ``. --sysconfdir=PATH +Base system location for configuration files. By default this path is +`/etc`. + +From time immemorial until NUT v2.8.5, this was the option to change +in order to define a dedicated directory for NUT configuration files. +Setting this to `/etc/nut` or `/etc/ups` might be useful in older builds. +Now the `--with-confdir*` options are preferable. + + --with-confdir-suffix=DIRNAME + +Provides a partial location where NUT's configuration files are stored, +relative to ``. By default this path is empty if either +`` was modified (assuming legacy build configuration was +re-used for current NUT), or if `` was NOT modified (then the +value of `/usr/local/ups/etc` makes sense to directly hold NUT configuration +files). Otherwise it defaults to `` which is `nut` (unless +some distribution hacks the `configure` script to their liking). + +Surrounding slashes would be removed and a trailing one added, to normalize +the paths and avoid double-slashes etc. + +See also `--enable-inplace-runtime`. + + --with-confdir=PATH + Changes the location where NUT's configuration files are stored. -By default this path is `/etc`. Setting this to `/etc/nut` or -`/etc/ups` might be useful. See also `--enable-inplace-runtime`. +By default this path is `/` which on +most systems resolves to `/etc/nut`. + +See also `--enable-inplace-runtime`. The `NUT_CONFPATH` environment variable overrides this at run time. + --with-confdir-examples=PATH + +Changes the location where NUT's configuration file examples are stored. +By default this path is ``, but some distributions prefer to +store examples under `` or somewhere else, requiring `` +to be used only by actual live system configuration. + --sbindir=PATH --bindir=PATH diff --git a/docs/man/apc_modbus.txt b/docs/man/apc_modbus.txt index 55a3d0fdfa..bc756633e8 100644 --- a/docs/man/apc_modbus.txt +++ b/docs/man/apc_modbus.txt @@ -139,7 +139,7 @@ make [NOTE] ====== * Other NUT `configure` options may be needed for proper behavior, such as -`--prefix`, `--with-sysconfdir`, `--with-user` and `--with-group` to match +`--prefix`, `--with-confdir`, `--with-user` and `--with-group` to match your packaged or otherwise preceding NUT installation. ====== diff --git a/docs/nut.dict b/docs/nut.dict index cdec3df402..8598d41b84 100644 --- a/docs/nut.dict +++ b/docs/nut.dict @@ -1,4 +1,4 @@ -personal_ws-1.1 en 3562 utf-8 +personal_ws-1.1 en 3564 utf-8 AAC AAS ABI @@ -263,6 +263,7 @@ DEXP DF DHEA DIGYS +DIRNAME DISCHRG DLDIR DLLs @@ -1816,6 +1817,7 @@ compareprocnames compat compilerPath conf +confdir config configparser configs diff --git a/docs/packager-guide.txt b/docs/packager-guide.txt index 035f484348..7af43e60d5 100644 --- a/docs/packager-guide.txt +++ b/docs/packager-guide.txt @@ -427,7 +427,7 @@ Example: name= "ups" or "nut" ./configure \ --prefix=/ \ - --sysconfdir=/etc/$name \ + --with-confdir=/etc/$name \ --mandir=/usr/share/man \ --libdir=/usr/lib \ --includedir=/usr/include \ @@ -450,4 +450,9 @@ out on new NUT features as they come with new releases. Some may require that you update your build environment with new third-party dependencies, so a broken build of a new NUT release would let you know how to act. +NOTE: For eons, the way to specify the directory for NUT configuration +files was to use `--sysconfdir=/etc/$name`. Since NUT v2.8.5 new options +are available to customize this location and keep the default `sysconfdir` +value intact (maybe unused). + ------------------------------------------------------------------------ diff --git a/lib/libnutclient.pc.in b/lib/libnutclient.pc.in index 964c24f063..d4629efbe3 100644 --- a/lib/libnutclient.pc.in +++ b/lib/libnutclient.pc.in @@ -2,7 +2,7 @@ prefix=@prefix@ exec_prefix=@exec_prefix@ libdir=@libdir@ includedir=@includedir@ -sysconfdir=@CONFPATH@ +confdir=@CONFPATH@ statepath=@STATEPATH@ nutuser=@RUN_AS_USER@ diff --git a/lib/libnutclientstub.pc.in b/lib/libnutclientstub.pc.in index e17fca3600..06b57a98f0 100644 --- a/lib/libnutclientstub.pc.in +++ b/lib/libnutclientstub.pc.in @@ -2,7 +2,7 @@ prefix=@prefix@ exec_prefix=@exec_prefix@ libdir=@libdir@ includedir=@includedir@ -sysconfdir=@CONFPATH@ +confdir=@CONFPATH@ statepath=@STATEPATH@ nutuser=@RUN_AS_USER@ diff --git a/lib/libnutconf.pc.in b/lib/libnutconf.pc.in index fbda516275..5f7d4b0d1a 100644 --- a/lib/libnutconf.pc.in +++ b/lib/libnutconf.pc.in @@ -2,7 +2,7 @@ prefix=@prefix@ exec_prefix=@exec_prefix@ libdir=@libdir@ includedir=@includedir@ -sysconfdir=@CONFPATH@ +confdir=@CONFPATH@ statepath=@STATEPATH@ nutuser=@RUN_AS_USER@ diff --git a/lib/libnutscan.pc.in b/lib/libnutscan.pc.in index a13a99be76..2c50634dfe 100644 --- a/lib/libnutscan.pc.in +++ b/lib/libnutscan.pc.in @@ -2,7 +2,7 @@ prefix=@prefix@ exec_prefix=@exec_prefix@ libdir=@libdir@ includedir=@includedir@ -sysconfdir=@CONFPATH@ +confdir=@CONFPATH@ statepath=@STATEPATH@ nutuser=@RUN_AS_USER@ diff --git a/lib/libupsclient-config.in b/lib/libupsclient-config.in index 408574562a..f035b9b467 100644 --- a/lib/libupsclient-config.in +++ b/lib/libupsclient-config.in @@ -20,7 +20,7 @@ datadir="@datadir@" libexecdir="@libexecdir@" libdir="@libdir@" includedir="@includedir@" -sysconfdir="@sysconfdir@" +confdir="@CONFPATH@" Libs="-L@libdir@ @LDFLAGS_NUT_RPATH@ -lupsclient @LIBSSL_LIBS@" Cflags="-I@includedir@ @LIBSSL_CFLAGS@" ConfigFlags='@CONFIG_FLAGS@' diff --git a/lib/libupsclient.pc.in b/lib/libupsclient.pc.in index d522cdf306..7891f4c3af 100644 --- a/lib/libupsclient.pc.in +++ b/lib/libupsclient.pc.in @@ -2,7 +2,7 @@ prefix=@prefix@ exec_prefix=@exec_prefix@ libdir=@libdir@ includedir=@includedir@ -sysconfdir=@CONFPATH@ +confdir=@CONFPATH@ statepath=@STATEPATH@ nutuser=@RUN_AS_USER@ diff --git a/scripts/Aix/nut-aix.spec.in b/scripts/Aix/nut-aix.spec.in index 1302160dcf..ed68abe56a 100644 --- a/scripts/Aix/nut-aix.spec.in +++ b/scripts/Aix/nut-aix.spec.in @@ -89,7 +89,7 @@ necessary to develop NUT client applications. --with-statepath=%{piddir} \ --with-pidpath=%{piddir} \ --with-altpidpath=%{piddir} \ - --sysconfdir=%{confdir} \ + --with-confdir=%{confdir} \ --with-cgipath=%{cgidir} \ --with-drvpath=%{_sbindir} \ --with-pkgconfig-dir=%{_libdir}/pkgconfig \ diff --git a/scripts/upsdrvsvcctl/nut-driver-enumerator.sh.in b/scripts/upsdrvsvcctl/nut-driver-enumerator.sh.in index 0686704dfc..a6caff44c0 100644 --- a/scripts/upsdrvsvcctl/nut-driver-enumerator.sh.in +++ b/scripts/upsdrvsvcctl/nut-driver-enumerator.sh.in @@ -86,7 +86,7 @@ EGREP="@EGREP@" # Directory where NUT configs are located, e.g. /etc/nut or /etc/ups # Set at package configuration, compiled into daemons and drivers prefix="@prefix@" -[ -n "${NUT_CONFPATH-}" ] || NUT_CONFPATH="@sysconfdir@" +[ -n "${NUT_CONFPATH-}" ] || NUT_CONFPATH="@CONFPATH@" # Technically this should be a distribution-dependent value configured # during package build. But everyone has it the same from systemd defaults: [ -n "${SYSTEMD_CONFPATH-}" ] || SYSTEMD_CONFPATH="/etc/systemd/system" From 8ae6778180bbf4343b1347647ae27969f90b358e Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Thu, 16 Oct 2025 14:34:24 +0200 Subject: [PATCH 303/805] Makefile.am: install-as-root: fix typo after replacement of @VAR@ to $(VAR) [#3131] Signed-off-by: Jim Klimov --- Makefile.am | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Makefile.am b/Makefile.am index 5998f0606d..81644bc5c7 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1226,14 +1226,14 @@ install-as-root: if (command -v chown) && ( test 0 -lt "`id -u '$(RUN_AS_USER)' 2>/dev/null`" || test 0 -lt "`id '$(RUN_AS_USER)' | sed -e 's,(.*$$,,' -e 's,^.*uid=,,'`" ] ) \ && ( test 0 -lt "`getent group '$(RUN_AS_GROUP)' | awk -F: '{print $$3}'`" || test 0 -lt "`id -g '$(RUN_AS_GROUP)'`" ) \ ; then \ - echo " CHOWN($(RUN_AS_USER@:@RUN_AS_GROUP@) $(DESTDIR)/@STATEPATH)/upssched" >&2 ; \ - chown "$(RUN_AS_USER@:@RUN_AS_GROUP)" "$(DESTDIR)/$(STATEPATH)/upssched" \ + echo " CHOWN($(RUN_AS_USER):$(RUN_AS_GROUP)) $(DESTDIR)/$(STATEPATH)/upssched" >&2 ; \ + chown "$(RUN_AS_USER):$(RUN_AS_GROUP)" "$(DESTDIR)/$(STATEPATH)/upssched" \ || exit ; \ for D in "$(STATEPATH)" "$(PIDPATH)" "$(ALTPIDPATH)" "$(ALTSTATEPATH)" ; do \ case x"$$D" in \ x|x@*|x/run|x/var/run|x/tmp|x/var/tmp|x/dev/shm|x/etc|x/var|x/usr|x/usr/local|x/usr/local/etc|x/usr/etc) ;; \ - *) echo " CHOWN($(RUN_AS_USER@:@RUN_AS_GROUP)) $(DESTDIR)/$$D" >&2 ; \ - chown "$(RUN_AS_USER@:@RUN_AS_GROUP)" "$(DESTDIR)/$$D" \ + *) echo " CHOWN($(RUN_AS_USER):$(RUN_AS_GROUP)) $(DESTDIR)/$$D" >&2 ; \ + chown "$(RUN_AS_USER):$(RUN_AS_GROUP)" "$(DESTDIR)/$$D" \ || exit ;; \ esac ; \ done ; \ From fd2d61559e17f0a15aa1ceafdc033ac0a70aef29 Mon Sep 17 00:00:00 2001 From: Atanas Vladimirov Date: Sat, 18 Oct 2025 22:04:28 +0300 Subject: [PATCH 304/805] nutdrv_qx_masterguard: Adds battery test until battery low. The difference between the battery test until battery low and deep battery test is that the latter is actually a battery calibration test and needs some preconditions to be met, i.e. the load must be between 30% and 100% and the battery capacity is greater than 99%. Battery test until battery low can be started anytime. Tested on Masterguard A1000 and A2000 units. Signed-off-by: Atanas Vladimirov --- data/cmdvartab | 1 + docs/nut-names.txt | 1 + drivers/nutdrv_qx_masterguard.c | 1 + 3 files changed, 3 insertions(+) diff --git a/data/cmdvartab b/data/cmdvartab index c65ae75fa2..3369f64db4 100644 --- a/data/cmdvartab +++ b/data/cmdvartab @@ -251,6 +251,7 @@ CMDDESC test.failure.start "Start a simulated power failure" CMDDESC test.failure.stop "Stop simulating a power failure" CMDDESC test.battery.start "Start a battery test" CMDDESC test.battery.start.quick "Start a quick battery test" +CMDDESC test.battery.start.low "Start a battery test until battery low" CMDDESC test.battery.start.deep "Start a deep battery test" CMDDESC test.battery.stop "Stop the battery test" CMDDESC test.system.start "Start a system test" diff --git a/docs/nut-names.txt b/docs/nut-names.txt index 62eba6f003..cf1a1621ab 100644 --- a/docs/nut-names.txt +++ b/docs/nut-names.txt @@ -1030,6 +1030,7 @@ Instant commands | test.failure.stop | Stop simulating a power failure | test.battery.start | Start a battery test | test.battery.start.quick | Start a "quick" battery test +| test.battery.start.low | Start a battery test until battery low | test.battery.start.deep | Start a "deep" battery test | test.battery.stop | Stop the battery test | test.system.start | Start a system test diff --git a/drivers/nutdrv_qx_masterguard.c b/drivers/nutdrv_qx_masterguard.c index e5549d3357..512a37ad7a 100644 --- a/drivers/nutdrv_qx_masterguard.c +++ b/drivers/nutdrv_qx_masterguard.c @@ -858,6 +858,7 @@ static item_t masterguard_qx2nut[] = { /* test.failure.stop */ { "test.battery.start", 0, NULL, NULL, "", 0, '\0', "", 0, 0, NULL, QX_FLAG_CMD, NULL, NULL, masterguard_test_battery }, { "test.battery.start.quick", 0, NULL, "T\r", "", 0, '\0', "", 0, 0, NULL, QX_FLAG_CMD, NULL, NULL, NULL }, + { "test.battery.start.low", 0, NULL, "TL\r", "", 0, '\0', "", 0, 0, NULL, QX_FLAG_CMD, NULL, NULL, NULL }, { "test.battery.start.deep", 0, NULL, "TUD\r", "", 0, '\0', "", 0, 0, NULL, QX_FLAG_CMD, NULL, NULL, NULL }, { "test.battery.stop", 0, NULL, "CT\r", "", 0, '\0', "", 0, 0, NULL, QX_FLAG_CMD, NULL, NULL, NULL }, /* test.system.start */ From 2e811a7f2c717c6cbc30d389aec24eca96fd70b5 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Sun, 19 Oct 2025 12:16:35 +0200 Subject: [PATCH 305/805] NEWS.adoc, docs/man/nutdrv_qx.txt: update regarding test.battery.start.low [#3135] Signed-off-by: Jim Klimov --- NEWS.adoc | 8 ++++++++ docs/man/nutdrv_qx.txt | 12 ++++++++++++ 2 files changed, 20 insertions(+) diff --git a/NEWS.adoc b/NEWS.adoc index 74d1ad5c5d..69a27adc3e 100644 --- a/NEWS.adoc +++ b/NEWS.adoc @@ -67,6 +67,14 @@ https://github.com/networkupstools/nut/milestone/12 well -- namely, that we successfully use reasonably many of the existing mappings. Suggest how user can help improve the driver if too few data points were seen. [PR #3095] + * `nutdrv_qx_masterguard` sub-driver adds a way to call battery test until + the battery charge is low, using a new `test.battery.start.low` instant + command name (registered in `docs/nut-names.txt`). The difference between + the "battery test until battery low" and "deep battery test" is that the + latter is actually a battery calibration test and needs some preconditions + to be met, i.e. the load must be between 30% and 100% and the starting + battery capacity is greater than 99%. The "Battery test until battery low" + can be started anytime. Tested on Masterguard A1000 and A2000 units. [#3135] - `powerp-bin` and `powerp-txt` driver updates: * Their `upsdrv_initinfo()` methods did not explicitly reference the diff --git a/docs/man/nutdrv_qx.txt b/docs/man/nutdrv_qx.txt index 67c1b92755..cd8212b0ed 100644 --- a/docs/man/nutdrv_qx.txt +++ b/docs/man/nutdrv_qx.txt @@ -531,6 +531,18 @@ Enable the UPS beeper. *beeper.disable*:: Disable the UPS beeper. +*test.battery.start.low*:: +Perform a battery test until the battery charge is low. ++ +The difference between the "battery test until battery low" and "deep battery +test" is that the latter is actually a battery calibration test and needs some +preconditions to be met, i.e. the load must be between 30% and 100% and the +starting battery capacity is greater than 99%. ++ +The "Battery test until battery low" can be started anytime. ++ +Feature was tested on Masterguard A1000 and A2000 units. + *test.battery.start* 'value':: Perform a battery test for the duration of 'value' seconds (truncated to 60 seconds) [+0..5940+]. This value is truncated to units of 6 seconds (less than 60 seconds) or 60 seconds (more than 60 seconds). From 719aa8faee5f71d5161678e81322f8cde4d0fc5e Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Tue, 28 Feb 2023 13:58:10 +0100 Subject: [PATCH 306/805] common/str.c: str_ends_with(): update origin attribution Signed-off-by: Jim Klimov --- common/str.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/common/str.c b/common/str.c index e6976ca9ef..e91f1e42ab 100644 --- a/common/str.c +++ b/common/str.c @@ -615,6 +615,8 @@ int str_to_double_strict(const char *string, double *number, const int base) return 1; } +/* Probably derived from https://stackoverflow.com/a/68816055/4715872 + * or a similar suggestion */ int str_ends_with(const char *s, const char *suff) { size_t slen; size_t sufflen; From 2ad23466d1e8703c77011b36038a114a12231623 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Thu, 16 Oct 2025 19:01:05 +0200 Subject: [PATCH 307/805] configure.ac: fix typo in help message for --with-CCACHE_NAMESPACE Signed-off-by: Jim Klimov --- configure.ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 363c2aa85c..33313f9a99 100644 --- a/configure.ac +++ b/configure.ac @@ -6746,7 +6746,7 @@ AS_IF([test x"${CCACHE_NAMESPACE}" = x], [ unset T ]) AC_ARG_WITH(CCACHE_NAMESPACE, - AS_HELP_STRING([--with-CCACHE_NAMESPACE=namespace], [which ccache namespace to use for built binaries; typically nut:${autotools_target})]), + AS_HELP_STRING([--with-CCACHE_NAMESPACE=namespace], [which ccache namespace to use for built binaries (typically nut:${autotools_target})]), [ case "${withval}" in no) From 91831541ea150f807d55329f19cff34aa31c0729 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Thu, 16 Oct 2025 16:56:41 +0200 Subject: [PATCH 308/805] m4/nut_arg_with.m4, configure.ac, NEWS.adoc: refactor with ability to provide custom representation for default value in AS_HELP_STRING message [#3049] Signed-off-by: Jim Klimov --- configure.ac | 20 +++++------ m4/nut_arg_with.m4 | 90 +++++++++++++++++++++++++++++++++++++++------- 2 files changed, 88 insertions(+), 22 deletions(-) diff --git a/configure.ac b/configure.ac index 33313f9a99..6aea2b6e37 100644 --- a/configure.ac +++ b/configure.ac @@ -302,8 +302,8 @@ AM_MAINTAINER_MODE dnl TOTHINK: Add a default --with-nutdir-suffix='nut'/'ups'/etc. for different paths we make? NUT_ARG_WITH([confdir-suffix], [Relative path to NUT configuration files under sysconfdir], [auto]) -NUT_ARG_WITH([confdir], [Complete path to NUT configuration files], [\${sysconfdir}\${confdir_suffix}]) -NUT_ARG_WITH([confdir-examples], [Complete path to NUT configuration file examples (some like it under datadir)], [\${confdir}]) +NUT_ARG_WITH_EXPAND_DEFAULT_HELP_SINGLEQUOTE([confdir], [Complete path to NUT configuration files], [\${sysconfdir}\${confdir_suffix}]) +NUT_ARG_WITH_EXPAND_DEFAULT_HELP_SINGLEQUOTE([confdir-examples], [Complete path to NUT configuration file examples (some like it under datadir)], [\${confdir}]) dnl GNU and BSD make are okay with the syntax, but Sun make/dmake are not: AC_MSG_CHECKING([whether this make implementation supports export VAR=VAL syntax]) @@ -2650,8 +2650,8 @@ AS_IF([($NUT_SOURCE_GITREV_IS_RELEASE || $NUT_SOURCE_GITREV_IS_PRERELEASE)], [AC_MSG_NOTICE([This is a (pre-)release build, setting default --with-doc='auto' (not just '${nut_with_docs_default}')]) nut_with_docs_default="auto"]) -NUT_ARG_WITH([docs], [build and install documentation (alias to --with-doc)], [${nut_with_docs_default}]) -NUT_ARG_WITH([doc], [build and install documentation (see docs/configure.txt for many variants of the option)], [${nut_with_docs}]) +NUT_ARG_WITH_EXPAND_DEFAULT_HELP([docs], [build and install documentation (alias to --with-doc)], [${nut_with_docs_default}]) +NUT_ARG_WITH_EXPAND_DEFAULT_HELP([doc], [build and install documentation (see docs/configure.txt for many variants of the option)], [${nut_with_docs}]) NUT_ARG_ENABLE([docs-man-for-progs-built-only], [build and install man pages (if enabled) only for built programs (yes, default) or all known pages (no)], [yes]) NUT_ARG_ENABLE([docs-changelog], [(re-)generate ChangeLog* files - and do so whenever git info changes? (default: auto; yes, no, "adoc,html,pdf"...)], [auto]) @@ -2688,13 +2688,13 @@ AC_MSG_NOTICE([Platform ${target_os} default man page section for user commands: AC_MSG_NOTICE([Platform ${target_os} default man page section for overviews, conventions, and miscellaneous: '${DEFAULT_MAN_SECTION_MISC}']) dnl NOTE: Sections may be strings, not pure numbers, on some platforms: -NUT_ARG_WITH([docs-man-section-api], [man page section for library APIs], [${DEFAULT_MAN_SECTION_API}]) -NUT_ARG_WITH([docs-man-section-cfg], [man page section for configuration files], [${DEFAULT_MAN_SECTION_CFG}]) -NUT_ARG_WITH([docs-man-section-cmd-sys], [man page section for system management commands], [${DEFAULT_MAN_SECTION_CMD_SYS}]) -NUT_ARG_WITH([docs-man-section-cmd-usr], [man page section for user commands], [${DEFAULT_MAN_SECTION_CMD_USR}]) -NUT_ARG_WITH([docs-man-section-misc], [man page section for overviews, conventions, and miscellaneous], [${DEFAULT_MAN_SECTION_MISC}]) +NUT_ARG_WITH_EXPAND_DEFAULT_HELP([docs-man-section-api], [man page section for library APIs], [${DEFAULT_MAN_SECTION_API}]) +NUT_ARG_WITH_EXPAND_DEFAULT_HELP([docs-man-section-cfg], [man page section for configuration files], [${DEFAULT_MAN_SECTION_CFG}]) +NUT_ARG_WITH_EXPAND_DEFAULT_HELP([docs-man-section-cmd-sys], [man page section for system management commands], [${DEFAULT_MAN_SECTION_CMD_SYS}]) +NUT_ARG_WITH_EXPAND_DEFAULT_HELP([docs-man-section-cmd-usr], [man page section for user commands], [${DEFAULT_MAN_SECTION_CMD_USR}]) +NUT_ARG_WITH_EXPAND_DEFAULT_HELP([docs-man-section-misc], [man page section for overviews, conventions, and miscellaneous], [${DEFAULT_MAN_SECTION_MISC}]) -NUT_ARG_WITH([docs-man-dir-as-base], [are platform man directories named by base number (yes) or full section name (no)], [${DEFAULT_MAN_DIR_AS_BASE}]) +NUT_ARG_WITH_EXPAND_DEFAULT_HELP([docs-man-dir-as-base], [are platform man directories named by base number (yes) or full section name (no)], [${DEFAULT_MAN_DIR_AS_BASE}]) NUT_ARG_WITH([docs-man-linkmanext-template], [asciidoc template for "linkmanext" tags (distro-dependent)], [auto]) NUT_ARG_WITH([docs-man-linkmanext2-template], [asciidoc template for "linkmanext2" tags (distro-dependent)], [auto]) diff --git a/m4/nut_arg_with.m4 b/m4/nut_arg_with.m4 index e85f7ee8ed..27c6cb6be8 100644 --- a/m4/nut_arg_with.m4 +++ b/m4/nut_arg_with.m4 @@ -1,21 +1,87 @@ -dnl simplified declaration of some feature options +dnl Simplified declaration of some feature options +dnl Copyright (C) +dnl 2006 Peter Selinger +dnl 2020-2025 Jim Klimov +dnl Common arguments: +dnl $1 option name (part after `--with-`) +dnl $2 help text (descriptive part) +dnl $3 default value +dnl $4 how to represent default in help text (for *_CUSTOM_DEFAULT_HELP) +dnl Note that for some reason use of dollar-number gets expanded below, +dnl but any other variable (e.g. $conftemp straight in help string) is not. +dnl In fact, the generated configure script includes the help wall of text +dnl much earlier than it includes lines that manipulate conftemp (unless it +dnl gets somehow escaped to happen earlier), due to m4 diverts in autoconf code. dnl Working With External Software (might name a variant or other contextual arg) dnl https://www.gnu.org/software/autoconf/manual/autoconf-2.66/html_node/External-Software.html#External-Software +dnl including concepts of the OS as external software (account names, paths...) +AC_DEFUN([NUT_ARG_WITH_CUSTOM_DEFAULT_HELP], +[ AC_ARG_WITH($1, + AS_HELP_STRING([--with-$1], [$2 ($4)]), + [[nut_with_]m4_translit($1, [-], [_])="${withval}"], + [[nut_with_]m4_translit($1, [-], [_])="$3"] + ) +]) + +AC_DEFUN([NUT_ARG_WITH_EXPAND_DEFAULT_HELP], +[ + dnl Note: only 3 args expected + dnl Default expanded once to substitute current variables, + dnl or remove backslashing of verbatim dollars, etc. + conftemp="$3" + eval conftemp=\"${conftemp}\" + NUT_ARG_WITH_CUSTOM_DEFAULT_HELP([$1], [$2], [$3], [${conftemp}]) + unset conftemp +]) + +AC_DEFUN([NUT_ARG_WITH_EXPAND_DEFAULT_HELP_SINGLEQUOTE], +[ + dnl Variant for paths (likely using backslash-dollar in $3) + dnl Note: only 3 args expected + dnl Default expanded once to substitute current variables, + dnl or remove backslashing of verbatim dollars, etc. + conftemp="$3" + eval conftemp=\"${conftemp}\" + NUT_ARG_WITH_CUSTOM_DEFAULT_HELP([$1], [$2], [$3], ['${conftemp}']) + unset conftemp +]) + AC_DEFUN([NUT_ARG_WITH], -[ AC_ARG_WITH($1, - AS_HELP_STRING([--with-$1], [$2 ($3)]), - [[nut_with_]m4_translit($1, [-], [_])="${withval}"], - [[nut_with_]m4_translit($1, [-], [_])="$3"] - ) +[ + dnl Note: only 3 args expected + dnl Legacy behavior (for static values): default value + dnl and its help representation are the same (verbatim!) + NUT_ARG_WITH_CUSTOM_DEFAULT_HELP([$1], [$2], [$3], [$3]) ]) -dnl Enable a feature (might name a variant), or yes/no +dnl Enable a package feature/ability (might name a variant, or yes/no) dnl https://www.gnu.org/software/autoconf/manual/autoconf-2.66/html_node/Package-Options.html +AC_DEFUN([NUT_ARG_ENABLE_CUSTOM_DEFAULT_HELP], +[ AC_ARG_ENABLE($1, + AS_HELP_STRING([--enable-$1], [$2 ($4)]), + [[nut_enable_]m4_translit($1, [-], [_])="${enableval}"], + [[nut_enable_]m4_translit($1, [-], [_])="$3"] + ) +]) + +AC_DEFUN([NUT_ARG_ENABLE_EXPAND_DEFAULT_HELP], +[ + conftemp="$3" + eval conftemp=\"${conftemp}\" + NUT_ARG_ENABLE_CUSTOM_DEFAULT_HELP([$1], [$2], [$3], [${conftemp}]) + unset conftemp +]) + +AC_DEFUN([NUT_ARG_ENABLE_EXPAND_DEFAULT_HELP_SINGLEQUOTE], +[ + conftemp="$3" + eval conftemp=\"${conftemp}\" + NUT_ARG_ENABLE_CUSTOM_DEFAULT_HELP([$1], [$2], [$3], ['${conftemp}']) + unset conftemp +]) + AC_DEFUN([NUT_ARG_ENABLE], -[ AC_ARG_ENABLE($1, - AS_HELP_STRING([--enable-$1], [$2 ($3)]), - [[nut_enable_]m4_translit($1, [-], [_])="${enableval}"], - [[nut_enable_]m4_translit($1, [-], [_])="$3"] - ) +[ + NUT_ARG_ENABLE_CUSTOM_DEFAULT_HELP([$1], [$2], [$3], [$3]) ]) From 140f3f5a10da69112445c830442c340042975faf Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Thu, 16 Oct 2025 19:16:12 +0200 Subject: [PATCH 309/805] m4/nut_arg_with.m4: fix passing of conftemp (non-verbatim per se) [#3049] Signed-off-by: Jim Klimov --- m4/nut_arg_with.m4 | 35 +++++++++++++++-------------------- 1 file changed, 15 insertions(+), 20 deletions(-) diff --git a/m4/nut_arg_with.m4 b/m4/nut_arg_with.m4 index 27c6cb6be8..bce49e10ca 100644 --- a/m4/nut_arg_with.m4 +++ b/m4/nut_arg_with.m4 @@ -13,6 +13,16 @@ dnl In fact, the generated configure script includes the help wall of text dnl much earlier than it includes lines that manipulate conftemp (unless it dnl gets somehow escaped to happen earlier), due to m4 diverts in autoconf code. +dnl Default expanded once to substitute current variables, +dnl or remove backslashing of verbatim dollars, etc. +AC_DEFUN([NUT_ARG_EXPAND], +[[]m4_esyscmd_s( + [nut_conftemp_]m4_translit($1, [-], [_])="$2" ; + eval [nut_conftemp_]m4_translit($1, [-], [_])=\"\${[nut_conftemp_]m4_translit($1, [-], [_])}\" ; + echo "${[nut_conftemp_]m4_translit($1, [-], [_])}" ; + dnl # RUNS 3 TIMES # echo "$1 | $2 | [nut_conftemp_]m4_translit($1, [-], [_])=${[nut_conftemp_]m4_translit($1, [-], [_])}" >> arg.log ; +)[]]) + dnl Working With External Software (might name a variant or other contextual arg) dnl https://www.gnu.org/software/autoconf/manual/autoconf-2.66/html_node/External-Software.html#External-Software dnl including concepts of the OS as external software (account names, paths...) @@ -27,24 +37,15 @@ AC_DEFUN([NUT_ARG_WITH_CUSTOM_DEFAULT_HELP], AC_DEFUN([NUT_ARG_WITH_EXPAND_DEFAULT_HELP], [ dnl Note: only 3 args expected - dnl Default expanded once to substitute current variables, - dnl or remove backslashing of verbatim dollars, etc. - conftemp="$3" - eval conftemp=\"${conftemp}\" - NUT_ARG_WITH_CUSTOM_DEFAULT_HELP([$1], [$2], [$3], [${conftemp}]) - unset conftemp + dnl NUT_ARG_EXPAND($1, $3) + NUT_ARG_WITH_CUSTOM_DEFAULT_HELP([$1], [$2], [$3], NUT_ARG_EXPAND($1, $3)) ]) AC_DEFUN([NUT_ARG_WITH_EXPAND_DEFAULT_HELP_SINGLEQUOTE], [ dnl Variant for paths (likely using backslash-dollar in $3) dnl Note: only 3 args expected - dnl Default expanded once to substitute current variables, - dnl or remove backslashing of verbatim dollars, etc. - conftemp="$3" - eval conftemp=\"${conftemp}\" - NUT_ARG_WITH_CUSTOM_DEFAULT_HELP([$1], [$2], [$3], ['${conftemp}']) - unset conftemp + NUT_ARG_WITH_CUSTOM_DEFAULT_HELP([$1], [$2], [$3], NUT_ARG_EXPAND($1, '$3')) ]) AC_DEFUN([NUT_ARG_WITH], @@ -67,18 +68,12 @@ AC_DEFUN([NUT_ARG_ENABLE_CUSTOM_DEFAULT_HELP], AC_DEFUN([NUT_ARG_ENABLE_EXPAND_DEFAULT_HELP], [ - conftemp="$3" - eval conftemp=\"${conftemp}\" - NUT_ARG_ENABLE_CUSTOM_DEFAULT_HELP([$1], [$2], [$3], [${conftemp}]) - unset conftemp + NUT_ARG_ENABLE_CUSTOM_DEFAULT_HELP([$1], [$2], [$3], NUT_ARG_EXPAND($1, $3)) ]) AC_DEFUN([NUT_ARG_ENABLE_EXPAND_DEFAULT_HELP_SINGLEQUOTE], [ - conftemp="$3" - eval conftemp=\"${conftemp}\" - NUT_ARG_ENABLE_CUSTOM_DEFAULT_HELP([$1], [$2], [$3], ['${conftemp}']) - unset conftemp + NUT_ARG_ENABLE_CUSTOM_DEFAULT_HELP([$1], [$2], [$3], NUT_ARG_EXPAND($1, '$3')) ]) AC_DEFUN([NUT_ARG_ENABLE], From d3d64f82847efcaae66c4e4e61a1034e570e0a15 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Thu, 16 Oct 2025 22:41:12 +0200 Subject: [PATCH 310/805] configure.ac, m4/nut_arg_with.m4: extend newer NUT_ARG_WITH_CUSTOM_DEFAULT_HELP, NUT_ARG_WITH_EXPAND_DEFAULT_HELP etc. methods to optionally print "--with-VARNAME=VALUES" formatted messages [#3049] Signed-off-by: Jim Klimov --- configure.ac | 20 ++++++++++---------- m4/nut_arg_with.m4 | 43 +++++++++++++++++++++++++++---------------- 2 files changed, 37 insertions(+), 26 deletions(-) diff --git a/configure.ac b/configure.ac index 6aea2b6e37..9b9fc5aab7 100644 --- a/configure.ac +++ b/configure.ac @@ -302,8 +302,8 @@ AM_MAINTAINER_MODE dnl TOTHINK: Add a default --with-nutdir-suffix='nut'/'ups'/etc. for different paths we make? NUT_ARG_WITH([confdir-suffix], [Relative path to NUT configuration files under sysconfdir], [auto]) -NUT_ARG_WITH_EXPAND_DEFAULT_HELP_SINGLEQUOTE([confdir], [Complete path to NUT configuration files], [\${sysconfdir}\${confdir_suffix}]) -NUT_ARG_WITH_EXPAND_DEFAULT_HELP_SINGLEQUOTE([confdir-examples], [Complete path to NUT configuration file examples (some like it under datadir)], [\${confdir}]) +NUT_ARG_WITH_EXPAND_DEFAULT_HELP_SINGLEQUOTE([confdir], [PATH], [Complete path to NUT configuration files], [\${sysconfdir}\${confdir_suffix}]) +NUT_ARG_WITH_EXPAND_DEFAULT_HELP_SINGLEQUOTE([confdir-examples], [PATH], [Complete path to NUT configuration file examples (some like it under datadir)], [\${confdir}]) dnl GNU and BSD make are okay with the syntax, but Sun make/dmake are not: AC_MSG_CHECKING([whether this make implementation supports export VAR=VAL syntax]) @@ -2650,8 +2650,8 @@ AS_IF([($NUT_SOURCE_GITREV_IS_RELEASE || $NUT_SOURCE_GITREV_IS_PRERELEASE)], [AC_MSG_NOTICE([This is a (pre-)release build, setting default --with-doc='auto' (not just '${nut_with_docs_default}')]) nut_with_docs_default="auto"]) -NUT_ARG_WITH_EXPAND_DEFAULT_HELP([docs], [build and install documentation (alias to --with-doc)], [${nut_with_docs_default}]) -NUT_ARG_WITH_EXPAND_DEFAULT_HELP([doc], [build and install documentation (see docs/configure.txt for many variants of the option)], [${nut_with_docs}]) +NUT_ARG_WITH_EXPAND_DEFAULT_HELP([docs], [], [build and install documentation (alias to --with-doc)], [${nut_with_docs_default}]) +NUT_ARG_WITH_EXPAND_DEFAULT_HELP([doc], [], [build and install documentation (see docs/configure.txt for many variants of the option)], [${nut_with_docs}]) NUT_ARG_ENABLE([docs-man-for-progs-built-only], [build and install man pages (if enabled) only for built programs (yes, default) or all known pages (no)], [yes]) NUT_ARG_ENABLE([docs-changelog], [(re-)generate ChangeLog* files - and do so whenever git info changes? (default: auto; yes, no, "adoc,html,pdf"...)], [auto]) @@ -2688,13 +2688,13 @@ AC_MSG_NOTICE([Platform ${target_os} default man page section for user commands: AC_MSG_NOTICE([Platform ${target_os} default man page section for overviews, conventions, and miscellaneous: '${DEFAULT_MAN_SECTION_MISC}']) dnl NOTE: Sections may be strings, not pure numbers, on some platforms: -NUT_ARG_WITH_EXPAND_DEFAULT_HELP([docs-man-section-api], [man page section for library APIs], [${DEFAULT_MAN_SECTION_API}]) -NUT_ARG_WITH_EXPAND_DEFAULT_HELP([docs-man-section-cfg], [man page section for configuration files], [${DEFAULT_MAN_SECTION_CFG}]) -NUT_ARG_WITH_EXPAND_DEFAULT_HELP([docs-man-section-cmd-sys], [man page section for system management commands], [${DEFAULT_MAN_SECTION_CMD_SYS}]) -NUT_ARG_WITH_EXPAND_DEFAULT_HELP([docs-man-section-cmd-usr], [man page section for user commands], [${DEFAULT_MAN_SECTION_CMD_USR}]) -NUT_ARG_WITH_EXPAND_DEFAULT_HELP([docs-man-section-misc], [man page section for overviews, conventions, and miscellaneous], [${DEFAULT_MAN_SECTION_MISC}]) +NUT_ARG_WITH_EXPAND_DEFAULT_HELP([docs-man-section-api], [], [man page section for library APIs], [${DEFAULT_MAN_SECTION_API}]) +NUT_ARG_WITH_EXPAND_DEFAULT_HELP([docs-man-section-cfg], [], [man page section for configuration files], [${DEFAULT_MAN_SECTION_CFG}]) +NUT_ARG_WITH_EXPAND_DEFAULT_HELP([docs-man-section-cmd-sys], [], [man page section for system management commands], [${DEFAULT_MAN_SECTION_CMD_SYS}]) +NUT_ARG_WITH_EXPAND_DEFAULT_HELP([docs-man-section-cmd-usr], [], [man page section for user commands], [${DEFAULT_MAN_SECTION_CMD_USR}]) +NUT_ARG_WITH_EXPAND_DEFAULT_HELP([docs-man-section-misc], [], [man page section for overviews, conventions, and miscellaneous], [${DEFAULT_MAN_SECTION_MISC}]) -NUT_ARG_WITH_EXPAND_DEFAULT_HELP([docs-man-dir-as-base], [are platform man directories named by base number (yes) or full section name (no)], [${DEFAULT_MAN_DIR_AS_BASE}]) +NUT_ARG_WITH_EXPAND_DEFAULT_HELP([docs-man-dir-as-base], [], [are platform man directories named by base number (yes) or full section name (no)], [${DEFAULT_MAN_DIR_AS_BASE}]) NUT_ARG_WITH([docs-man-linkmanext-template], [asciidoc template for "linkmanext" tags (distro-dependent)], [auto]) NUT_ARG_WITH([docs-man-linkmanext2-template], [asciidoc template for "linkmanext2" tags (distro-dependent)], [auto]) diff --git a/m4/nut_arg_with.m4 b/m4/nut_arg_with.m4 index bce49e10ca..17c525f15b 100644 --- a/m4/nut_arg_with.m4 +++ b/m4/nut_arg_with.m4 @@ -4,9 +4,10 @@ dnl 2006 Peter Selinger dnl 2020-2025 Jim Klimov dnl Common arguments: dnl $1 option name (part after `--with-`) -dnl $2 help text (descriptive part) -dnl $3 default value -dnl $4 how to represent default in help text (for *_CUSTOM_DEFAULT_HELP) +dnl $2 help bit in option name (except legacy short funcs) +dnl $2 or $3 help text (descriptive part) +dnl $3 or $4 default value +dnl $4 or $5 how to represent default in help text (for *_CUSTOM_DEFAULT_HELP) dnl Note that for some reason use of dollar-number gets expanded below, dnl but any other variable (e.g. $conftemp straight in help string) is not. dnl In fact, the generated configure script includes the help wall of text @@ -26,26 +27,34 @@ AC_DEFUN([NUT_ARG_EXPAND], dnl Working With External Software (might name a variant or other contextual arg) dnl https://www.gnu.org/software/autoconf/manual/autoconf-2.66/html_node/External-Software.html#External-Software dnl including concepts of the OS as external software (account names, paths...) + +dnl $1 option name (part after `--with-`) +dnl $2 optional "=VALUE" for help tag (after $1) +dnl $3 help text (descriptive part) +dnl $4 default value +dnl $5 how to represent default in help text (for *_CUSTOM_DEFAULT_HELP) AC_DEFUN([NUT_ARG_WITH_CUSTOM_DEFAULT_HELP], [ AC_ARG_WITH($1, - AS_HELP_STRING([--with-$1], [$2 ($4)]), + m4_ifval([$2], + [AS_HELP_STRING([--with-$1=$2], [$3 ($5)])], + [AS_HELP_STRING([--with-$1], [$3 ($5)])]), [[nut_with_]m4_translit($1, [-], [_])="${withval}"], - [[nut_with_]m4_translit($1, [-], [_])="$3"] + [[nut_with_]m4_translit($1, [-], [_])="$4"] ) ]) AC_DEFUN([NUT_ARG_WITH_EXPAND_DEFAULT_HELP], [ - dnl Note: only 3 args expected + dnl Note: only 4 args expected dnl NUT_ARG_EXPAND($1, $3) - NUT_ARG_WITH_CUSTOM_DEFAULT_HELP([$1], [$2], [$3], NUT_ARG_EXPAND($1, $3)) + NUT_ARG_WITH_CUSTOM_DEFAULT_HELP([$1], [$2], [$3], [$4], NUT_ARG_EXPAND($1, $4)) ]) AC_DEFUN([NUT_ARG_WITH_EXPAND_DEFAULT_HELP_SINGLEQUOTE], [ - dnl Variant for paths (likely using backslash-dollar in $3) - dnl Note: only 3 args expected - NUT_ARG_WITH_CUSTOM_DEFAULT_HELP([$1], [$2], [$3], NUT_ARG_EXPAND($1, '$3')) + dnl Variant for paths (likely using backslash-dollar in $4) + dnl Note: only 4 args expected + NUT_ARG_WITH_CUSTOM_DEFAULT_HELP([$1], [$2], [$3], [$4], NUT_ARG_EXPAND($1, '$4')) ]) AC_DEFUN([NUT_ARG_WITH], @@ -53,30 +62,32 @@ AC_DEFUN([NUT_ARG_WITH], dnl Note: only 3 args expected dnl Legacy behavior (for static values): default value dnl and its help representation are the same (verbatim!) - NUT_ARG_WITH_CUSTOM_DEFAULT_HELP([$1], [$2], [$3], [$3]) + NUT_ARG_WITH_CUSTOM_DEFAULT_HELP([$1], [], [$2], [$3], [$3]) ]) dnl Enable a package feature/ability (might name a variant, or yes/no) dnl https://www.gnu.org/software/autoconf/manual/autoconf-2.66/html_node/Package-Options.html AC_DEFUN([NUT_ARG_ENABLE_CUSTOM_DEFAULT_HELP], [ AC_ARG_ENABLE($1, - AS_HELP_STRING([--enable-$1], [$2 ($4)]), + m4_ifval([$2], + [AS_HELP_STRING([--enable-$1=$2], [$3 ($5)])], + [AS_HELP_STRING([--enable-$1], [$3 ($5)])]), [[nut_enable_]m4_translit($1, [-], [_])="${enableval}"], - [[nut_enable_]m4_translit($1, [-], [_])="$3"] + [[nut_enable_]m4_translit($1, [-], [_])="$4"] ) ]) AC_DEFUN([NUT_ARG_ENABLE_EXPAND_DEFAULT_HELP], [ - NUT_ARG_ENABLE_CUSTOM_DEFAULT_HELP([$1], [$2], [$3], NUT_ARG_EXPAND($1, $3)) + NUT_ARG_ENABLE_CUSTOM_DEFAULT_HELP([$1], [$2], [$3], [$4], NUT_ARG_EXPAND($1, $4)) ]) AC_DEFUN([NUT_ARG_ENABLE_EXPAND_DEFAULT_HELP_SINGLEQUOTE], [ - NUT_ARG_ENABLE_CUSTOM_DEFAULT_HELP([$1], [$2], [$3], NUT_ARG_EXPAND($1, '$3')) + NUT_ARG_ENABLE_CUSTOM_DEFAULT_HELP([$1], [$2], [$3], [$4], NUT_ARG_EXPAND($1, '$4')) ]) AC_DEFUN([NUT_ARG_ENABLE], [ - NUT_ARG_ENABLE_CUSTOM_DEFAULT_HELP([$1], [$2], [$3], [$3]) + NUT_ARG_ENABLE_CUSTOM_DEFAULT_HELP([$1], [], [$2], [$3], [$3]) ]) From b40b0cd42013e4a58df11388394dd7f3ff84e089 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Fri, 17 Oct 2025 09:02:22 +0200 Subject: [PATCH 311/805] m4/nut_arg_with.m4: update comments [#3049] Signed-off-by: Jim Klimov --- m4/nut_arg_with.m4 | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/m4/nut_arg_with.m4 b/m4/nut_arg_with.m4 index 17c525f15b..ac3aa626e5 100644 --- a/m4/nut_arg_with.m4 +++ b/m4/nut_arg_with.m4 @@ -13,9 +13,14 @@ dnl but any other variable (e.g. $conftemp straight in help string) is not. dnl In fact, the generated configure script includes the help wall of text dnl much earlier than it includes lines that manipulate conftemp (unless it dnl gets somehow escaped to happen earlier), due to m4 diverts in autoconf code. +dnl So we can use the "EXPAND" methods to convert static text, but not to display +dnl any values determined and changed during `configure` shell script run-time. +dnl See research in https://github.com/networkupstools/nut/issues/3049 for more. dnl Default expanded once to substitute current variables, dnl or remove backslashing of verbatim dollars, etc. +dnl NOTE: Not sure if the fuss with uniquely named conftemp is worth it, +dnl or is even remembered between calls. There seems to be 3 calls per name. AC_DEFUN([NUT_ARG_EXPAND], [[]m4_esyscmd_s( [nut_conftemp_]m4_translit($1, [-], [_])="$2" ; From da1b58b73e4dfde4d561724dabaf0db62a198b22 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Fri, 17 Oct 2025 09:02:42 +0200 Subject: [PATCH 312/805] m4/nut_arg_with.m4: more uniquely name the conftemp variables [#3049] Signed-off-by: Jim Klimov --- m4/nut_arg_with.m4 | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/m4/nut_arg_with.m4 b/m4/nut_arg_with.m4 index ac3aa626e5..ac0966b42c 100644 --- a/m4/nut_arg_with.m4 +++ b/m4/nut_arg_with.m4 @@ -52,14 +52,14 @@ AC_DEFUN([NUT_ARG_WITH_EXPAND_DEFAULT_HELP], [ dnl Note: only 4 args expected dnl NUT_ARG_EXPAND($1, $3) - NUT_ARG_WITH_CUSTOM_DEFAULT_HELP([$1], [$2], [$3], [$4], NUT_ARG_EXPAND($1, $4)) + NUT_ARG_WITH_CUSTOM_DEFAULT_HELP([$1], [$2], [$3], [$4], NUT_ARG_EXPAND(with_$1, $4)) ]) AC_DEFUN([NUT_ARG_WITH_EXPAND_DEFAULT_HELP_SINGLEQUOTE], [ dnl Variant for paths (likely using backslash-dollar in $4) dnl Note: only 4 args expected - NUT_ARG_WITH_CUSTOM_DEFAULT_HELP([$1], [$2], [$3], [$4], NUT_ARG_EXPAND($1, '$4')) + NUT_ARG_WITH_CUSTOM_DEFAULT_HELP([$1], [$2], [$3], [$4], NUT_ARG_EXPAND(with_$1, '$4')) ]) AC_DEFUN([NUT_ARG_WITH], @@ -84,12 +84,12 @@ AC_DEFUN([NUT_ARG_ENABLE_CUSTOM_DEFAULT_HELP], AC_DEFUN([NUT_ARG_ENABLE_EXPAND_DEFAULT_HELP], [ - NUT_ARG_ENABLE_CUSTOM_DEFAULT_HELP([$1], [$2], [$3], [$4], NUT_ARG_EXPAND($1, $4)) + NUT_ARG_ENABLE_CUSTOM_DEFAULT_HELP([$1], [$2], [$3], [$4], NUT_ARG_EXPAND(enable_$1, $4)) ]) AC_DEFUN([NUT_ARG_ENABLE_EXPAND_DEFAULT_HELP_SINGLEQUOTE], [ - NUT_ARG_ENABLE_CUSTOM_DEFAULT_HELP([$1], [$2], [$3], [$4], NUT_ARG_EXPAND($1, '$4')) + NUT_ARG_ENABLE_CUSTOM_DEFAULT_HELP([$1], [$2], [$3], [$4], NUT_ARG_EXPAND(enable_$1, '$4')) ]) AC_DEFUN([NUT_ARG_ENABLE], From f8b2cc6482be65bf7427c81d1773ce601e77cc6b Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Fri, 17 Oct 2025 10:26:00 +0200 Subject: [PATCH 313/805] m4/nut_arg_with.m4: extend NUT_ARG_ENABLE_CUSTOM_DEFAULT_HELP and NUT_ARG_WITH_CUSTOM_DEFAULT_HELP to short-circuit $5==$4 if $5 is not specified [#3049] Signed-off-by: Jim Klimov --- m4/nut_arg_with.m4 | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/m4/nut_arg_with.m4 b/m4/nut_arg_with.m4 index ac0966b42c..8060e1030c 100644 --- a/m4/nut_arg_with.m4 +++ b/m4/nut_arg_with.m4 @@ -41,8 +41,12 @@ dnl $5 how to represent default in help text (for *_CUSTOM_DEFAULT_HELP) AC_DEFUN([NUT_ARG_WITH_CUSTOM_DEFAULT_HELP], [ AC_ARG_WITH($1, m4_ifval([$2], - [AS_HELP_STRING([--with-$1=$2], [$3 ($5)])], - [AS_HELP_STRING([--with-$1], [$3 ($5)])]), + [m4_ifval([$5], + [AS_HELP_STRING([--with-$1=$2], [$3 ($5)])], + [AS_HELP_STRING([--with-$1=$2], [$3 ($4)])])], + [m4_ifval([$5], + [AS_HELP_STRING([--with-$1], [$3 ($5)])], + [AS_HELP_STRING([--with-$1], [$3 ($4)])])]), [[nut_with_]m4_translit($1, [-], [_])="${withval}"], [[nut_with_]m4_translit($1, [-], [_])="$4"] ) @@ -75,8 +79,12 @@ dnl https://www.gnu.org/software/autoconf/manual/autoconf-2.66/html_node/Package AC_DEFUN([NUT_ARG_ENABLE_CUSTOM_DEFAULT_HELP], [ AC_ARG_ENABLE($1, m4_ifval([$2], - [AS_HELP_STRING([--enable-$1=$2], [$3 ($5)])], - [AS_HELP_STRING([--enable-$1], [$3 ($5)])]), + [m4_ifval([$5], + [AS_HELP_STRING([--enable-$1=$2], [$3 ($5)])], + [AS_HELP_STRING([--enable-$1=$2], [$3 ($4)])])], + [m4_ifval([$5], + [AS_HELP_STRING([--enable-$1], [$3 ($5)])], + [AS_HELP_STRING([--enable-$1], [$3 ($4)])])]), [[nut_enable_]m4_translit($1, [-], [_])="${enableval}"], [[nut_enable_]m4_translit($1, [-], [_])="$4"] ) From 89dd3fbbd1b3f2db0083f43d9af378665dad8bbc Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Fri, 17 Oct 2025 10:41:34 +0200 Subject: [PATCH 314/805] m4/nut_arg_with.m4: extend NUT_ARG_ENABLE and NUT_ARG_WITH to optionally accept one more (second) argument for "...=VALUES" [#3049] Signed-off-by: Jim Klimov --- m4/nut_arg_with.m4 | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/m4/nut_arg_with.m4 b/m4/nut_arg_with.m4 index 8060e1030c..7aa73d6d5c 100644 --- a/m4/nut_arg_with.m4 +++ b/m4/nut_arg_with.m4 @@ -68,10 +68,13 @@ AC_DEFUN([NUT_ARG_WITH_EXPAND_DEFAULT_HELP_SINGLEQUOTE], AC_DEFUN([NUT_ARG_WITH], [ - dnl Note: only 3 args expected + dnl Note: historicaly only 3 args were expected + dnl Now a second arg may be injected for optional "=VALUE" for help tag (after $1) dnl Legacy behavior (for static values): default value dnl and its help representation are the same (verbatim!) - NUT_ARG_WITH_CUSTOM_DEFAULT_HELP([$1], [], [$2], [$3], [$3]) + m4_ifval([$4], + [NUT_ARG_WITH_CUSTOM_DEFAULT_HELP([$1], [$2], [$3], [$4], [$4])], + [NUT_ARG_WITH_CUSTOM_DEFAULT_HELP([$1], [], [$2], [$3], [$3])]) ]) dnl Enable a package feature/ability (might name a variant, or yes/no) @@ -102,5 +105,7 @@ AC_DEFUN([NUT_ARG_ENABLE_EXPAND_DEFAULT_HELP_SINGLEQUOTE], AC_DEFUN([NUT_ARG_ENABLE], [ - NUT_ARG_ENABLE_CUSTOM_DEFAULT_HELP([$1], [], [$2], [$3], [$3]) + m4_ifval([$4], + [NUT_ARG_ENABLE_CUSTOM_DEFAULT_HELP([$1], [$2], [$3], [$4], [$4])], + [NUT_ARG_ENABLE_CUSTOM_DEFAULT_HELP([$1], [], [$2], [$3], [$3])]) ]) From 307572c61c4c983e4be56de65930f670d6507d27 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Fri, 17 Oct 2025 10:46:52 +0200 Subject: [PATCH 315/805] m4/nut_arg_with.m4: clarify that parentheses mean "default:" and *_SINGLEQUOTE values are "resolved from" [#3049] Signed-off-by: Jim Klimov --- m4/nut_arg_with.m4 | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/m4/nut_arg_with.m4 b/m4/nut_arg_with.m4 index 7aa73d6d5c..65a89fa777 100644 --- a/m4/nut_arg_with.m4 +++ b/m4/nut_arg_with.m4 @@ -42,11 +42,11 @@ AC_DEFUN([NUT_ARG_WITH_CUSTOM_DEFAULT_HELP], [ AC_ARG_WITH($1, m4_ifval([$2], [m4_ifval([$5], - [AS_HELP_STRING([--with-$1=$2], [$3 ($5)])], - [AS_HELP_STRING([--with-$1=$2], [$3 ($4)])])], + [AS_HELP_STRING([--with-$1=$2], [$3 (default: $5)])], + [AS_HELP_STRING([--with-$1=$2], [$3 (default: $4)])])], [m4_ifval([$5], - [AS_HELP_STRING([--with-$1], [$3 ($5)])], - [AS_HELP_STRING([--with-$1], [$3 ($4)])])]), + [AS_HELP_STRING([--with-$1], [$3 (default: $5)])], + [AS_HELP_STRING([--with-$1], [$3 (default: $4)])])]), [[nut_with_]m4_translit($1, [-], [_])="${withval}"], [[nut_with_]m4_translit($1, [-], [_])="$4"] ) @@ -63,7 +63,8 @@ AC_DEFUN([NUT_ARG_WITH_EXPAND_DEFAULT_HELP_SINGLEQUOTE], [ dnl Variant for paths (likely using backslash-dollar in $4) dnl Note: only 4 args expected - NUT_ARG_WITH_CUSTOM_DEFAULT_HELP([$1], [$2], [$3], [$4], NUT_ARG_EXPAND(with_$1, '$4')) + dnl Note: "resolved from" must be not bracketed + NUT_ARG_WITH_CUSTOM_DEFAULT_HELP([$1], [$2], [$3], [$4], resolved from NUT_ARG_EXPAND(with_$1, '$4')) ]) AC_DEFUN([NUT_ARG_WITH], @@ -83,11 +84,11 @@ AC_DEFUN([NUT_ARG_ENABLE_CUSTOM_DEFAULT_HELP], [ AC_ARG_ENABLE($1, m4_ifval([$2], [m4_ifval([$5], - [AS_HELP_STRING([--enable-$1=$2], [$3 ($5)])], - [AS_HELP_STRING([--enable-$1=$2], [$3 ($4)])])], + [AS_HELP_STRING([--enable-$1=$2], [$3 (default: $5)])], + [AS_HELP_STRING([--enable-$1=$2], [$3 (default: $4)])])], [m4_ifval([$5], - [AS_HELP_STRING([--enable-$1], [$3 ($5)])], - [AS_HELP_STRING([--enable-$1], [$3 ($4)])])]), + [AS_HELP_STRING([--enable-$1], [$3 (default: $5)])], + [AS_HELP_STRING([--enable-$1], [$3 (default: $4)])])]), [[nut_enable_]m4_translit($1, [-], [_])="${enableval}"], [[nut_enable_]m4_translit($1, [-], [_])="$4"] ) @@ -100,7 +101,7 @@ AC_DEFUN([NUT_ARG_ENABLE_EXPAND_DEFAULT_HELP], AC_DEFUN([NUT_ARG_ENABLE_EXPAND_DEFAULT_HELP_SINGLEQUOTE], [ - NUT_ARG_ENABLE_CUSTOM_DEFAULT_HELP([$1], [$2], [$3], [$4], NUT_ARG_EXPAND(enable_$1, '$4')) + NUT_ARG_ENABLE_CUSTOM_DEFAULT_HELP([$1], [$2], [$3], [$4], resolved from NUT_ARG_EXPAND(enable_$1, '$4')) ]) AC_DEFUN([NUT_ARG_ENABLE], From c3d0523778840416f1993833445f5cdebda0e2a1 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Fri, 17 Oct 2025 10:48:18 +0200 Subject: [PATCH 316/805] configure.ac: define "confdir-suffix" via 4-arg syntax of NUT_ARG_WITH; rephrase other confdir options to say =PATH => =DIRPATH [#3049] Signed-off-by: Jim Klimov --- configure.ac | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/configure.ac b/configure.ac index 9b9fc5aab7..8b2d86012c 100644 --- a/configure.ac +++ b/configure.ac @@ -301,9 +301,9 @@ dnl in sync after Git updates. AM_MAINTAINER_MODE dnl TOTHINK: Add a default --with-nutdir-suffix='nut'/'ups'/etc. for different paths we make? -NUT_ARG_WITH([confdir-suffix], [Relative path to NUT configuration files under sysconfdir], [auto]) -NUT_ARG_WITH_EXPAND_DEFAULT_HELP_SINGLEQUOTE([confdir], [PATH], [Complete path to NUT configuration files], [\${sysconfdir}\${confdir_suffix}]) -NUT_ARG_WITH_EXPAND_DEFAULT_HELP_SINGLEQUOTE([confdir-examples], [PATH], [Complete path to NUT configuration file examples (some like it under datadir)], [\${confdir}]) +NUT_ARG_WITH([confdir-suffix], [SHORT_DIRNAME], [Relative path to NUT configuration files under '${sysconfdir}', typically 'nut'], [auto]) +NUT_ARG_WITH_EXPAND_DEFAULT_HELP_SINGLEQUOTE([confdir], [DIRPATH], [Complete path to NUT configuration files], [\${sysconfdir}\${confdir_suffix}]) +NUT_ARG_WITH_EXPAND_DEFAULT_HELP_SINGLEQUOTE([confdir-examples], [DIRPATH], [Complete path to NUT configuration file examples (some like it under datadir)], [\${confdir}]) dnl GNU and BSD make are okay with the syntax, but Sun make/dmake are not: AC_MSG_CHECKING([whether this make implementation supports export VAR=VAL syntax]) From 975e2fdc9ef169584ddbbc32b4e77668b3e88651 Mon Sep 17 00:00:00 2001 From: Viktor Drobot Date: Mon, 20 Oct 2025 21:02:09 +0300 Subject: [PATCH 317/805] Basic Ippon Innova TAE support Signed-off-by: Viktor Drobot --- docs/man/nutdrv_qx.txt | 14 +-- docs/nutdrv_qx-subdrivers.txt | 1 + drivers/Makefile.am | 4 +- drivers/nutdrv_qx.c | 2 + drivers/nutdrv_qx_blazer-common.c | 2 +- drivers/nutdrv_qx_blazer-common.h | 2 +- drivers/nutdrv_qx_innovatae.c | 144 ++++++++++++++++++++++++++++++ drivers/nutdrv_qx_innovatae.h | 29 ++++++ 8 files changed, 188 insertions(+), 10 deletions(-) create mode 100644 drivers/nutdrv_qx_innovatae.c create mode 100644 drivers/nutdrv_qx_innovatae.h diff --git a/docs/man/nutdrv_qx.txt b/docs/man/nutdrv_qx.txt index cd8212b0ed..1948d8e227 100644 --- a/docs/man/nutdrv_qx.txt +++ b/docs/man/nutdrv_qx.txt @@ -88,7 +88,7 @@ If you set stayoff in linkman:ups.conf[5] when FSD arises the UPS will call a *s *protocol =* 'string':: Skip autodetection of the protocol to use and only use the one specified. -Supported values: 'bestups', 'gtec', 'hunnox', 'innovart31', 'innovart33', 'masterguard', 'mecer', 'megatec', 'megatec/old', 'mustek', 'q1', 'q2', 'q6', 'voltronic', 'voltronic-axpert', 'voltronic-qs', 'voltronic-qs-hex' and 'zinto'. +Supported values: 'bestups', 'gtec', 'hunnox', 'innovart31', 'innovart33', 'innovatae', 'masterguard', 'mecer', 'megatec', 'megatec/old', 'mustek', 'q1', 'q2', 'q6', 'voltronic', 'voltronic-axpert', 'voltronic-qs', 'voltronic-qs-hex' and 'zinto'. + Run the driver program with the `--help` option to see the exact list of `protocol` values it would currently recognize. @@ -168,8 +168,8 @@ If not specified, the driver defaults to 10%. Only used if *runtimecal* is also specified. -BESTUPS, INNOVART31, INNOVART33, MECER, MEGATEC, MEGATEC/OLD, MUSTEK, Q1, Q2, Q6, VOLTRONIC-QS, VOLTRONIC-QS-HEX, ZINTO PROTOCOLS -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +BESTUPS, INNOVART31, INNOVART33, INNOVATAE, MECER, MEGATEC, MEGATEC/OLD, MUSTEK, Q1, Q2, Q6, VOLTRONIC-QS, VOLTRONIC-QS-HEX, ZINTO PROTOCOLS +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ *ignoresab*:: Some UPSes incorrectly report the `Shutdown Active' bit as always on, consequently making the driver believe the UPS is nearing a shutdown (and, as a result, ups.status always contains +FSD+... and you know what this means). @@ -217,8 +217,8 @@ Safeguard against talking to the wrong one of several identical UPSes on the sam Note that when changing *ups.id* (through linkman:upsrw[8]) the driver will continue to talk to the UPS with the new 'slave address', but won't claim it again on restart until the *slave_addr* parameter is adjusted. -INNOVART31, INNOVART33, Q1, Q2, Q6 PROTOCOLS -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +INNOVART31, INNOVART33, INNOVATAE, Q1, Q2, Q6 PROTOCOLS +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ *ondelay*:: The acceptable range is +0..599940+ seconds. @@ -515,8 +515,8 @@ Stop a running battery test. (Not available on some hardware) -BESTUPS, INNOVART31, INNOVART33, MECER, MEGATEC, MEGATEC/OLD, MUSTEK, Q1, Q2, Q6, ZINTO PROTOCOLS -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +BESTUPS, INNOVART31, INNOVART33, INNOVATAE, MECER, MEGATEC, MEGATEC/OLD, MUSTEK, Q1, Q2, Q6, ZINTO PROTOCOLS +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ *test.battery.start* 'value':: Perform a battery test for the duration of 'value' seconds (truncated to 60 seconds) [+60..5940+]. diff --git a/docs/nutdrv_qx-subdrivers.txt b/docs/nutdrv_qx-subdrivers.txt index d6441ef282..642980556a 100644 --- a/docs/nutdrv_qx-subdrivers.txt +++ b/docs/nutdrv_qx-subdrivers.txt @@ -1184,6 +1184,7 @@ For more details, have a look at the currently available subdrivers: - +nutdrv_qx_bestups.+{+c+,+h+} - +nutdrv_qx_innovart31.+{+c+,+h+} - +nutdrv_qx_innovart33.+{+c+,+h+} +- +nutdrv_qx_innovatae.+{+c+,+h+} - +nutdrv_qx_masterguard.+{+c+,+h+} - +nutdrv_qx_mecer.+{+c+,+h+} - +nutdrv_qx_megatec.+{+c+,+h+} diff --git a/drivers/Makefile.am b/drivers/Makefile.am index 0a81ff5737..3f8378b668 100644 --- a/drivers/Makefile.am +++ b/drivers/Makefile.am @@ -413,6 +413,7 @@ NUTDRV_QX_SUBDRIVERS = \ nutdrv_qx_bestups.c nutdrv_qx_blazer-common.c \ nutdrv_qx_innovart31.c \ nutdrv_qx_innovart33.c \ + nutdrv_qx_innovatae.c \ nutdrv_qx_masterguard.c \ nutdrv_qx_mecer.c nutdrv_qx_megatec.c nutdrv_qx_megatec-old.c \ nutdrv_qx_mustek.c nutdrv_qx_q1.c nutdrv_qx_q2.c nutdrv_qx_q6.c \ @@ -440,7 +441,8 @@ dist_noinst_HEADERS = \ upshandler.h usb-common.h usbhid-ups.h powercom-hid.h compaq-mib.h idowell-hid.h \ apcsmart.h apcsmart_tabs.h apcsmart-old.h apcupsd-ups.h cyberpower-mib.h riello.h openups-hid.h \ delta_ups-mib.h nutdrv_qx.h nutdrv_qx_bestups.h nutdrv_qx_blazer-common.h \ - nutdrv_qx_gtec.h nutdrv_qx_innovart31.h nutdrv_qx_innovart33.h nutdrv_qx_masterguard.h nutdrv_qx_mecer.h nutdrv_qx_ablerex.h \ + nutdrv_qx_gtec.h nutdrv_qx_innovart31.h nutdrv_qx_innovart33.h nutdrv_qx_innovatae.h \ + nutdrv_qx_masterguard.h nutdrv_qx_mecer.h nutdrv_qx_ablerex.h \ nutdrv_qx_megatec.h nutdrv_qx_megatec-old.h nutdrv_qx_mustek.h nutdrv_qx_q1.h nutdrv_qx_q2.h nutdrv_qx_q6.h nutdrv_qx_hunnox.h \ nutdrv_qx.h common_voltronic-crc.h nutdrv_qx_voltronic.h \ nutdrv_qx_voltronic-axpert.h nutdrv_qx_voltronic-qs.h nutdrv_qx_voltronic-qs-hex.h \ diff --git a/drivers/nutdrv_qx.c b/drivers/nutdrv_qx.c index 799371d3a6..14a229fb27 100644 --- a/drivers/nutdrv_qx.c +++ b/drivers/nutdrv_qx.c @@ -73,6 +73,7 @@ #include "nutdrv_qx_hunnox.h" #include "nutdrv_qx_innovart31.h" #include "nutdrv_qx_innovart33.h" +#include "nutdrv_qx_innovatae.h" #include "nutdrv_qx_mecer.h" #include "nutdrv_qx_megatec.h" #include "nutdrv_qx_megatec-old.h" @@ -106,6 +107,7 @@ static subdriver_t *subdriver_list[] = { &ablerex_subdriver, &innovart31_subdriver, &innovart33_subdriver, + &innovatae_subdriver, &q2_subdriver, &q6_subdriver, >ec_subdriver, diff --git a/drivers/nutdrv_qx_blazer-common.c b/drivers/nutdrv_qx_blazer-common.c index 1fe00226dc..fd7582ec97 100644 --- a/drivers/nutdrv_qx_blazer-common.c +++ b/drivers/nutdrv_qx_blazer-common.c @@ -1,4 +1,4 @@ -/* nutdrv_qx_blazer-common.c - Common functions/settings for nutdrv_qx_{innovart31,innovart33,mecer,megatec,megatec-old,mustek,q1,q2,q6,voltronic-qs,zinto}.{c,h} +/* nutdrv_qx_blazer-common.c - Common functions/settings for nutdrv_qx_{innovart31,innovart33,innovatae,mecer,megatec,megatec-old,mustek,q1,q2,q6,voltronic-qs,zinto}.{c,h} * * Copyright (C) * 2013 Daniele Pezzini diff --git a/drivers/nutdrv_qx_blazer-common.h b/drivers/nutdrv_qx_blazer-common.h index 997eaa21c5..09bb1ff0f2 100644 --- a/drivers/nutdrv_qx_blazer-common.h +++ b/drivers/nutdrv_qx_blazer-common.h @@ -1,4 +1,4 @@ -/* nutdrv_qx_blazer-common.h - Common functions/settings for nutdrv_qx_{innovart31,innovart33,mecer,megatec,megatec-old,mustek,q1,q2,q6,voltronic-qs,zinto}.{c,h} +/* nutdrv_qx_blazer-common.h - Common functions/settings for nutdrv_qx_{innovart31,innovart33,innovatae,mecer,megatec,megatec-old,mustek,q1,q2,q6,voltronic-qs,zinto}.{c,h} * * Copyright (C) * 2013 Daniele Pezzini diff --git a/drivers/nutdrv_qx_innovatae.c b/drivers/nutdrv_qx_innovatae.c new file mode 100644 index 0000000000..d9d020e6b2 --- /dev/null +++ b/drivers/nutdrv_qx_innovatae.c @@ -0,0 +1,144 @@ +/* nutdrv_qx_innovatae.c - Subdriver for INNOVA TAE series + * + * Copyright (C) + * 2025 Viktor Drobot + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ + +#include "main.h" +#include "nutdrv_qx.h" +#include "nutdrv_qx_blazer-common.h" + +#include "nutdrv_qx_innovatae.h" + +#define INNOVATAE_VERSION "INNOVATAE 0.01" + +static void innovatae_initups(void); + +/* qx2nut lookup table */ +static item_t innovatae_qx2nut[] = { + /* Static values */ + { "device.mfr", 0, NULL, "", "", 0, '\0', "", 0, 0, "Ippon", QX_FLAG_STATIC | QX_FLAG_ABSENT,NULL, NULL, NULL }, + + /* + * > [Q1\r] + * < [(226.0 195.0 226.0 014 49.0 27.5 30.0 00001000\r] + * 01234567890123456789012345678901234567890123456 + * 0 1 2 3 4 + */ + + /* Common parameters */ + { "input.voltage", 0, NULL, "Q1\r", "", 47, '(', "", 1, 5, "%.1f", 0, NULL, NULL, NULL }, + { "input.voltage.fault", 0, NULL, "Q1\r", "", 47, '(', "", 7, 11, "%.1f", 0, NULL, NULL, NULL }, + { "output.voltage", 0, NULL, "Q1\r", "", 47, '(', "", 13, 17, "%.1f", 0, NULL, NULL, NULL }, + { "ups.load", 0, NULL, "Q1\r", "", 47, '(', "", 19, 21, "%.0f", 0, NULL, NULL, NULL }, + { "input.frequency", 0, NULL, "Q1\r", "", 47, '(', "", 23, 26, "%.1f", 0, NULL, NULL, NULL }, + { "battery.voltage", 0, NULL, "Q1\r", "", 47, '(', "", 28, 31, "%.2f", 0, NULL, NULL, qx_multiply_battvolt }, + { "ups.temperature", 0, NULL, "Q1\r", "", 47, '(', "", 33, 36, "%.1f", 0, NULL, NULL, NULL }, + + /* Status bits */ + { "ups.status", 0, NULL, "Q1\r", "", 47, '(', "", 38, 38, NULL, QX_FLAG_QUICK_POLL, NULL, NULL, blazer_process_status_bits }, /* Utility Fail (Immediate) */ + { "ups.status", 0, NULL, "Q1\r", "", 47, '(', "", 39, 39, NULL, QX_FLAG_QUICK_POLL, NULL, NULL, blazer_process_status_bits }, /* Battery Low */ + { "ups.status", 0, NULL, "Q1\r", "", 47, '(', "", 40, 40, NULL, QX_FLAG_QUICK_POLL, NULL, NULL, blazer_process_status_bits }, /* Bypass/Boost or Buck Active */ + { "ups.alarm", 0, NULL, "Q1\r", "", 47, '(', "", 41, 41, NULL, 0, NULL, NULL, blazer_process_status_bits }, /* UPS Failed */ + { "ups.type", 0, NULL, "Q1\r", "", 47, '(', "", 42, 42, "%s", QX_FLAG_STATIC, NULL, NULL, blazer_process_status_bits }, /* UPS Type */ + { "ups.status", 0, NULL, "Q1\r", "", 47, '(', "", 43, 43, NULL, QX_FLAG_QUICK_POLL, NULL, NULL, blazer_process_status_bits }, /* Test in Progress */ + { "ups.status", 0, NULL, "Q1\r", "", 47, '(', "", 44, 44, NULL, QX_FLAG_QUICK_POLL, NULL, NULL, blazer_process_status_bits }, /* Shutdown Active */ + { "ups.beeper.status", 0, NULL, "Q1\r", "", 47, '(', "", 45, 45, "%s", 0, NULL, NULL, blazer_process_status_bits }, /* Beeper status */ + + /* + * > [F\r] + * < [#230.0 004 024.0 50.0\r] + * 0123456789012345678901 + * 0 1 2 + */ + + /* Nominal parameters (ratings) */ + { "input.voltage.nominal", 0, NULL, "F\r", "", 22, '#', "", 1, 5, "%.0f", QX_FLAG_STATIC, NULL, NULL, NULL }, + { "input.current.nominal", 0, NULL, "F\r", "", 22, '#', "", 7, 9, "%.1f", QX_FLAG_STATIC, NULL, NULL, NULL }, + { "battery.voltage.nominal", 0, NULL, "F\r", "", 22, '#', "", 11, 15, "%.1f", QX_FLAG_STATIC, NULL, NULL, NULL }, + { "input.frequency.nominal", 0, NULL, "F\r", "", 22, '#', "", 17, 20, "%.0f", QX_FLAG_STATIC, NULL, NULL, NULL }, + + /* + * > [I\r] + * < [#222222222222222222222222222R1.00.48\r] + * 0123456789012345678901234567890123456 + * 0 1 2 3 + */ + + /* Firmware version */ + { "ups.firmware", 0, NULL, "I\r", "", 37, '#', "", 28, 35, "%s", QX_FLAG_STATIC, NULL, NULL, NULL }, + + /* Instant commands */ + { "beeper.toggle", 0, NULL, "Q\r", "", 0, 0, "", 0, 0, NULL, QX_FLAG_CMD, NULL, NULL, NULL }, + { "load.off", 0, NULL, "S00R0000\r", "", 0, 0, "", 0, 0, NULL, QX_FLAG_CMD, NULL, NULL, NULL }, + { "load.on", 0, NULL, "C\r", "", 0, 0, "", 0, 0, NULL, QX_FLAG_CMD, NULL, NULL, NULL }, + { "shutdown.return", 0, NULL, "S%s\r", "", 0, 0, "", 0, 0, NULL, QX_FLAG_CMD, NULL, NULL, blazer_process_command }, + { "shutdown.stayoff", 0, NULL, "S%sR0000\r", "", 0, 0, "", 0, 0, NULL, QX_FLAG_CMD, NULL, NULL, blazer_process_command }, + { "shutdown.stop", 0, NULL, "C\r", "", 0, 0, "", 0, 0, NULL, QX_FLAG_CMD, NULL, NULL, NULL }, + { "test.battery.start", 0, NULL, "T%02d\r", "", 0, 0, "", 0, 0, NULL, QX_FLAG_CMD, NULL, NULL, blazer_process_command }, + { "test.battery.start.deep", 0, NULL, "TL\r", "", 0, 0, "", 0, 0, NULL, QX_FLAG_CMD, NULL, NULL, NULL }, + { "test.battery.start.quick", 0, NULL, "T\r", "", 0, 0, "", 0, 0, NULL, QX_FLAG_CMD, NULL, NULL, NULL }, + { "test.battery.stop", 0, NULL, "CT\r", "", 0, 0, "", 0, 0, NULL, QX_FLAG_CMD, NULL, NULL, NULL }, + + /* Server-side settable vars */ + { "ups.delay.start", ST_FLAG_RW, blazer_r_ondelay, NULL, "", 0, 0, "", 0, 0, DEFAULT_ONDELAY, QX_FLAG_ABSENT | QX_FLAG_SETVAR | QX_FLAG_RANGE, NULL, NULL, blazer_process_setvar }, + { "ups.delay.shutdown", ST_FLAG_RW, blazer_r_offdelay, NULL, "", 0, 0, "", 0, 0, DEFAULT_OFFDELAY, QX_FLAG_ABSENT | QX_FLAG_SETVAR | QX_FLAG_RANGE, NULL, NULL, blazer_process_setvar }, + + /* End of structure. */ + { NULL, 0, NULL, NULL, "", 0, 0, "", 0, 0, NULL, 0, NULL, NULL, NULL } +}; + +/* Testing table */ +#ifdef TESTING +static testing_t innovatae_testing[] = { + { "Q1\r", "(215.0 195.0 230.0 014 49.0 22.7 30.0 00000000\r", -1 }, + { "Q\r", "", -1 }, + { "F\r", "#230.0 004 024.0 50.0\r", -1 }, + { "I\r", "#222222222222222222222222222R1.00.48\r", -1 }, + { "S03\r", "", -1 }, + { "C\r", "", -1 }, + { "S02R0005\r", "", -1 }, + { "S.5R0000\r", "", -1 }, + { "T04\r", "ACK", -1 }, + { "TL\r", "ACK", -1 }, + { "T\r", "ACK", -1 }, + { "CT\r", "ACK", -1 }, + { NULL } +}; +#endif /* TESTING */ + +/* Subdriver-specific initups */ +static void innovatae_initups(void) +{ + blazer_initups_light(innovatae_qx2nut); +} + +/* Subdriver interface */ +subdriver_t innovatae_subdriver = { + INNOVATAE_VERSION, + blazer_claim_light, + innovatae_qx2nut, + innovatae_initups, + NULL, + blazer_makevartable_light, + "ACK", + "NAK\r", +#ifdef TESTING + innovatae_testing, +#endif /* TESTING */ +}; diff --git a/drivers/nutdrv_qx_innovatae.h b/drivers/nutdrv_qx_innovatae.h new file mode 100644 index 0000000000..9422a44fa9 --- /dev/null +++ b/drivers/nutdrv_qx_innovatae.h @@ -0,0 +1,29 @@ +/* nutdrv_qx_innovatae.h - Subdriver for INNOVA TAE series + * + * Copyright (C) + * 2025 Viktor Drobot + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ + +#ifndef NUTDRV_QX_INNOVATAE_H +#define NUTDRV_QX_INNOVATAE_H + +#include "nutdrv_qx.h" + +extern subdriver_t innovatae_subdriver; + +#endif /* NUTDRV_QX_INNOVATAE_H */ From 55e6a47639f438f70fe6b57c6af6af3f8421795a Mon Sep 17 00:00:00 2001 From: Viktor Drobot Date: Mon, 20 Oct 2025 21:12:00 +0300 Subject: [PATCH 318/805] Forgot to add to dict Signed-off-by: Viktor Drobot --- docs/nut.dict | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/nut.dict b/docs/nut.dict index 8598d41b84..cdefc78f54 100644 --- a/docs/nut.dict +++ b/docs/nut.dict @@ -1,4 +1,4 @@ -personal_ws-1.1 en 3564 utf-8 +personal_ws-1.1 en 3565 utf-8 AAC AAS ABI @@ -2278,6 +2278,7 @@ inline inlined innotech innovart +innovatae inode inplace installable From eb9111c027052d47191e4f8e88db47125448b7b6 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Fri, 17 Oct 2025 10:49:28 +0200 Subject: [PATCH 319/805] configure.ac: refactor NUT_ARG_* help and determination of STATEPATH, PIDPATH and ALTPIDPATH [#3049] Signed-off-by: Jim Klimov --- configure.ac | 84 ++++++++++++++++++++++++---------------------------- 1 file changed, 39 insertions(+), 45 deletions(-) diff --git a/configure.ac b/configure.ac index 8b2d86012c..f591c2b9e3 100644 --- a/configure.ac +++ b/configure.ac @@ -433,7 +433,9 @@ dnl and docs/macros.txt dnl +------------------------------------------------------------------+ dnl | default values for things later on (can be overridden) | -STATEPATH="/var/state/ups" +dnl Define m4var and shellvar from that: +m4_define([m4nut_DEFAULT_STATEPATH], [/var/state/ups]) +STATEPATH="m4nut_DEFAULT_STATEPATH" dnl Historically this refers to *system location* for PID files, dnl and more specifically that for `upsmon` (running as `root`). @@ -448,7 +450,8 @@ dnl ensure that these locations would exist and be properly owned. dnl dnl See also ALTPIDPATH (defaulted to STATEPATH) setting below dnl for the unprivileged daemons (`upsd`, drivers). -PIDPATH="/var/run" +m4_define([m4nut_DEFAULT_PIDPATH], [/var/run]) +PIDPATH="m4nut_DEFAULT_PIDPATH" dnl Honour new FHS-3.0 recommendations if applied on the build dnl system (but do still prefer '/var/run' if usable); see also dnl https://en.wikipedia.org/wiki/Filesystem_Hierarchy_Standard : @@ -4526,22 +4529,19 @@ PREFIX="${prefix}" NUT_REPORT_SETTING_PATH([Default installation prefix path], PREFIX, "${prefix}", [Default installation prefix path]) +dnl Note: long ago in NUT history drivers and upsd exchanges state files +dnl Now socket files live there for similar but more efficient effect. AC_MSG_CHECKING(if requested state path) -AC_ARG_WITH(statepath, - AS_HELP_STRING([--with-statepath=PATH], [path for ups state files (${STATEPATH}, typically /var/state/ups)]), -[ - case "${withval}" in - yes|no) - AC_MSG_ERROR(invalid option --with(out)-statepath - see docs/configure.txt) - ;; - *) - STATEPATH="${withval}" - AC_MSG_RESULT([specified]) - ;; - esac -], [AC_MSG_RESULT([default])]) +NUT_ARG_WITH([statepath], [DIRPATH], [Path for UPS driver state (socket) files], [m4nut_DEFAULT_STATEPATH]) + +AS_CASE([${nut_with_statepath}], + [yes|no|""], [AC_MSG_ERROR(invalid option --with(out)-statepath - see docs/configure.txt)], + ["${STATEPATH}"|m4nut_DEFAULT_STATEPATH], [AC_MSG_RESULT([default])], + [AC_MSG_RESULT([specified])] +) +STATEPATH="${nut_with_statepath}" NUT_REPORT_SETTING_PATH([State file path], - STATEPATH, "${STATEPATH}", [Path for UPS driver state files]) + STATEPATH, "${STATEPATH}", [Path for UPS driver state (socket) files]) dnl --------------------------------------------------------------------- dnl The 'alt pid path' is used by the drivers (via main.c) and upsd, since @@ -4551,39 +4551,33 @@ dnl able to write there. dnl AC_MSG_CHECKING(if requested alt pid path) -AC_ARG_WITH(altpidpath, - AS_HELP_STRING([--with-altpidpath=PATH], [path for NUT driver/upsd .pid files not running as root ()]), -[ - case "${withval}" in - yes|no) - AC_MSG_ERROR(invalid option --with(out)-altpidpath - see docs/configure.txt) - ;; - *) - ALTPIDPATH="${withval}" - AC_MSG_RESULT([specified]) - ;; - esac -], [ - ALTPIDPATH="${STATEPATH}" - AC_MSG_RESULT([default]) -]) +NUT_ARG_WITH_EXPAND_DEFAULT_HELP_SINGLEQUOTE([altpidpath], [DIRPATH], [path for NUT driver/upsd .pid files not running as root], [\${STATEPATH}]) + +AS_CASE([${nut_with_altpidpath}], + [yes|no|""], [AC_MSG_ERROR(invalid option --with(out)-altpidpath - see docs/configure.txt)], + [${STATEPATH}|\${STATEPATH}], [AC_MSG_RESULT([default])], + [AC_MSG_RESULT([specified])] +) +conftemp="${nut_with_altpidpath}" +eval conftemp=\"${conftemp}\" +eval conftemp=\"${conftemp}\" +ALTPIDPATH="${conftemp}" NUT_REPORT_SETTING_PATH([Unprivileged PID file path], ALTPIDPATH, "${ALTPIDPATH}", [Path for pid files of processes not running as root, such as drivers and upsd (usually STATEPATH)]) +dnl --------------------------------------------------------------------- +dnl Recommended: a sub-directory of (/var)/run as long as we can create +dnl and chown+chmod it before starting NUT daemons. + AC_MSG_CHECKING(if requested pidpath) -AC_ARG_WITH(pidpath, - AS_HELP_STRING([--with-pidpath=PATH], [Path for root-owned .pid files (${PIDPATH}, typically /var/run)]), -[ - case "${withval}" in - yes|no) - AC_MSG_ERROR(invalid option --with(out)-pidpath - see docs/configure.txt) - ;; - *) - PIDPATH="${withval}" - AC_MSG_RESULT([specified]) - ;; - esac -], [AC_MSG_RESULT([default])]) +NUT_ARG_WITH_CUSTOM_DEFAULT_HELP([pidpath], [DIRPATH], [Path for root-owned .pid files], [auto], [platform-dependent, usually m4nut_DEFAULT_PIDPATH]) + +AS_CASE([${nut_with_pidpath}], + [yes|no|""], [AC_MSG_ERROR(invalid option --with(out)-pidpath - see docs/configure.txt)], + [auto], [AC_MSG_RESULT([default])], dnl Keep what we chose above in the script (/var/run or /run) + [AC_MSG_RESULT([specified]) + PIDPATH="${nut_with_pidpath}"] +) NUT_REPORT_SETTING_PATH([Privileged PID file path], PIDPATH, "${PIDPATH}", [Path for pid files of processes running as root, such as upsmon]) From fbd20766c85c0bb1a65233f61f600e4ee58324ce Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Fri, 17 Oct 2025 15:16:38 +0200 Subject: [PATCH 320/805] configure.ac: refactor NUT_ARG_* help and determination of POWERDOWNFLAG [#3049] Signed-off-by: Jim Klimov --- configure.ac | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/configure.ac b/configure.ac index f591c2b9e3..c6c942f399 100644 --- a/configure.ac +++ b/configure.ac @@ -4591,20 +4591,20 @@ dnl Ideally the filesystems with `upsmon` program and libraries it needs dnl also remain mounted, so `upsmon -K` may be queried late in shutdown - dnl and we can avoid hardcoding such paths into those shutdown hooks. dnl Note that upsmon removes this file early in any daemonized start-up. +dnl Keep in mind that upsmon requires the value to be actually defined +dnl in its own config file, if we want to use late end-game UPS poweroff. +dnl Otherwise that code path is skipped. AC_MSG_CHECKING(if requested default upsmon POWERDOWNFLAG path) -AC_ARG_WITH(powerdownflag, - AS_HELP_STRING([--with-powerdownflag=PATH], [default path for upsmon POWERDOWNFLAG file (${POWERDOWNFLAG}, typically /etc/killpower)]), -[ - case "${withval}" in - yes|no) - AC_MSG_ERROR(invalid option --with(out)-powerdownflag - see docs/configure.txt) - ;; - *) - POWERDOWNFLAG="${withval}" - AC_MSG_RESULT([specified]) - ;; - esac -], [AC_MSG_RESULT([default])]) +NUT_ARG_WITH_CUSTOM_DEFAULT_HELP([powerdownflag], [FILEPATH], [Default path for upsmon POWERDOWNFLAG file, often '/etc/killpower' but recommended to be under some tmpfs], + [auto], [platform-dependent: /etc/killpower on POSIX systems, C:\killpower on Windows]) + +AS_CASE([${nut_with_powerdownflag}], + [yes|no|""], [AC_MSG_ERROR(invalid option --with(out)-powerdownflag - see docs/configure.txt)], + [auto], [AC_MSG_RESULT([default])], + [POWERDOWNFLAG="${nut_with_powerdownflag}" + AC_MSG_RESULT([specified])] +) + dnl # This should be internal detail for "upsmon -K" implementation, dnl # so not necessarily reported (reduce noise): dnl NUT_REPORT_SETTING_PATH([Default upsmon POWERDOWNFLAG path], From d1deb0fd18516b5d763f91346ea31edd1037214f Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Fri, 17 Oct 2025 15:57:56 +0200 Subject: [PATCH 321/805] configure.ac: refactor NUT_ARG_* help and determination of DRVPATH [#3049] Signed-off-by: Jim Klimov --- configure.ac | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/configure.ac b/configure.ac index c6c942f399..232b2edd09 100644 --- a/configure.ac +++ b/configure.ac @@ -507,9 +507,11 @@ AS_CASE([${target_os}], [POWERDOWNFLAG="/etc/killpower"] dnl POSIX systems default ) + cgiexecdir='${exec_prefix}/cgi-bin' -driverexecdir='${exec_prefix}/bin' -dnl Note: htmldir per se is originally for nut-cgi resources +m4_define([m4nut_DEFAULT_DRVPATH], [\${exec_prefix}/bin]) +dnl Note: htmldir per se is originally for nut-cgi resources, +dnl so htmldocdir and htmlmandir are separate htmldir='${prefix}/html' htmldocdir='${docdir}/html-doc' htmlmandir='${docdir}/html-man' @@ -4612,19 +4614,17 @@ dnl POWERDOWNFLAG, "${POWERDOWNFLAG}", [Default path for upsmon POWERDOWNFLAG dnl --------------------------------------------------------------------- AC_MSG_CHECKING(if requested driver path) -AC_ARG_WITH(drvpath, - AS_HELP_STRING([--with-drvpath=PATH], [where to install UPS drivers (legacy default: EPREFIX/bin; recommended: a subdir of libexecdir)]), -[ - case "${withval}" in - yes|no) - AC_MSG_ERROR(invalid option --with(out)-drvpath - see docs/configure.txt) - ;; - *) - driverexecdir="${withval}" - AC_MSG_RESULT([specified]) - ;; - esac -], [AC_MSG_RESULT([default])]) +NUT_ARG_WITH_EXPAND_DEFAULT_HELP_SINGLEQUOTE([drvpath], [DIRPATH], [Where to install UPS driver programs, often EPREFIX/bin, but recommended to be a subdir of '${libexecdir}'], [m4nut_DEFAULT_DRVPATH]) + +AS_CASE([${nut_with_drvpath}], + [yes|no|""], [AC_MSG_ERROR(invalid option --with(out)-drvpath - see docs/configure.txt)], + [m4nut_DEFAULT_DRVPATH], [AC_MSG_RESULT([default])], + [AC_MSG_RESULT([specified])] +) +dnl Raw value for Makefile automated install rules +driverexecdir="${nut_with_drvpath}" + +dnl Resolved value conftemp="${driverexecdir}" eval conftemp=\"${conftemp}\" eval conftemp=\"${conftemp}\" From 7640672d82df0c15f5a96cb0c4b4119256b26b9c Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Sun, 19 Oct 2025 13:05:05 +0200 Subject: [PATCH 322/805] configure.ac: refactor NUT_ARG_* help and determination of CGIPATH [#3049] Signed-off-by: Jim Klimov --- configure.ac | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/configure.ac b/configure.ac index 232b2edd09..9b75ceb35e 100644 --- a/configure.ac +++ b/configure.ac @@ -508,7 +508,7 @@ AS_CASE([${target_os}], ) -cgiexecdir='${exec_prefix}/cgi-bin' +m4_define([m4nut_DEFAULT_CGIPATH], [\${exec_prefix}/cgi-bin]) m4_define([m4nut_DEFAULT_DRVPATH], [\${exec_prefix}/bin]) dnl Note: htmldir per se is originally for nut-cgi resources, dnl so htmldocdir and htmlmandir are separate @@ -4632,20 +4632,19 @@ DRVPATH="${conftemp}" NUT_REPORT_SETTING_PATH([Driver program path], DRVPATH, "${conftemp}", [Default path for UPS drivers]) +dnl --------------------------------------------------------------------- AC_MSG_CHECKING(if requested cgi path) -AC_ARG_WITH(cgipath, - AS_HELP_STRING([--with-cgipath=PATH], [where to install CGI programs (EPREFIX/cgi-bin)]), -[ - case "${withval}" in - yes|no) - AC_MSG_ERROR(invalid option --with(out)-cgipath - see docs/configure.txt) - ;; - *) - cgiexecdir="${withval}" - AC_MSG_RESULT([specified]) - ;; - esac -], [AC_MSG_RESULT([default])]) +NUT_ARG_WITH_EXPAND_DEFAULT_HELP_SINGLEQUOTE([cgipath], [DIRPATH], [Where to install CGI programs, distros may want it in a location dictated by web server software], [m4nut_DEFAULT_CGIPATH]) + +AS_CASE([${nut_with_cgipath}], + [yes|no|""], [AC_MSG_ERROR(invalid option --with(out)-cgipath - see docs/configure.txt)], + [m4nut_DEFAULT_CGIPATH], [AC_MSG_RESULT([default])], + [AC_MSG_RESULT([specified])] +) +dnl Raw value for Makefile automated install rules +cgiexecdir="${nut_with_cgipath}" + +dnl Resolved value conftemp="${cgiexecdir}" eval conftemp=\"${conftemp}\" eval conftemp=\"${conftemp}\" From 593367ae1933715c7eeea99d4a836f445e38d987 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Sun, 19 Oct 2025 13:16:14 +0200 Subject: [PATCH 323/805] configure.ac: add separators between unrelated subjects, revise comments Signed-off-by: Jim Klimov --- configure.ac | 39 +++++++++++++++++++++++++++++++++++---- 1 file changed, 35 insertions(+), 4 deletions(-) diff --git a/configure.ac b/configure.ac index 9b75ceb35e..0df36eb215 100644 --- a/configure.ac +++ b/configure.ac @@ -305,6 +305,7 @@ NUT_ARG_WITH([confdir-suffix], [SHORT_DIRNAME], [Relative path to NUT configurat NUT_ARG_WITH_EXPAND_DEFAULT_HELP_SINGLEQUOTE([confdir], [DIRPATH], [Complete path to NUT configuration files], [\${sysconfdir}\${confdir_suffix}]) NUT_ARG_WITH_EXPAND_DEFAULT_HELP_SINGLEQUOTE([confdir-examples], [DIRPATH], [Complete path to NUT configuration file examples (some like it under datadir)], [\${confdir}]) +dnl --------------------------------------------------------------------- dnl GNU and BSD make are okay with the syntax, but Sun make/dmake are not: AC_MSG_CHECKING([whether this make implementation supports export VAR=VAL syntax]) dnl # using printf formatting for some funniner shells out there @@ -322,6 +323,7 @@ AC_SUBST(NUT_AM_MAKE_CAN_EXPORT) dnl Some systems have older autotools without direct macro support for PKG_CONF* NUT_CHECK_PKGCONFIG +dnl --------------------------------------------------------------------- dnl Nowadays both `tail -n +3` and `tail +3` work almost everywhere dnl * CentOS7 tail can not do `tail +3` -- no such file dnl * Classic Solaris tooling (even in Solaris 11) can not do `tail -n` -- no such option @@ -375,6 +377,7 @@ NUT_NETVERSION="1.3" AC_DEFINE_UNQUOTED(NUT_NETVERSION, "${NUT_NETVERSION}", [NUT network protocol version]) +dnl --------------------------------------------------------------------- dnl Fix this early so we can expand with eval later test "${prefix}" = "NONE" && prefix="${ac_default_prefix}" test "${exec_prefix}" = "NONE" && exec_prefix='${prefix}' @@ -583,6 +586,7 @@ case "${target_os}" in ;; esac +dnl --------------------------------------------------------------------- dnl Note: this deals with run-time settings so that the newly built dnl programs can be "just executed" to use same configuration files dnl and filesystem object permissions as an older deployment of NUT @@ -1125,6 +1129,7 @@ AS_IF([test x"$nut_enable_inplace_runtime" = xyes -a x"${NUT_VERSION_DEPLOYED-}" ]) ]) +dnl --------------------------------------------------------------------- dnl Define directory where LIBOBJS replacement functions are AC_CONFIG_LIBOBJ_DIR([common]) @@ -4526,11 +4531,13 @@ AS_IF([test "x$nut_cv_header_windows_h" = xyes], dnl ---------------------------------------------------------------------- +dnl Bits and pieces of NUT build artefacts' installation locations PREFIX="${prefix}" NUT_REPORT_SETTING_PATH([Default installation prefix path], PREFIX, "${prefix}", [Default installation prefix path]) +dnl --------------------------------------------------------------------- dnl Note: long ago in NUT history drivers and upsd exchanges state files dnl Now socket files live there for similar but more efficient effect. AC_MSG_CHECKING(if requested state path) @@ -4633,7 +4640,7 @@ NUT_REPORT_SETTING_PATH([Driver program path], DRVPATH, "${conftemp}", [Default path for UPS drivers]) dnl --------------------------------------------------------------------- -AC_MSG_CHECKING(if requested cgi path) +AC_MSG_CHECKING(if requested CGI program path) NUT_ARG_WITH_EXPAND_DEFAULT_HELP_SINGLEQUOTE([cgipath], [DIRPATH], [Where to install CGI programs, distros may want it in a location dictated by web server software], [m4nut_DEFAULT_CGIPATH]) AS_CASE([${nut_with_cgipath}], @@ -4652,9 +4659,10 @@ CGIPATH="${conftemp}" NUT_REPORT_SETTING_PATH([CGI program path], CGIPATH, "${conftemp}", [Default path for CGI programs]) -AC_MSG_CHECKING(if requested html path) +dnl --------------------------------------------------------------------- +AC_MSG_CHECKING(if requested CGI HTML resource path) AC_ARG_WITH(htmlpath, - AS_HELP_STRING([--with-htmlpath=PATH], [where to install HTML files (PREFIX/html)]), + AS_HELP_STRING([--with-htmlpath=PATH], [where to install CGI HTML resource files (PREFIX/html)]), [ case "${withval}" in yes|no) @@ -4673,6 +4681,8 @@ HTMLPATH="${conftemp}" NUT_REPORT_SETTING_PATH([HTML file path], HTMLPATH, "${conftemp}", [Default path for HTML files (CGI templates)]) +dnl --------------------------------------------------------------------- +dnl Other NUT build/install customization options AC_MSG_CHECKING(network port number) AC_ARG_WITH(port, AS_HELP_STRING([--with-port=PORT], [port for network communications (3493)]), @@ -4691,6 +4701,7 @@ AC_ARG_WITH(port, AC_DEFINE_UNQUOTED(PORT, ${PORT}, [Port for network communications]) AC_MSG_RESULT(${PORT}) +dnl --------------------------------------------------------------------- AC_MSG_CHECKING(facility for syslog) AC_ARG_WITH(logfacility, AS_HELP_STRING([--with-logfacility=FACILITY], [facility for log messages (LOG_DAEMON)]), @@ -4709,6 +4720,7 @@ AC_ARG_WITH(logfacility, AC_DEFINE_UNQUOTED(LOG_FACILITY, ${LOGFACILITY}, [Desired syslog facility - see syslog(3)]) AC_MSG_RESULT(${LOGFACILITY}) +dnl --------------------------------------------------------------------- AC_MSG_CHECKING(which driver man pages to install) DRIVER_MAN_LIST_PAGES="" if test "${WITH_MANS}" = "yes"; then @@ -4731,6 +4743,7 @@ else AC_MSG_RESULT([none (manpages disabled)]) fi +dnl --------------------------------------------------------------------- dnl By default as we iterate (and git commit) the codebase during development, dnl prerequisites for that header file change and cause much of the C code dnl to be rebuilt and re-linked. For developers fixing one small part of the @@ -4758,6 +4771,7 @@ AC_ARG_ENABLE(force-nut-version-header, ]) +dnl --------------------------------------------------------------------- AC_MSG_CHECKING(whether to strip debug symbols) AC_ARG_ENABLE(strip, AS_HELP_STRING([--enable-strip], [Strip debugging symbols from binaries (no)]), @@ -4775,6 +4789,7 @@ AC_ARG_ENABLE(strip, AC_MSG_RESULT(no) ]) +dnl --------------------------------------------------------------------- AC_MSG_CHECKING(whether to install pkg-config *.pc files) AC_ARG_WITH(pkgconfig-dir, AS_HELP_STRING([--with-pkgconfig-dir=PATH], [where to install pkg-config *.pc files (EPREFIX/lib/pkgconfig)]), @@ -4809,6 +4824,7 @@ else fi AM_CONDITIONAL(WITH_PKG_CONFIG, test -n "${pkgconfigdir}") +dnl --------------------------------------------------------------------- dnl Only check the option here (and show in help near pkg-config) dnl See LDFLAGS_NUT_RPATH determination further below NUT_ARG_ENABLE([ldflags-nut-rpath], @@ -4819,6 +4835,7 @@ NUT_ARG_ENABLE([ldflags-nut-rpath-cxx], [Suggest linker flags for NUT C++ library consumers to set RPATH for uncommon location], [auto]) +dnl --------------------------------------------------------------------- dnl Options for Solaris/illumos `make install` and `make package` AC_MSG_CHECKING(whether to make Solaris SVR4 packages) solarispkg_svr4="auto" @@ -4953,6 +4970,7 @@ AC_MSG_RESULT([${solarisinit}]) AM_CONDITIONAL(WITH_SOLARIS_INIT, test x"$solarisinit" = x"yes") +dnl --------------------------------------------------------------------- dnl Note: Currently there is no reliable automatic detection - dnl users have to ask they want systemd units installed, or dnl risk auto-detection like seen below. @@ -5262,7 +5280,7 @@ AS_IF([test x"${with_libsystemd}" = xyes && test x"${nut_have_libsystemd_inhibit AC_DEFINE_UNQUOTED(WITH_LIBSYSTEMD_INHIBITOR, [${nut_with_libsystemd_inhibitor}], [Define as 1 if we can use systemd inhibitor interface here]) AM_CONDITIONAL([WITH_LIBSYSTEMD_INHIBITOR], [test x"${nut_with_libsystemd_inhibitor}" = x1]) -dnl +dnl --------------------------------------------------------------------- dnl Tests for CppUnit availability and usability (will be built if we can, dnl and if valgrind is enabled for this configuration - reported below). dnl Using CppUnit implies C++ support! @@ -5325,6 +5343,7 @@ AC_LANG_POP([C++]) unset CPLUSPLUS_MAIN unset CPLUSPLUS_DECL +dnl --------------------------------------------------------------------- AC_MSG_CHECKING(for have_cppunit) have_cppunit="no" dnl CPPUNIT_NUT_CXXFLAGS are set below if suitable, but can be @@ -5429,6 +5448,7 @@ NUT_REPORT_FEATURE([build C++ tests with CPPUNIT], [${have_cppunit}], [], [HAVE_CPPUNIT], [Define to enable CPPUNIT tests]) dnl ---------------------------------------------------------------------- +dnl Practical C++ code: AC_MSG_CHECKING(whether we can and want to build nutconf configuration-management tool) @@ -5478,6 +5498,7 @@ dnl automake rules to build the library (privately or publicly, that depends): AM_CONDITIONAL(WITH_LIBNUTCONF, [test x"${nut_with_dev_libnutconf}" = x"yes" -o x"${nut_with_nutconf}" = x"yes"]) dnl ---------------------------------------------------------------------- +dnl Other third-party integrations AC_MSG_CHECKING(whether to install Augeas configuration-management lenses) AC_ARG_WITH(augeas-lenses-dir, @@ -5700,6 +5721,7 @@ AM_CONDITIONAL([SYSTEM_AIX], [test "xAIX" = "x`uname -s 2>/dev/null`"]) dnl processor type AC_DEFINE_UNQUOTED(CPU_TYPE, ["$target_cpu"], [Define processor type]) +dnl --------------------------------------------------------------------- dnl Can use valgrind for memory-leak testing, if present dnl FIXME: Set to "auto" after ensuring that we pass on all NUT CI farm platforms with_valgrind="no" @@ -6253,6 +6275,7 @@ dnl that explicitly specify a CFLAGS="-std=..." (for GCC/CLANG toolkits), dnl nothing should get added to CFLAGS/CXXFLAGS by this method: NUT_COMPILER_FAMILY_FLAGS_DEFAULT_STANDARD +dnl --------------------------------------------------------------------- dnl Filter through known variants first, so automatic choices can be made. dnl Note that clang identifies as gcc-compatible so should be probed first. dnl TODO: Flip this default to "hard" when we clear existing codebase. @@ -6454,6 +6477,7 @@ Forcing "-Wno-format" into warnings options. ]) ]) +dnl --------------------------------------------------------------------- AC_MSG_CHECKING([whether to make warnings fatal]) AS_CASE(["${nut_enable_Werror}"], [yes|auto], [ @@ -6467,6 +6491,7 @@ AS_CASE(["${nut_enable_Werror}"], ) AC_MSG_RESULT([${nut_enable_Werror}]) +dnl --------------------------------------------------------------------- dnl Some compilers (e.g. older clang-3.4) have issues with built-in methods dnl that are implemented as macros in system headers -- but only for some dnl sources like snmp-ups.c, nutscan-serial.c, scan_eaton_serial.c, serial.c, @@ -6585,6 +6610,7 @@ sin.s_addr = htonl((ntohl(sin.s_addr) + 1)) dnl Finally restore warnings settings that the caller might have provided in CFLAGS etc NUT_POP_WARNINGS +dnl --------------------------------------------------------------------- dnl Due to possibly repetitive content, generate unique settings dnl relative to the top_builddir (distcheck and all): AC_MSG_CHECKING([for top build dir for this configure run]) @@ -6631,6 +6657,7 @@ dnl Use these at best for tests (e.g. nutconf), not production code: AC_DEFINE_UNQUOTED([ABS_TOP_SRCDIR], ["${ABS_TOP_SRCDIR}"], [NUT source directory when the build was configured]) AC_DEFINE_UNQUOTED([ABS_TOP_BUILDDIR], ["${ABS_TOP_BUILDDIR}"], [NUT build directory when the build was configured]) +dnl --------------------------------------------------------------------- AC_MSG_CHECKING([whether to install External API integration script: Enphase Monitor]) nut_with_extapi_enphase="no" AC_ARG_ENABLE([extapi-enphase], @@ -6664,6 +6691,7 @@ fi AC_MSG_RESULT([${nut_enable_extapi_enphase}]) AM_CONDITIONAL(ENABLE_EXTAPI_ENPHASE, test x"$nut_enable_extapi_enphase" = x"yes") +dnl --------------------------------------------------------------------- AC_MSG_CHECKING([whether to customize ${TOP_BUILDDIR}/scripts/systemd/nut-common-tmpfiles.conf.in for this system]) dnl TOTHINK: Some distributions make the directories below owned dnl by "root:${RUN_AS_GROUP}" with 77x permissions. Is it safer?.. @@ -6786,6 +6814,7 @@ AC_SUBST(NUT_AM_EXPORT_CCACHE_PATH) PATH_DURING_CONFIGURE="$PATH" AC_SUBST(PATH_DURING_CONFIGURE) +dnl --------------------------------------------------------------------- dnl Some binaries, like CPPUNIT tests, have similar flags already added dnl We might wipe their specific options below if consistently applying dnl debug-friendly options to everything @@ -6994,6 +7023,7 @@ m4_foreach_w([SCRIPTFILE], [ AC_CONFIG_FILES(SCRIPTFILE, chmod +x "SCRIPTFILE") ]) +dnl --------------------------------------------------------------------- AC_MSG_NOTICE([Generating templated script files whose templates might have been generated (or not) by autogen.sh calling our helper scripts]) m4_foreach_w([SCRIPTFILE], [ scripts/augeas/nutupsconf.aug @@ -7008,6 +7038,7 @@ m4_foreach_w([SCRIPTFILE], [ ) ]) +dnl --------------------------------------------------------------------- dnl Define this before AC_OUTPUT(), so not inside the report routine below: AM_CONDITIONAL(KEEP_NUT_REPORT, test x"${nut_enable_keep_nut_report_feature-}" = xyes) From de1999273b71025d1c2a38ac545d6f8370580ce2 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Sun, 19 Oct 2025 13:19:45 +0200 Subject: [PATCH 324/805] data/html/Makefile.am: ensure that HTML files for CGI are in dist tarball Signed-off-by: Jim Klimov --- data/html/Makefile.am | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/data/html/Makefile.am b/data/html/Makefile.am index 1327c724b9..bff6548341 100644 --- a/data/html/Makefile.am +++ b/data/html/Makefile.am @@ -1,11 +1,14 @@ # Network UPS Tools: data/html +EXTRA_DIST = README.adoc + # install these only if configured --with-cgi if WITH_CGI dist_html_DATA = index.html bottom.html nut-banner.png nodist_html_DATA = header.html +else + EXTRA_DIST += index.html bottom.html nut-banner.png header.html.in endif -EXTRA_DIST = README.adoc SPELLCHECK_SRC = README.adoc From b660249804d9807250790e6e24869f216f98a5b3 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Sun, 19 Oct 2025 13:44:51 +0200 Subject: [PATCH 325/805] configure.ac, *.am: rename "htmldir" to "htmlcgidir", "data/html" to "data/htmlcgi", CGIPATH to CGIEXECPATH, and tentatively HTMLPATH to CGIDATAPATH (and actually expose the latter two from configure script) [#3049] Signed-off-by: Jim Klimov --- Makefile.am | 2 +- configure.ac | 31 ++++++++++++++------------ data/Makefile.am | 2 +- data/{html => htmlcgi}/.gitignore | 0 data/{html => htmlcgi}/Makefile.am | 6 ++--- data/{html => htmlcgi}/README.adoc | 0 data/{html => htmlcgi}/bottom.html | 0 data/{html => htmlcgi}/header.html.in | 0 data/{html => htmlcgi}/index.html | 0 data/{html => htmlcgi}/nut-banner.png | Bin docs/configure.txt | 4 ++-- docs/nut.dict | 3 ++- 12 files changed, 26 insertions(+), 22 deletions(-) rename data/{html => htmlcgi}/.gitignore (100%) rename data/{html => htmlcgi}/Makefile.am (94%) rename data/{html => htmlcgi}/README.adoc (100%) rename data/{html => htmlcgi}/bottom.html (100%) rename data/{html => htmlcgi}/header.html.in (100%) rename data/{html => htmlcgi}/index.html (100%) rename data/{html => htmlcgi}/nut-banner.png (100%) diff --git a/Makefile.am b/Makefile.am index 81644bc5c7..0646b54128 100644 --- a/Makefile.am +++ b/Makefile.am @@ -642,7 +642,7 @@ SPELLCHECK_DIRS_MOST = \ spellcheck/docs/man \ spellcheck/conf \ spellcheck/data \ - spellcheck/data/html \ + spellcheck/data/htmlcgi \ spellcheck/scripts \ spellcheck/scripts/Solaris \ spellcheck/scripts/Windows \ diff --git a/configure.ac b/configure.ac index 0df36eb215..3bebf1181e 100644 --- a/configure.ac +++ b/configure.ac @@ -511,11 +511,11 @@ AS_CASE([${target_os}], ) -m4_define([m4nut_DEFAULT_CGIPATH], [\${exec_prefix}/cgi-bin]) +m4_define([m4nut_DEFAULT_CGIEXECPATH], [\${exec_prefix}/cgi-bin]) m4_define([m4nut_DEFAULT_DRVPATH], [\${exec_prefix}/bin]) -dnl Note: htmldir per se is originally for nut-cgi resources, +dnl Note: htmlcgidir per se is originally for nut-cgi resources, dnl so htmldocdir and htmlmandir are separate -htmldir='${prefix}/html' +htmlcgidir='${prefix}/html' htmldocdir='${docdir}/html-doc' htmlmandir='${docdir}/html-man' pkgconfigdir='${libdir}/pkgconfig' @@ -4641,11 +4641,11 @@ NUT_REPORT_SETTING_PATH([Driver program path], dnl --------------------------------------------------------------------- AC_MSG_CHECKING(if requested CGI program path) -NUT_ARG_WITH_EXPAND_DEFAULT_HELP_SINGLEQUOTE([cgipath], [DIRPATH], [Where to install CGI programs, distros may want it in a location dictated by web server software], [m4nut_DEFAULT_CGIPATH]) +NUT_ARG_WITH_EXPAND_DEFAULT_HELP_SINGLEQUOTE([cgipath], [DIRPATH], [Where to install CGI programs, distros may want it in a location dictated by web server software], [m4nut_DEFAULT_CGIEXECPATH]) AS_CASE([${nut_with_cgipath}], [yes|no|""], [AC_MSG_ERROR(invalid option --with(out)-cgipath - see docs/configure.txt)], - [m4nut_DEFAULT_CGIPATH], [AC_MSG_RESULT([default])], + [m4nut_DEFAULT_CGIEXECPATH], [AC_MSG_RESULT([default])], [AC_MSG_RESULT([specified])] ) dnl Raw value for Makefile automated install rules @@ -4655,11 +4655,12 @@ dnl Resolved value conftemp="${cgiexecdir}" eval conftemp=\"${conftemp}\" eval conftemp=\"${conftemp}\" -CGIPATH="${conftemp}" +CGIEXECPATH="${conftemp}" NUT_REPORT_SETTING_PATH([CGI program path], - CGIPATH, "${conftemp}", [Default path for CGI programs]) + CGIEXECPATH, "${conftemp}", [Default path for CGI programs]) dnl --------------------------------------------------------------------- +dnl FIXME: Make it an alias for a new --with-htmlcgipath AC_MSG_CHECKING(if requested CGI HTML resource path) AC_ARG_WITH(htmlpath, AS_HELP_STRING([--with-htmlpath=PATH], [where to install CGI HTML resource files (PREFIX/html)]), @@ -4669,17 +4670,17 @@ AC_ARG_WITH(htmlpath, AC_MSG_ERROR(invalid option --with(out)-htmlpath - see docs/configure.txt) ;; *) - htmldir="${withval}" + htmlcgidir="${withval}" AC_MSG_RESULT([specified]) ;; esac ], [AC_MSG_RESULT([default])]) -conftemp="${htmldir}" +conftemp="${htmlcgidir}" eval conftemp=\"${conftemp}\" eval conftemp=\"${conftemp}\" -HTMLPATH="${conftemp}" +CGIDATAPATH="${conftemp}" NUT_REPORT_SETTING_PATH([HTML file path], - HTMLPATH, "${conftemp}", [Default path for HTML files (CGI templates)]) + CGIDATAPATH, "${conftemp}", [Default path for HTML files (CGI templates)]) dnl --------------------------------------------------------------------- dnl Other NUT build/install customization options @@ -6249,11 +6250,13 @@ AC_SUBST(RUN_AS_USER) AC_SUBST(RUN_AS_GROUP) AC_SUBST(SUN_LIBUSB) AC_SUBST(WORDS_BIGENDIAN) +AC_SUBST(CGIEXECPATH) AC_SUBST(cgiexecdir) AC_SUBST(devddir) AC_SUBST(driverexecdir) AC_SUBST(freebsdquirksdir) -AC_SUBST(htmldir) +AC_SUBST(CGIDATAPATH) +AC_SUBST(htmlcgidir) AC_SUBST(htmldocdir) AC_SUBST(htmlmandir) AC_SUBST(pkgconfigdir) @@ -6899,8 +6902,8 @@ AC_CONFIG_FILES([ conf/Makefile conf/upsmon.conf.sample conf/upssched.conf.sample - data/html/header.html - data/html/Makefile + data/htmlcgi/header.html + data/htmlcgi/Makefile data/Makefile data/driver.list docs/asciidoc.conf diff --git a/data/Makefile.am b/data/Makefile.am index 25cea62466..b4e82af77e 100644 --- a/data/Makefile.am +++ b/data/Makefile.am @@ -1,6 +1,6 @@ # Network UPS Tools: data -SUBDIRS = html +SUBDIRS = htmlcgi dist_data_DATA = cmdvartab nodist_data_DATA = driver.list diff --git a/data/html/.gitignore b/data/htmlcgi/.gitignore similarity index 100% rename from data/html/.gitignore rename to data/htmlcgi/.gitignore diff --git a/data/html/Makefile.am b/data/htmlcgi/Makefile.am similarity index 94% rename from data/html/Makefile.am rename to data/htmlcgi/Makefile.am index bff6548341..a34d8cac20 100644 --- a/data/html/Makefile.am +++ b/data/htmlcgi/Makefile.am @@ -1,11 +1,11 @@ -# Network UPS Tools: data/html +# Network UPS Tools: data/htmlcgi EXTRA_DIST = README.adoc # install these only if configured --with-cgi if WITH_CGI - dist_html_DATA = index.html bottom.html nut-banner.png - nodist_html_DATA = header.html + dist_htmlcgi_DATA = index.html bottom.html nut-banner.png + nodist_htmlcgi_DATA = header.html else EXTRA_DIST += index.html bottom.html nut-banner.png header.html.in endif diff --git a/data/html/README.adoc b/data/htmlcgi/README.adoc similarity index 100% rename from data/html/README.adoc rename to data/htmlcgi/README.adoc diff --git a/data/html/bottom.html b/data/htmlcgi/bottom.html similarity index 100% rename from data/html/bottom.html rename to data/htmlcgi/bottom.html diff --git a/data/html/header.html.in b/data/htmlcgi/header.html.in similarity index 100% rename from data/html/header.html.in rename to data/htmlcgi/header.html.in diff --git a/data/html/index.html b/data/htmlcgi/index.html similarity index 100% rename from data/html/index.html rename to data/htmlcgi/index.html diff --git a/data/html/nut-banner.png b/data/htmlcgi/nut-banner.png similarity index 100% rename from data/html/nut-banner.png rename to data/htmlcgi/nut-banner.png diff --git a/docs/configure.txt b/docs/configure.txt index 6586bf509b..005c28ca23 100644 --- a/docs/configure.txt +++ b/docs/configure.txt @@ -276,8 +276,8 @@ CGI client interface Build and install the optional CGI programs, HTML files, and sample CGI configuration files. This is not enabled by default, as they -are only useful on web servers. See link:data/html/README[] for additional -information on how to set up CGI programs. +are only useful on web servers. See link:data/htmlcgi/README[] for +additional information on how to set up CGI programs. NUT Scanner tool ~~~~~~~~~~~~~~~~ diff --git a/docs/nut.dict b/docs/nut.dict index 8598d41b84..36187ed8c1 100644 --- a/docs/nut.dict +++ b/docs/nut.dict @@ -1,4 +1,4 @@ -personal_ws-1.1 en 3564 utf-8 +personal_ws-1.1 en 3565 utf-8 AAC AAS ABI @@ -2211,6 +2211,7 @@ href htaccess htm html +htmlcgi htmlpath http httpd From 917571f419e21a22f949d89b5802c007d764cbb3 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Mon, 20 Oct 2025 14:06:19 +0200 Subject: [PATCH 326/805] configure.ac: refactor NUT_ARG_* help and determination of CGIDATAPATH [#3049] Signed-off-by: Jim Klimov --- configure.ac | 28 +++++++++++++--------------- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/configure.ac b/configure.ac index 3bebf1181e..14b4d36a0f 100644 --- a/configure.ac +++ b/configure.ac @@ -512,10 +512,10 @@ AS_CASE([${target_os}], m4_define([m4nut_DEFAULT_CGIEXECPATH], [\${exec_prefix}/cgi-bin]) +m4_define([m4nut_DEFAULT_CGIDATAPATH], [\${prefix}/html]) m4_define([m4nut_DEFAULT_DRVPATH], [\${exec_prefix}/bin]) -dnl Note: htmlcgidir per se is originally for nut-cgi resources, +dnl Note: CGIDATAPATH (nee htmlcgidir) is for nut-cgi resources, dnl so htmldocdir and htmlmandir are separate -htmlcgidir='${prefix}/html' htmldocdir='${docdir}/html-doc' htmlmandir='${docdir}/html-man' pkgconfigdir='${libdir}/pkgconfig' @@ -4662,19 +4662,17 @@ NUT_REPORT_SETTING_PATH([CGI program path], dnl --------------------------------------------------------------------- dnl FIXME: Make it an alias for a new --with-htmlcgipath AC_MSG_CHECKING(if requested CGI HTML resource path) -AC_ARG_WITH(htmlpath, - AS_HELP_STRING([--with-htmlpath=PATH], [where to install CGI HTML resource files (PREFIX/html)]), -[ - case "${withval}" in - yes|no) - AC_MSG_ERROR(invalid option --with(out)-htmlpath - see docs/configure.txt) - ;; - *) - htmlcgidir="${withval}" - AC_MSG_RESULT([specified]) - ;; - esac -], [AC_MSG_RESULT([default])]) +NUT_ARG_WITH_EXPAND_DEFAULT_HELP_SINGLEQUOTE([htmlpath], [DIRPATH], [Where to install CGI HTML resource files, distros may want it in a location dictated by web server software], [m4nut_DEFAULT_CGIDATAPATH]) + +AS_CASE([${nut_with_htmlpath}], + [yes|no|""], [AC_MSG_ERROR(invalid option --with(out)-htmlpath - see docs/configure.txt)], + [m4nut_DEFAULT_CGIDATAPATH], [AC_MSG_RESULT([default])], + [AC_MSG_RESULT([specified])] +) +dnl Raw value for Makefile automated install rules +htmlcgidir="${nut_with_htmlpath}" + +dnl Resolved value conftemp="${htmlcgidir}" eval conftemp=\"${conftemp}\" eval conftemp=\"${conftemp}\" From bf6beacf33bb95fcfa7325ff496a76220675c438 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Mon, 20 Oct 2025 14:45:07 +0200 Subject: [PATCH 327/805] configure.ac: refactor NUT_ARG_* help and determination of DEFAULT_MAN_* tunables [#3049] Signed-off-by: Jim Klimov --- configure.ac | 38 +++++++++++++++++++++++++------------- 1 file changed, 25 insertions(+), 13 deletions(-) diff --git a/configure.ac b/configure.ac index 14b4d36a0f..4f717176e9 100644 --- a/configure.ac +++ b/configure.ac @@ -2674,17 +2674,27 @@ dnl numbers. The one we treat as default seems to be most wide-spread, in dnl Linux and FreeBSD. For others, there are other defaults (see `man man` dnl on your platform to port defaults here), and builders can override with dnl options further below. -DEFAULT_MAN_SECTION_API="3" -DEFAULT_MAN_SECTION_CFG="5" -DEFAULT_MAN_SECTION_CMD_SYS="8" -DEFAULT_MAN_SECTION_CMD_USR="1" -DEFAULT_MAN_SECTION_MISC="7" +m4_define([m4nut_DEFAULT_MAN_SECTION_API], [3]) +m4_define([m4nut_DEFAULT_MAN_SECTION_CFG], [5]) +m4_define([m4nut_DEFAULT_MAN_SECTION_CMD_SYS], [8]) +m4_define([m4nut_DEFAULT_MAN_SECTION_CMD_USR], [1]) +m4_define([m4nut_DEFAULT_MAN_SECTION_MISC], [7]) dnl Should we use "man1" or "man1m"? -DEFAULT_MAN_DIR_AS_BASE="yes" +m4_define([m4nut_DEFAULT_MAN_DIR_AS_BASE], [yes]) + +dnl Initiate shell variables to customize below: +DEFAULT_MAN_SECTION_API='m4nut_DEFAULT_MAN_SECTION_API' +DEFAULT_MAN_SECTION_CFG='m4nut_DEFAULT_MAN_SECTION_CFG' +DEFAULT_MAN_SECTION_CMD_SYS='m4nut_DEFAULT_MAN_SECTION_CMD_SYS' +DEFAULT_MAN_SECTION_CMD_USR='m4nut_DEFAULT_MAN_SECTION_CMD_USR' +DEFAULT_MAN_SECTION_MISC='m4nut_DEFAULT_MAN_SECTION_MISC' +DEFAULT_MAN_DIR_AS_BASE='m4nut_DEFAULT_MAN_DIR_AS_BASE' case "${target_os}" in solaris*|sunos*|SunOS*|illumos*) + dnl Note: this regards target OS standard layout + dnl but may not fit certain packaging projects DEFAULT_MAN_SECTION_CMD_SYS="1m" DEFAULT_MAN_DIR_AS_BASE="no" ;; @@ -2697,14 +2707,16 @@ AC_MSG_NOTICE([Platform ${target_os} default man page section for system managem AC_MSG_NOTICE([Platform ${target_os} default man page section for user commands: '${DEFAULT_MAN_SECTION_CMD_USR}']) AC_MSG_NOTICE([Platform ${target_os} default man page section for overviews, conventions, and miscellaneous: '${DEFAULT_MAN_SECTION_MISC}']) -dnl NOTE: Sections may be strings, not pure numbers, on some platforms: -NUT_ARG_WITH_EXPAND_DEFAULT_HELP([docs-man-section-api], [], [man page section for library APIs], [${DEFAULT_MAN_SECTION_API}]) -NUT_ARG_WITH_EXPAND_DEFAULT_HELP([docs-man-section-cfg], [], [man page section for configuration files], [${DEFAULT_MAN_SECTION_CFG}]) -NUT_ARG_WITH_EXPAND_DEFAULT_HELP([docs-man-section-cmd-sys], [], [man page section for system management commands], [${DEFAULT_MAN_SECTION_CMD_SYS}]) -NUT_ARG_WITH_EXPAND_DEFAULT_HELP([docs-man-section-cmd-usr], [], [man page section for user commands], [${DEFAULT_MAN_SECTION_CMD_USR}]) -NUT_ARG_WITH_EXPAND_DEFAULT_HELP([docs-man-section-misc], [], [man page section for overviews, conventions, and miscellaneous], [${DEFAULT_MAN_SECTION_MISC}]) +dnl NOTE: Sections may be strings, not pure numbers, on some platforms. +dnl NOTE: Weird formatting (m4nut... outside brackets) helps avoid spurious +dnl end of line in help text before the value (left alone on a short line). +NUT_ARG_WITH_CUSTOM_DEFAULT_HELP([docs-man-section-api], [], [man page section for library APIs], [${DEFAULT_MAN_SECTION_API}], [platform-dependent, usually ]m4nut_DEFAULT_MAN_SECTION_API) +NUT_ARG_WITH_CUSTOM_DEFAULT_HELP([docs-man-section-cfg], [], [man page section for configuration files], [${DEFAULT_MAN_SECTION_CFG}], [platform-dependent, usually ]m4nut_DEFAULT_MAN_SECTION_CFG) +NUT_ARG_WITH_CUSTOM_DEFAULT_HELP([docs-man-section-cmd-sys], [], [man page section for system management commands], [${DEFAULT_MAN_SECTION_CMD_SYS}], [platform-dependent, usually ]m4nut_DEFAULT_MAN_SECTION_CMD_SYS) +NUT_ARG_WITH_CUSTOM_DEFAULT_HELP([docs-man-section-cmd-usr], [], [man page section for user commands], [${DEFAULT_MAN_SECTION_CMD_USR}], [platform-dependent, usually ]m4nut_DEFAULT_MAN_SECTION_CMD_USR) +NUT_ARG_WITH_CUSTOM_DEFAULT_HELP([docs-man-section-misc], [], [man page section for overviews, conventions, and miscellaneous], [${DEFAULT_MAN_SECTION_MISC}], [platform-dependent, usually ]m4nut_DEFAULT_MAN_SECTION_MISC) -NUT_ARG_WITH_EXPAND_DEFAULT_HELP([docs-man-dir-as-base], [], [are platform man directories named by base number (yes) or full section name (no)], [${DEFAULT_MAN_DIR_AS_BASE}]) +NUT_ARG_WITH_CUSTOM_DEFAULT_HELP([docs-man-dir-as-base], [], [are platform man directories named by base number (yes) or full section name (no)], [${DEFAULT_MAN_DIR_AS_BASE}], [platform-dependent, usually ]m4nut_DEFAULT_MAN_DIR_AS_BASE) NUT_ARG_WITH([docs-man-linkmanext-template], [asciidoc template for "linkmanext" tags (distro-dependent)], [auto]) NUT_ARG_WITH([docs-man-linkmanext2-template], [asciidoc template for "linkmanext2" tags (distro-dependent)], [auto]) From 75bc281bedc851a653eab0d6986d2f6ace459c34 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Mon, 20 Oct 2025 15:11:18 +0200 Subject: [PATCH 328/805] configure.ac: refactor NUT_ARG_* help and determination of --with-doc(s) and --with-docs-changelog* tunables [#3049] Signed-off-by: Jim Klimov --- configure.ac | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/configure.ac b/configure.ac index 4f717176e9..70011dd068 100644 --- a/configure.ac +++ b/configure.ac @@ -2655,19 +2655,20 @@ dnl a second-class citizen (if both are set, the old option name wins). dnl Also note that the legacy default was "man=yes" due to requirements dnl of the "make distcheck", but it was reduced to "man=auto" so that dnl the usual builds can pass by default on systems without asciidoc. -nut_with_docs_default="man=auto" +m4_define([m4nut_DEFAULT_WITH_DOCS], [man=auto]) +nut_with_docs_default="m4nut_DEFAULT_WITH_DOCS" AS_IF([($NUT_SOURCE_GITREV_IS_RELEASE || $NUT_SOURCE_GITREV_IS_PRERELEASE)], [AC_MSG_NOTICE([This is a (pre-)release build, setting default --with-doc='auto' (not just '${nut_with_docs_default}')]) nut_with_docs_default="auto"]) -NUT_ARG_WITH_EXPAND_DEFAULT_HELP([docs], [], [build and install documentation (alias to --with-doc)], [${nut_with_docs_default}]) -NUT_ARG_WITH_EXPAND_DEFAULT_HELP([doc], [], [build and install documentation (see docs/configure.txt for many variants of the option)], [${nut_with_docs}]) +NUT_ARG_WITH_CUSTOM_DEFAULT_HELP([docs], [(auto|yes|no|man|man=auto|...)], [build and install documentation (alias to legacy --with-doc)], [${nut_with_docs_default}], [varies for development vs. (pre-)release builds, typically ]m4nut_DEFAULT_WITH_DOCS) +NUT_ARG_WITH_CUSTOM_DEFAULT_HELP([doc], [], [build and install documentation (see docs/configure.txt for many variants of the option)], [${nut_with_docs}], [same as ${nut_with_docs}]) NUT_ARG_ENABLE([docs-man-for-progs-built-only], [build and install man pages (if enabled) only for built programs (yes, default) or all known pages (no)], [yes]) -NUT_ARG_ENABLE([docs-changelog], [(re-)generate ChangeLog* files - and do so whenever git info changes? (default: auto; yes, no, "adoc,html,pdf"...)], [auto]) +NUT_ARG_ENABLE([docs-changelog], [(auto|yes|no|"adoc,html,pdf"...)], [(re-)generate ChangeLog* files - and do so whenever git info changes?], [auto]) -NUT_ARG_WITH([docs-changelog-start], [Starting point when generating ChangeLog* files (default: auto; otherwise Git commit ID)], [auto]) -NUT_ARG_WITH([docs-changelog-end], [Ending point when generating ChangeLog* files (default: HEAD; otherwise Git commit ID)], [HEAD]) +NUT_ARG_WITH([docs-changelog-start], [(auto|GitTreeish)], [Starting point (Git commit ID) when generating ChangeLog* files], [auto]) +NUT_ARG_WITH([docs-changelog-end], [GitTreeish], [Ending point (Git commit ID) when generating ChangeLog* files], [HEAD]) dnl Different OS distributions have different layouts of man page section dnl numbers. The one we treat as default seems to be most wide-spread, in From 1a564648b666b8e46267e641108108543e8283e1 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Mon, 20 Oct 2025 15:22:52 +0200 Subject: [PATCH 329/805] configure.ac: refactor NUT_ARG_* help and determination of --enable-check-NIT [#3049] Signed-off-by: Jim Klimov --- configure.ac | 20 +++----------------- 1 file changed, 3 insertions(+), 17 deletions(-) diff --git a/configure.ac b/configure.ac index 70011dd068..e01138eb70 100644 --- a/configure.ac +++ b/configure.ac @@ -3763,24 +3763,10 @@ AM_CONDITIONAL(WITH_CPPCHECK, test "${WITH_CPPCHECK}" = "yes") dnl ---------------------------------------------------------------------- dnl checks related to --enable-check-NIT +dnl FIXME? Add "auto" to align with development builds? AC_MSG_CHECKING(whether to run NIT among default make check target) -nut_enable_check_NIT="no" -AC_ARG_ENABLE([check-NIT], - AS_HELP_STRING([--enable-check-NIT], [Run check-NIT among default checks (no)]), -[ - case "${enableval}" in - no) - AC_MSG_RESULT(no) - ;; - *) - AC_MSG_RESULT(yes) - nut_enable_check_NIT="yes" - ;; - esac -], [ - AC_MSG_RESULT(no) -]) - +NUT_ARG_ENABLE([check-NIT], [Run check-NIT among default checks], [no]) +AC_MSG_RESULT([${nut_enable_check_NIT}]) AM_CONDITIONAL(WITH_CHECK_NIT, test "${nut_enable_check_NIT}" = "yes") dnl ---------------------------------------------------------------------- From 0ae4efd372f6e345fcf2b137c084ca529acf0054 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Mon, 20 Oct 2025 15:23:14 +0200 Subject: [PATCH 330/805] configure.ac: refactor NUT_ARG_* help and determination of --with-port [#3049] Signed-off-by: Jim Klimov --- configure.ac | 22 +++++++--------------- 1 file changed, 7 insertions(+), 15 deletions(-) diff --git a/configure.ac b/configure.ac index e01138eb70..00cc7c4c20 100644 --- a/configure.ac +++ b/configure.ac @@ -4682,22 +4682,14 @@ NUT_REPORT_SETTING_PATH([HTML file path], dnl --------------------------------------------------------------------- dnl Other NUT build/install customization options AC_MSG_CHECKING(network port number) -AC_ARG_WITH(port, - AS_HELP_STRING([--with-port=PORT], [port for network communications (3493)]), -[ - case "${withval}" in - yes|no) - AC_MSG_ERROR(invalid option --with(out)-port - see docs/configure.txt) - ;; - *) - PORT="${withval}" - ;; - esac -], [ - PORT="3493" -]) -AC_DEFINE_UNQUOTED(PORT, ${PORT}, [Port for network communications]) +NUT_ARG_WITH([port], [PORTNUM], [port for network communications], [3493]) + +AS_IF([(test 0 -lt "${nut_with_port}" && test 65536 -gt "${nut_with_port}") 2>/dev/null], + [PORT="${nut_with_port}"], + [AC_MSG_ERROR(invalid option --with(out)-port - see docs/configure.txt)] +) AC_MSG_RESULT(${PORT}) +AC_DEFINE_UNQUOTED(PORT, ${PORT}, [Port for network communications]) dnl --------------------------------------------------------------------- AC_MSG_CHECKING(facility for syslog) From c43fba4ec32ebd687624a119ab35940cf032076d Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Mon, 20 Oct 2025 15:33:36 +0200 Subject: [PATCH 331/805] configure.ac: refactor NUT_ARG_* help and determination of --with-logfacility [#3049] Signed-off-by: Jim Klimov --- configure.ac | 21 ++++++--------------- 1 file changed, 6 insertions(+), 15 deletions(-) diff --git a/configure.ac b/configure.ac index 00cc7c4c20..8ed44b842a 100644 --- a/configure.ac +++ b/configure.ac @@ -4693,22 +4693,13 @@ AC_DEFINE_UNQUOTED(PORT, ${PORT}, [Port for network communications]) dnl --------------------------------------------------------------------- AC_MSG_CHECKING(facility for syslog) -AC_ARG_WITH(logfacility, - AS_HELP_STRING([--with-logfacility=FACILITY], [facility for log messages (LOG_DAEMON)]), -[ - case "${withval}" in - yes|no) - AC_MSG_ERROR(invalid option --with(out)-logfacility - see docs/configure.txt) - ;; - *) - LOGFACILITY="${withval}" - ;; - esac -], [ - LOGFACILITY="LOG_DAEMON" -]) -AC_DEFINE_UNQUOTED(LOG_FACILITY, ${LOGFACILITY}, [Desired syslog facility - see syslog(3)]) +NUT_ARG_WITH([logfacility], [FACILITY], [syslog facility for log messages], [LOG_DAEMON]) +AS_CASE([${nut_with_logfacility}], + [yes|no|""], [AC_MSG_ERROR(invalid option --with(out)-logfacility - see docs/configure.txt)], + [LOGFACILITY="${nut_with_logfacility}"] +) AC_MSG_RESULT(${LOGFACILITY}) +AC_DEFINE_UNQUOTED(LOG_FACILITY, ${LOGFACILITY}, [Desired syslog facility - see syslog(3)]) dnl --------------------------------------------------------------------- AC_MSG_CHECKING(which driver man pages to install) From b8e7f8133cde2038a6b577db590de31ce70e7931 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Mon, 20 Oct 2025 15:34:13 +0200 Subject: [PATCH 332/805] configure.ac: refactor NUT_ARG_* help and determination of --enable-force-nut-version-header (and actually fix default report vs. setting) [#3049] Signed-off-by: Jim Klimov --- configure.ac | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-) diff --git a/configure.ac b/configure.ac index 8ed44b842a..a5c3079385 100644 --- a/configure.ac +++ b/configure.ac @@ -4734,22 +4734,15 @@ dnl iterating *quickly* and rebuiding just what "really" changed! dnl Still, this speed-up is not default to avoid surprises for core team. AC_MSG_CHECKING(whether to force nut_version.h generation for every make run) dnl Value is "FORCE" or empty, substituted into Makefile.am rule: -FORCE_NUT_VERSION="FORCE" -AC_ARG_ENABLE(force-nut-version-header, - AS_HELP_STRING([--enable-force-nut-version-header], [Force nut_version.h generation for every make run (yes)]), -[ - case "${enableval}" in - no) +NUT_ARG_ENABLE([force-nut-version-header], [Force nut_version.h generation for every make run?], [yes]) +AS_CASE([${nut_enable_force_nut_version_header}], + [no], [ AC_MSG_RESULT(no) - FORCE_NUT_VERSION="" - ;; - *) + FORCE_NUT_VERSION="" + ], [ AC_MSG_RESULT(yes) - ;; - esac -], [ - AC_MSG_RESULT(no) -]) + FORCE_NUT_VERSION="FORCE" + ]) dnl --------------------------------------------------------------------- From 946501a88b32e70a34ed0d252a562fb7a6a51e24 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Mon, 20 Oct 2025 15:42:34 +0200 Subject: [PATCH 333/805] configure.ac: refactor NUT_ARG_* help and determination of --enable-strip (and actually fix a missed compiler family dependency) [#3049] Signed-off-by: Jim Klimov --- configure.ac | 27 ++++++++++++--------------- 1 file changed, 12 insertions(+), 15 deletions(-) diff --git a/configure.ac b/configure.ac index a5c3079385..1b2c70f89d 100644 --- a/configure.ac +++ b/configure.ac @@ -4747,21 +4747,18 @@ AS_CASE([${nut_enable_force_nut_version_header}], dnl --------------------------------------------------------------------- AC_MSG_CHECKING(whether to strip debug symbols) -AC_ARG_ENABLE(strip, - AS_HELP_STRING([--enable-strip], [Strip debugging symbols from binaries (no)]), -[ - case "${enableval}" in - no) - AC_MSG_RESULT(no) - ;; - *) - AC_MSG_RESULT(yes) - CFLAGS="${CFLAGS} -s" - ;; - esac -], [ - AC_MSG_RESULT(no) -]) +NUT_ARG_ENABLE([strip], [Strip debugging symbols from binaries? Some packaging policies require this...], [no]) + +AS_CASE([${nut_enable_strip}], + [no], [AC_MSG_RESULT(no)], + [AS_IF([test "${CLANGCC}" = "yes" || test "${GCC}" = "yes"], + [AC_MSG_RESULT(yes) + CFLAGS="${CFLAGS} -s"], + [AS_IF([test "${nut_enable_strip}" = yes], + [AC_MSG_ERROR([Do not know how to request debug symbol stripping with currently chosen compiler])] + )] + )] +) dnl --------------------------------------------------------------------- AC_MSG_CHECKING(whether to install pkg-config *.pc files) From 3560b5d0e89c419f0032b53e3ce3acad4afa6c35 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Mon, 20 Oct 2025 15:49:57 +0200 Subject: [PATCH 334/805] configure.ac: refactor NUT_ARG_* help and determination of PKGCONFIGDIR [#3049] Signed-off-by: Jim Klimov --- configure.ac | 23 ++++++++--------------- 1 file changed, 8 insertions(+), 15 deletions(-) diff --git a/configure.ac b/configure.ac index 1b2c70f89d..f13bea06ad 100644 --- a/configure.ac +++ b/configure.ac @@ -518,7 +518,7 @@ dnl Note: CGIDATAPATH (nee htmlcgidir) is for nut-cgi resources, dnl so htmldocdir and htmlmandir are separate htmldocdir='${docdir}/html-doc' htmlmandir='${docdir}/html-man' -pkgconfigdir='${libdir}/pkgconfig' +m4_define([m4nut_DEFAULT_PKGCONFIGDIR], [\${libdir}/pkgconfig]) dnl Detection of augeas lens dirs is a bit troublesome, since dnl they (if present) reside in location not controlled by NUT. @@ -4762,20 +4762,13 @@ AS_CASE([${nut_enable_strip}], dnl --------------------------------------------------------------------- AC_MSG_CHECKING(whether to install pkg-config *.pc files) -AC_ARG_WITH(pkgconfig-dir, - AS_HELP_STRING([--with-pkgconfig-dir=PATH], [where to install pkg-config *.pc files (EPREFIX/lib/pkgconfig)]), -[ - case "${withval}" in - yes|auto) - ;; - no) - pkgconfigdir="" - ;; - *) - pkgconfigdir="${withval}" - ;; - esac -], []) +NUT_ARG_WITH_EXPAND_DEFAULT_HELP_SINGLEQUOTE([pkgconfig-dir], [(DIRPATH|yes|no|auto)], [Whether/where to install pkg-config *.pc files, typically EPREFIX/lib/pkgconfig], [m4nut_DEFAULT_PKGCONFIGDIR]) + +AS_CASE([${nut_with_pkgconfig_dir}], + [yes|auto|""], [pkgconfigdir='m4nut_DEFAULT_PKGCONFIGDIR'], + [no], [pkgconfigdir=""], + [pkgconfigdir="${nut_with_pkgconfig_dir}"] +) dnl Note: currently pkgconfigdir='${libdir}/pkgconfig' literally dnl goes into lib/Makefile.am substitution for pkgconfig_DATA. From ab72756a255d5193a224a1fffeabedf5a2e953a0 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Mon, 20 Oct 2025 16:46:38 +0200 Subject: [PATCH 335/805] configure.ac: refactor NUT_ARG_* help and determination of Solaris/illumos packaging options, fix a few logical mismatches [#3049] Signed-off-by: Jim Klimov --- configure.ac | 190 ++++++++++++++++++++++----------------------------- 1 file changed, 83 insertions(+), 107 deletions(-) diff --git a/configure.ac b/configure.ac index f13bea06ad..b7ebbfbab8 100644 --- a/configure.ac +++ b/configure.ac @@ -4802,134 +4802,110 @@ NUT_ARG_ENABLE([ldflags-nut-rpath-cxx], dnl --------------------------------------------------------------------- dnl Options for Solaris/illumos `make install` and `make package` AC_MSG_CHECKING(whether to make Solaris SVR4 packages) -solarispkg_svr4="auto" -AC_ARG_WITH([solaris-pkg-svr4], - AS_HELP_STRING([--with-solaris-pkg-svr4=(yes|auto|no)], [Enable construction of Solaris SVR4 packages (auto)]), -[ - case "${withval}" in - auto|"") - solarispkg_svr4="auto" - ;; - yes|no) - solarispkg_svr4="${withval}" - ;; - *) - AC_MSG_ERROR([Unexpected argument for --with-solaris-pkg-svr4=${withval}]) - ;; - esac -], []) +NUT_ARG_WITH([solaris-pkg-svr4], [(yes|no|auto)], [Enable construction of Solaris SVR4 packages], [auto]) -if test x"$solarispkg_svr4" = xauto ; then - if test -x /usr/bin/pkgtrans && test -x /usr/bin/pkgmk && test -x /usr/bin/pkgproto ; then - solarispkg_svr4="yes" - else - solarispkg_svr4="no" - fi -fi +AS_CASE([${nut_with_solaris_pkg_svr4}], + [auto|""], [solarispkg_svr4="auto"], + [yes|no], [solarispkg_svr4="${nut_with_solaris_pkg_svr4}"], + [AC_MSG_ERROR([Unexpected argument for --with-solaris-pkg-svr4=${nut_with_solaris_pkg_svr4}])] +) + +AS_CASE([${solarispkg_svr4}], + [no], [], + [AS_IF([test -x /usr/bin/pkgtrans && test -x /usr/bin/pkgmk && test -x /usr/bin/pkgproto], + [AS_CASE([${solarispkg_svr4}], + [auto], [solarispkg_svr4="yes"] + )], + [AS_CASE([${solarispkg_svr4}], + [auto], [solarispkg_svr4="no"], + [yes], [AC_MSG_ERROR([Can not fulfill --with-solaris-pkg-svr4 in the current build environment])] + )] + )] +) AC_MSG_RESULT([${solarispkg_svr4}]) AM_CONDITIONAL(WITH_SOLARIS_PKG_SVR4, test x"$solarispkg_svr4" = x"yes") +dnl WARNING: this is not currently implemented! +dnl Consider porting OpenIndiana (or eventually OmniOS) build recipes; see e.g. +dnl https://github.com/OpenIndiana/oi-userland/tree/oi/hipster/components/sysutils/nut AC_MSG_CHECKING(whether to make Solaris IPS packages) -solarispkg_ips="auto" -AC_ARG_WITH([solaris-pkg-ips], - AS_HELP_STRING([--with-solaris-pkg-ips=(yes|auto|no)], [Enable construction of Solaris IPS packages (auto)]), -[ - case "${withval}" in - auto|"") - solarispkg_ips="auto" - ;; - yes|no) - solarispkg_ips="${withval}" - ;; - *) - AC_MSG_ERROR([Unexpected argument for --with-solaris-pkg-ips=${withval}]) - ;; - esac -], []) +NUT_ARG_WITH([solaris-pkg-ips], [(yes|no|auto)], [Enable construction of Solaris IPS packages (PLACEHOLDER!)], [auto]) -if test x"$solarispkg_ips" = xauto ; then - if test -x /usr/bin/pkg && test -x /usr/bin/pkgmogrify && test -x /usr/bin/pkgdepend ; then - solarispkg_ips="yes" - else - solarispkg_ips="no" - fi -fi +AS_CASE([${nut_with_solaris_pkg_ips}], + [auto|""], [solarispkg_ips="auto"], + [yes|no], [solarispkg_ips="${nut_with_solaris_pkg_ips}"], + [AC_MSG_ERROR([Unexpected argument for --with-solaris-pkg-ips=${nut_with_solaris_pkg_ips}])] +) + +AS_CASE([${solarispkg_ips}], + [no], [], + [AS_IF([test -x /usr/bin/pkg && test -x /usr/bin/pkgmogrify && test -x /usr/bin/pkgdepend], + [AS_CASE([${solarispkg_ips}], + [auto], [solarispkg_ips="yes"] + )], + [AS_CASE([${solarispkg_ips}], + [auto], [solarispkg_ips="no"], + [yes], [AC_MSG_ERROR([Can not fulfill --with-solaris-pkg-ips in the current build environment])] + )] + )] +) AC_MSG_RESULT([${solarispkg_ips}]) AM_CONDITIONAL(WITH_SOLARIS_PKG_IPS, test x"$solarispkg_ips" = x"yes") dnl NOTE: Be sure to customize e.g. --datadir=/usr/share/nut to install dnl these scripts not into default location as e.g. /usr/share/solaris-smf +solarissmf="" +solarisinit="" AC_MSG_CHECKING(whether to install Solaris SMF files) -solarissmf="auto" -AC_ARG_WITH([solaris-smf], - AS_HELP_STRING([--with-solaris-smf=(yes|auto|no)], [Enable installation of NUT scripts and manifests for Solaris Service Management Framework (auto)]), -[ - case "${withval}" in - auto|"") - solarissmf="auto" - ;; - yes|no) - solarissmf="${withval}" - ;; - *) - AC_MSG_ERROR([Unexpected argument for --with-solaris-smf=${withval}]) - ;; - esac -], []) +NUT_ARG_WITH([solaris-smf], [(yes|no|auto)], [Enable installation of NUT scripts and manifests for Solaris Service Management Framework], [auto]) -if test x"$solarissmf" = xauto ; then - if test -x /usr/sbin/svcadm && test -x /usr/sbin/svccfg && test -x /usr/bin/svcs ; then - solarissmf="yes" - else - case "${solarispkg_ips}${solarispkg_svr4}" in - *yes*) solarisinit="yes" ;; dnl Want to install so we can generally package - *) solarissmf="no" ;; dnl Target not solarish - esac - fi -fi +AS_CASE([${nut_with_solaris_smf}], + [auto|""], [solarissmf="auto"], + [yes|no], [solarissmf="${nut_with_solaris_smf}"], + [AC_MSG_ERROR([Unexpected argument for --with-solaris-smf=${nut_with_solaris_smf}])] +) + +AS_CASE([${solarissmf}], + [no], [], + [AS_IF([test -x /usr/sbin/svcadm && test -x /usr/sbin/svccfg && test -x /usr/bin/svcs], + [solarissmf="yes"], dnl yes/auto and got the tools => yes + [AS_CASE([${solarispkg_ips}${solarispkg_svr4}], + [*yes*], [AS_IF([test "${solarissmf}" = yes], [AC_MSG_ERROR([Can not fulfill --with-solaris-smf in the current build environment])]) + solarisinit="yes"], dnl Older distro requested/detected, so we would want to install INIT SCRIPTS at least, so we can generally package NUT + [solarissmf="no"] dnl Target not solarish + )] + )] +) AC_MSG_RESULT([${solarissmf}]) NUT_REPORT_FEATURE([consider basic SMF support], [${solarissmf}], [], [WITH_SOLARIS_SMF], [Define to consider basic SMF support (provide units and configuration files)]) AC_MSG_CHECKING(whether to install Solaris SVR4 (legacy) init-script files) -solarisinit="auto" -AC_ARG_WITH([solaris-init], - AS_HELP_STRING([--with-solaris-init=(yes|auto|no)], [Enable installation of NUT legacy init-scripts for Solaris/illumos (auto)]), -[ - case "${withval}" in - auto|"") - solarisinit="auto" - ;; - yes|no) - solarisinit="${withval}" - ;; - *) - AC_MSG_ERROR([Unexpected argument for --with-solaris-init=${withval}]) - ;; - esac -], []) +NUT_ARG_WITH([solaris-init], [(yes|no|auto)], [Enable installation of NUT legacy init-scripts for Solaris/illumos], [auto]) -if test x"$solarisinit" = xauto ; then - dnl Depends on usability of SMF or making for packaging - case "${solarispkg_ips}${solarispkg_svr4}" in - *yes*) solarisinit="yes" ;; dnl Want to install so we can generally package - *) - case ${target_os} in - solaris*|sunos*|SunOS*|illumos*) - if test "$solarissmf" = x"yes" ; then - dnl no need on modern OSes - solarisinit="no" - else - solarisinit="yes" - fi - ;; - *) solarisinit="no" ;; dnl Some other OS - esac - ;; - esac -fi +AS_CASE([${nut_with_solaris_init}], + [auto|""], [AS_IF([test x"${solarisinit}" = x], [solarisinit="auto"])], + [yes|no], [solarisinit="${nut_with_solaris_init}"], + [AC_MSG_ERROR([Unexpected argument for --with-solaris-init=${nut_with_solaris_init}])] +) + +AS_IF([test x"$solarisinit" = xauto], + [dnl Depends on usability of SMF or making for packaging + AS_CASE([${solarispkg_ips}${solarispkg_svr4}], + [*yes*], [solarisinit="yes"], dnl Want to install so we can generally package, even if IPS/SMF is present on build host + [AS_CASE([${target_os}], + [solaris*|sunos*|SunOS*|illumos*], + [AS_IF([test x"${solarissmf}" = x"yes"], + [dnl No need on modern OSes, can use SMF instead + solarisinit="no"], + [solarisinit="yes"] + )], + [solarisinit="no"] dnl Some other OS + )] + )] +) AC_MSG_RESULT([${solarisinit}]) AM_CONDITIONAL(WITH_SOLARIS_INIT, test x"$solarisinit" = x"yes") From 207d8d5cbd9fb3fd68c1f9f16c823c3e02e8b194 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Mon, 20 Oct 2025 16:53:19 +0200 Subject: [PATCH 336/805] configure.ac: refactor NUT_ARG_* help and determination of systemd paths [#3049] Signed-off-by: Jim Klimov --- configure.ac | 28 ++++++++++++---------------- 1 file changed, 12 insertions(+), 16 deletions(-) diff --git a/configure.ac b/configure.ac index b7ebbfbab8..250fddb890 100644 --- a/configure.ac +++ b/configure.ac @@ -4914,11 +4914,11 @@ dnl --------------------------------------------------------------------- dnl Note: Currently there is no reliable automatic detection - dnl users have to ask they want systemd units installed, or dnl risk auto-detection like seen below. +dnl FIXME: Add a toggle like "--with(out)-systemd" to disable these probes too AC_MSG_CHECKING(whether to install systemd unit files) -AC_ARG_WITH([systemdsystemunitdir], - AS_HELP_STRING([--with-systemdsystemunitdir=DIR], [Directory for systemd service files (auto)]), - [systemdsystemunitdir="${withval}"], - [systemdsystemunitdir="auto"]) +NUT_ARG_WITH([systemdsystemunitdir], [(DIRPATH|yes|no|auto)], [Directory for systemd service files], [auto]) +systemdsystemunitdir="${nut_with_systemdsystemunitdir}" + case "${systemdsystemunitdir}" in yes|auto|"") AS_IF([test x"$have_PKG_CONFIG" = xyes], @@ -4964,10 +4964,8 @@ AC_PATH_PROG([SYSTEMD_SYSTEMCTL_PROGRAM], [systemctl], [/usr/bin/systemctl]) dnl Similarly for presets (list of svcs enabled/disabled by default) AC_MSG_CHECKING(whether to install systemd preset files) -AC_ARG_WITH([systemdsystempresetdir], - [AS_HELP_STRING([--with-systemdsystempresetdir=DIR], [Directory for systemd preset files (auto)])], - [systemdsystempresetdir="${withval}"], - [systemdsystempresetdir="auto"]) +NUT_ARG_WITH([systemdsystempresetdir], [(DIRPATH|yes|no|auto)], [Directory for systemd preset files], [auto]) +systemdsystempresetdir="${nut_with_systemdsystempresetdir}" dnl Note: this option is enabled only if systemdsystemunitdir is not trivial if test -n "${systemdsystemunitdir}"; then @@ -5006,10 +5004,9 @@ AM_CONDITIONAL([WITH_SYSTEMD_PRESET], [test x"${systemdsystempresetdir}" != "x"] dnl Similarly for shutdown integration hooks AC_MSG_CHECKING(whether to install systemd shutdown files) -AC_ARG_WITH([systemdshutdowndir], - AS_HELP_STRING([--with-systemdshutdowndir=DIR], [Directory for systemd shutdown scripts (auto)]), - [systemdshutdowndir="${withval}"], - [systemdshutdowndir="auto"]) +NUT_ARG_WITH([systemdshutdowndir], [(DIRPATH|yes|no|auto)], [Directory for systemd shutdown scripts], [auto]) +systemdshutdowndir="${nut_with_systemdshutdowndir}" + dnl Note: this option is enabled only if systemdsystemunitdir is not trivial if test -n "${systemdsystemunitdir}"; then case "${systemdshutdowndir}" in @@ -5048,10 +5045,9 @@ AM_CONDITIONAL([WITH_SYSTEMD_SHUTDOWN], [test x"${systemdshutdowndir}" != "x"]) dnl Note: if (systemd-)tmpfiles tech is present, it can be useful even for dnl daemons starting not as systemd units, to pre-create /var/run/nut etc. AC_MSG_CHECKING([whether to install systemd tmpfiles files]) -AC_ARG_WITH([systemdtmpfilesdir], - AS_HELP_STRING([--with-systemdtmpfilesdir=DIR], [Directory for systemd tmpfiles scripts (auto)]), - [systemdtmpfilesdir="${withval}"], - [systemdtmpfilesdir="auto"]) +NUT_ARG_WITH([systemdtmpfilesdir], [(DIRPATH|yes|no|auto)], [Directory for systemd tmpfiles scripts], [auto]) +systemdtmpfilesdir="${nut_with_systemdtmpfilesdir}" + case "${systemdtmpfilesdir}" in yes|auto|"") AS_IF([test x"$have_PKG_CONFIG" = xyes], From 6c6fed134ed2e10c5c8bf95936f8c8112cd13253 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Mon, 20 Oct 2025 17:02:33 +0200 Subject: [PATCH 337/805] configure.ac: refactor NUT_ARG_* help and determination of --enable-cppunit [#3049] Signed-off-by: Jim Klimov --- configure.ac | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/configure.ac b/configure.ac index 250fddb890..9349020de1 100644 --- a/configure.ac +++ b/configure.ac @@ -5367,17 +5367,16 @@ return res ? 0 : 1; dnl # By default keep the originally detected have_cppunit value AC_MSG_CHECKING(for impact from --enable-cppunit option - should we build cppunit tests?) -AC_ARG_ENABLE(cppunit, - [AS_HELP_STRING([--enable-cppunit], [enable CPPUNIT tests for C++ bindings (yes, no, force, auto)])], - [AS_CASE(["${enableval}"], - ["force"], [AS_IF([test x"${have_cppunit}" = xyes], [], [ - AC_MSG_WARN([--enable-cppunit=yes can not be satisfied, but developer asked for it]) - have_cppunit=yes - ])], - ["yes"], [AS_IF([test x"${have_cppunit}" = xyes], [], [AC_MSG_ERROR([--enable-cppunit=yes can not be satisfied])])], - ["no"], [have_cppunit=no] +NUT_ARG_ENABLE([cppunit], [(yes|no|force|auto)], [Enable CPPUNIT tests for C++ bindings], [auto]) +AS_CASE(["${nut_enable_cppunit}"], + ["force"], [AS_IF([test x"${have_cppunit}" = xyes], [], [ + AC_MSG_WARN([--enable-cppunit=yes can not be satisfied, but developer asked for it]) + have_cppunit=yes + ])], + ["yes"], [AS_IF([test x"${have_cppunit}" = xyes], [], [AC_MSG_ERROR([--enable-cppunit=yes can not be satisfied])])], + ["no"], [have_cppunit=no] dnl # "auto" and other values keep what was detected (or not) - )]) +) AC_MSG_RESULT(${have_cppunit}) NUT_REPORT_FEATURE([build C++ tests with CPPUNIT], [${have_cppunit}], [], From 151145cb777f7ecb66889c3ce5eb302a18fa9078 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Mon, 20 Oct 2025 17:02:50 +0200 Subject: [PATCH 338/805] configure.ac: refactor NUT_ARG_* help and determination of --with-augeas-lenses-dir [#3049] Signed-off-by: Jim Klimov --- configure.ac | 36 ++++++++++++++---------------------- 1 file changed, 14 insertions(+), 22 deletions(-) diff --git a/configure.ac b/configure.ac index 9349020de1..8d43eb8689 100644 --- a/configure.ac +++ b/configure.ac @@ -5436,34 +5436,26 @@ dnl ---------------------------------------------------------------------- dnl Other third-party integrations AC_MSG_CHECKING(whether to install Augeas configuration-management lenses) -AC_ARG_WITH(augeas-lenses-dir, - AS_HELP_STRING([--with-augeas-lenses-dir=PATH], [where to install Augeas configuration-management lenses (/usr/share/augeas/lenses{/dist,/})]), -[ - case "${withval}" in - yes) - if test -z "${auglensdir}"; then +NUT_ARG_WITH([augeas-lenses-dir], [(DIRPATH|yes|no|auto)], [Whether/where to install Augeas configuration-management lenses, typically /usr/share/augeas/lenses{/dist,/}], [auto]) + +AS_CASE([${nut_with_augeas_lenses_dir}], + [yes], [if test -z "${auglensdir}"; then AC_MSG_RESULT(no) AC_MSG_ERROR([augeas lenses directory requested but not found in default location]) - fi - if test ! -s scripts/augeas/nutupsconf.aug.in ; then + fi + if test ! -s scripts/augeas/nutupsconf.aug.in ; then AC_MSG_RESULT(no) AC_MSG_ERROR([augeas lenses directory requested but a non-trivial scripts/augeas/nutupsconf.aug.in was not provided by autogen.sh or dist archive]) - fi - ;; - auto) - if test ! -s scripts/augeas/nutupsconf.aug.in ; then + fi + ], + [auto], [if test ! -s scripts/augeas/nutupsconf.aug.in ; then AC_MSG_WARN([augeas lenses directory skipped because a non-trivial scripts/augeas/nutupsconf.aug.in was not provided by autogen.sh or dist archive]) auglensdir="" - fi - ;; - no) - auglensdir="" - ;; - *) - auglensdir="${withval}" - ;; - esac -], []) + fi + ], + [no], [auglensdir=""], + [auglensdir="${nut_with_augeas_lenses_dir}"] +) if test -n "${auglensdir}"; then AC_MSG_RESULT(using ${auglensdir}) NUT_REPORT_PATH_INTEGRATIONS([Augeas lenses directory], [${auglensdir}]) From ad6218b6d468d04d1b80076d44d934a4db85646b Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Mon, 20 Oct 2025 17:22:03 +0200 Subject: [PATCH 339/805] configure.ac: refactor NUT_ARG_* help and determination of udev, hotplug, devd, freebsdquirksdir paths [#3049] Signed-off-by: Jim Klimov --- configure.ac | 147 +++++++++++++++++++++------------------------------ 1 file changed, 61 insertions(+), 86 deletions(-) diff --git a/configure.ac b/configure.ac index 8d43eb8689..f0d61473a3 100644 --- a/configure.ac +++ b/configure.ac @@ -5481,27 +5481,20 @@ fi dnl ---------------------------------------------------------------------- +dnl Note: initial hotplugdir value, empty or not, was determined far above AC_MSG_CHECKING(whether to install hotplug rules) -AC_ARG_WITH(hotplug-dir, - AS_HELP_STRING([--with-hotplug-dir=PATH], [where to install hotplug rules (${hotplugdir}); typically /etc/hotplug]), -[ - case "${withval}" in - yes) - if test -z "${hotplugdir}"; then +NUT_ARG_WITH([hotplug-dir], [(DIRPATH|yes|no|auto)], [Whether/where to install hotplug rules, typically /etc/hotplug], [auto]) + +AS_CASE([${nut_with_hotplug_dir}], + [yes], + [if test -z "${hotplugdir}"; then AC_MSG_RESULT(no) AC_MSG_ERROR([hotplug directory requested but not found]) - fi - ;; - auto) - ;; - no) - hotplugdir="" - ;; - *) - hotplugdir="${withval}" - ;; - esac -], []) + fi], + [auto], [], + [no], [hotplugdir=""], + [hotplugdir="${nut_with_hotplug_dir}"] +) if test -n "${hotplugdir}"; then AC_MSG_RESULT(using ${hotplugdir}) NUT_REPORT_PATH_INTEGRATIONS([Hotplug rules directory], [${hotplugdir}]) @@ -5510,35 +5503,30 @@ else fi AM_CONDITIONAL(WITH_HOTPLUG, test -n "${hotplugdir}") +dnl Note: initial udevdir value, empty or not, was determined far above AC_MSG_CHECKING(whether to install udev rules) -AC_ARG_WITH(udev-dir, - AS_HELP_STRING([--with-udev-dir=PATH], [where to install udev rules (${udevdir}; typically /lib/udev or /etc/udev)]), -[ - case "${withval}" in - yes) dnl Typically /lib/udev or /etc/udev - if test -z "${udevdir}"; then +NUT_ARG_WITH([udev-dir], [(DIRPATH|yes|no|auto)], [Whether/where to install udev rules, typically /lib/udev or /etc/udev], [auto]) + +AS_CASE([${nut_with_udev_dir}], + [yes], dnl Typically /lib/udev or /etc/udev + [if test -z "${udevdir}"; then AC_MSG_RESULT(no) AC_MSG_ERROR([udev directory requested but not found]) - fi - if test "${nut_with_usb}" = yes && test ! -s scripts/udev/nut-usbups.rules.in ; then + fi + if test "${nut_with_usb}" = yes && test ! -s scripts/udev/nut-usbups.rules.in ; then AC_MSG_RESULT(no) AC_MSG_ERROR([udev directory and USB driver support requested but a non-trivial scripts/udev/nut-usbups.rules.in was not provided by autogen.sh or dist archive]) - fi - ;; - auto) - if test "${nut_with_usb}" = yes && test ! -s scripts/udev/nut-usbups.rules.in ; then + fi + ], + [auto], + [if test "${nut_with_usb}" = yes && test ! -s scripts/udev/nut-usbups.rules.in ; then AC_MSG_WARN([udev directory skipped because a non-trivial scripts/udev/nut-usbups.rules.in was not provided by autogen.sh or dist archive]) udevdir="" - fi - ;; - no) - udevdir="" - ;; - *) - udevdir="${withval}" - ;; - esac -], []) + fi + ], + [no], [udevdir=""], + [udevdir="${nut_with_udev_dir}"] +) if test -n "${udevdir}"; then AC_MSG_RESULT(using ${udevdir}) NUT_REPORT_PATH_INTEGRATIONS([Udev rules directory], [${udevdir}]) @@ -5547,37 +5535,32 @@ else fi AM_CONDITIONAL(WITH_UDEV, test -n "${udevdir}") -dnl FreeBSD devd support: +dnl FreeBSD devd support +dnl Note: initial udevdir value, empty or not, was determined far above AC_MSG_CHECKING(whether to install FreeBSD devd.conf file) -AC_ARG_WITH(devd-dir, - AS_HELP_STRING([--with-devd-dir=PATH], [where to install devd.conf file (${devddir}; typically /usr/local/etc/devd or /etc/devd)]), -[ - case "${withval}" in - yes) dnl Typically /usr/local/etc/devd or /etc/devd - if test -z "${devddir}"; then +NUT_ARG_WITH([devd-dir], [(DIRPATH|yes|no|auto)], [Whether/where to install devd.conf file, typically /usr/local/etc/devd or /etc/devd], [auto]) + +AS_CASE([${nut_with_devd_dir}], + [yes], dnl Typically /usr/local/etc/devd or /etc/devd + [if test -z "${devddir}"; then AC_MSG_RESULT(no) AC_MSG_ERROR([devd directory requested but not found]) - fi - if test "${nut_with_usb}" = yes && test ! -s scripts/devd/nut-usbups.rules.in -o ! -s scripts/devd/nut-usb.conf.in ; then + fi + if test "${nut_with_usb}" = yes && test ! -s scripts/devd/nut-usbups.rules.in -o ! -s scripts/devd/nut-usb.conf.in ; then AC_MSG_RESULT(no) AC_MSG_ERROR([devd directory and USB driver support requested but non-trivial scripts/devd/nut-usbups.rules.in and scripts/devd/nut-usb.conf.in were not provided by autogen.sh or dist archive]) - fi - ;; - auto) - if test "${nut_with_usb}" = yes && test ! -s scripts/devd/nut-usbups.rules.in -o ! -s scripts/devd/nut-usb.conf.in ; then + fi + ], + [auto], + [if test "${nut_with_usb}" = yes && test ! -s scripts/devd/nut-usbups.rules.in -o ! -s scripts/devd/nut-usb.conf.in ; then AC_MSG_WARN([devd directory skipped because non-trivial scripts/devd/nut-usbups.rules.in and scripts/devd/nut-usb.conf.in were not provided by autogen.sh or dist archive]) devddir="" - fi - ;; - no) - devddir="" - ;; - *) - devddir="${withval}" - ;; - esac -], []) + fi + ], + [no], [devddir=""], + [devddir="${nut_with_devd_dir}"] +) if test -n "${devddir}"; then AC_MSG_RESULT(using ${devddir}) NUT_REPORT_PATH_INTEGRATIONS([FreeBSD devd rules directory], [${devddir}]) @@ -5586,35 +5569,27 @@ else fi AM_CONDITIONAL(WITH_DEVD, test -n "${devddir}") -dnl FreeBSD quirks support: +dnl FreeBSD quirks support: freebsdquirksdir="" AC_MSG_CHECKING(whether to install FreeBSD site-local USB quirks file) -AC_ARG_WITH(freebsd-quirks-dir, - AS_HELP_STRING([--with-freebsd-quirks-dir=PATH], [where to install nut-usb.quirks file (${datadir}; typically /usr/local/share/nut)]), -[ - case "${withval}" in - yes) dnl Typically /usr/local/share/nut - freebsdquirksdir="${datadir}" - ;; - auto) - dnl Are we building for FreeBSD with such customizations? - if test -s /boot/loader.conf.local ; then +NUT_ARG_WITH([freebsd-quirks-dir], [(DIRPATH|yes|no|auto)], [Whether/where to install nut-usb.quirks file, typically ${datadir}], [auto]) + +AS_CASE([${nut_with_freebsd_quirks_dir}], + [yes], dnl Typically /usr/local/share/nut + [freebsdquirksdir="${datadir}"], + [auto], dnl Are we building for FreeBSD with such customizations? + [if test -s /boot/loader.conf.local ; then freebsdquirksdir="${datadir}" - fi - if test "${nut_with_usb}" = yes && test ! -s scripts/devd/nut-usb.quirks ; then + fi + if test "${nut_with_usb}" = yes && test ! -s scripts/devd/nut-usb.quirks ; then AC_MSG_WARN([freebsd-quirks-dir directory skipped because a non-trivial scripts/devd/nut-usb.quirks was not provided by autogen.sh or dist archive]) freebsdquirksdir="" - fi - ;; - no) - freebsdquirksdir="" - ;; - *) - freebsdquirksdir="${withval}" - ;; - esac -], []) + fi + ], + [no], [freebsdquirksdir=""], + [freebsdquirksdir="${nut_with_freebsd_quirks_dir}"] +) if test -n "${freebsdquirksdir}"; then AC_MSG_RESULT(using ${freebsdquirksdir}) NUT_REPORT_PATH_INTEGRATIONS([FreeBSD site-local USB quirks directory (add into /boot/loader.conf.local)], [${freebsdquirksdir}]) From 2716eb27edd775db0e96d9e6b3514aca0bc68e08 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Mon, 20 Oct 2025 17:24:44 +0200 Subject: [PATCH 340/805] configure.ac: move SYSTEM_AIX and CPU_TYPE determination way up, to where we detect other aspects of the build target Signed-off-by: Jim Klimov --- configure.ac | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/configure.ac b/configure.ac index f0d61473a3..4c3de36f03 100644 --- a/configure.ac +++ b/configure.ac @@ -208,6 +208,12 @@ If this happens, please retry with GNU C/C++ language mode options instead. ])] ) +dnl AIX system +AM_CONDITIONAL([SYSTEM_AIX], [test "xAIX" = "x`uname -s 2>/dev/null`"]) + +dnl processor type +AC_DEFINE_UNQUOTED(CPU_TYPE, ["$target_cpu"], [Define processor type]) + dnl +------------------------------------------------------------------- dnl Help avoid "polluting" CFLAGS etc. with auto-settings like "-g -O2" dnl at least if we intend to tune --with-debuginfo anyway (where we check @@ -5615,14 +5621,6 @@ fi AM_CONDITIONAL(WITH_FREEBSD_QUIRKS_DIR, test -n "${freebsdquirksdir}") -dnl - -dnl AIX system -AM_CONDITIONAL([SYSTEM_AIX], [test "xAIX" = "x`uname -s 2>/dev/null`"]) - -dnl processor type -AC_DEFINE_UNQUOTED(CPU_TYPE, ["$target_cpu"], [Define processor type]) - dnl --------------------------------------------------------------------- dnl Can use valgrind for memory-leak testing, if present dnl FIXME: Set to "auto" after ensuring that we pass on all NUT CI farm platforms From 8492b018822e6939a3cc01bcbeff69e8266c44ea Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Mon, 20 Oct 2025 17:37:30 +0200 Subject: [PATCH 341/805] configure.ac: refactor NUT_ARG_* help and determination of --with-valgrind [#3049] Signed-off-by: Jim Klimov --- configure.ac | 43 +++++++++++++++++-------------------------- 1 file changed, 17 insertions(+), 26 deletions(-) diff --git a/configure.ac b/configure.ac index 4c3de36f03..47a734ed82 100644 --- a/configure.ac +++ b/configure.ac @@ -5623,38 +5623,29 @@ AM_CONDITIONAL(WITH_FREEBSD_QUIRKS_DIR, test -n "${freebsdquirksdir}") dnl --------------------------------------------------------------------- dnl Can use valgrind for memory-leak testing, if present -dnl FIXME: Set to "auto" after ensuring that we pass on all NUT CI farm platforms -with_valgrind="no" AC_PATH_PROGS([VALGRIND], [valgrind], [none]) dnl Caller can provide a specific valgrind implementation to use: -AC_ARG_WITH(valgrind, - AS_HELP_STRING([--with-valgrind=(yes|no|auto|PATH)], [whether to use valgrind for memory-leak testing (no)]), -[ - dnl ### echo "Caller said: '${withval}'... Discovered tool: '${VALGRIND}'... " - case "${withval}" in - yes) - if test "x$VALGRIND" = "xnone"; then +dnl FIXME: Set default to "auto" after ensuring that we pass on all NUT CI farm platforms +NUT_ARG_WITH([valgrind], [(yes|no|auto|/path/to/valgrind)], [whether to use valgrind for memory-leak testing], [no]) + +dnl ### echo "Caller said: '${nut_with_valgrind}'... Initially discovered tool: '${VALGRIND}'... " +AS_CASE([${nut_with_valgrind}], + [yes], [if test "x$VALGRIND" = "xnone"; then AC_MSG_RESULT(no) AC_MSG_ERROR([valgrind requested but not found]) - fi - with_valgrind="yes" - ;; - auto) - with_valgrind="auto" - ;; - no) - with_valgrind="no" - ;; - *) - AC_PATH_PROGS([VALGRIND], ["${withval}"], [none]) - if test "x$VALGRIND" = "xnone"; then + fi + with_valgrind="yes" + ], + [auto], [with_valgrind="auto"], + [no], [with_valgrind="no"], + [AC_PATH_PROGS([VALGRIND], ["${nut_with_valgrind}"], [none]) + if test "x$VALGRIND" = "xnone"; then AC_MSG_RESULT(no) AC_MSG_ERROR([valgrind requested but not found]) - fi - with_valgrind="yes" - ;; - esac -], []) + fi + with_valgrind="yes" + ] +) dnl Even if the tool is installed, it may be not usable on build platform. dnl QEMU may further complicate things, providing CPUs that formally match From 02a9961848bb66668faa4d308d1f66bf59263b8b Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Mon, 20 Oct 2025 17:45:35 +0200 Subject: [PATCH 342/805] configure.ac: refactor NUT_ARG_* help and determination of --with-user and --with-group (reword the latter) [#3049, #3120] Signed-off-by: Jim Klimov --- configure.ac | 68 ++++++++++++++++++++++++---------------------------- 1 file changed, 31 insertions(+), 37 deletions(-) diff --git a/configure.ac b/configure.ac index 47a734ed82..9e21382098 100644 --- a/configure.ac +++ b/configure.ac @@ -5994,46 +5994,40 @@ dnl Check the user and group to run as last, so we can use the paths configured dnl above as data sources for default values if building an in-place replacement AC_MSG_CHECKING(if requested user to run as) -AC_ARG_WITH(user, - AS_HELP_STRING([--with-user=username], [user for programs started as root (${RUN_AS_USER})]), -[ - case "${withval}" in - yes|no) - AC_MSG_ERROR(invalid option --with(out)-user - see docs/configure.txt) - ;; - *) - RUN_AS_USER="${withval}" - nut_user_given=yes - AC_MSG_RESULT([specified]) - ;; - esac -], [ - nut_user_given=no - AC_MSG_RESULT([default]) -]) +NUT_ARG_WITH_CUSTOM_DEFAULT_HELP([user], [USERNAME], [(Unprivileged) user for programs normally started as root, typically 'nut' or 'ups'], [${RUN_AS_USER}], [platform-dependent, usually 'nobody']) + +AS_CASE([${nut_with_user}], + [yes|no], [AC_MSG_ERROR(invalid option --with(out)-user - see docs/configure.txt)], + ["${RUN_AS_USER}"], [ + nut_user_given=no + AC_MSG_RESULT([default]) + ], + [RUN_AS_USER="${nut_with_user}" + nut_user_given=yes + AC_MSG_RESULT([specified]) + ] +) NUT_REPORT_SETTING([User to run as], RUN_AS_USER, "${RUN_AS_USER}", [User to switch to if started as root]) -AC_MSG_CHECKING(if requested group membership of user to run as) -AC_ARG_WITH(group, - AS_HELP_STRING([--with-group=groupname], [group membership of user for programs started as root (${RUN_AS_GROUP})]), -[ - case "${withval}" in - yes|no) - AC_MSG_ERROR(invalid option --with(out)-group - see docs/configure.txt) - ;; - *) - RUN_AS_GROUP="${withval}" - nut_group_given=yes - AC_MSG_RESULT([specified]) - ;; - esac -], [ - nut_group_given=no - AC_MSG_RESULT([default]) -]) -NUT_REPORT_SETTING([Group of user to run as], - RUN_AS_GROUP, "${RUN_AS_GROUP}", [Group membership of user to switch to if started as root]) +dnl Note: Technically daemons "run as" the primary GID of the user they de-levate into; +dnl but in simpler setups (stipulated by common packaging) this one is the "run as" GID too +AC_MSG_CHECKING(if requested group membership of user to own state files) +NUT_ARG_WITH_CUSTOM_DEFAULT_HELP([group], [GROUPNAME], [(Unprivileged) group membership for state files of drivers normally started as root, typically 'nut' or 'ups'], [${RUN_AS_GROUP}], [platform-dependent, usually 'nobody' or 'nogroup']) + +AS_CASE([${nut_with_group}], + [yes|no], [AC_MSG_ERROR(invalid option --with(out)-group - see docs/configure.txt)], + ["${RUN_AS_GROUP}"], [ + nut_group_given=no + AC_MSG_RESULT([default]) + ], + [RUN_AS_GROUP="${nut_with_group}" + nut_group_given=yes + AC_MSG_RESULT([specified]) + ] +) +NUT_REPORT_SETTING([Group of user to own state files], + RUN_AS_GROUP, "${RUN_AS_GROUP}", [Group membership for state files of drivers normally started as root]) dnl check that --with-user is given if --with-group is given. if test "${nut_user_given}" = "yes" -a "${nut_group_given}" = "no"; then From 3a9c81492e1c99856c141a4daaee8b31e3ccbcf6 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Mon, 20 Oct 2025 17:54:58 +0200 Subject: [PATCH 343/805] configure.ac: refactor NUT_ARG_* help and determination of --enable-extapi-enphase [#3049] Signed-off-by: Jim Klimov --- configure.ac | 22 +++++++--------------- 1 file changed, 7 insertions(+), 15 deletions(-) diff --git a/configure.ac b/configure.ac index 9e21382098..70864aee3a 100644 --- a/configure.ac +++ b/configure.ac @@ -6547,21 +6547,13 @@ AC_DEFINE_UNQUOTED([ABS_TOP_BUILDDIR], ["${ABS_TOP_BUILDDIR}"], [NUT build direc dnl --------------------------------------------------------------------- AC_MSG_CHECKING([whether to install External API integration script: Enphase Monitor]) nut_with_extapi_enphase="no" -AC_ARG_ENABLE([extapi-enphase], - AS_HELP_STRING([--enable-extapi-enphase=(yes|auto|no)], [Enable installation of integration script for External API: Enphase Monitor (default: no)]), -[ - case "${enableval}" in - yes|"") - nut_enable_extapi_enphase="auto" - ;; - auto|no) - nut_enable_extapi_enphase="${enableval}" - ;; - *) - AC_MSG_ERROR([Unexpected argument for --enable-extapi-enphase=${enableval}]) - ;; - esac -], []) +NUT_ARG_ENABLE([extapi-enphase], [(yes|no|auto)], [Enable installation of integration script for External API: Enphase Monitor], [no]) + +AS_CASE([${nut_enable_extapi_enphase}], + [yes|""], [nut_enable_extapi_enphase="auto"], + [auto|no], [], + [AC_MSG_ERROR([Unexpected argument for --enable-extapi-enphase=${nut_enable_extapi_enphase}])] +) if test x"$nut_enable_extapi_enphase" != xno ; then dnl Depends on usability of further programs and bash version From b9edb4000a33129d7d434c4e8456b8bcb025516a Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Mon, 20 Oct 2025 17:57:08 +0200 Subject: [PATCH 344/805] configure.ac: refactor NUT_ARG_* help and determination of --with-CCACHE_NAMESPACE [#3049] Signed-off-by: Jim Klimov --- configure.ac | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-) diff --git a/configure.ac b/configure.ac index 70864aee3a..5c8e0d13c9 100644 --- a/configure.ac +++ b/configure.ac @@ -6645,20 +6645,13 @@ AS_IF([test x"${CCACHE_NAMESPACE}" = x], [ done unset T ]) -AC_ARG_WITH(CCACHE_NAMESPACE, - AS_HELP_STRING([--with-CCACHE_NAMESPACE=namespace], [which ccache namespace to use for built binaries (typically nut:${autotools_target})]), -[ - case "${withval}" in - no) - CCACHE_NAMESPACE="" - ;; - yes) # Use user envvar or calculation above - ;; - *) - CCACHE_NAMESPACE="${withval}" - ;; - esac -], []) +NUT_ARG_WITH([CCACHE_NAMESPACE], [yes|no|auto|NAMESPACE], [Whether/which ccache namespace to use for built binaries, typically 'nut:${autotools_target}'], [auto]) +AS_CASE([${nut_with_CCACHE_NAMESPACE}], + [no], [CCACHE_NAMESPACE=""], + [yes], [AS_IF([text x"${CCACHE_NAMESPACE}" = x], [AC_MSG_ERROR([--with-CCACHE_NAMESPACE can not be fulfilled on this system])])], dnl Else use user envvar or calculation above + [auto], [], dnl Use user envvar or calculation above + [CCACHE_NAMESPACE="${nut_with_CCACHE_NAMESPACE}"] +) NUT_REPORT_TARGET(CCACHE_NAMESPACE, "${CCACHE_NAMESPACE}", [ccache namespace tag (if ccache is used and new enough)]) AS_IF([test x"$CCACHE_NAMESPACE" != x -a x"$NUT_AM_MAKE_CAN_EXPORT" != x], [ AC_MSG_WARN([CCACHE_NAMESPACE setting may have no effect: this make implementation seems to not support "export VAR=VAL" syntax]) From 0bfc5c2d0840c1e8be4341da47609e62cbe3992e Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Mon, 20 Oct 2025 18:24:23 +0200 Subject: [PATCH 345/805] m4/nut_arg_with.m4: introduce NUT_ARG_WITH_LIBOPTS* [#3049] Signed-off-by: Jim Klimov --- m4/nut_arg_with.m4 | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/m4/nut_arg_with.m4 b/m4/nut_arg_with.m4 index 65a89fa777..4db7af769c 100644 --- a/m4/nut_arg_with.m4 +++ b/m4/nut_arg_with.m4 @@ -78,6 +78,35 @@ AC_DEFUN([NUT_ARG_WITH], [NUT_ARG_WITH_CUSTOM_DEFAULT_HELP([$1], [], [$2], [$3], [$3])]) ]) +dnl Special common case for *-includes and *-libs optional parameters +dnl (bracketed in help text to confer optionality) +AC_DEFUN([NUT_ARG_WITH_LIBOPTS], +[ + AC_ARG_WITH($1, + [AS_HELP_STRING([@<:@--with-$1=$2@:>@], [$3 (default: $4)])], + [AS_CASE([${withval}], + [yes|no], [AC_MSG_ERROR([invalid option --with(out)-$1 - see docs/configure.txt])], + [[nut_with_]m4_translit($1, [-], [_])="${withval}"] + )], + [[nut_with_]m4_translit($1, [-], [_])="$4"] + ) +]) + +dnl Just the (normal-cased) third-party project name is required +AC_DEFUN([NUT_ARG_WITH_LIBOPTS_INCLUDES], +[ + m4_ifval([$2], + [NUT_ARG_WITH_LIBOPTS([m4_translit($1, 'A-Z', 'a-z')-includes], [CFLAGS], [include flags for the $1 library], [$2])], + [NUT_ARG_WITH_LIBOPTS([m4_translit($1, 'A-Z', 'a-z')-includes], [CFLAGS], [include flags for the $1 library], [auto])]) +]) + +AC_DEFUN([NUT_ARG_WITH_LIBOPTS_LIBS], +[ + m4_ifval([$2], + [NUT_ARG_WITH_LIBOPTS([m4_translit($1, 'A-Z', 'a-z')-libs], [LIBS], [linker flags for the $1 library], [$2])], + [NUT_ARG_WITH_LIBOPTS([m4_translit($1, 'A-Z', 'a-z')-libs], [LIBS], [linker flags for the $1 library], [auto])]) +]) + dnl Enable a package feature/ability (might name a variant, or yes/no) dnl https://www.gnu.org/software/autoconf/manual/autoconf-2.66/html_node/Package-Options.html AC_DEFUN([NUT_ARG_ENABLE_CUSTOM_DEFAULT_HELP], From 8d39e481c5094a7320a5abc998d11e9d133bad10 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Mon, 20 Oct 2025 20:50:16 +0200 Subject: [PATCH 346/805] m4/nut_check_libavahi.m4: refactor to word the help and determine options via NUT_ARG_WITH_LIBOPTS* [#3049] Signed-off-by: Jim Klimov --- m4/nut_check_libavahi.m4 | 50 +++++++++++++--------------------------- 1 file changed, 16 insertions(+), 34 deletions(-) diff --git a/m4/nut_check_libavahi.m4 b/m4/nut_check_libavahi.m4 index 0e8782a366..a45ac4a564 100644 --- a/m4/nut_check_libavahi.m4 +++ b/m4/nut_check_libavahi.m4 @@ -36,44 +36,26 @@ if test -z "${nut_have_avahi_seen}"; then ) AC_MSG_CHECKING(for avahi cflags) - AC_ARG_WITH(avahi-includes, - AS_HELP_STRING([@<:@--with-avahi-includes=CFLAGS@:>@], [include flags for the avahi library]), - [ - case "${withval}" in - yes|no) - AC_MSG_ERROR(invalid option --with(out)-avahi-includes - see docs/configure.txt) - ;; - *) - depCFLAGS="${withval}" - ;; - esac - ], [ - AS_IF([test x"$have_PKG_CONFIG" = xyes], - [depCFLAGS="`$PKG_CONFIG --silence-errors --cflags avahi-core avahi-client 2>/dev/null`" \ - || depCFLAGS="-I/usr/local/include -I/usr/include -L/usr/local/lib -L/usr/lib"], - [depCFLAGS="-I/usr/local/include -I/usr/include -L/usr/local/lib -L/usr/lib"] - )] + NUT_ARG_WITH_LIBOPTS_INCLUDES([avahi], [auto]) + AS_CASE([${nut_with_avahi_includes}], + [auto], [AS_IF([test x"$have_PKG_CONFIG" = xyes], + [depCFLAGS="`$PKG_CONFIG --silence-errors --cflags avahi-core avahi-client 2>/dev/null`" \ + || depCFLAGS="-I/usr/local/include -I/usr/include -L/usr/local/lib -L/usr/lib"], + [depCFLAGS="-I/usr/local/include -I/usr/include -L/usr/local/lib -L/usr/lib"] + )], + [depCFLAGS="${nut_with_avahi_includes}"] ) AC_MSG_RESULT([${depCFLAGS}]) AC_MSG_CHECKING(for avahi ldflags) - AC_ARG_WITH(avahi-libs, - AS_HELP_STRING([@<:@--with-avahi-libs=LIBS@:>@], [linker flags for the avahi library]), - [ - case "${withval}" in - yes|no) - AC_MSG_ERROR(invalid option --with(out)-avahi-libs - see docs/configure.txt) - ;; - *) - depLIBS="${withval}" - ;; - esac - ], [ - AS_IF([test x"$have_PKG_CONFIG" = xyes], - [depLIBS="`$PKG_CONFIG --silence-errors --libs avahi-core avahi-client 2>/dev/null`" \ - || depLIBS="-lavahi-core -lavahi-client"], - [depLIBS="-lavahi-core -lavahi-client"] - )] + NUT_ARG_WITH_LIBOPTS_LIBS([avahi], [auto]) + AS_CASE([${nut_with_avahi_libs}], + [auto], [AS_IF([test x"$have_PKG_CONFIG" = xyes], + [depLIBS="`$PKG_CONFIG --silence-errors --libs avahi-core avahi-client 2>/dev/null`" \ + || depLIBS="-lavahi-core -lavahi-client"], + [depLIBS="-lavahi-core -lavahi-client"] + )], + [depLIBS="${nut_with_avahi_libs}"] ) AC_MSG_RESULT([${depLIBS}]) From 0c2c391d84ec35f57e06f5f40858e9773490d59b Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Tue, 21 Oct 2025 07:54:40 +0200 Subject: [PATCH 347/805] m4/nut_check_libfreeipmi.m4: refactor to word the help and determine options via NUT_ARG_WITH_LIBOPTS* [#3049] Signed-off-by: Jim Klimov --- m4/nut_check_libfreeipmi.m4 | 34 ++++++++++------------------------ 1 file changed, 10 insertions(+), 24 deletions(-) diff --git a/m4/nut_check_libfreeipmi.m4 b/m4/nut_check_libfreeipmi.m4 index 1d563013e1..fc2c00c5c8 100644 --- a/m4/nut_check_libfreeipmi.m4 +++ b/m4/nut_check_libfreeipmi.m4 @@ -45,33 +45,19 @@ if test -z "${nut_have_libfreeipmi_seen}"; then dnl allow overriding FreeIPMI settings if the user knows best AC_MSG_CHECKING(for FreeIPMI cflags) - AC_ARG_WITH(freeipmi-includes, - AS_HELP_STRING([@<:@--with-freeipmi-includes=CFLAGS@:>@], [include flags for the FreeIPMI library]), - [ - case "${withval}" in - yes|no) - AC_MSG_ERROR(invalid option --with(out)-freeipmi-includes - see docs/configure.txt) - ;; - *) - depCFLAGS="${withval}" - ;; - esac - ], []) + NUT_ARG_WITH_LIBOPTS_INCLUDES([FreeIPMI], [auto]) + AS_CASE([${nut_with_freeipmi_includes}], + [auto], [], dnl Keep what we had found above + [depCFLAGS="${nut_with_freeipmi_includes}"] + ) AC_MSG_RESULT([${depCFLAGS}]) AC_MSG_CHECKING(for FreeIPMI ldflags) - AC_ARG_WITH(freeipmi-libs, - AS_HELP_STRING([@<:@--with-freeipmi-libs=LIBS@:>@], [linker flags for the FreeIPMI library]), - [ - case "${withval}" in - yes|no) - AC_MSG_ERROR(invalid option --with(out)-freeipmi-libs - see docs/configure.txt) - ;; - *) - depLIBS="${withval}" - ;; - esac - ], []) + NUT_ARG_WITH_LIBOPTS_LIBS([FreeIPMI], [auto]) + AS_CASE([${nut_with_freeipmi_libs}], + [auto], [], dnl Keep what we had found above + [depLIBS="${nut_with_freeipmi_libs}"] + ) AC_MSG_RESULT([${depLIBS}]) dnl check if freeipmi is usable with our current flags From f84a17b462ec1f911775a8f837bf5ff963fd2d56 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Tue, 21 Oct 2025 08:33:25 +0200 Subject: [PATCH 348/805] m4/nut_arg_with.m4: rearrange NUT_ARG_WITH_LIBOPTS_INCLUDES and NUT_ARG_WITH_LIBOPTS_LIBS using renamed NUT_ARG_WITH_LIBOPTS_INVALID_YESNO; use simpler NUT_ARG_WITH_LIBOPTS for new NUT_ARG_WITH_LIBOPTS_CONFIGSCRIPT* methods [#3049] Signed-off-by: Jim Klimov --- m4/nut_arg_with.m4 | 64 +++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 60 insertions(+), 4 deletions(-) diff --git a/m4/nut_arg_with.m4 b/m4/nut_arg_with.m4 index 4db7af769c..d648e2e153 100644 --- a/m4/nut_arg_with.m4 +++ b/m4/nut_arg_with.m4 @@ -80,7 +80,17 @@ AC_DEFUN([NUT_ARG_WITH], dnl Special common case for *-includes and *-libs optional parameters dnl (bracketed in help text to confer optionality) +dnl Options same as NUT_ARG_WITH (4-arg version) AC_DEFUN([NUT_ARG_WITH_LIBOPTS], +[ + AC_ARG_WITH($1, + [AS_HELP_STRING([@<:@--with-$1=$2@:>@], [$3 (default: $4)])], + [[nut_with_]m4_translit($1, [-], [_])="${withval}"], + [[nut_with_]m4_translit($1, [-], [_])="$4"] + ) +]) + +AC_DEFUN([NUT_ARG_WITH_LIBOPTS_INVALID_YESNO], [ AC_ARG_WITH($1, [AS_HELP_STRING([@<:@--with-$1=$2@:>@], [$3 (default: $4)])], @@ -93,18 +103,64 @@ AC_DEFUN([NUT_ARG_WITH_LIBOPTS], ]) dnl Just the (normal-cased) third-party project name is required +dnl $1 project name +dnl $2 default value (optional) AC_DEFUN([NUT_ARG_WITH_LIBOPTS_INCLUDES], [ m4_ifval([$2], - [NUT_ARG_WITH_LIBOPTS([m4_translit($1, 'A-Z', 'a-z')-includes], [CFLAGS], [include flags for the $1 library], [$2])], - [NUT_ARG_WITH_LIBOPTS([m4_translit($1, 'A-Z', 'a-z')-includes], [CFLAGS], [include flags for the $1 library], [auto])]) + [NUT_ARG_WITH_LIBOPTS_INVALID_YESNO([m4_translit($1, 'A-Z', 'a-z')-includes], [CFLAGS|auto], [include flags for the $1 library], [$2])], + [NUT_ARG_WITH_LIBOPTS_INVALID_YESNO([m4_translit($1, 'A-Z', 'a-z')-includes], [CFLAGS|auto], [include flags for the $1 library], [auto])]) ]) AC_DEFUN([NUT_ARG_WITH_LIBOPTS_LIBS], [ m4_ifval([$2], - [NUT_ARG_WITH_LIBOPTS([m4_translit($1, 'A-Z', 'a-z')-libs], [LIBS], [linker flags for the $1 library], [$2])], - [NUT_ARG_WITH_LIBOPTS([m4_translit($1, 'A-Z', 'a-z')-libs], [LIBS], [linker flags for the $1 library], [auto])]) + [NUT_ARG_WITH_LIBOPTS_INVALID_YESNO([m4_translit($1, 'A-Z', 'a-z')-libs], [LIBS|auto], [linker flags for the $1 library], [$2])], + [NUT_ARG_WITH_LIBOPTS_INVALID_YESNO([m4_translit($1, 'A-Z', 'a-z')-libs], [LIBS|auto], [linker flags for the $1 library], [auto])]) +]) + +dnl Help detect legacy -config scripts, assigns "none" if disabled or not found +dnl $1 project name +dnl $2 m4 var to assign +dnl $3 program name(s) to try +dnl $4 default value +AC_DEFUN([NUT_ARG_WITH_LIBOPTS_CONFIGSCRIPT_IMPLEM], +[ + dnl By default seek in PATH + NUT_ARG_WITH_LIBOPTS([m4_translit($1, 'A-Z', 'a-z')-config], [/path/to/m4_translit($1, 'A-Z', 'a-z')-config|auto|none], [path to program that reports $1 configuration], [$4]) + AS_CASE([[${[nut_with_]]m4_translit($1, [-], [_])[[_config]}]], + [yes|auto|""], [AC_PATH_PROGS([$2], [$3], [none])], + [no|none], [$2="none"], + [$2=["${[nut_with_]]m4_translit($1, [-], [_])[[_config]}"]] + ) +]) + +dnl Part of stack, use or guess optional parameter $2 (m4 var name); pass others as is +AC_DEFUN([NUT_ARG_WITH_LIBOPTS_CONFIGSCRIPT_IMPLEM_2], +[ + m4_ifval([$2], + [NUT_ARG_WITH_LIBOPTS_CONFIGSCRIPT_IMPLEM([$1], [$2], [$3], [$4])], + [NUT_ARG_WITH_LIBOPTS_CONFIGSCRIPT_IMPLEM([$1], m4_translit(m4_translit($1, 'a-z', 'A-Z'), [-], [_])[_CONFIG], [$3], [$4])]) +]) + +dnl Part of stack, use or guess optional parameter $3 (prog names); pass others as is +AC_DEFUN([NUT_ARG_WITH_LIBOPTS_CONFIGSCRIPT_IMPLEM_3], +[ + m4_ifval([$3], + [NUT_ARG_WITH_LIBOPTS_CONFIGSCRIPT_IMPLEM_2([$1], [$2], [$3], [$4])], + [NUT_ARG_WITH_LIBOPTS_CONFIGSCRIPT_IMPLEM_2([$1], [$2], [m4_translit($1, 'A-Z', 'a-z')-config], [$4])]) +]) + +dnl Just the (normal-cased) third-party project name is required +dnl $1 project name +dnl $2 m4 var to assign (optional) +dnl $3 program name(s) to try (optional) +dnl $4 default value (optional) +AC_DEFUN([NUT_ARG_WITH_LIBOPTS_CONFIGSCRIPT], +[ + m4_ifval([$4], + [NUT_ARG_WITH_LIBOPTS_CONFIGSCRIPT_IMPLEM_3([$1], [$2], [$3], [$4])], + [NUT_ARG_WITH_LIBOPTS_CONFIGSCRIPT_IMPLEM_3([$1], [$2], [$3], [auto])]) ]) dnl Enable a package feature/ability (might name a variant, or yes/no) From ea3f0cd458066bd2cb84b3b873a4e4016e191eb2 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Tue, 21 Oct 2025 08:51:41 +0200 Subject: [PATCH 349/805] m4/nut_arg_with.m4: add NUT_ARG_WITH_LIBOPTS_LIBS_AS_LDFLAGS and NUT_ARG_WITH_LIBOPTS_LDFLAGS for cosmetic completeness [#3049] Signed-off-by: Jim Klimov --- m4/nut_arg_with.m4 | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/m4/nut_arg_with.m4 b/m4/nut_arg_with.m4 index d648e2e153..618045b97b 100644 --- a/m4/nut_arg_with.m4 +++ b/m4/nut_arg_with.m4 @@ -112,6 +112,8 @@ AC_DEFUN([NUT_ARG_WITH_LIBOPTS_INCLUDES], [NUT_ARG_WITH_LIBOPTS_INVALID_YESNO([m4_translit($1, 'A-Z', 'a-z')-includes], [CFLAGS|auto], [include flags for the $1 library], [auto])]) ]) +dnl Technically LIBS and LDFLAGS are about the same for +dnl most of our m4 code and legacy help messaging... so far. AC_DEFUN([NUT_ARG_WITH_LIBOPTS_LIBS], [ m4_ifval([$2], @@ -119,6 +121,20 @@ AC_DEFUN([NUT_ARG_WITH_LIBOPTS_LIBS], [NUT_ARG_WITH_LIBOPTS_INVALID_YESNO([m4_translit($1, 'A-Z', 'a-z')-libs], [LIBS|auto], [linker flags for the $1 library], [auto])]) ]) +AC_DEFUN([NUT_ARG_WITH_LIBOPTS_LIBS_AS_LDFLAGS], +[ + m4_ifval([$2], + [NUT_ARG_WITH_LIBOPTS_INVALID_YESNO([m4_translit($1, 'A-Z', 'a-z')-libs], [LDFLAGS|auto], [linker flags for the $1 library], [$2])], + [NUT_ARG_WITH_LIBOPTS_INVALID_YESNO([m4_translit($1, 'A-Z', 'a-z')-libs], [LDFLAGS|auto], [linker flags for the $1 library], [auto])]) +]) + +AC_DEFUN([NUT_ARG_WITH_LIBOPTS_LDFLAGS], +[ + m4_ifval([$2], + [NUT_ARG_WITH_LIBOPTS_INVALID_YESNO([m4_translit($1, 'A-Z', 'a-z')-ldflags], [LDFLAGS|auto], [linker flags for the $1 library], [$2])], + [NUT_ARG_WITH_LIBOPTS_INVALID_YESNO([m4_translit($1, 'A-Z', 'a-z')-ldflags], [LDFLAGS|auto], [linker flags for the $1 library], [auto])]) +]) + dnl Help detect legacy -config scripts, assigns "none" if disabled or not found dnl $1 project name dnl $2 m4 var to assign From 15eedd611d1eebf21605e5373e3d3d8986812d71 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Tue, 21 Oct 2025 08:53:09 +0200 Subject: [PATCH 350/805] m4/nut_check_libgd.m4: refactor to word the help and determine options via NUT_ARG_WITH_LIBOPTS* [#3049] Signed-off-by: Jim Klimov --- m4/nut_check_libgd.m4 | 56 ++++++++++++------------------------------- 1 file changed, 15 insertions(+), 41 deletions(-) diff --git a/m4/nut_check_libgd.m4 b/m4/nut_check_libgd.m4 index 74c77f3f66..c51eeeb9bd 100644 --- a/m4/nut_check_libgd.m4 +++ b/m4/nut_check_libgd.m4 @@ -47,22 +47,8 @@ if test -z "${nut_have_libgd_seen}"; then depLDFLAGS="-L/usr/X11R6/lib" depLIBS="-lgd -lpng -lz -ljpeg -lfreetype -lm -lXpm -lX11" - dnl By default seek in PATH - AC_PATH_PROGS([GDLIB_CONFIG], [gdlib-config], [none]) - AC_ARG_WITH(gdlib-config, - AS_HELP_STRING([@<:@--with-gdlib-config=/path/to/gdlib-config@:>@], - [path to program that reports GDLIB configuration]), - [ - case "${withval}" in - "") ;; - yes|no) - AC_MSG_ERROR(invalid option --with(out)-gdlib-config - see docs/configure.txt) - ;; - *) - GDLIB_CONFIG="${withval}" - ;; - esac - ]) + dnl Define --with-gdlib-config option + NUT_ARG_WITH_LIBOPTS_CONFIGSCRIPT([GDLIB]) AS_IF([test x"$GDLIB_CONFIG" != xnone], [AC_MSG_CHECKING(for gd version via ${GDLIB_CONFIG}) @@ -91,35 +77,23 @@ if test -z "${nut_have_libgd_seen}"; then ) dnl Now allow overriding gd settings if the user knows best + dnl (note not "GDLIB" as referenced above for config script) AC_MSG_CHECKING(for gd include flags) - AC_ARG_WITH(gd-includes, - AS_HELP_STRING([@<:@--with-gd-includes=CFLAGS@:>@], [include flags for the gd library]), - [ - case "${withval}" in - yes|no) - AC_MSG_ERROR(invalid option --with(out)-gd-includes - see docs/configure.txt) - ;; - *) - depCFLAGS="${withval}" - ;; - esac - ], []) + NUT_ARG_WITH_LIBOPTS_INCLUDES([gd], [auto]) + AS_CASE([${nut_with_gd_includes}], + [auto], [], dnl Keep what we had found above + [depCFLAGS="${nut_with_gd_includes}"] + ) AC_MSG_RESULT([${depCFLAGS}]) + dnl Technically, here we seek LDFLAGS not LIBS... AC_MSG_CHECKING(for gd library flags) - AC_ARG_WITH(gd-libs, - AS_HELP_STRING([@<:@--with-gd-libs=LDFLAGS@:>@], [linker flags for the gd library]), - [ - case "${withval}" in - yes|no) - AC_MSG_ERROR(invalid option --with(out)-gd-libs - see docs/configure.txt) - ;; - *) - depLDFLAGS="${withval}" - depLIBS="" - ;; - esac - ], []) + NUT_ARG_WITH_LIBOPTS_LIBS_AS_LDFLAGS([gd], [auto]) + AS_CASE([${nut_with_gd_libs}], + [auto], [], dnl Keep what we had found above + [depLDFLAGS="${nut_with_gd_libs}" + depLIBS=""] + ) AC_MSG_RESULT([${depLDFLAGS} ${depLIBS}]) dnl check if gd is usable From 8a97685ed8b25d0329baaf90028b48ad0b53836c Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Tue, 21 Oct 2025 11:40:06 +0200 Subject: [PATCH 351/805] configure.ac: rephrase help for (alt)pidpath [#3049] Signed-off-by: Jim Klimov --- configure.ac | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index 5c8e0d13c9..4d600de53b 100644 --- a/configure.ac +++ b/configure.ac @@ -4565,7 +4565,7 @@ dnl able to write there. dnl AC_MSG_CHECKING(if requested alt pid path) -NUT_ARG_WITH_EXPAND_DEFAULT_HELP_SINGLEQUOTE([altpidpath], [DIRPATH], [path for NUT driver/upsd .pid files not running as root], [\${STATEPATH}]) +NUT_ARG_WITH_EXPAND_DEFAULT_HELP_SINGLEQUOTE([altpidpath], [DIRPATH], [Path for .pid files of NUT driver/upsd not running as root], [\${STATEPATH}]) AS_CASE([${nut_with_altpidpath}], [yes|no|""], [AC_MSG_ERROR(invalid option --with(out)-altpidpath - see docs/configure.txt)], @@ -4584,7 +4584,7 @@ dnl Recommended: a sub-directory of (/var)/run as long as we can create dnl and chown+chmod it before starting NUT daemons. AC_MSG_CHECKING(if requested pidpath) -NUT_ARG_WITH_CUSTOM_DEFAULT_HELP([pidpath], [DIRPATH], [Path for root-owned .pid files], [auto], [platform-dependent, usually m4nut_DEFAULT_PIDPATH]) +NUT_ARG_WITH_CUSTOM_DEFAULT_HELP([pidpath], [DIRPATH], [Path for root-owned NUT process .pid files], [auto], [platform-dependent, usually m4nut_DEFAULT_PIDPATH]) AS_CASE([${nut_with_pidpath}], [yes|no|""], [AC_MSG_ERROR(invalid option --with(out)-pidpath - see docs/configure.txt)], From a48e841d7e63207395941d20efbfbf200a5e68c4 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Tue, 21 Oct 2025 11:43:26 +0200 Subject: [PATCH 352/805] m4/nut_arg_with.m4: extend NUT_ARG_WITH_LIBOPTS* with optional alternate spelling of project name for help text [#3049] Signed-off-by: Jim Klimov --- m4/nut_arg_with.m4 | 37 ++++++++++++++++++++++--------------- 1 file changed, 22 insertions(+), 15 deletions(-) diff --git a/m4/nut_arg_with.m4 b/m4/nut_arg_with.m4 index 618045b97b..e0a9b0982d 100644 --- a/m4/nut_arg_with.m4 +++ b/m4/nut_arg_with.m4 @@ -102,14 +102,19 @@ AC_DEFUN([NUT_ARG_WITH_LIBOPTS_INVALID_YESNO], ) ]) +dnl NOTE: The defaulting substituter may be not defined/renamed in some autoconf versions +dnl m4_ifndef([m4_default], [m4_define([m4_default], [m4_ifval([[$1]], [[$1]], [[$2]])])]) + dnl Just the (normal-cased) third-party project name is required dnl $1 project name dnl $2 default value (optional) +dnl $3 project name spelling for help message (very optional) + AC_DEFUN([NUT_ARG_WITH_LIBOPTS_INCLUDES], [ m4_ifval([$2], - [NUT_ARG_WITH_LIBOPTS_INVALID_YESNO([m4_translit($1, 'A-Z', 'a-z')-includes], [CFLAGS|auto], [include flags for the $1 library], [$2])], - [NUT_ARG_WITH_LIBOPTS_INVALID_YESNO([m4_translit($1, 'A-Z', 'a-z')-includes], [CFLAGS|auto], [include flags for the $1 library], [auto])]) + [NUT_ARG_WITH_LIBOPTS_INVALID_YESNO([m4_translit($1, 'A-Z', 'a-z')-includes], [CFLAGS|auto], [include flags for the ]m4_default($3, $1)[ library], [$2])], + [NUT_ARG_WITH_LIBOPTS_INVALID_YESNO([m4_translit($1, 'A-Z', 'a-z')-includes], [CFLAGS|auto], [include flags for the ]m4_default($3, $1)[ library], [auto])]) ]) dnl Technically LIBS and LDFLAGS are about the same for @@ -117,22 +122,22 @@ dnl most of our m4 code and legacy help messaging... so far. AC_DEFUN([NUT_ARG_WITH_LIBOPTS_LIBS], [ m4_ifval([$2], - [NUT_ARG_WITH_LIBOPTS_INVALID_YESNO([m4_translit($1, 'A-Z', 'a-z')-libs], [LIBS|auto], [linker flags for the $1 library], [$2])], - [NUT_ARG_WITH_LIBOPTS_INVALID_YESNO([m4_translit($1, 'A-Z', 'a-z')-libs], [LIBS|auto], [linker flags for the $1 library], [auto])]) + [NUT_ARG_WITH_LIBOPTS_INVALID_YESNO([m4_translit($1, 'A-Z', 'a-z')-libs], [LIBS|auto], [linker flags for the ]m4_default($3, $1)[ library], [$2])], + [NUT_ARG_WITH_LIBOPTS_INVALID_YESNO([m4_translit($1, 'A-Z', 'a-z')-libs], [LIBS|auto], [linker flags for the ]m4_default($3, $1)[ library], [auto])]) ]) AC_DEFUN([NUT_ARG_WITH_LIBOPTS_LIBS_AS_LDFLAGS], [ m4_ifval([$2], - [NUT_ARG_WITH_LIBOPTS_INVALID_YESNO([m4_translit($1, 'A-Z', 'a-z')-libs], [LDFLAGS|auto], [linker flags for the $1 library], [$2])], - [NUT_ARG_WITH_LIBOPTS_INVALID_YESNO([m4_translit($1, 'A-Z', 'a-z')-libs], [LDFLAGS|auto], [linker flags for the $1 library], [auto])]) + [NUT_ARG_WITH_LIBOPTS_INVALID_YESNO([m4_translit($1, 'A-Z', 'a-z')-libs], [LDFLAGS|auto], [linker flags for the ]m4_default($3, $1)[ library], [$2])], + [NUT_ARG_WITH_LIBOPTS_INVALID_YESNO([m4_translit($1, 'A-Z', 'a-z')-libs], [LDFLAGS|auto], [linker flags for the ]m4_default($3, $1)[ library], [auto])]) ]) AC_DEFUN([NUT_ARG_WITH_LIBOPTS_LDFLAGS], [ m4_ifval([$2], - [NUT_ARG_WITH_LIBOPTS_INVALID_YESNO([m4_translit($1, 'A-Z', 'a-z')-ldflags], [LDFLAGS|auto], [linker flags for the $1 library], [$2])], - [NUT_ARG_WITH_LIBOPTS_INVALID_YESNO([m4_translit($1, 'A-Z', 'a-z')-ldflags], [LDFLAGS|auto], [linker flags for the $1 library], [auto])]) + [NUT_ARG_WITH_LIBOPTS_INVALID_YESNO([m4_translit($1, 'A-Z', 'a-z')-ldflags], [LDFLAGS|auto], [linker flags for the ]m4_default($3, $1)[ library], [$2])], + [NUT_ARG_WITH_LIBOPTS_INVALID_YESNO([m4_translit($1, 'A-Z', 'a-z')-ldflags], [LDFLAGS|auto], [linker flags for the ]m4_default($3, $1)[ library], [auto])]) ]) dnl Help detect legacy -config scripts, assigns "none" if disabled or not found @@ -140,10 +145,11 @@ dnl $1 project name dnl $2 m4 var to assign dnl $3 program name(s) to try dnl $4 default value +dnl $5 project name spelling for help message (very optional) AC_DEFUN([NUT_ARG_WITH_LIBOPTS_CONFIGSCRIPT_IMPLEM], [ dnl By default seek in PATH - NUT_ARG_WITH_LIBOPTS([m4_translit($1, 'A-Z', 'a-z')-config], [/path/to/m4_translit($1, 'A-Z', 'a-z')-config|auto|none], [path to program that reports $1 configuration], [$4]) + NUT_ARG_WITH_LIBOPTS([m4_translit($1, 'A-Z', 'a-z')-config], [/path/to/m4_translit($1, 'A-Z', 'a-z')-config|auto|none], [path to program that reports ]m4_default($5, $1)[ configuration], [$4]) AS_CASE([[${[nut_with_]]m4_translit($1, [-], [_])[[_config]}]], [yes|auto|""], [AC_PATH_PROGS([$2], [$3], [none])], [no|none], [$2="none"], @@ -155,16 +161,16 @@ dnl Part of stack, use or guess optional parameter $2 (m4 var name); pass others AC_DEFUN([NUT_ARG_WITH_LIBOPTS_CONFIGSCRIPT_IMPLEM_2], [ m4_ifval([$2], - [NUT_ARG_WITH_LIBOPTS_CONFIGSCRIPT_IMPLEM([$1], [$2], [$3], [$4])], - [NUT_ARG_WITH_LIBOPTS_CONFIGSCRIPT_IMPLEM([$1], m4_translit(m4_translit($1, 'a-z', 'A-Z'), [-], [_])[_CONFIG], [$3], [$4])]) + [NUT_ARG_WITH_LIBOPTS_CONFIGSCRIPT_IMPLEM([$1], [$2], [$3], [$4], [$5])], + [NUT_ARG_WITH_LIBOPTS_CONFIGSCRIPT_IMPLEM([$1], m4_translit(m4_translit($1, 'a-z', 'A-Z'), [-], [_])[_CONFIG], [$3], [$4], [$5])]) ]) dnl Part of stack, use or guess optional parameter $3 (prog names); pass others as is AC_DEFUN([NUT_ARG_WITH_LIBOPTS_CONFIGSCRIPT_IMPLEM_3], [ m4_ifval([$3], - [NUT_ARG_WITH_LIBOPTS_CONFIGSCRIPT_IMPLEM_2([$1], [$2], [$3], [$4])], - [NUT_ARG_WITH_LIBOPTS_CONFIGSCRIPT_IMPLEM_2([$1], [$2], [m4_translit($1, 'A-Z', 'a-z')-config], [$4])]) + [NUT_ARG_WITH_LIBOPTS_CONFIGSCRIPT_IMPLEM_2([$1], [$2], [$3], [$4], [$5])], + [NUT_ARG_WITH_LIBOPTS_CONFIGSCRIPT_IMPLEM_2([$1], [$2], [m4_translit($1, 'A-Z', 'a-z')-config], [$4], [$5])]) ]) dnl Just the (normal-cased) third-party project name is required @@ -172,11 +178,12 @@ dnl $1 project name dnl $2 m4 var to assign (optional) dnl $3 program name(s) to try (optional) dnl $4 default value (optional) +dnl $5 project name spelling for help message (very optional) AC_DEFUN([NUT_ARG_WITH_LIBOPTS_CONFIGSCRIPT], [ m4_ifval([$4], - [NUT_ARG_WITH_LIBOPTS_CONFIGSCRIPT_IMPLEM_3([$1], [$2], [$3], [$4])], - [NUT_ARG_WITH_LIBOPTS_CONFIGSCRIPT_IMPLEM_3([$1], [$2], [$3], [auto])]) + [NUT_ARG_WITH_LIBOPTS_CONFIGSCRIPT_IMPLEM_3([$1], [$2], [$3], [$4], [$5])], + [NUT_ARG_WITH_LIBOPTS_CONFIGSCRIPT_IMPLEM_3([$1], [$2], [$3], [auto], [$5])]) ]) dnl Enable a package feature/ability (might name a variant, or yes/no) From 22be20882aa2ebca814fa88da327aab3f4052fae Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Tue, 21 Oct 2025 11:43:43 +0200 Subject: [PATCH 353/805] m4/nut_check_libgpiod.m4: refactor to word the help and determine options via NUT_ARG_WITH_LIBOPTS* [#3049] Signed-off-by: Jim Klimov --- m4/nut_check_libgpiod.m4 | 52 ++++++++++++++-------------------------- 1 file changed, 18 insertions(+), 34 deletions(-) diff --git a/m4/nut_check_libgpiod.m4 b/m4/nut_check_libgpiod.m4 index daf4100325..84c4d1fa44 100644 --- a/m4/nut_check_libgpiod.m4 +++ b/m4/nut_check_libgpiod.m4 @@ -39,44 +39,28 @@ if test -z "${nut_have_gpio_seen}"; then ) AC_MSG_CHECKING(for libgpiod cflags) - AC_ARG_WITH(gpio-includes, - AS_HELP_STRING([@<:@--with-gpio-includes=CFLAGS@:>@], [include flags for the gpiod library]), - [ - case "${withval}" in - yes|no) - AC_MSG_ERROR(invalid option --with(out)-gpio-includes - see docs/configure.txt) - ;; - *) - depCFLAGS="${withval}" - ;; - esac - ], [ - AS_IF([test x"$have_PKG_CONFIG" = xyes], - [depCFLAGS="`$PKG_CONFIG --silence-errors --cflags libgpiod 2>/dev/null`" \ - || depCFLAGS="-I/usr/include -I/usr/local/include"], - [depCFLAGS="-I/usr/include -I/usr/local/include"] - )] + NUT_ARG_WITH_LIBOPTS_INCLUDES([gpio], [auto], [gpiod]) + AS_CASE([${nut_with_gpio_includes}], + [auto], [ + AS_IF([test x"$have_PKG_CONFIG" = xyes], + [depCFLAGS="`$PKG_CONFIG --silence-errors --cflags libgpiod 2>/dev/null`" \ + || depCFLAGS="-I/usr/include -I/usr/local/include"], + [depCFLAGS="-I/usr/include -I/usr/local/include"] + )], + [depCFLAGS="${nut_with_gpio_includes}"] ) AC_MSG_RESULT([${depCFLAGS}]) AC_MSG_CHECKING(for libgpiod ldflags) - AC_ARG_WITH(gpio-libs, - AS_HELP_STRING([@<:@--with-gpio-libs=LIBS@:>@], [linker flags for the gpiod library]), - [ - case "${withval}" in - yes|no) - AC_MSG_ERROR(invalid option --with(out)-gpio-libs - see docs/configure.txt) - ;; - *) - depLIBS="${withval}" - ;; - esac - ], [ - AS_IF([test x"$have_PKG_CONFIG" = xyes], - [depLIBS="`$PKG_CONFIG --silence-errors --libs libgpiod 2>/dev/null`" \ - || depLIBS="-lgpiod"], - [depLIBS="-lgpiod"] - )] + NUT_ARG_WITH_LIBOPTS_LIBS([gpio], [auto], [gpiod]) + AS_CASE([${nut_with_gpio_libs}], + [auto], [ + AS_IF([test x"$have_PKG_CONFIG" = xyes], + [depLIBS="`$PKG_CONFIG --silence-errors --libs libgpiod 2>/dev/null`" \ + || depLIBS="-lgpiod"], + [depLIBS="-lgpiod"] + )], + [depLIBS="${nut_with_gpio_libs}"] ) AC_MSG_RESULT([${depLIBS}]) From 9eba1eb885e9d29f3d8ecef7637010899661cb54 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Tue, 21 Oct 2025 12:32:25 +0200 Subject: [PATCH 354/805] m4/nut_arg_with.m4: simplify with use of m4_default() [#3049] Signed-off-by: Jim Klimov --- m4/nut_arg_with.m4 | 60 +++++++++++----------------------------------- 1 file changed, 14 insertions(+), 46 deletions(-) diff --git a/m4/nut_arg_with.m4 b/m4/nut_arg_with.m4 index e0a9b0982d..5da96ef14f 100644 --- a/m4/nut_arg_with.m4 +++ b/m4/nut_arg_with.m4 @@ -41,12 +41,8 @@ dnl $5 how to represent default in help text (for *_CUSTOM_DEFAULT_HELP) AC_DEFUN([NUT_ARG_WITH_CUSTOM_DEFAULT_HELP], [ AC_ARG_WITH($1, m4_ifval([$2], - [m4_ifval([$5], - [AS_HELP_STRING([--with-$1=$2], [$3 (default: $5)])], - [AS_HELP_STRING([--with-$1=$2], [$3 (default: $4)])])], - [m4_ifval([$5], - [AS_HELP_STRING([--with-$1], [$3 (default: $5)])], - [AS_HELP_STRING([--with-$1], [$3 (default: $4)])])]), + [AS_HELP_STRING([--with-$1=$2], [$3 (default: ]m4_default($5, $4)[)])], + [AS_HELP_STRING([--with-$1], [$3 (default: ]m4_default($5, $4)[)])]), [[nut_with_]m4_translit($1, [-], [_])="${withval}"], [[nut_with_]m4_translit($1, [-], [_])="$4"] ) @@ -102,9 +98,6 @@ AC_DEFUN([NUT_ARG_WITH_LIBOPTS_INVALID_YESNO], ) ]) -dnl NOTE: The defaulting substituter may be not defined/renamed in some autoconf versions -dnl m4_ifndef([m4_default], [m4_define([m4_default], [m4_ifval([[$1]], [[$1]], [[$2]])])]) - dnl Just the (normal-cased) third-party project name is required dnl $1 project name dnl $2 default value (optional) @@ -112,32 +105,24 @@ dnl $3 project name spelling for help message (very optional) AC_DEFUN([NUT_ARG_WITH_LIBOPTS_INCLUDES], [ - m4_ifval([$2], - [NUT_ARG_WITH_LIBOPTS_INVALID_YESNO([m4_translit($1, 'A-Z', 'a-z')-includes], [CFLAGS|auto], [include flags for the ]m4_default($3, $1)[ library], [$2])], - [NUT_ARG_WITH_LIBOPTS_INVALID_YESNO([m4_translit($1, 'A-Z', 'a-z')-includes], [CFLAGS|auto], [include flags for the ]m4_default($3, $1)[ library], [auto])]) + NUT_ARG_WITH_LIBOPTS_INVALID_YESNO([m4_translit($1, 'A-Z', 'a-z')-includes], [CFLAGS|auto], [include flags for the ]m4_default($3, $1)[ library], m4_default([$2], [auto])) ]) dnl Technically LIBS and LDFLAGS are about the same for dnl most of our m4 code and legacy help messaging... so far. AC_DEFUN([NUT_ARG_WITH_LIBOPTS_LIBS], [ - m4_ifval([$2], - [NUT_ARG_WITH_LIBOPTS_INVALID_YESNO([m4_translit($1, 'A-Z', 'a-z')-libs], [LIBS|auto], [linker flags for the ]m4_default($3, $1)[ library], [$2])], - [NUT_ARG_WITH_LIBOPTS_INVALID_YESNO([m4_translit($1, 'A-Z', 'a-z')-libs], [LIBS|auto], [linker flags for the ]m4_default($3, $1)[ library], [auto])]) + NUT_ARG_WITH_LIBOPTS_INVALID_YESNO([m4_translit($1, 'A-Z', 'a-z')-libs], [LIBS|auto], [linker flags for the ]m4_default($3, $1)[ library], m4_default([$2], [auto])) ]) AC_DEFUN([NUT_ARG_WITH_LIBOPTS_LIBS_AS_LDFLAGS], [ - m4_ifval([$2], - [NUT_ARG_WITH_LIBOPTS_INVALID_YESNO([m4_translit($1, 'A-Z', 'a-z')-libs], [LDFLAGS|auto], [linker flags for the ]m4_default($3, $1)[ library], [$2])], - [NUT_ARG_WITH_LIBOPTS_INVALID_YESNO([m4_translit($1, 'A-Z', 'a-z')-libs], [LDFLAGS|auto], [linker flags for the ]m4_default($3, $1)[ library], [auto])]) + NUT_ARG_WITH_LIBOPTS_INVALID_YESNO([m4_translit($1, 'A-Z', 'a-z')-libs], [LDFLAGS|auto], [linker flags for the ]m4_default($3, $1)[ library], m4_default([$2], [auto])) ]) AC_DEFUN([NUT_ARG_WITH_LIBOPTS_LDFLAGS], [ - m4_ifval([$2], - [NUT_ARG_WITH_LIBOPTS_INVALID_YESNO([m4_translit($1, 'A-Z', 'a-z')-ldflags], [LDFLAGS|auto], [linker flags for the ]m4_default($3, $1)[ library], [$2])], - [NUT_ARG_WITH_LIBOPTS_INVALID_YESNO([m4_translit($1, 'A-Z', 'a-z')-ldflags], [LDFLAGS|auto], [linker flags for the ]m4_default($3, $1)[ library], [auto])]) + NUT_ARG_WITH_LIBOPTS_INVALID_YESNO([m4_translit($1, 'A-Z', 'a-z')-ldflags], [LDFLAGS|auto], [linker flags for the ]m4_default($3, $1)[ library], m4_default([$2], [auto])) ]) dnl Help detect legacy -config scripts, assigns "none" if disabled or not found @@ -157,22 +142,6 @@ AC_DEFUN([NUT_ARG_WITH_LIBOPTS_CONFIGSCRIPT_IMPLEM], ) ]) -dnl Part of stack, use or guess optional parameter $2 (m4 var name); pass others as is -AC_DEFUN([NUT_ARG_WITH_LIBOPTS_CONFIGSCRIPT_IMPLEM_2], -[ - m4_ifval([$2], - [NUT_ARG_WITH_LIBOPTS_CONFIGSCRIPT_IMPLEM([$1], [$2], [$3], [$4], [$5])], - [NUT_ARG_WITH_LIBOPTS_CONFIGSCRIPT_IMPLEM([$1], m4_translit(m4_translit($1, 'a-z', 'A-Z'), [-], [_])[_CONFIG], [$3], [$4], [$5])]) -]) - -dnl Part of stack, use or guess optional parameter $3 (prog names); pass others as is -AC_DEFUN([NUT_ARG_WITH_LIBOPTS_CONFIGSCRIPT_IMPLEM_3], -[ - m4_ifval([$3], - [NUT_ARG_WITH_LIBOPTS_CONFIGSCRIPT_IMPLEM_2([$1], [$2], [$3], [$4], [$5])], - [NUT_ARG_WITH_LIBOPTS_CONFIGSCRIPT_IMPLEM_2([$1], [$2], [m4_translit($1, 'A-Z', 'a-z')-config], [$4], [$5])]) -]) - dnl Just the (normal-cased) third-party project name is required dnl $1 project name dnl $2 m4 var to assign (optional) @@ -181,9 +150,12 @@ dnl $4 default value (optional) dnl $5 project name spelling for help message (very optional) AC_DEFUN([NUT_ARG_WITH_LIBOPTS_CONFIGSCRIPT], [ - m4_ifval([$4], - [NUT_ARG_WITH_LIBOPTS_CONFIGSCRIPT_IMPLEM_3([$1], [$2], [$3], [$4], [$5])], - [NUT_ARG_WITH_LIBOPTS_CONFIGSCRIPT_IMPLEM_3([$1], [$2], [$3], [auto], [$5])]) + NUT_ARG_WITH_LIBOPTS_CONFIGSCRIPT_IMPLEM([$1], + m4_default([$2], m4_translit(m4_translit([$1], 'a-z', 'A-Z'), [-], [_])[_CONFIG]), + m4_default([$3], [m4_translit($1, 'A-Z', 'a-z')-config]), + m4_default([$4], [auto]), + [$5] + ) ]) dnl Enable a package feature/ability (might name a variant, or yes/no) @@ -191,12 +163,8 @@ dnl https://www.gnu.org/software/autoconf/manual/autoconf-2.66/html_node/Package AC_DEFUN([NUT_ARG_ENABLE_CUSTOM_DEFAULT_HELP], [ AC_ARG_ENABLE($1, m4_ifval([$2], - [m4_ifval([$5], - [AS_HELP_STRING([--enable-$1=$2], [$3 (default: $5)])], - [AS_HELP_STRING([--enable-$1=$2], [$3 (default: $4)])])], - [m4_ifval([$5], - [AS_HELP_STRING([--enable-$1], [$3 (default: $5)])], - [AS_HELP_STRING([--enable-$1], [$3 (default: $4)])])]), + [AS_HELP_STRING([--enable-$1=$2], [$3 (default: ]m4_default($5, $4)[)])], + [AS_HELP_STRING([--enable-$1], [$3 (default: ]m4_default($5, $4)[)])]), [[nut_enable_]m4_translit($1, [-], [_])="${enableval}"], [[nut_enable_]m4_translit($1, [-], [_])="$4"] ) From ad89aa8898a46a1488d6499fb7835333f6a7f2e5 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Tue, 21 Oct 2025 13:58:00 +0200 Subject: [PATCH 355/805] configure.ac, scripts/devd/README.adoc: revise help and doc regarding FreeBSD devd snippet file installation Signed-off-by: Jim Klimov --- configure.ac | 4 ++-- scripts/devd/README.adoc | 4 +++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/configure.ac b/configure.ac index 4d600de53b..8940b76a17 100644 --- a/configure.ac +++ b/configure.ac @@ -5544,8 +5544,8 @@ AM_CONDITIONAL(WITH_UDEV, test -n "${udevdir}") dnl FreeBSD devd support dnl Note: initial udevdir value, empty or not, was determined far above -AC_MSG_CHECKING(whether to install FreeBSD devd.conf file) -NUT_ARG_WITH([devd-dir], [(DIRPATH|yes|no|auto)], [Whether/where to install devd.conf file, typically /usr/local/etc/devd or /etc/devd], [auto]) +AC_MSG_CHECKING(whether to install FreeBSD devd nut-usb.conf file) +NUT_ARG_WITH([devd-dir], [(DIRPATH|yes|no|auto)], [Whether/where to install devd snippet nut-usb.conf file, typically /usr/local/etc/devd or /etc/devd], [auto]) AS_CASE([${nut_with_devd_dir}], [yes], dnl Typically /usr/local/etc/devd or /etc/devd diff --git a/scripts/devd/README.adoc b/scripts/devd/README.adoc index baefb3a9fa..ff960c3cb8 100644 --- a/scripts/devd/README.adoc +++ b/scripts/devd/README.adoc @@ -5,7 +5,9 @@ On FreeBSD, the `devd` subsystem has a similar role to `udev` on Linux. NOTE: Some FreeBSD based systems rely on "quirks" instead. -The `devd.conf` file defines actions to perform when devices are plugged in. +The `(/etc/)devd.conf` file defines actions to perform when devices are plugged +in, and usually refers to directories like `/etc/devd` and `/usr/local/etc/devd` +where additional configuration files can be placed. The `tools/nut-usbinfo.pl` script (under NUT source tree root) generates the `nut-usb.conf.in` here by processing USB macros in all of the drivers. From f83c876b00dad2317ad20379e125ebdc13d2ba1c Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Tue, 21 Oct 2025 14:00:13 +0200 Subject: [PATCH 356/805] configure.ac, NEWS.adoc: there was never a scripts/devd/nut-usbups.rules.in (probably a copy-paste typo in NUT v2.8.0) Signed-off-by: Jim Klimov --- NEWS.adoc | 3 +++ configure.ac | 8 ++++---- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/NEWS.adoc b/NEWS.adoc index 69a27adc3e..5a92355ac7 100644 --- a/NEWS.adoc +++ b/NEWS.adoc @@ -180,6 +180,9 @@ several `FSD` notifications into one executed action. [PR #3097] it), if not bundling with NUT-Monitor UI app. By default the respective interpreter's 'site-packages' or 'dist-packages' location will be used, so you may have to adjust search paths for any other values. [#3062] + * Automatic `--with-devd` could not detect the need to install a FreeBSD + devd configuration snippet file, because it expected a source that should + not have been there (probably a copy-paste typo in NUT v2.8.0). - Fixed CI recipes for PyPI publication of PyNUT(Client) module to also include the source distribution (was posted for NUT v2.8.1 and v2.8.2 diff --git a/configure.ac b/configure.ac index 8940b76a17..d6184b664a 100644 --- a/configure.ac +++ b/configure.ac @@ -5553,14 +5553,14 @@ AS_CASE([${nut_with_devd_dir}], AC_MSG_RESULT(no) AC_MSG_ERROR([devd directory requested but not found]) fi - if test "${nut_with_usb}" = yes && test ! -s scripts/devd/nut-usbups.rules.in -o ! -s scripts/devd/nut-usb.conf.in ; then + if test "${nut_with_usb}" = yes && test ! -s scripts/devd/nut-usb.conf.in ; then AC_MSG_RESULT(no) - AC_MSG_ERROR([devd directory and USB driver support requested but non-trivial scripts/devd/nut-usbups.rules.in and scripts/devd/nut-usb.conf.in were not provided by autogen.sh or dist archive]) + AC_MSG_ERROR([devd directory and USB driver support requested but non-trivial scripts/devd/nut-usb.conf.in was not provided by autogen.sh or dist archive]) fi ], [auto], - [if test "${nut_with_usb}" = yes && test ! -s scripts/devd/nut-usbups.rules.in -o ! -s scripts/devd/nut-usb.conf.in ; then - AC_MSG_WARN([devd directory skipped because non-trivial scripts/devd/nut-usbups.rules.in and scripts/devd/nut-usb.conf.in were not provided by autogen.sh or dist archive]) + [if test "${nut_with_usb}" = yes && test ! -s scripts/devd/nut-usb.conf.in ; then + AC_MSG_WARN([devd directory skipped because non-trivial scripts/devd/nut-usb.conf.in was not provided by autogen.sh or dist archive]) devddir="" fi ], From 5906d8bdf9ba207c405fcf998e4ba2eb263c659c Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Tue, 21 Oct 2025 16:38:13 +0200 Subject: [PATCH 357/805] m4/nut_check_libltdl.m4: refactor to word the help and determine options via NUT_ARG_WITH_LIBOPTS* [#3049] Signed-off-by: Jim Klimov --- m4/nut_check_libltdl.m4 | 41 ++++++++++++++--------------------------- 1 file changed, 14 insertions(+), 27 deletions(-) diff --git a/m4/nut_check_libltdl.m4 b/m4/nut_check_libltdl.m4 index 6f3afe261c..5fe95ee17c 100644 --- a/m4/nut_check_libltdl.m4 +++ b/m4/nut_check_libltdl.m4 @@ -20,36 +20,23 @@ if test -z "${nut_have_libltdl_seen}"; then myCFLAGS="" AC_MSG_CHECKING(for libltdl cflags) - AC_ARG_WITH(libltdl-includes, - AS_HELP_STRING([@<:@--with-libltdl-includes=CFLAGS@:>@], [include flags for the libltdl library]), - [ - case "${withval}" in - yes|no) - AC_MSG_ERROR(invalid option --with(out)-libltdl-includes - see docs/configure.txt) - ;; - *) - depCFLAGS="${withval}" - ;; - esac - ], [dnl Best-Effort Fallback (LDFLAGS might make more sense for -L..., - dnl but other m4's have it so) to use if probe below fails: - myCFLAGS="-I/usr/local/include -I/usr/include -L/usr/local/lib -L/usr/lib" - ]) + NUT_ARG_WITH_LIBOPTS_INCLUDES([libltdl], [auto]) + AS_CASE([${nut_with_libltdl_includes}], + [auto], [ + dnl Best-Effort Fallback (LDFLAGS might make more sense for -L..., + dnl but other m4 files have it so) to use if probe below fails: + myCFLAGS="-I/usr/local/include -I/usr/include -L/usr/local/lib -L/usr/lib" + ], + [depCFLAGS="${nut_with_libltdl_includes}"] + ) AC_MSG_RESULT([${depCFLAGS}]) AC_MSG_CHECKING(for libltdl ldflags) - AC_ARG_WITH(libltdl-libs, - AS_HELP_STRING([@<:@--with-libltdl-libs=LIBS@:>@], [linker flags for the libltdl library]), - [ - case "${withval}" in - yes|no) - AC_MSG_ERROR(invalid option --with(out)-libltdl-libs - see docs/configure.txt) - ;; - *) - depLIBS="${withval}" - ;; - esac - ], [])dnl No fallback here - we probe suitable libs below + NUT_ARG_WITH_LIBOPTS_LIBS([libltdl], [auto]) + AS_CASE([${nut_with_libltdl_libs}], + [auto], [], dnl No fallback here - we probe suitable libs below + [depLIBS="${nut_with_libltdl_libs}"] + ) AC_MSG_RESULT([${depLIBS}]) CFLAGS="${CFLAGS_ORIG} ${depCFLAGS}" From 836dfb43b542f0837f441269396f9a54d172e024 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Tue, 21 Oct 2025 16:45:34 +0200 Subject: [PATCH 358/805] m4/nut_check_libmodbus.m4: refactor to word the help and determine options via NUT_ARG_WITH_LIBOPTS* [#3049] Signed-off-by: Jim Klimov --- m4/nut_check_libmodbus.m4 | 34 ++++++++++------------------------ 1 file changed, 10 insertions(+), 24 deletions(-) diff --git a/m4/nut_check_libmodbus.m4 b/m4/nut_check_libmodbus.m4 index d7bf3f7042..bd5dce0cb8 100644 --- a/m4/nut_check_libmodbus.m4 +++ b/m4/nut_check_libmodbus.m4 @@ -40,33 +40,19 @@ if test -z "${nut_have_libmodbus_seen}"; then ) AC_MSG_CHECKING(for libmodbus cflags) - AC_ARG_WITH(modbus-includes, - AS_HELP_STRING([@<:@--with-modbus-includes=CFLAGS@:>@], [include flags for the libmodbus library]), - [ - case "${withval}" in - yes|no) - AC_MSG_ERROR(invalid option --with(out)-modbus-includes - see docs/configure.txt) - ;; - *) - depCFLAGS="${withval}" - ;; - esac - ], []) + NUT_ARG_WITH_LIBOPTS_INCLUDES([modbus], [auto], [libmodbus]) + AS_CASE([${nut_with_modbus_includes}], + [auto], [], dnl Keep what we had found above + [depCFLAGS="${nut_with_modbus_includes}"] + ) AC_MSG_RESULT([${depCFLAGS}]) AC_MSG_CHECKING(for libmodbus ldflags) - AC_ARG_WITH(modbus-libs, - AS_HELP_STRING([@<:@--with-modbus-libs=LIBS@:>@], [linker flags for the libmodbus library]), - [ - case "${withval}" in - yes|no) - AC_MSG_ERROR(invalid option --with(out)-modbus-libs - see docs/configure.txt) - ;; - *) - depLIBS="${withval}" - ;; - esac - ], []) + NUT_ARG_WITH_LIBOPTS_LIBS([modbus], [auto], [libmodbus]) + AS_CASE([${nut_with_modbus_libs}], + [auto], [], dnl Keep what we had found above + [depLIBS="${nut_with_modbus_libs}"] + ) AC_MSG_RESULT([${depLIBS}]) dnl check if libmodbus is usable From 6b81c8722d9487d0b9884b386d6ef23abbb90a44 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Tue, 21 Oct 2025 16:48:59 +0200 Subject: [PATCH 359/805] m4/nut_check_libneon.m4: refactor to word the help and determine options via NUT_ARG_WITH_LIBOPTS* [#3049] Signed-off-by: Jim Klimov --- m4/nut_check_libneon.m4 | 50 +++++++++++++---------------------------- 1 file changed, 16 insertions(+), 34 deletions(-) diff --git a/m4/nut_check_libneon.m4 b/m4/nut_check_libneon.m4 index a20d8328fb..15f2830c71 100644 --- a/m4/nut_check_libneon.m4 +++ b/m4/nut_check_libneon.m4 @@ -34,44 +34,26 @@ if test -z "${nut_have_neon_seen}"; then ) AC_MSG_CHECKING(for libneon cflags) - AC_ARG_WITH(neon-includes, - AS_HELP_STRING([@<:@--with-neon-includes=CFLAGS@:>@], [include flags for the neon library]), - [ - case "${withval}" in - yes|no) - AC_MSG_ERROR(invalid option --with(out)-neon-includes - see docs/configure.txt) - ;; - *) - depCFLAGS="${withval}" - ;; - esac - ], [ - AS_IF([test x"$have_PKG_CONFIG" = xyes], - [depCFLAGS="`$PKG_CONFIG --silence-errors --cflags neon 2>/dev/null`" \ - || depCFLAGS="-I/usr/include/neon -I/usr/local/include/neon"], - [depCFLAGS="-I/usr/include/neon -I/usr/local/include/neon"] - )] + NUT_ARG_WITH_LIBOPTS_INCLUDES([neon], [auto]) + AS_CASE([${nut_with_neon_includes}], + [auto], [AS_IF([test x"$have_PKG_CONFIG" = xyes], + [depCFLAGS="`$PKG_CONFIG --silence-errors --cflags neon 2>/dev/null`" \ + || depCFLAGS="-I/usr/include/neon -I/usr/local/include/neon"], + [depCFLAGS="-I/usr/include/neon -I/usr/local/include/neon"] + )], + [depCFLAGS="${nut_with_neon_includes}"] ) AC_MSG_RESULT([${CFLAGS}]) AC_MSG_CHECKING(for libneon ldflags) - AC_ARG_WITH(neon-libs, - AS_HELP_STRING([@<:@--with-neon-libs=LIBS@:>@], [linker flags for the neon library]), - [ - case "${withval}" in - yes|no) - AC_MSG_ERROR(invalid option --with(out)-neon-libs - see docs/configure.txt) - ;; - *) - depLIBS="${withval}" - ;; - esac - ], [ - AS_IF([test x"$have_PKG_CONFIG" = xyes], - [depLIBS="`$PKG_CONFIG --silence-errors --libs neon 2>/dev/null`" \ - || depLIBS="-lneon"], - [depLIBS="-lneon"] - )] + NUT_ARG_WITH_LIBOPTS_LIBS([neon], [auto]) + AS_CASE([${nut_with_neon_libs}], + [auto], [AS_IF([test x"$have_PKG_CONFIG" = xyes], + [depLIBS="`$PKG_CONFIG --silence-errors --libs neon 2>/dev/null`" \ + || depLIBS="-lneon"], + [depLIBS="-lneon"] + )], + [depLIBS="${nut_with_neon_libs}"] ) AC_MSG_RESULT([${depLIBS}]) From d907efedc0d83a1060cf25a5d5f5715effe2af52 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Tue, 21 Oct 2025 16:52:00 +0200 Subject: [PATCH 360/805] m4/nut_check_libnss.m4: refactor to word the help and determine options via NUT_ARG_WITH_LIBOPTS* [#3049] Signed-off-by: Jim Klimov --- m4/nut_check_libnss.m4 | 34 ++++++++++------------------------ 1 file changed, 10 insertions(+), 24 deletions(-) diff --git a/m4/nut_check_libnss.m4 b/m4/nut_check_libnss.m4 index ef81ad5491..e33328e67f 100644 --- a/m4/nut_check_libnss.m4 +++ b/m4/nut_check_libnss.m4 @@ -46,33 +46,19 @@ if test -z "${nut_have_libnss_seen}"; then dnl allow overriding NSS settings if the user knows best AC_MSG_CHECKING(for Mozilla NSS cflags) - AC_ARG_WITH(nss-includes, - AS_HELP_STRING([@<:@--with-nss-includes=CFLAGS@:>@], [include flags for the Mozilla NSS library]), - [ - case "${withval}" in - yes|no) - AC_MSG_ERROR(invalid option --with(out)-nss-includes - see docs/configure.txt) - ;; - *) - depCFLAGS="${withval}" - ;; - esac - ], []) + NUT_ARG_WITH_LIBOPTS_INCLUDES([nss], [auto], [Mozilla NSS]) + AS_CASE([${nut_with_nss_includes}], + [auto], [], dnl Keep what we had found above + [depCFLAGS="${nut_with_nss_includes}"] + ) AC_MSG_RESULT([${depCFLAGS}]) AC_MSG_CHECKING(for Mozilla NSS ldflags) - AC_ARG_WITH(nss-libs, - AS_HELP_STRING([@<:@--with-nss-libs=LIBS@:>@], [linker flags for the Mozilla NSS library]), - [ - case "${withval}" in - yes|no) - AC_MSG_ERROR(invalid option --with(out)-nss-libs - see docs/configure.txt) - ;; - *) - depLIBS="${withval}" - ;; - esac - ], []) + NUT_ARG_WITH_LIBOPTS_LIBS([nss], [auto], [Mozilla NSS]) + AS_CASE([${nut_with_nss_libs}], + [auto], [], dnl Keep what we had found above + [depLIBS="${nut_with_nss_libs}"] + ) AC_MSG_RESULT([${depLIBS}]) dnl check if NSS is usable: we need both the runtime and headers From ef7e3ed08ed3e825985205c093e3d604d6530463 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Tue, 21 Oct 2025 16:57:32 +0200 Subject: [PATCH 361/805] m4/nut_check_pkgconfig.m4: refactor NUT_ARG_* help and determination of --with-pkg-config [#3049] Signed-off-by: Jim Klimov --- m4/nut_check_pkgconfig.m4 | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-) diff --git a/m4/nut_check_pkgconfig.m4 b/m4/nut_check_pkgconfig.m4 index 7a6575032b..499738ef34 100644 --- a/m4/nut_check_pkgconfig.m4 +++ b/m4/nut_check_pkgconfig.m4 @@ -26,20 +26,12 @@ AC_DEFUN([NUT_CHECK_PKGCONFIG], have_PKG_CONFIG=yes AC_PATH_PROG(dummy_PKG_CONFIG, pkg-config) - AC_ARG_WITH(pkg-config, - AS_HELP_STRING([--with-pkg-config=/path/to/pkg-config], - [path to program that reports development package configuration]), - [ - case "${withval}" in - "") ;; - yes|no) - AC_MSG_ERROR(invalid option --with(out)-pkg-config - see docs/configure.txt) - ;; - *) - dummy_PKG_CONFIG="${withval}" - ;; - esac - ]) + NUT_ARG_WITH([pkg-config], [auto|/path/to/pkg-config], [Path to program that reports development package configuration], [auto]) + AS_CASE([${nut_with_pkg_config}], + [""|auto], [], dnl Keep what we had found above + [yes|no], [AC_MSG_ERROR(invalid option --with(out)-pkg-config - see docs/configure.txt)], + [dummy_PKG_CONFIG="${nut_with_pkg_config}"] + ) AC_MSG_CHECKING([whether usable PKG_CONFIG is present in PATH or was set by caller]) AS_IF([test x"$dummy_PKG_CONFIG" = xno || test -z "$dummy_PKG_CONFIG"], From 2a8024c10e6916a006c1517cdcb2e5842c41795f Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Tue, 21 Oct 2025 16:59:42 +0200 Subject: [PATCH 362/805] m4/nut_check_libopenssl.m4: refactor to word the help and determine options via NUT_ARG_WITH_LIBOPTS* [#3049] Signed-off-by: Jim Klimov --- m4/nut_check_libopenssl.m4 | 34 ++++++++++------------------------ 1 file changed, 10 insertions(+), 24 deletions(-) diff --git a/m4/nut_check_libopenssl.m4 b/m4/nut_check_libopenssl.m4 index a39a3c6246..5b57a417b6 100644 --- a/m4/nut_check_libopenssl.m4 +++ b/m4/nut_check_libopenssl.m4 @@ -47,33 +47,19 @@ if test -z "${nut_have_libopenssl_seen}"; then dnl allow overriding OpenSSL settings if the user knows best AC_MSG_CHECKING(for OpenSSL cflags) - AC_ARG_WITH(openssl-includes, - AS_HELP_STRING([@<:@--with-openssl-includes=CFLAGS@:>@], [include flags for the OpenSSL library]), - [ - case "${withval}" in - yes|no) - AC_MSG_ERROR(invalid option --with(out)-openssl-includes - see docs/configure.txt) - ;; - *) - depCFLAGS="${withval}" - ;; - esac - ], []) + NUT_ARG_WITH_LIBOPTS_INCLUDES([openssl], [auto]) + AS_CASE([${nut_with_openssl_includes}], + [auto], [], dnl Keep what we had found above + [depCFLAGS="${nut_with_openssl_includes}"] + ) AC_MSG_RESULT([${depCFLAGS}]) AC_MSG_CHECKING(for OpenSSL ldflags) - AC_ARG_WITH(openssl-libs, - AS_HELP_STRING([@<:@--with-openssl-libs=LIBS@:>@], [linker flags for the OpenSSL library]), - [ - case "${withval}" in - yes|no) - AC_MSG_ERROR(invalid option --with(out)-openssl-libs - see docs/configure.txt) - ;; - *) - depLIBS="${withval}" - ;; - esac - ], []) + NUT_ARG_WITH_LIBOPTS_LIBS([openssl], [auto]) + AS_CASE([${nut_with_openssl_libs}], + [auto], [], dnl Keep what we had found above + [depLIBS="${nut_with_openssl_libs}"] + ) AC_MSG_RESULT([${depLIBS}]) dnl check if openssl is usable From 7cfd1fd1038bd0d3d52d0436564198a744df72a5 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Tue, 21 Oct 2025 17:02:35 +0200 Subject: [PATCH 363/805] m4/nut_check_libpowerman.m4: refactor to word the help and determine options via NUT_ARG_WITH_LIBOPTS* [#3049] Signed-off-by: Jim Klimov --- m4/nut_check_libpowerman.m4 | 34 ++++++++++------------------------ 1 file changed, 10 insertions(+), 24 deletions(-) diff --git a/m4/nut_check_libpowerman.m4 b/m4/nut_check_libpowerman.m4 index f263a61a31..c8615e06d1 100644 --- a/m4/nut_check_libpowerman.m4 +++ b/m4/nut_check_libpowerman.m4 @@ -46,33 +46,19 @@ if test -z "${nut_have_libpowerman_seen}"; then ) AC_MSG_CHECKING([for libpowerman cflags]) - AC_ARG_WITH(powerman-includes, - AS_HELP_STRING([@<:@--with-powerman-includes=CFLAGS@:>@], [include flags for the libpowerman library]), - [ - case "${withval}" in - yes|no) - AC_MSG_ERROR([invalid option --with(out)-powerman-includes - see docs/configure.txt]) - ;; - *) - depCFLAGS="${withval}" - ;; - esac - ], []) + NUT_ARG_WITH_LIBOPTS_INCLUDES([powerman], [auto], [libpowerman]) + AS_CASE([${nut_with_powerman_includes}], + [auto], [], dnl Keep what we had found above + [depCFLAGS="${nut_with_powerman_includes}"] + ) AC_MSG_RESULT([${depCFLAGS}]) AC_MSG_CHECKING(for libpowerman libs) - AC_ARG_WITH(powerman-libs, - AS_HELP_STRING([@<:@--with-powerman-libs=LIBS@:>@], [linker flags for the libpowerman library]), - [ - case "${withval}" in - yes|no) - AC_MSG_ERROR(invalid option --with(out)-powerman-libs - see docs/configure.txt) - ;; - *) - depLIBS="${withval}" - ;; - esac - ], []) + NUT_ARG_WITH_LIBOPTS_LIBS([powerman], [auto], [libpowerman]) + AS_CASE([${nut_with_powerman_libs}], + [auto], [], dnl Keep what we had found above + [depLIBS="${nut_with_powerman_libs}"] + ) AC_MSG_RESULT([${depLIBS}]) dnl check if libpowerman is usable From cfcf1c30e70be81a731c586972ad1517ef8e5f38 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Tue, 21 Oct 2025 17:19:10 +0200 Subject: [PATCH 364/805] m4/nut_check_libnetsnmp.m4: refactor to word the help and determine options via NUT_ARG_WITH_LIBOPTS* [#3049] Signed-off-by: Jim Klimov --- m4/nut_check_libnetsnmp.m4 | 94 +++++++++++++++----------------------- m4/nut_check_libsystemd.m4 | 58 +++++++++-------------- 2 files changed, 59 insertions(+), 93 deletions(-) diff --git a/m4/nut_check_libnetsnmp.m4 b/m4/nut_check_libnetsnmp.m4 index d5192c2349..2f8494ad71 100644 --- a/m4/nut_check_libnetsnmp.m4 +++ b/m4/nut_check_libnetsnmp.m4 @@ -34,22 +34,19 @@ if test -z "${nut_have_libnetsnmp_seen}"; then ) prefer_NET_SNMP_CONFIG=false - AC_ARG_WITH(net-snmp-config, - AS_HELP_STRING([@<:@--with-net-snmp-config=/path/to/net-snmp-config@:>@], - [path to program that reports Net-SNMP configuration]), - [ - case "${withval}" in - ""|yes) prefer_NET_SNMP_CONFIG=true ;; - no) + NUT_ARG_WITH_LIBOPTS([net-snmp-config], [/path/to/net-snmp-config], + [Path to program that reports Net-SNMP configuration], [auto]) + + AS_CASE([${nut_with_net_snmp_config}], + [""|yes|auto], [prefer_NET_SNMP_CONFIG=true], + [no], [ dnl AC_MSG_ERROR(invalid option --with(out)-net-snmp-config - see docs/configure.txt) prefer_NET_SNMP_CONFIG=false - ;; - *) - NET_SNMP_CONFIG="${withval}" - prefer_NET_SNMP_CONFIG=true - ;; - esac - ]) + ], + [NET_SNMP_CONFIG="${nut_with_net_snmp_config}" + prefer_NET_SNMP_CONFIG=true + ] + ) if test x"$have_PKG_CONFIG" = xyes -a x"${prefer_NET_SNMP_CONFIG}" = xfalse ; then AC_MSG_CHECKING(for Net-SNMP version via pkg-config) @@ -85,53 +82,38 @@ if test -z "${nut_have_libnetsnmp_seen}"; then depCFLAGS_SOURCE="" AC_MSG_CHECKING(for Net-SNMP cflags) - AC_ARG_WITH(snmp-includes, - AS_HELP_STRING([@<:@--with-snmp-includes=CFLAGS@:>@], [include flags for the Net-SNMP library]), - [ - case "${withval}" in - yes|no) - AC_MSG_ERROR(invalid option --with(out)-snmp-includes - see docs/configure.txt) - ;; - *) - depCFLAGS_SOURCE="confarg" - depCFLAGS="${withval}" - ;; - esac - ], [AS_IF(["${prefer_NET_SNMP_CONFIG}"], - [depCFLAGS="`${NET_SNMP_CONFIG} --base-cflags 2>/dev/null`" - depCFLAGS_SOURCE="netsnmp-config"], - [AS_IF([test x"$have_PKG_CONFIG" = xyes], - [depCFLAGS="`$PKG_CONFIG --silence-errors --cflags netsnmp 2>/dev/null`" - depCFLAGS_SOURCE="pkg-config"], - [depCFLAGS_SOURCE="default"] - )] - )] + NUT_ARG_WITH_LIBOPTS_INCLUDES([snmp], [auto], [Net-SNMP]) + AS_CASE([${nut_with_snmp_includes}], + [auto], [AS_IF(["${prefer_NET_SNMP_CONFIG}"], + [depCFLAGS="`${NET_SNMP_CONFIG} --base-cflags 2>/dev/null`" + depCFLAGS_SOURCE="netsnmp-config"], + [AS_IF([test x"$have_PKG_CONFIG" = xyes], + [depCFLAGS="`$PKG_CONFIG --silence-errors --cflags netsnmp 2>/dev/null`" + depCFLAGS_SOURCE="pkg-config"], + [depCFLAGS_SOURCE="default"] + )] + )], + [depCFLAGS_SOURCE="confarg" + depCFLAGS="${nut_with_snmp_includes}"] ) AC_MSG_RESULT([${depCFLAGS} (source: ${depCFLAGS_SOURCE})]) depLIBS_SOURCE="" AC_MSG_CHECKING(for Net-SNMP libs) - AC_ARG_WITH(snmp-libs, - AS_HELP_STRING([@<:@--with-snmp-libs=LIBS@:>@], [linker flags for the Net-SNMP library]), - [ - case "${withval}" in - yes|no) - AC_MSG_ERROR(invalid option --with(out)-snmp-libs - see docs/configure.txt) - ;; - *) - depLIBS_SOURCE="confarg" - depLIBS="${withval}" - ;; - esac - ], [AS_IF(["${prefer_NET_SNMP_CONFIG}"], - [depLIBS="`${NET_SNMP_CONFIG} --libs 2>/dev/null`" - depLIBS_SOURCE="netsnmp-config"], - [AS_IF([test x"$have_PKG_CONFIG" = xyes], - [depLIBS="`$PKG_CONFIG --silence-errors --libs netsnmp 2>/dev/null`" - depLIBS_SOURCE="pkg-config"], - [depLIBS="-lnetsnmp" - depLIBS_SOURCE="default"])] - )] + NUT_ARG_WITH_LIBOPTS_LIBS([snmp], [auto], [Net-SNMP]) + AS_CASE([${nut_with_snmp_libs}], + [auto], [AS_IF(["${prefer_NET_SNMP_CONFIG}"], + [depLIBS="`${NET_SNMP_CONFIG} --libs 2>/dev/null`" + depLIBS_SOURCE="netsnmp-config"], + [AS_IF([test x"$have_PKG_CONFIG" = xyes], + [depLIBS="`$PKG_CONFIG --silence-errors --libs netsnmp 2>/dev/null`" + depLIBS_SOURCE="pkg-config"], + [depLIBS="-lnetsnmp" + depLIBS_SOURCE="default"] + )] + )], + [depLIBS_SOURCE="confarg" + depLIBS="${nut_with_snmp_libs}"] ) AC_MSG_RESULT([${depLIBS} (source: ${depLIBS_SOURCE})]) diff --git a/m4/nut_check_libsystemd.m4 b/m4/nut_check_libsystemd.m4 index c784c71082..8852e46fbc 100644 --- a/m4/nut_check_libsystemd.m4 +++ b/m4/nut_check_libsystemd.m4 @@ -54,47 +54,31 @@ if test -z "${nut_have_libsystemd_seen}"; then ]) AC_MSG_CHECKING(for libsystemd cflags) - AC_ARG_WITH(libsystemd-includes, - AS_HELP_STRING([@<:@--with-libsystemd-includes=CFLAGS@:>@], [include flags for the systemd library]), - [ - case "${withval}" in - yes|no) - AC_MSG_ERROR(invalid option --with(out)-libsystemd-includes - see docs/configure.txt) - ;; - *) - depCFLAGS="${withval}" - ;; - esac - ], [ - dnl Not specifying a default include path here, - dnl headers are referenced by relative directory - dnl and these should be in OS location usually. - AS_IF([test x"$have_PKG_CONFIG" = xyes], - [depCFLAGS="`$PKG_CONFIG --silence-errors --cflags libsystemd 2>/dev/null`" \ - || depCFLAGS=""], - [depCFLAGS=""] - )] + NUT_ARG_WITH_LIBOPTS_INCLUDES([libsystemd], [auto], [systemd]) + AS_CASE([${nut_with_libsystemd_includes}], + [auto], [ + dnl Not specifying a default include path here, + dnl headers are referenced by relative directory + dnl and these should be in OS location usually. + AS_IF([test x"$have_PKG_CONFIG" = xyes], + [depCFLAGS="`$PKG_CONFIG --silence-errors --cflags libsystemd 2>/dev/null`" \ + || depCFLAGS=""], + [depCFLAGS=""] + )], + [depCFLAGS="${nut_with_libsystemd_includes}"] ) AC_MSG_RESULT([${depCFLAGS}]) AC_MSG_CHECKING(for libsystemd ldflags) - AC_ARG_WITH(libsystemd-libs, - AS_HELP_STRING([@<:@--with-libsystemd-libs=LIBS@:>@], [linker flags for the systemd library]), - [ - case "${withval}" in - yes|no) - AC_MSG_ERROR(invalid option --with(out)-libsystemd-libs - see docs/configure.txt) - ;; - *) - depLIBS="${withval}" - ;; - esac - ], [ - AS_IF([test x"$have_PKG_CONFIG" = xyes], - [depLIBS="`$PKG_CONFIG --silence-errors --libs libsystemd 2>/dev/null`" \ - || depLIBS="-lsystemd"], - [depLIBS="-lsystemd"] - )] + NUT_ARG_WITH_LIBOPTS_LIBS([libsystemd], [auto], [systemd]) + AS_CASE([${nut_with_libsystemd_libs}], + [auto], [ + AS_IF([test x"$have_PKG_CONFIG" = xyes], + [depLIBS="`$PKG_CONFIG --silence-errors --libs libsystemd 2>/dev/null`" \ + || depLIBS="-lsystemd"], + [depLIBS="-lsystemd"] + )], + [depLIBS="${nut_with_libsystemd_libs}"] ) AC_MSG_RESULT([${depLIBS}]) From 62be879749ff57e0c84c3a5510226fd067b69c5e Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Tue, 21 Oct 2025 17:26:03 +0200 Subject: [PATCH 365/805] m4/nut_check_libusb.m4: refactor to word the help and determine options via NUT_ARG_WITH_LIBOPTS* [#3049] Signed-off-by: Jim Klimov --- m4/nut_check_libusb.m4 | 54 ++++++++++-------------------------------- 1 file changed, 12 insertions(+), 42 deletions(-) diff --git a/m4/nut_check_libusb.m4 b/m4/nut_check_libusb.m4 index f17ddd04d2..c4213cd071 100644 --- a/m4/nut_check_libusb.m4 +++ b/m4/nut_check_libusb.m4 @@ -51,24 +51,8 @@ if test -z "${nut_have_libusb_seen}"; then dnl Note: it seems the script was only shipped for libusb-0.1 dnl So we don't separate into LIBUSB_0_1_CONFIG and LIBUSB_1_0_CONFIG - AC_PATH_PROGS([LIBUSB_CONFIG], [libusb-config], [none]) - - AC_ARG_WITH(libusb-config, - AS_HELP_STRING([@<:@--with-libusb-config=/path/to/libusb-config@:>@], - [path to program that reports LibUSB configuration]), dnl ...for LibUSB-0.1 - [ - AS_CASE(["${withval}"], - [""], [], dnl empty arg - [yes|no], [ - dnl MAYBE bump preference of script over pkg-config? - AC_MSG_ERROR([invalid option --with(out)-libusb-config - see docs/configure.txt]) - ], - [dnl default - LIBUSB_CONFIG="${withval}" - ] - ) - ] - ) + dnl MAYBE bump preference of a found script over pkg-config? + NUT_ARG_WITH_LIBOPTS_CONFIGSCRIPT([libusb], [], [], [], [LibUSB(-0.1)]) AS_IF([test x"${LIBUSB_CONFIG}" != xnone], [AC_MSG_CHECKING([via ${LIBUSB_CONFIG}]) @@ -184,33 +168,19 @@ if test -z "${nut_have_libusb_seen}"; then dnl check optional user-provided values for cflags/ldflags dnl and publish what we end up using AC_MSG_CHECKING(for libusb cflags) - AC_ARG_WITH(usb-includes, - AS_HELP_STRING([@<:@--with-usb-includes=CFLAGS@:>@], [include flags for the libusb library]), - [ - AS_CASE(["${withval}"], - [yes|no], [ - AC_MSG_ERROR(invalid option --with(out)-usb-includes - see docs/configure.txt) - ], - [dnl default - depCFLAGS="${withval}" - ] - ) - ], []) + NUT_ARG_WITH_LIBOPTS_INCLUDES([usb], [auto], [libusb]) + AS_CASE([${nut_with_usb_includes}], + [auto], [], dnl Keep what we had found above + [depCFLAGS="${nut_with_usb_includes}"] + ) AC_MSG_RESULT([${depCFLAGS}]) AC_MSG_CHECKING(for libusb ldflags) - AC_ARG_WITH(usb-libs, - AS_HELP_STRING([@<:@--with-usb-libs=LIBS@:>@], [linker flags for the libusb library]), - [ - AS_CASE(["${withval}"], - [yes|no], [ - AC_MSG_ERROR(invalid option --with(out)-usb-libs - see docs/configure.txt) - ], - [dnl default - depLIBS="${withval}" - ] - ) - ], []) + NUT_ARG_WITH_LIBOPTS_LIBS([usb], [auto], [libusb]) + AS_CASE([${nut_with_usb_libs}], + [auto], [], dnl Keep what we had found above + [depLIBS="${nut_with_usb_libs}"] + ) AC_MSG_RESULT([${depLIBS}]) dnl TODO: Consult chosen nut_usb_lib value and/or nut_with_usb argument From b3a4d71aa4b7c85e5e2507097983ea1024abe717 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Tue, 21 Oct 2025 18:19:55 +0200 Subject: [PATCH 366/805] m4/nut_arg_with.m4: NUT_ARG_WITH_LIBOPTS_CONFIGSCRIPT_IMPLEM: drop extra brackets [#3049] Signed-off-by: Jim Klimov --- m4/nut_arg_with.m4 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/m4/nut_arg_with.m4 b/m4/nut_arg_with.m4 index 5da96ef14f..853cfafd9a 100644 --- a/m4/nut_arg_with.m4 +++ b/m4/nut_arg_with.m4 @@ -135,10 +135,10 @@ AC_DEFUN([NUT_ARG_WITH_LIBOPTS_CONFIGSCRIPT_IMPLEM], [ dnl By default seek in PATH NUT_ARG_WITH_LIBOPTS([m4_translit($1, 'A-Z', 'a-z')-config], [/path/to/m4_translit($1, 'A-Z', 'a-z')-config|auto|none], [path to program that reports ]m4_default($5, $1)[ configuration], [$4]) - AS_CASE([[${[nut_with_]]m4_translit($1, [-], [_])[[_config]}]], + AS_CASE([[${nut_with_]m4_translit($1, [-], [_])[_config}]], [yes|auto|""], [AC_PATH_PROGS([$2], [$3], [none])], [no|none], [$2="none"], - [$2=["${[nut_with_]]m4_translit($1, [-], [_])[[_config]}"]] + [$2=["${nut_with_]m4_translit($1, [-], [_])[_config}"]] ) ]) From 58b5f81bb599406ffb5aa1cb4ecd368001f485d4 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Tue, 21 Oct 2025 18:20:41 +0200 Subject: [PATCH 367/805] NEWS.adoc: update entry with PR number Signed-off-by: Jim Klimov --- NEWS.adoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/NEWS.adoc b/NEWS.adoc index 5a92355ac7..c65bf546f0 100644 --- a/NEWS.adoc +++ b/NEWS.adoc @@ -182,7 +182,7 @@ several `FSD` notifications into one executed action. [PR #3097] so you may have to adjust search paths for any other values. [#3062] * Automatic `--with-devd` could not detect the need to install a FreeBSD devd configuration snippet file, because it expected a source that should - not have been there (probably a copy-paste typo in NUT v2.8.0). + not have been there (probably a copy-paste typo in NUT v2.8.0). [#3140] - Fixed CI recipes for PyPI publication of PyNUT(Client) module to also include the source distribution (was posted for NUT v2.8.1 and v2.8.2 From 9c6b00e6c7db846de4e8a2146060c165bd40bfb7 Mon Sep 17 00:00:00 2001 From: Viktor Drobot Date: Tue, 21 Oct 2025 20:54:49 +0300 Subject: [PATCH 368/805] More info about firmware version in bogus reply Signed-off-by: Viktor Drobot --- drivers/nutdrv_qx_innovatae.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/drivers/nutdrv_qx_innovatae.c b/drivers/nutdrv_qx_innovatae.c index d9d020e6b2..1a5a693705 100644 --- a/drivers/nutdrv_qx_innovatae.c +++ b/drivers/nutdrv_qx_innovatae.c @@ -75,13 +75,17 @@ static item_t innovatae_qx2nut[] = { /* * > [I\r] - * < [#222222222222222222222222222R1.00.48\r] - * 0123456789012345678901234567890123456 + * < [#222222222222222222222222222R1.00.48 \r] + * 012345678901234567890123456789012345678 * 0 1 2 3 */ /* Firmware version */ - { "ups.firmware", 0, NULL, "I\r", "", 37, '#', "", 28, 35, "%s", QX_FLAG_STATIC, NULL, NULL, NULL }, + /* According to the Megatec Qx protocol implementation (nutdrv_qx_megatec.c) firmware version can be reported + * via I command (positions 28-35) and answer length may vary between 38 and 39. + * Referenced source suggests to use lesser number + */ + { "ups.firmware", 0, NULL, "I\r", "", 38, '#', "", 28, 35, "%s", QX_FLAG_STATIC, NULL, NULL, NULL }, /* Instant commands */ { "beeper.toggle", 0, NULL, "Q\r", "", 0, 0, "", 0, 0, NULL, QX_FLAG_CMD, NULL, NULL, NULL }, From d4a4b3ca7d9dc6fbaef760dc765cadeaff80a663 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Tue, 21 Oct 2025 22:32:20 +0200 Subject: [PATCH 369/805] m4/nut_check_libnetsnmp.m4: fix new --with-net-snmp-config=auto mode [#3049] Signed-off-by: Jim Klimov --- m4/nut_check_libnetsnmp.m4 | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/m4/nut_check_libnetsnmp.m4 b/m4/nut_check_libnetsnmp.m4 index 2f8494ad71..13d60bd82d 100644 --- a/m4/nut_check_libnetsnmp.m4 +++ b/m4/nut_check_libnetsnmp.m4 @@ -38,7 +38,8 @@ if test -z "${nut_have_libnetsnmp_seen}"; then [Path to program that reports Net-SNMP configuration], [auto]) AS_CASE([${nut_with_net_snmp_config}], - [""|yes|auto], [prefer_NET_SNMP_CONFIG=true], + [""|yes], [prefer_NET_SNMP_CONFIG=true], + [auto], [prefer_NET_SNMP_CONFIG=auto], [no], [ dnl AC_MSG_ERROR(invalid option --with(out)-net-snmp-config - see docs/configure.txt) prefer_NET_SNMP_CONFIG=false @@ -48,13 +49,16 @@ if test -z "${nut_have_libnetsnmp_seen}"; then ] ) - if test x"$have_PKG_CONFIG" = xyes -a x"${prefer_NET_SNMP_CONFIG}" = xfalse ; then + if test x"$have_PKG_CONFIG" = xyes -a x"${prefer_NET_SNMP_CONFIG}" != xtrue ; then AC_MSG_CHECKING(for Net-SNMP version via pkg-config) dnl TODO? Loop over possible/historic pkg names, like dnl netsnmp, net-snmp, ucd-snmp, libsnmp, snmp... SNMP_VERSION="`$PKG_CONFIG --silence-errors --modversion netsnmp 2>/dev/null`" if test "$?" = "0" -a -n "${SNMP_VERSION}" ; then AC_MSG_RESULT(${SNMP_VERSION} found) + if test x"${prefer_NET_SNMP_CONFIG}" = xauto; then + prefer_NET_SNMP_CONFIG=false + fi else AC_MSG_RESULT(none found) prefer_NET_SNMP_CONFIG=true From dfad3a4f24980c5658d5ee6ae2eee64494ebb8a6 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Tue, 21 Oct 2025 22:54:28 +0200 Subject: [PATCH 370/805] ci_build.sh: check more ARCH and BITS sources for illumos/Solaris pkgconfig path guessing Signed-off-by: Jim Klimov --- ci_build.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ci_build.sh b/ci_build.sh index 1ad6bc0332..adec0daa92 100755 --- a/ci_build.sh +++ b/ci_build.sh @@ -869,10 +869,13 @@ detect_platform_PKG_CONFIG_PATH_and_FLAGS() { BUILTIN_PKG_CONFIG_PATH="`$PKG_CONFIG --variable pc_path pkg-config`" || BUILTIN_PKG_CONFIG_PATH="" case "`echo "$CI_OS_NAME" | $TOLOWER`" in *openindiana*|*omnios*|*solaris*|*illumos*|*sunos*) - _ARCHES="${ARCH-}" + _ARCHES="${ARCH_TGT-}${ARCH-}${ARCH32-}${ARCH64-}" _BITS="${BITS-}" _ISA1="" + [ -n "${_BITS}" ] || \ + _BITS="${ARCH_BITS-}" + [ -n "${_BITS}" ] || \ case "${CC}${CXX}${CFLAGS}${CXXFLAGS}${LDFLAGS}" in *-m64*) _BITS=64 ;; From a76ec1aa931d73aee579cf1f26ec4a7a2a069f06 Mon Sep 17 00:00:00 2001 From: Atanas Vladimirov Date: Tue, 21 Oct 2025 23:58:34 +0300 Subject: [PATCH 371/805] nutdrv_qx_masterguard: Fix masterguard_add_slaveaddr return value The masterguard_add_slaveaddr function, defined as a preprocess_command handler, must return the length of the command string it has processed. It was incorrectly returning 0. This caused the main qx_process function to see a 0-byte command length, resulting in a send: timeout (0) debug log and a failure to send the command to the UPS. This commit fixes the function to return the correct command length (which was already stored in the local variable l), resolving the bug for all commands that use the ,XX slave address placeholder. Tested on Masterguard A1000 and A2000 units. Signed-off-by: Atanas Vladimirov --- drivers/nutdrv_qx_masterguard.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/nutdrv_qx_masterguard.c b/drivers/nutdrv_qx_masterguard.c index 512a37ad7a..6dfaa276e6 100644 --- a/drivers/nutdrv_qx_masterguard.c +++ b/drivers/nutdrv_qx_masterguard.c @@ -456,7 +456,7 @@ static int masterguard_add_slaveaddr(item_t *item, char *command, const size_t c } upsdebugx(4, "add slaveaddr %s to command %s", masterguard_my_slaveaddr, command); memcpy(command + l - 3, masterguard_my_slaveaddr, 2); - return 0; + return l; } From 97f8706ca89dc702feb249ef5babd3eee6f9f732 Mon Sep 17 00:00:00 2001 From: Atanas Vladimirov Date: Wed, 22 Oct 2025 00:00:52 +0300 Subject: [PATCH 372/805] nutdrv_qx_masterguard: Makes the deep battery test command works The test.battery.start.deep (TUD) command requires the slave address as a parameter to function. Following the fix to masterguard_add_slaveaddr in the previous commit, this command can now be properly enabled. Tested on Masterguard A1000 and A2000 units. Signed-off-by: Atanas Vladimirov --- drivers/nutdrv_qx_masterguard.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/nutdrv_qx_masterguard.c b/drivers/nutdrv_qx_masterguard.c index 6dfaa276e6..5442ebf515 100644 --- a/drivers/nutdrv_qx_masterguard.c +++ b/drivers/nutdrv_qx_masterguard.c @@ -859,7 +859,7 @@ static item_t masterguard_qx2nut[] = { { "test.battery.start", 0, NULL, NULL, "", 0, '\0', "", 0, 0, NULL, QX_FLAG_CMD, NULL, NULL, masterguard_test_battery }, { "test.battery.start.quick", 0, NULL, "T\r", "", 0, '\0', "", 0, 0, NULL, QX_FLAG_CMD, NULL, NULL, NULL }, { "test.battery.start.low", 0, NULL, "TL\r", "", 0, '\0', "", 0, 0, NULL, QX_FLAG_CMD, NULL, NULL, NULL }, - { "test.battery.start.deep", 0, NULL, "TUD\r", "", 0, '\0', "", 0, 0, NULL, QX_FLAG_CMD, NULL, NULL, NULL }, + { "test.battery.start.deep", 0, NULL, "TUD,XX\r", "", 0, '\0', "", 0, 0, NULL, QX_FLAG_CMD, masterguard_add_slaveaddr, NULL, NULL }, { "test.battery.stop", 0, NULL, "CT\r", "", 0, '\0', "", 0, 0, NULL, QX_FLAG_CMD, NULL, NULL, NULL }, /* test.system.start */ /* calibrate.start */ From e46842aa8be47af712ed12da7ceee1dd0dc90d08 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Tue, 21 Oct 2025 23:15:52 +0200 Subject: [PATCH 373/805] NEWS.adoc: update notes for #3049 and #3140 Signed-off-by: Jim Klimov --- NEWS.adoc | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/NEWS.adoc b/NEWS.adoc index c65bf546f0..0df9677fd6 100644 --- a/NEWS.adoc +++ b/NEWS.adoc @@ -180,9 +180,16 @@ several `FSD` notifications into one executed action. [PR #3097] it), if not bundling with NUT-Monitor UI app. By default the respective interpreter's 'site-packages' or 'dist-packages' location will be used, so you may have to adjust search paths for any other values. [#3062] + * Streamlined handling of `--with-*` and `--enable-*` options using NUT 'm4' + macros; fixed reporting help for options whose defaults are evaluated. + [issue #3049, PR #3140] * Automatic `--with-devd` could not detect the need to install a FreeBSD devd configuration snippet file, because it expected a source that should - not have been there (probably a copy-paste typo in NUT v2.8.0). [#3140] + not have been there (probably a copy-paste typo in NUT v2.8.0). Also + fixed a missed compiler family dependency when handling `--enable-strip`, + a few logical mismatches of Solaris/illumos packaging options, and default + report vs. setting of `--enable-force-nut-version-header`. Rephrased and + updated many help messages. [#3140] - Fixed CI recipes for PyPI publication of PyNUT(Client) module to also include the source distribution (was posted for NUT v2.8.1 and v2.8.2 From fb76fa2e8eee5bec82f1dd257dc079fa0b65f0d7 Mon Sep 17 00:00:00 2001 From: Atanas Vladimirov Date: Wed, 22 Oct 2025 11:04:47 +0300 Subject: [PATCH 374/805] nutdrv_qx_masterguard: Bump MASTERGUARD_VERSION to 0.04 And updates the NEWS.adoc in regards of PR [#3141] Tested on Masterguard A1000 and A2000 units. Signed-off-by: Atanas Vladimirov --- NEWS.adoc | 4 ++++ drivers/nutdrv_qx_masterguard.c | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/NEWS.adoc b/NEWS.adoc index 69a27adc3e..f7ab291b92 100644 --- a/NEWS.adoc +++ b/NEWS.adoc @@ -75,6 +75,10 @@ https://github.com/networkupstools/nut/milestone/12 to be met, i.e. the load must be between 30% and 100% and the starting battery capacity is greater than 99%. The "Battery test until battery low" can be started anytime. Tested on Masterguard A1000 and A2000 units. [#3135] + * `nutdrv_qx_masterguard` sub-driver fix `masterguard_add_slaveaddr` to + return the correct command length, resolving a bug for all commands using + the `,XX` slave address placeholder. This also enables support for the + `test.battery.start.deep` (`TUD`) command. [#3141] - `powerp-bin` and `powerp-txt` driver updates: * Their `upsdrv_initinfo()` methods did not explicitly reference the diff --git a/drivers/nutdrv_qx_masterguard.c b/drivers/nutdrv_qx_masterguard.c index 5442ebf515..626db87543 100644 --- a/drivers/nutdrv_qx_masterguard.c +++ b/drivers/nutdrv_qx_masterguard.c @@ -26,7 +26,7 @@ #include #include "nut_stdint.h" -#define MASTERGUARD_VERSION "Masterguard 0.03" +#define MASTERGUARD_VERSION "Masterguard 0.04" /* series (for un-SKIP) */ static char masterguard_my_series = '?'; From ec602c5af2cd1282f01c092e1919dbccf6897e85 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Wed, 22 Oct 2025 11:00:44 +0200 Subject: [PATCH 375/805] Revert "m4/nut_arg_with.m4: simplify with use of m4_default() [#3049]" This reverts commit 9eba1eb885e9d29f3d8ecef7637010899661cb54, seems autoconf (or myself) gets lost in the maze of m4_default with or without brackets, especially when arguments with commas are involved. Signed-off-by: Jim Klimov --- m4/nut_arg_with.m4 | 60 +++++++++++++++++++++++++++++++++++----------- 1 file changed, 46 insertions(+), 14 deletions(-) diff --git a/m4/nut_arg_with.m4 b/m4/nut_arg_with.m4 index 853cfafd9a..c12922cf32 100644 --- a/m4/nut_arg_with.m4 +++ b/m4/nut_arg_with.m4 @@ -41,8 +41,12 @@ dnl $5 how to represent default in help text (for *_CUSTOM_DEFAULT_HELP) AC_DEFUN([NUT_ARG_WITH_CUSTOM_DEFAULT_HELP], [ AC_ARG_WITH($1, m4_ifval([$2], - [AS_HELP_STRING([--with-$1=$2], [$3 (default: ]m4_default($5, $4)[)])], - [AS_HELP_STRING([--with-$1], [$3 (default: ]m4_default($5, $4)[)])]), + [m4_ifval([$5], + [AS_HELP_STRING([--with-$1=$2], [$3 (default: $5)])], + [AS_HELP_STRING([--with-$1=$2], [$3 (default: $4)])])], + [m4_ifval([$5], + [AS_HELP_STRING([--with-$1], [$3 (default: $5)])], + [AS_HELP_STRING([--with-$1], [$3 (default: $4)])])]), [[nut_with_]m4_translit($1, [-], [_])="${withval}"], [[nut_with_]m4_translit($1, [-], [_])="$4"] ) @@ -98,6 +102,9 @@ AC_DEFUN([NUT_ARG_WITH_LIBOPTS_INVALID_YESNO], ) ]) +dnl NOTE: The defaulting substituter may be not defined/renamed in some autoconf versions +dnl m4_ifndef([m4_default], [m4_define([m4_default], [m4_ifval([[$1]], [[$1]], [[$2]])])]) + dnl Just the (normal-cased) third-party project name is required dnl $1 project name dnl $2 default value (optional) @@ -105,24 +112,32 @@ dnl $3 project name spelling for help message (very optional) AC_DEFUN([NUT_ARG_WITH_LIBOPTS_INCLUDES], [ - NUT_ARG_WITH_LIBOPTS_INVALID_YESNO([m4_translit($1, 'A-Z', 'a-z')-includes], [CFLAGS|auto], [include flags for the ]m4_default($3, $1)[ library], m4_default([$2], [auto])) + m4_ifval([$2], + [NUT_ARG_WITH_LIBOPTS_INVALID_YESNO([m4_translit($1, 'A-Z', 'a-z')-includes], [CFLAGS|auto], [include flags for the ]m4_default($3, $1)[ library], [$2])], + [NUT_ARG_WITH_LIBOPTS_INVALID_YESNO([m4_translit($1, 'A-Z', 'a-z')-includes], [CFLAGS|auto], [include flags for the ]m4_default($3, $1)[ library], [auto])]) ]) dnl Technically LIBS and LDFLAGS are about the same for dnl most of our m4 code and legacy help messaging... so far. AC_DEFUN([NUT_ARG_WITH_LIBOPTS_LIBS], [ - NUT_ARG_WITH_LIBOPTS_INVALID_YESNO([m4_translit($1, 'A-Z', 'a-z')-libs], [LIBS|auto], [linker flags for the ]m4_default($3, $1)[ library], m4_default([$2], [auto])) + m4_ifval([$2], + [NUT_ARG_WITH_LIBOPTS_INVALID_YESNO([m4_translit($1, 'A-Z', 'a-z')-libs], [LIBS|auto], [linker flags for the ]m4_default($3, $1)[ library], [$2])], + [NUT_ARG_WITH_LIBOPTS_INVALID_YESNO([m4_translit($1, 'A-Z', 'a-z')-libs], [LIBS|auto], [linker flags for the ]m4_default($3, $1)[ library], [auto])]) ]) AC_DEFUN([NUT_ARG_WITH_LIBOPTS_LIBS_AS_LDFLAGS], [ - NUT_ARG_WITH_LIBOPTS_INVALID_YESNO([m4_translit($1, 'A-Z', 'a-z')-libs], [LDFLAGS|auto], [linker flags for the ]m4_default($3, $1)[ library], m4_default([$2], [auto])) + m4_ifval([$2], + [NUT_ARG_WITH_LIBOPTS_INVALID_YESNO([m4_translit($1, 'A-Z', 'a-z')-libs], [LDFLAGS|auto], [linker flags for the ]m4_default($3, $1)[ library], [$2])], + [NUT_ARG_WITH_LIBOPTS_INVALID_YESNO([m4_translit($1, 'A-Z', 'a-z')-libs], [LDFLAGS|auto], [linker flags for the ]m4_default($3, $1)[ library], [auto])]) ]) AC_DEFUN([NUT_ARG_WITH_LIBOPTS_LDFLAGS], [ - NUT_ARG_WITH_LIBOPTS_INVALID_YESNO([m4_translit($1, 'A-Z', 'a-z')-ldflags], [LDFLAGS|auto], [linker flags for the ]m4_default($3, $1)[ library], m4_default([$2], [auto])) + m4_ifval([$2], + [NUT_ARG_WITH_LIBOPTS_INVALID_YESNO([m4_translit($1, 'A-Z', 'a-z')-ldflags], [LDFLAGS|auto], [linker flags for the ]m4_default($3, $1)[ library], [$2])], + [NUT_ARG_WITH_LIBOPTS_INVALID_YESNO([m4_translit($1, 'A-Z', 'a-z')-ldflags], [LDFLAGS|auto], [linker flags for the ]m4_default($3, $1)[ library], [auto])]) ]) dnl Help detect legacy -config scripts, assigns "none" if disabled or not found @@ -142,6 +157,22 @@ AC_DEFUN([NUT_ARG_WITH_LIBOPTS_CONFIGSCRIPT_IMPLEM], ) ]) +dnl Part of stack, use or guess optional parameter $2 (m4 var name); pass others as is +AC_DEFUN([NUT_ARG_WITH_LIBOPTS_CONFIGSCRIPT_IMPLEM_2], +[ + m4_ifval([$2], + [NUT_ARG_WITH_LIBOPTS_CONFIGSCRIPT_IMPLEM([$1], [$2], [$3], [$4], [$5])], + [NUT_ARG_WITH_LIBOPTS_CONFIGSCRIPT_IMPLEM([$1], m4_translit(m4_translit($1, 'a-z', 'A-Z'), [-], [_])[_CONFIG], [$3], [$4], [$5])]) +]) + +dnl Part of stack, use or guess optional parameter $3 (prog names); pass others as is +AC_DEFUN([NUT_ARG_WITH_LIBOPTS_CONFIGSCRIPT_IMPLEM_3], +[ + m4_ifval([$3], + [NUT_ARG_WITH_LIBOPTS_CONFIGSCRIPT_IMPLEM_2([$1], [$2], [$3], [$4], [$5])], + [NUT_ARG_WITH_LIBOPTS_CONFIGSCRIPT_IMPLEM_2([$1], [$2], [m4_translit($1, 'A-Z', 'a-z')-config], [$4], [$5])]) +]) + dnl Just the (normal-cased) third-party project name is required dnl $1 project name dnl $2 m4 var to assign (optional) @@ -150,12 +181,9 @@ dnl $4 default value (optional) dnl $5 project name spelling for help message (very optional) AC_DEFUN([NUT_ARG_WITH_LIBOPTS_CONFIGSCRIPT], [ - NUT_ARG_WITH_LIBOPTS_CONFIGSCRIPT_IMPLEM([$1], - m4_default([$2], m4_translit(m4_translit([$1], 'a-z', 'A-Z'), [-], [_])[_CONFIG]), - m4_default([$3], [m4_translit($1, 'A-Z', 'a-z')-config]), - m4_default([$4], [auto]), - [$5] - ) + m4_ifval([$4], + [NUT_ARG_WITH_LIBOPTS_CONFIGSCRIPT_IMPLEM_3([$1], [$2], [$3], [$4], [$5])], + [NUT_ARG_WITH_LIBOPTS_CONFIGSCRIPT_IMPLEM_3([$1], [$2], [$3], [auto], [$5])]) ]) dnl Enable a package feature/ability (might name a variant, or yes/no) @@ -163,8 +191,12 @@ dnl https://www.gnu.org/software/autoconf/manual/autoconf-2.66/html_node/Package AC_DEFUN([NUT_ARG_ENABLE_CUSTOM_DEFAULT_HELP], [ AC_ARG_ENABLE($1, m4_ifval([$2], - [AS_HELP_STRING([--enable-$1=$2], [$3 (default: ]m4_default($5, $4)[)])], - [AS_HELP_STRING([--enable-$1], [$3 (default: ]m4_default($5, $4)[)])]), + [m4_ifval([$5], + [AS_HELP_STRING([--enable-$1=$2], [$3 (default: $5)])], + [AS_HELP_STRING([--enable-$1=$2], [$3 (default: $4)])])], + [m4_ifval([$5], + [AS_HELP_STRING([--enable-$1], [$3 (default: $5)])], + [AS_HELP_STRING([--enable-$1], [$3 (default: $4)])])]), [[nut_enable_]m4_translit($1, [-], [_])="${enableval}"], [[nut_enable_]m4_translit($1, [-], [_])="$4"] ) From a5ccab12decd31ea0552eb823d4090066962f513 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Wed, 22 Oct 2025 11:10:58 +0200 Subject: [PATCH 376/805] m4/nut_arg_with.m4: revise brackets to pass arguments with commas in the value correctly [#3049] Signed-off-by: Jim Klimov --- m4/nut_arg_with.m4 | 68 +++++++++++++++++++++++----------------------- 1 file changed, 34 insertions(+), 34 deletions(-) diff --git a/m4/nut_arg_with.m4 b/m4/nut_arg_with.m4 index c12922cf32..10f2516c8f 100644 --- a/m4/nut_arg_with.m4 +++ b/m4/nut_arg_with.m4 @@ -23,10 +23,10 @@ dnl NOTE: Not sure if the fuss with uniquely named conftemp is worth it, dnl or is even remembered between calls. There seems to be 3 calls per name. AC_DEFUN([NUT_ARG_EXPAND], [[]m4_esyscmd_s( - [nut_conftemp_]m4_translit($1, [-], [_])="$2" ; - eval [nut_conftemp_]m4_translit($1, [-], [_])=\"\${[nut_conftemp_]m4_translit($1, [-], [_])}\" ; - echo "${[nut_conftemp_]m4_translit($1, [-], [_])}" ; - dnl # RUNS 3 TIMES # echo "$1 | $2 | [nut_conftemp_]m4_translit($1, [-], [_])=${[nut_conftemp_]m4_translit($1, [-], [_])}" >> arg.log ; + [nut_conftemp_]m4_translit([$1], [-], [_])="$2" ; + eval [nut_conftemp_]m4_translit([$1], [-], [_])=\"\${[nut_conftemp_]m4_translit([$1], [-], [_])}\" ; + echo "${[nut_conftemp_]m4_translit([$1], [-], [_])}" ; + dnl # RUNS 3 TIMES # echo "$1 | $2 | [nut_conftemp_]m4_translit([$1], [-], [_])=${[nut_conftemp_]m4_translit([$1], [-], [_])}" >> arg.log ; )[]]) dnl Working With External Software (might name a variant or other contextual arg) @@ -39,7 +39,7 @@ dnl $3 help text (descriptive part) dnl $4 default value dnl $5 how to represent default in help text (for *_CUSTOM_DEFAULT_HELP) AC_DEFUN([NUT_ARG_WITH_CUSTOM_DEFAULT_HELP], -[ AC_ARG_WITH($1, +[ AC_ARG_WITH([$1], m4_ifval([$2], [m4_ifval([$5], [AS_HELP_STRING([--with-$1=$2], [$3 (default: $5)])], @@ -47,16 +47,16 @@ AC_DEFUN([NUT_ARG_WITH_CUSTOM_DEFAULT_HELP], [m4_ifval([$5], [AS_HELP_STRING([--with-$1], [$3 (default: $5)])], [AS_HELP_STRING([--with-$1], [$3 (default: $4)])])]), - [[nut_with_]m4_translit($1, [-], [_])="${withval}"], - [[nut_with_]m4_translit($1, [-], [_])="$4"] + [[nut_with_]m4_translit([$1], [-], [_])="${withval}"], + [[nut_with_]m4_translit([$1], [-], [_])="$4"] ) ]) AC_DEFUN([NUT_ARG_WITH_EXPAND_DEFAULT_HELP], [ dnl Note: only 4 args expected - dnl NUT_ARG_EXPAND($1, $3) - NUT_ARG_WITH_CUSTOM_DEFAULT_HELP([$1], [$2], [$3], [$4], NUT_ARG_EXPAND(with_$1, $4)) + dnl NUT_ARG_EXPAND([$1], $3) + NUT_ARG_WITH_CUSTOM_DEFAULT_HELP([$1], [$2], [$3], [$4], NUT_ARG_EXPAND([with_$1], [$4])) ]) AC_DEFUN([NUT_ARG_WITH_EXPAND_DEFAULT_HELP_SINGLEQUOTE], @@ -64,7 +64,7 @@ AC_DEFUN([NUT_ARG_WITH_EXPAND_DEFAULT_HELP_SINGLEQUOTE], dnl Variant for paths (likely using backslash-dollar in $4) dnl Note: only 4 args expected dnl Note: "resolved from" must be not bracketed - NUT_ARG_WITH_CUSTOM_DEFAULT_HELP([$1], [$2], [$3], [$4], resolved from NUT_ARG_EXPAND(with_$1, '$4')) + NUT_ARG_WITH_CUSTOM_DEFAULT_HELP([$1], [$2], [$3], [$4], resolved from NUT_ARG_EXPAND([with_$1], '[$4]')) ]) AC_DEFUN([NUT_ARG_WITH], @@ -83,22 +83,22 @@ dnl (bracketed in help text to confer optionality) dnl Options same as NUT_ARG_WITH (4-arg version) AC_DEFUN([NUT_ARG_WITH_LIBOPTS], [ - AC_ARG_WITH($1, + AC_ARG_WITH([$1], [AS_HELP_STRING([@<:@--with-$1=$2@:>@], [$3 (default: $4)])], - [[nut_with_]m4_translit($1, [-], [_])="${withval}"], - [[nut_with_]m4_translit($1, [-], [_])="$4"] + [[nut_with_]m4_translit([$1], [-], [_])="${withval}"], + [[nut_with_]m4_translit([$1], [-], [_])="$4"] ) ]) AC_DEFUN([NUT_ARG_WITH_LIBOPTS_INVALID_YESNO], [ - AC_ARG_WITH($1, + AC_ARG_WITH([$1], [AS_HELP_STRING([@<:@--with-$1=$2@:>@], [$3 (default: $4)])], [AS_CASE([${withval}], [yes|no], [AC_MSG_ERROR([invalid option --with(out)-$1 - see docs/configure.txt])], - [[nut_with_]m4_translit($1, [-], [_])="${withval}"] + [[nut_with_]m4_translit([$1], [-], [_])="${withval}"] )], - [[nut_with_]m4_translit($1, [-], [_])="$4"] + [[nut_with_]m4_translit([$1], [-], [_])="$4"] ) ]) @@ -113,8 +113,8 @@ dnl $3 project name spelling for help message (very optional) AC_DEFUN([NUT_ARG_WITH_LIBOPTS_INCLUDES], [ m4_ifval([$2], - [NUT_ARG_WITH_LIBOPTS_INVALID_YESNO([m4_translit($1, 'A-Z', 'a-z')-includes], [CFLAGS|auto], [include flags for the ]m4_default($3, $1)[ library], [$2])], - [NUT_ARG_WITH_LIBOPTS_INVALID_YESNO([m4_translit($1, 'A-Z', 'a-z')-includes], [CFLAGS|auto], [include flags for the ]m4_default($3, $1)[ library], [auto])]) + [NUT_ARG_WITH_LIBOPTS_INVALID_YESNO([]m4_translit([$1], 'A-Z', 'a-z')[-includes], [CFLAGS|auto], [include flags for the ]m4_default([$3], [$1])[ library], [$2])], + [NUT_ARG_WITH_LIBOPTS_INVALID_YESNO([]m4_translit([$1], 'A-Z', 'a-z')[-includes], [CFLAGS|auto], [include flags for the ]m4_default([$3], [$1])[ library], [auto])]) ]) dnl Technically LIBS and LDFLAGS are about the same for @@ -122,22 +122,22 @@ dnl most of our m4 code and legacy help messaging... so far. AC_DEFUN([NUT_ARG_WITH_LIBOPTS_LIBS], [ m4_ifval([$2], - [NUT_ARG_WITH_LIBOPTS_INVALID_YESNO([m4_translit($1, 'A-Z', 'a-z')-libs], [LIBS|auto], [linker flags for the ]m4_default($3, $1)[ library], [$2])], - [NUT_ARG_WITH_LIBOPTS_INVALID_YESNO([m4_translit($1, 'A-Z', 'a-z')-libs], [LIBS|auto], [linker flags for the ]m4_default($3, $1)[ library], [auto])]) + [NUT_ARG_WITH_LIBOPTS_INVALID_YESNO([]m4_translit([$1], 'A-Z', 'a-z')[-libs], [LIBS|auto], [linker flags for the ]m4_default([$3], [$1])[ library], [$2])], + [NUT_ARG_WITH_LIBOPTS_INVALID_YESNO([]m4_translit([$1], 'A-Z', 'a-z')[-libs], [LIBS|auto], [linker flags for the ]m4_default([$3], [$1])[ library], [auto])]) ]) AC_DEFUN([NUT_ARG_WITH_LIBOPTS_LIBS_AS_LDFLAGS], [ m4_ifval([$2], - [NUT_ARG_WITH_LIBOPTS_INVALID_YESNO([m4_translit($1, 'A-Z', 'a-z')-libs], [LDFLAGS|auto], [linker flags for the ]m4_default($3, $1)[ library], [$2])], - [NUT_ARG_WITH_LIBOPTS_INVALID_YESNO([m4_translit($1, 'A-Z', 'a-z')-libs], [LDFLAGS|auto], [linker flags for the ]m4_default($3, $1)[ library], [auto])]) + [NUT_ARG_WITH_LIBOPTS_INVALID_YESNO([]m4_translit([$1], 'A-Z', 'a-z')[-libs], [LDFLAGS|auto], [linker flags for the ]m4_default([$3], [$1])[ library], [$2])], + [NUT_ARG_WITH_LIBOPTS_INVALID_YESNO([]m4_translit([$1], 'A-Z', 'a-z')[-libs], [LDFLAGS|auto], [linker flags for the ]m4_default([$3], [$1])[ library], [auto])]) ]) AC_DEFUN([NUT_ARG_WITH_LIBOPTS_LDFLAGS], [ m4_ifval([$2], - [NUT_ARG_WITH_LIBOPTS_INVALID_YESNO([m4_translit($1, 'A-Z', 'a-z')-ldflags], [LDFLAGS|auto], [linker flags for the ]m4_default($3, $1)[ library], [$2])], - [NUT_ARG_WITH_LIBOPTS_INVALID_YESNO([m4_translit($1, 'A-Z', 'a-z')-ldflags], [LDFLAGS|auto], [linker flags for the ]m4_default($3, $1)[ library], [auto])]) + [NUT_ARG_WITH_LIBOPTS_INVALID_YESNO([]m4_translit([$1], 'A-Z', 'a-z')[-ldflags], [LDFLAGS|auto], [linker flags for the ]m4_default([$3], [$1])[ library], [$2])], + [NUT_ARG_WITH_LIBOPTS_INVALID_YESNO([]m4_translit([$1], 'A-Z', 'a-z')[-ldflags], [LDFLAGS|auto], [linker flags for the ]m4_default([$3], [$1])[ library], [auto])]) ]) dnl Help detect legacy -config scripts, assigns "none" if disabled or not found @@ -149,11 +149,11 @@ dnl $5 project name spelling for help message (very optional) AC_DEFUN([NUT_ARG_WITH_LIBOPTS_CONFIGSCRIPT_IMPLEM], [ dnl By default seek in PATH - NUT_ARG_WITH_LIBOPTS([m4_translit($1, 'A-Z', 'a-z')-config], [/path/to/m4_translit($1, 'A-Z', 'a-z')-config|auto|none], [path to program that reports ]m4_default($5, $1)[ configuration], [$4]) - AS_CASE([[${nut_with_]m4_translit($1, [-], [_])[_config}]], + NUT_ARG_WITH_LIBOPTS([]m4_translit([$1], 'A-Z', 'a-z')[-config], [/path/to/m4_translit([$1], 'A-Z', 'a-z')-config|auto|none], [path to program that reports ]m4_default([$5], [$1])[ configuration], [$4]) + AS_CASE([[${nut_with_]m4_translit([$1], [-], [_])[_config}]], [yes|auto|""], [AC_PATH_PROGS([$2], [$3], [none])], [no|none], [$2="none"], - [$2=["${nut_with_]m4_translit($1, [-], [_])[_config}"]] + [$2=["${nut_with_]m4_translit([$1], [-], [_])[_config}"]] ) ]) @@ -162,7 +162,7 @@ AC_DEFUN([NUT_ARG_WITH_LIBOPTS_CONFIGSCRIPT_IMPLEM_2], [ m4_ifval([$2], [NUT_ARG_WITH_LIBOPTS_CONFIGSCRIPT_IMPLEM([$1], [$2], [$3], [$4], [$5])], - [NUT_ARG_WITH_LIBOPTS_CONFIGSCRIPT_IMPLEM([$1], m4_translit(m4_translit($1, 'a-z', 'A-Z'), [-], [_])[_CONFIG], [$3], [$4], [$5])]) + [NUT_ARG_WITH_LIBOPTS_CONFIGSCRIPT_IMPLEM([$1], m4_translit(m4_translit([$1], 'a-z', 'A-Z'), [-], [_])[_CONFIG], [$3], [$4], [$5])]) ]) dnl Part of stack, use or guess optional parameter $3 (prog names); pass others as is @@ -170,7 +170,7 @@ AC_DEFUN([NUT_ARG_WITH_LIBOPTS_CONFIGSCRIPT_IMPLEM_3], [ m4_ifval([$3], [NUT_ARG_WITH_LIBOPTS_CONFIGSCRIPT_IMPLEM_2([$1], [$2], [$3], [$4], [$5])], - [NUT_ARG_WITH_LIBOPTS_CONFIGSCRIPT_IMPLEM_2([$1], [$2], [m4_translit($1, 'A-Z', 'a-z')-config], [$4], [$5])]) + [NUT_ARG_WITH_LIBOPTS_CONFIGSCRIPT_IMPLEM_2([$1], [$2], []m4_translit([$1], 'A-Z', 'a-z')[-config], [$4], [$5])]) ]) dnl Just the (normal-cased) third-party project name is required @@ -189,7 +189,7 @@ AC_DEFUN([NUT_ARG_WITH_LIBOPTS_CONFIGSCRIPT], dnl Enable a package feature/ability (might name a variant, or yes/no) dnl https://www.gnu.org/software/autoconf/manual/autoconf-2.66/html_node/Package-Options.html AC_DEFUN([NUT_ARG_ENABLE_CUSTOM_DEFAULT_HELP], -[ AC_ARG_ENABLE($1, +[ AC_ARG_ENABLE([$1], m4_ifval([$2], [m4_ifval([$5], [AS_HELP_STRING([--enable-$1=$2], [$3 (default: $5)])], @@ -197,19 +197,19 @@ AC_DEFUN([NUT_ARG_ENABLE_CUSTOM_DEFAULT_HELP], [m4_ifval([$5], [AS_HELP_STRING([--enable-$1], [$3 (default: $5)])], [AS_HELP_STRING([--enable-$1], [$3 (default: $4)])])]), - [[nut_enable_]m4_translit($1, [-], [_])="${enableval}"], - [[nut_enable_]m4_translit($1, [-], [_])="$4"] + [[nut_enable_]m4_translit([$1], [-], [_])="${enableval}"], + [[nut_enable_]m4_translit([$1], [-], [_])="$4"] ) ]) AC_DEFUN([NUT_ARG_ENABLE_EXPAND_DEFAULT_HELP], [ - NUT_ARG_ENABLE_CUSTOM_DEFAULT_HELP([$1], [$2], [$3], [$4], NUT_ARG_EXPAND(enable_$1, $4)) + NUT_ARG_ENABLE_CUSTOM_DEFAULT_HELP([$1], [$2], [$3], [$4], NUT_ARG_EXPAND([[enable_]$1], [$4])) ]) AC_DEFUN([NUT_ARG_ENABLE_EXPAND_DEFAULT_HELP_SINGLEQUOTE], [ - NUT_ARG_ENABLE_CUSTOM_DEFAULT_HELP([$1], [$2], [$3], [$4], resolved from NUT_ARG_EXPAND(enable_$1, '$4')) + NUT_ARG_ENABLE_CUSTOM_DEFAULT_HELP([$1], [$2], [$3], [$4], resolved from NUT_ARG_EXPAND([[enable_]$1], '[$4]')) ]) AC_DEFUN([NUT_ARG_ENABLE], From 0ca2665c82bdb832b33aa47388bca12ab24015bb Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Wed, 22 Oct 2025 12:28:07 +0200 Subject: [PATCH 377/805] m4/nut_check_libfreeipmi.m4: comment a reminder about numerous libs that we can resolve here (with one being correct) [#3049] Signed-off-by: Jim Klimov --- m4/nut_check_libfreeipmi.m4 | 3 +++ 1 file changed, 3 insertions(+) diff --git a/m4/nut_check_libfreeipmi.m4 b/m4/nut_check_libfreeipmi.m4 index fc2c00c5c8..b3ac02ef23 100644 --- a/m4/nut_check_libfreeipmi.m4 +++ b/m4/nut_check_libfreeipmi.m4 @@ -93,6 +93,9 @@ if test -z "${nut_have_libfreeipmi_seen}"; then LIBIPMI_LIBS="${depLIBS}" dnl Help ltdl if we can (nut-scanner etc.) + dnl Note we can have e.g. `-lfreeipmi -lipmimonitoring` with + dnl one including the other, so should try to prefer the + dnl "outer" linked library (libipmimonitoring here). (FIXME!) for TOKEN in $depLIBS ; do AS_CASE(["${TOKEN}"], [-l*ipmi*], [ From e98a3ad7c0c514565f1486238f90c4e3e3bc7aa1 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Wed, 22 Oct 2025 12:40:43 +0200 Subject: [PATCH 378/805] m4/nut_check_libfreeipmi.m4: track and report depCFLAGS_SOURCE/depLIBS_SOURCE consistently [#3049] Signed-off-by: Jim Klimov --- m4/nut_check_libfreeipmi.m4 | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/m4/nut_check_libfreeipmi.m4 b/m4/nut_check_libfreeipmi.m4 index b3ac02ef23..07b88d9747 100644 --- a/m4/nut_check_libfreeipmi.m4 +++ b/m4/nut_check_libfreeipmi.m4 @@ -16,7 +16,9 @@ if test -z "${nut_have_libfreeipmi_seen}"; then CFLAGS="" LIBS="" depCFLAGS="" + depCFLAGS_SOURCE="" depLIBS="" + depLIBS_SOURCE="" AS_IF([test x"$have_PKG_CONFIG" = xyes], [dnl pkg-config support requires Freeipmi 1.0.5, released on Thu Jun 30 2011 @@ -37,9 +39,13 @@ if test -z "${nut_have_libfreeipmi_seen}"; then AS_IF([test x"$FREEIPMI_VERSION" != xnone], [depCFLAGS="`$PKG_CONFIG --silence-errors --cflags libfreeipmi libipmimonitoring 2>/dev/null`" depLIBS="`$PKG_CONFIG --silence-errors --libs libfreeipmi libipmimonitoring 2>/dev/null`" + depCFLAGS_SOURCE="pkg-config" + depLIBS_SOURCE="pkg-config" ], [depCFLAGS="" depLIBS="-lfreeipmi -lipmimonitoring" + depCFLAGS_SOURCE="default" + depLIBS_SOURCE="default" ] ) @@ -48,17 +54,19 @@ if test -z "${nut_have_libfreeipmi_seen}"; then NUT_ARG_WITH_LIBOPTS_INCLUDES([FreeIPMI], [auto]) AS_CASE([${nut_with_freeipmi_includes}], [auto], [], dnl Keep what we had found above - [depCFLAGS="${nut_with_freeipmi_includes}"] + [depCFLAGS="${nut_with_freeipmi_includes}" + depCFLAGS_SOURCE="confarg"] ) - AC_MSG_RESULT([${depCFLAGS}]) + AC_MSG_RESULT([${depCFLAGS} (source: ${depCFLAGS_SOURCE})]) AC_MSG_CHECKING(for FreeIPMI ldflags) NUT_ARG_WITH_LIBOPTS_LIBS([FreeIPMI], [auto]) AS_CASE([${nut_with_freeipmi_libs}], [auto], [], dnl Keep what we had found above - [depLIBS="${nut_with_freeipmi_libs}"] + [depLIBS="${nut_with_freeipmi_libs}" + depLIBS_SOURCE="confarg"] ) - AC_MSG_RESULT([${depLIBS}]) + AC_MSG_RESULT([${depLIBS} (source: ${depLIBS_SOURCE})]) dnl check if freeipmi is usable with our current flags CFLAGS="${CFLAGS_ORIG} ${depCFLAGS}" @@ -122,6 +130,8 @@ if test -z "${nut_have_libfreeipmi_seen}"; then unset depCFLAGS unset depLIBS + unset depCFLAGS_SOURCE + unset depLIBS_SOURCE dnl restore original CFLAGS and LIBS CFLAGS="${CFLAGS_ORIG}" From 5e1491a42eb8baf120d663098a352364f622ed06 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Wed, 22 Oct 2025 12:58:33 +0200 Subject: [PATCH 379/805] m4/nut_check_libgd.m4: track and report depCFLAGS_SOURCE/depLIBS_SOURCE consistently [#3049] Signed-off-by: Jim Klimov --- m4/nut_check_libgd.m4 | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/m4/nut_check_libgd.m4 b/m4/nut_check_libgd.m4 index c51eeeb9bd..def3363e87 100644 --- a/m4/nut_check_libgd.m4 +++ b/m4/nut_check_libgd.m4 @@ -16,8 +16,11 @@ if test -z "${nut_have_libgd_seen}"; then LDFLAGS="" LIBS="" depCFLAGS="" + depCFLAGS_SOURCE="" depLDFLAGS="" + depLDFLAGS_SOURCE="" depLIBS="" + depLIBS_SOURCE="" AS_IF([test x"${nut_enable_configure_debug}" = xyes], [ AC_MSG_NOTICE([(CONFIGURE-DEVEL-DEBUG) LIBGD (before): CFLAGS_ORIG="${CFLAGS_ORIG}" CXXFLAGS_ORIG="${CXXFLAGS_ORIG}" CPPFLAGS_ORIG="${CPPFLAGS_ORIG}" LDFLAGS_ORIG="${LDFLAGS_ORIG}" LIBS_ORIG="${LIBS_ORIG}"]) @@ -39,6 +42,9 @@ if test -z "${nut_have_libgd_seen}"; then AS_IF([test x"$GD_VERSION" != xnone], [depCFLAGS="`$PKG_CONFIG --silence-errors --cflags gdlib 2>/dev/null`" depLIBS="`$PKG_CONFIG --silence-errors --libs gdlib 2>/dev/null`" + depCFLAGS_SOURCE="pkg-config" + depLDFLAGS_SOURCE="pkg-config(N/A)" + depLIBS_SOURCE="pkg-config" ], [dnl Initial defaults. These are only used if gdlib-config is dnl unusable and the user fails to pass better values in --with @@ -46,6 +52,9 @@ if test -z "${nut_have_libgd_seen}"; then depCFLAGS="" depLDFLAGS="-L/usr/X11R6/lib" depLIBS="-lgd -lpng -lz -ljpeg -lfreetype -lm -lXpm -lX11" + depCFLAGS_SOURCE="default" + depLDFLAGS_SOURCE="default" + depLIBS_SOURCE="default" dnl Define --with-gdlib-config option NUT_ARG_WITH_LIBOPTS_CONFIGSCRIPT([GDLIB]) @@ -71,6 +80,9 @@ if test -z "${nut_have_libgd_seen}"; then depCFLAGS="`${GDLIB_CONFIG} --includes 2>/dev/null`" depLDFLAGS="`${GDLIB_CONFIG} --ldflags 2>/dev/null`" depLIBS="`${GDLIB_CONFIG} --libs 2>/dev/null`" + depCFLAGS_SOURCE="${GDLIB_CONFIG} program" + depLDFLAGS_SOURCE="${GDLIB_CONFIG} program" + depLIBS_SOURCE="${GDLIB_CONFIG} program" ;; esac ] @@ -82,9 +94,10 @@ if test -z "${nut_have_libgd_seen}"; then NUT_ARG_WITH_LIBOPTS_INCLUDES([gd], [auto]) AS_CASE([${nut_with_gd_includes}], [auto], [], dnl Keep what we had found above - [depCFLAGS="${nut_with_gd_includes}"] + [depCFLAGS="${nut_with_gd_includes}" + depCFLAGS_SOURCE="confarg"] ) - AC_MSG_RESULT([${depCFLAGS}]) + AC_MSG_RESULT([${depCFLAGS} (source: ${depCFLAGS_SOURCE})]) dnl Technically, here we seek LDFLAGS not LIBS... AC_MSG_CHECKING(for gd library flags) @@ -92,9 +105,11 @@ if test -z "${nut_have_libgd_seen}"; then AS_CASE([${nut_with_gd_libs}], [auto], [], dnl Keep what we had found above [depLDFLAGS="${nut_with_gd_libs}" - depLIBS=""] + depLIBS="" + depLDFLAGS_SOURCE="confarg" + depLIBS_SOURCE="confarg"] ) - AC_MSG_RESULT([${depLDFLAGS} ${depLIBS}]) + AC_MSG_RESULT([${depLDFLAGS} ${depLIBS} (source: ${depLDFLAGS_SOURCE}/${depLIBS_SOURCE})]) dnl check if gd is usable CFLAGS="${CFLAGS_ORIG} ${depCFLAGS}" @@ -168,6 +183,9 @@ gdImageDestroy(im); unset depCFLAGS unset depLDFLAGS unset depLIBS + unset depCFLAGS_SOURCE + unset depLDFLAGS_SOURCE + unset depLIBS_SOURCE dnl put back the original versions CFLAGS="${CFLAGS_ORIG}" From 49a8120ce8248dcfb7d81fb7bad004ee27317c95 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Wed, 22 Oct 2025 12:58:49 +0200 Subject: [PATCH 380/805] m4/nut_check_libusb.m4: track and report depCFLAGS_SOURCE/depLIBS_SOURCE consistently [#3049] Signed-off-by: Jim Klimov --- m4/nut_check_libusb.m4 | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/m4/nut_check_libusb.m4 b/m4/nut_check_libusb.m4 index c4213cd071..8e2e03f07d 100644 --- a/m4/nut_check_libusb.m4 +++ b/m4/nut_check_libusb.m4 @@ -23,7 +23,9 @@ if test -z "${nut_have_libusb_seen}"; then CFLAGS="" LIBS="" depCFLAGS="" + depCFLAGS_SOURCE="" depLIBS="" + depLIBS_SOURCE="" dnl Magic-format string to hold chosen libusb version and its config-source nut_usb_lib="" @@ -105,7 +107,7 @@ if test -z "${nut_have_libusb_seen}"; then ) dnl Pick up the default or caller-provided choice here from - dnl NUT_ARG_WITH(usb, ...) in the main configure.ac script + dnl NUT-ARG-WITH(usb, ...) in the main configure.ac script AC_MSG_CHECKING([for libusb preferred version]) AS_CASE(["${nut_with_usb}"], [auto], [], dnl Use preference picked above @@ -148,20 +150,28 @@ if test -z "${nut_have_libusb_seen}"; then ["(libusb-1.0)"], [ depCFLAGS="`$PKG_CONFIG --silence-errors --cflags libusb-1.0 2>/dev/null`" depLIBS="`$PKG_CONFIG --silence-errors --libs libusb-1.0 2>/dev/null`" + depCFLAGS_SOURCE="pkg-config(libusb-1.0)" + depLIBS_SOURCE="pkg-config(libusb-1.0)" ], ["(libusb-0.1)"], [ depCFLAGS="`$PKG_CONFIG --silence-errors --cflags libusb 2>/dev/null`" depLIBS="`$PKG_CONFIG --silence-errors --libs libusb 2>/dev/null`" + depCFLAGS_SOURCE="pkg-config(libusb-0.1)" + depLIBS_SOURCE="pkg-config(libusb-0.1)" ], ["(libusb-0.1-config)"], [ depCFLAGS="`$LIBUSB_CONFIG --cflags 2>/dev/null`" depLIBS="`$LIBUSB_CONFIG --libs 2>/dev/null`" + depCFLAGS_SOURCE="${LIBUSB_CONFIG} program (libusb-0.1)" + depLIBS_SOURCE="${LIBUSB_CONFIG} program (libusb-0.1)" ], [dnl default, for other versions or "none" AC_MSG_WARN([Defaulting libusb configuration]) LIBUSB_VERSION="none" depCFLAGS="" depLIBS="-lusb" + depCFLAGS_SOURCE="default" + depLIBS_SOURCE="default" ] ) @@ -171,17 +181,19 @@ if test -z "${nut_have_libusb_seen}"; then NUT_ARG_WITH_LIBOPTS_INCLUDES([usb], [auto], [libusb]) AS_CASE([${nut_with_usb_includes}], [auto], [], dnl Keep what we had found above - [depCFLAGS="${nut_with_usb_includes}"] + [depCFLAGS="${nut_with_usb_includes}" + depCFLAGS_SOURCE="confarg"] ) - AC_MSG_RESULT([${depCFLAGS}]) + AC_MSG_RESULT([${depCFLAGS} (source: ${depCFLAGS_SOURCE})]) AC_MSG_CHECKING(for libusb ldflags) NUT_ARG_WITH_LIBOPTS_LIBS([usb], [auto], [libusb]) AS_CASE([${nut_with_usb_libs}], [auto], [], dnl Keep what we had found above - [depLIBS="${nut_with_usb_libs}"] + [depLIBS="${nut_with_usb_libs}" + depLIBS_SOURCE="confarg"] ) - AC_MSG_RESULT([${depLIBS}]) + AC_MSG_RESULT([${depLIBS} (source: ${depLIBS_SOURCE})]) dnl TODO: Consult chosen nut_usb_lib value and/or nut_with_usb argument dnl (with "auto" we may use a 0.1 if present and working while a 1.0 is @@ -416,6 +428,8 @@ if test -z "${nut_have_libusb_seen}"; then unset depCFLAGS unset depLIBS + unset depCFLAGS_SOURCE + unset depLIBS_SOURCE dnl restore original CFLAGS and LIBS CFLAGS="${CFLAGS_ORIG}" From 1bb137926ca72bf7e7924915ae508f9cc5f73827 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Wed, 22 Oct 2025 13:03:20 +0200 Subject: [PATCH 381/805] m4/nut_check_libavahi.m4: track and report depCFLAGS_SOURCE/depLIBS_SOURCE consistently [#3049] Signed-off-by: Jim Klimov --- m4/nut_check_libavahi.m4 | 32 ++++++++++++++++++++++---------- 1 file changed, 22 insertions(+), 10 deletions(-) diff --git a/m4/nut_check_libavahi.m4 b/m4/nut_check_libavahi.m4 index a45ac4a564..0226b5fc5d 100644 --- a/m4/nut_check_libavahi.m4 +++ b/m4/nut_check_libavahi.m4 @@ -15,7 +15,9 @@ if test -z "${nut_have_avahi_seen}"; then CFLAGS="" LIBS="" depCFLAGS="" + depCFLAGS_SOURCE="" depLIBS="" + depLIBS_SOURCE="" AS_IF([test x"$have_PKG_CONFIG" = xyes], [dnl See which version of the avahi library (if any) is installed @@ -39,25 +41,33 @@ if test -z "${nut_have_avahi_seen}"; then NUT_ARG_WITH_LIBOPTS_INCLUDES([avahi], [auto]) AS_CASE([${nut_with_avahi_includes}], [auto], [AS_IF([test x"$have_PKG_CONFIG" = xyes], - [depCFLAGS="`$PKG_CONFIG --silence-errors --cflags avahi-core avahi-client 2>/dev/null`" \ - || depCFLAGS="-I/usr/local/include -I/usr/include -L/usr/local/lib -L/usr/lib"], - [depCFLAGS="-I/usr/local/include -I/usr/include -L/usr/local/lib -L/usr/lib"] + [ { depCFLAGS="`$PKG_CONFIG --silence-errors --cflags avahi-core avahi-client 2>/dev/null`" \ + && depCFLAGS_SOURCE="pkg-config" ; } \ + || { depCFLAGS="-I/usr/local/include -I/usr/include -L/usr/local/lib -L/usr/lib" \ + && depCFLAGS_SOURCE="default" ; }], + [depCFLAGS="-I/usr/local/include -I/usr/include -L/usr/local/lib -L/usr/lib" + depCFLAGS_SOURCE="default"] )], - [depCFLAGS="${nut_with_avahi_includes}"] + [depCFLAGS="${nut_with_avahi_includes}" + depCFLAGS_SOURCE="confarg"] ) - AC_MSG_RESULT([${depCFLAGS}]) + AC_MSG_RESULT([${depCFLAGS} (source: ${depCFLAGS_SOURCE})]) AC_MSG_CHECKING(for avahi ldflags) NUT_ARG_WITH_LIBOPTS_LIBS([avahi], [auto]) AS_CASE([${nut_with_avahi_libs}], [auto], [AS_IF([test x"$have_PKG_CONFIG" = xyes], - [depLIBS="`$PKG_CONFIG --silence-errors --libs avahi-core avahi-client 2>/dev/null`" \ - || depLIBS="-lavahi-core -lavahi-client"], - [depLIBS="-lavahi-core -lavahi-client"] + [ { depLIBS="`$PKG_CONFIG --silence-errors --libs avahi-core avahi-client 2>/dev/null`" \ + && depLIBS_SOURCE="pkg-config" ; } \ + || { depLIBS="-lavahi-core -lavahi-client" \ + && depLIBS_SOURCE="default" ; }], + [depLIBS="-lavahi-core -lavahi-client" + depLIBS_SOURCE="default"] )], - [depLIBS="${nut_with_avahi_libs}"] + [depLIBS="${nut_with_avahi_libs}" + depLIBS_SOURCE="confarg"] ) - AC_MSG_RESULT([${depLIBS}]) + AC_MSG_RESULT([${depLIBS} (source: ${depLIBS_SOURCE})]) dnl check if avahi-core is usable CFLAGS="${CFLAGS_ORIG} ${depCFLAGS}" @@ -93,6 +103,8 @@ if test -z "${nut_have_avahi_seen}"; then unset depCFLAGS unset depLIBS + unset depCFLAGS_SOURCE + unset depLIBS_SOURCE dnl restore original CFLAGS and LIBS CFLAGS="${CFLAGS_ORIG}" From be7ec677f784826c0dfa69198ed2c1e8d78682e3 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Wed, 22 Oct 2025 13:07:04 +0200 Subject: [PATCH 382/805] m4/nut_check_libgpiod.m4: track and report depCFLAGS_SOURCE/depLIBS_SOURCE consistently [#3049] Signed-off-by: Jim Klimov --- m4/nut_check_libgpiod.m4 | 30 ++++++++++++++++++++---------- 1 file changed, 20 insertions(+), 10 deletions(-) diff --git a/m4/nut_check_libgpiod.m4 b/m4/nut_check_libgpiod.m4 index 84c4d1fa44..13b83e3830 100644 --- a/m4/nut_check_libgpiod.m4 +++ b/m4/nut_check_libgpiod.m4 @@ -15,7 +15,9 @@ if test -z "${nut_have_gpio_seen}"; then CFLAGS="" LIBS="" depCFLAGS="" + depCFLAGS_SOURCE="" depLIBS="" + depLIBS_SOURCE="" # Store implementation (if any) to be reported by configure.ac: nut_gpio_lib="" @@ -43,26 +45,34 @@ if test -z "${nut_have_gpio_seen}"; then AS_CASE([${nut_with_gpio_includes}], [auto], [ AS_IF([test x"$have_PKG_CONFIG" = xyes], - [depCFLAGS="`$PKG_CONFIG --silence-errors --cflags libgpiod 2>/dev/null`" \ - || depCFLAGS="-I/usr/include -I/usr/local/include"], - [depCFLAGS="-I/usr/include -I/usr/local/include"] + [ { depCFLAGS="`$PKG_CONFIG --silence-errors --cflags libgpiod 2>/dev/null`" \ + && depCFLAGS_SOURCE="pkg-config" ; } \ + || { depCFLAGS="-I/usr/include -I/usr/local/include" \ + && depCFLAGS_SOURCE="default" ; }], + [depCFLAGS="-I/usr/include -I/usr/local/include" + depCFLAGS_SOURCE="default"] )], - [depCFLAGS="${nut_with_gpio_includes}"] + [depCFLAGS="${nut_with_gpio_includes}" + depCFLAGS_SOURCE="confarg"] ) - AC_MSG_RESULT([${depCFLAGS}]) + AC_MSG_RESULT([${depCFLAGS} (source: ${depCFLAGS_SOURCE})]) AC_MSG_CHECKING(for libgpiod ldflags) NUT_ARG_WITH_LIBOPTS_LIBS([gpio], [auto], [gpiod]) AS_CASE([${nut_with_gpio_libs}], [auto], [ AS_IF([test x"$have_PKG_CONFIG" = xyes], - [depLIBS="`$PKG_CONFIG --silence-errors --libs libgpiod 2>/dev/null`" \ - || depLIBS="-lgpiod"], - [depLIBS="-lgpiod"] + [ { depLIBS="`$PKG_CONFIG --silence-errors --libs libgpiod 2>/dev/null`" \ + && depLIBS_SOURCE="pkg-config" ; } \ + || { depLIBS="-lgpiod" \ + && depLIBS_SOURCE="default" ; }], + [depLIBS="-lgpiod" + depLIBS_SOURCE="default"] )], - [depLIBS="${nut_with_gpio_libs}"] + [depLIBS="${nut_with_gpio_libs}" + depLIBS_SOURCE="confarg"] ) - AC_MSG_RESULT([${depLIBS}]) + AC_MSG_RESULT([${depLIBS} (source: ${depLIBS_SOURCE})]) dnl check if gpiod is usable CFLAGS="${CFLAGS_ORIG} ${depCFLAGS}" From c867baf30c394c999fb89e30a25b6657360c9596 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Wed, 22 Oct 2025 13:10:04 +0200 Subject: [PATCH 383/805] m4/nut_check_libltdl.m4: track and report depCFLAGS_SOURCE/depLIBS_SOURCE consistently [#3049] Signed-off-by: Jim Klimov --- m4/nut_check_libltdl.m4 | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/m4/nut_check_libltdl.m4 b/m4/nut_check_libltdl.m4 index 5fe95ee17c..a7c6021180 100644 --- a/m4/nut_check_libltdl.m4 +++ b/m4/nut_check_libltdl.m4 @@ -12,10 +12,12 @@ if test -z "${nut_have_libltdl_seen}"; then dnl save CFLAGS and LIBS CFLAGS_ORIG="${CFLAGS}" LIBS_ORIG="${LIBS}" - LIBS="" CFLAGS="" - depLIBS="" + LIBS="" depCFLAGS="" + depCFLAGS_SOURCE="" + depLIBS="" + depLIBS_SOURCE="" dnl For fallback below: myCFLAGS="" @@ -26,18 +28,21 @@ if test -z "${nut_have_libltdl_seen}"; then dnl Best-Effort Fallback (LDFLAGS might make more sense for -L..., dnl but other m4 files have it so) to use if probe below fails: myCFLAGS="-I/usr/local/include -I/usr/include -L/usr/local/lib -L/usr/lib" + depCFLAGS_SOURCE="default" ], - [depCFLAGS="${nut_with_libltdl_includes}"] + [depCFLAGS="${nut_with_libltdl_includes}" + depCFLAGS_SOURCE="confarg"] ) - AC_MSG_RESULT([${depCFLAGS}]) + AC_MSG_RESULT([${depCFLAGS} (source: ${depCFLAGS_SOURCE})]) AC_MSG_CHECKING(for libltdl ldflags) NUT_ARG_WITH_LIBOPTS_LIBS([libltdl], [auto]) AS_CASE([${nut_with_libltdl_libs}], - [auto], [], dnl No fallback here - we probe suitable libs below - [depLIBS="${nut_with_libltdl_libs}"] + [auto], [depLIBS_SOURCE="default (probe later)"], dnl No fallback here - we probe suitable libs below + [depLIBS="${nut_with_libltdl_libs}" + depLIBS_SOURCE="confarg"] ) - AC_MSG_RESULT([${depLIBS}]) + AC_MSG_RESULT([${depLIBS} (source: ${depLIBS_SOURCE})]) CFLAGS="${CFLAGS_ORIG} ${depCFLAGS}" LIBS="${LIBS_ORIG} ${depLIBS}" @@ -76,9 +81,12 @@ if test -z "${nut_have_libltdl_seen}"; then LIBLTDL_CFLAGS="${depCFLAGS}" LIBLTDL_LIBS="${depLIBS}" ]) + unset myCFLAGS unset depCFLAGS unset depLIBS + unset depCFLAGS_SOURCE + unset depLIBS_SOURCE dnl restore original CFLAGS and LIBS CFLAGS="${CFLAGS_ORIG}" From 2e91a61ffd624bd3d09643a89b9a46cea7544662 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Wed, 22 Oct 2025 13:12:38 +0200 Subject: [PATCH 384/805] m4/nut_check_libnetsnmp.m4: track and report depCFLAGS_SOURCE/depLIBS_SOURCE consistently [#3049] Signed-off-by: Jim Klimov --- m4/nut_check_libnetsnmp.m4 | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/m4/nut_check_libnetsnmp.m4 b/m4/nut_check_libnetsnmp.m4 index 13d60bd82d..1e8fcb6d2b 100644 --- a/m4/nut_check_libnetsnmp.m4 +++ b/m4/nut_check_libnetsnmp.m4 @@ -18,6 +18,8 @@ if test -z "${nut_have_libnetsnmp_seen}"; then LIBS="" depCFLAGS="" depLIBS="" + depCFLAGS_SOURCE="" + depLIBS_SOURCE="" dnl We prefer to get info from pkg-config (for suitable arch/bitness as dnl specified in args for that mechanism), unless (legacy) a particular @@ -84,13 +86,12 @@ if test -z "${nut_have_libnetsnmp_seen}"; then AC_MSG_WARN([did not find either net-snmp-config or pkg-config for net-snmp]) fi - depCFLAGS_SOURCE="" AC_MSG_CHECKING(for Net-SNMP cflags) NUT_ARG_WITH_LIBOPTS_INCLUDES([snmp], [auto], [Net-SNMP]) AS_CASE([${nut_with_snmp_includes}], [auto], [AS_IF(["${prefer_NET_SNMP_CONFIG}"], [depCFLAGS="`${NET_SNMP_CONFIG} --base-cflags 2>/dev/null`" - depCFLAGS_SOURCE="netsnmp-config"], + depCFLAGS_SOURCE="${NET_SNMP_CONFIG} program"], [AS_IF([test x"$have_PKG_CONFIG" = xyes], [depCFLAGS="`$PKG_CONFIG --silence-errors --cflags netsnmp 2>/dev/null`" depCFLAGS_SOURCE="pkg-config"], @@ -102,13 +103,13 @@ if test -z "${nut_have_libnetsnmp_seen}"; then ) AC_MSG_RESULT([${depCFLAGS} (source: ${depCFLAGS_SOURCE})]) - depLIBS_SOURCE="" + dnl Note: below we check for specifically `if depLIBS_SOURCE == "pkg-config"` AC_MSG_CHECKING(for Net-SNMP libs) NUT_ARG_WITH_LIBOPTS_LIBS([snmp], [auto], [Net-SNMP]) AS_CASE([${nut_with_snmp_libs}], [auto], [AS_IF(["${prefer_NET_SNMP_CONFIG}"], [depLIBS="`${NET_SNMP_CONFIG} --libs 2>/dev/null`" - depLIBS_SOURCE="netsnmp-config"], + depLIBS_SOURCE="${NET_SNMP_CONFIG} program"], [AS_IF([test x"$have_PKG_CONFIG" = xyes], [depLIBS="`$PKG_CONFIG --silence-errors --libs netsnmp 2>/dev/null`" depLIBS_SOURCE="pkg-config"], @@ -375,6 +376,8 @@ int num = NETSNMP_DRAFT_BLUMENTHAL_AES_04 + 1; /* if defined, NETSNMP_DRAFT_BLUM unset depCFLAGS unset depLIBS + unset depCFLAGS_SOURCE + unset depLIBS_SOURCE dnl restore original CFLAGS and LIBS CFLAGS="${CFLAGS_ORIG}" From 94e648f4331ad33d6f742f8926b449c75064cf8c Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Wed, 22 Oct 2025 13:23:24 +0200 Subject: [PATCH 385/805] m4/nut_check_libmodbus.m4: track and report depCFLAGS_SOURCE/depLIBS_SOURCE consistently [#3049] Signed-off-by: Jim Klimov --- m4/nut_check_libmodbus.m4 | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/m4/nut_check_libmodbus.m4 b/m4/nut_check_libmodbus.m4 index bd5dce0cb8..81e680bcae 100644 --- a/m4/nut_check_libmodbus.m4 +++ b/m4/nut_check_libmodbus.m4 @@ -15,7 +15,9 @@ if test -z "${nut_have_libmodbus_seen}"; then CFLAGS="" LIBS="" depCFLAGS="" + depCFLAGS_SOURCE="" depLIBS="" + depLIBS_SOURCE="" AS_IF([test x"$have_PKG_CONFIG" = xyes], [AC_MSG_CHECKING(for libmodbus version via pkg-config) @@ -33,9 +35,13 @@ if test -z "${nut_have_libmodbus_seen}"; then AS_IF([test x"$LIBMODBUS_VERSION" != xnone], [depCFLAGS="`$PKG_CONFIG --silence-errors --cflags libmodbus 2>/dev/null`" depLIBS="`$PKG_CONFIG --silence-errors --libs libmodbus 2>/dev/null`" + depCFLAGS_SOURCE="pkg-config" + depLIBS_SOURCE="pkg-config" ], [depCFLAGS="-I/usr/include/modbus" depLIBS="-lmodbus" + depCFLAGS_SOURCE="default" + depLIBS_SOURCE="default" ] ) @@ -43,17 +49,19 @@ if test -z "${nut_have_libmodbus_seen}"; then NUT_ARG_WITH_LIBOPTS_INCLUDES([modbus], [auto], [libmodbus]) AS_CASE([${nut_with_modbus_includes}], [auto], [], dnl Keep what we had found above - [depCFLAGS="${nut_with_modbus_includes}"] + [depCFLAGS="${nut_with_modbus_includes}" + depCFLAGS_SOURCE="confarg"] ) - AC_MSG_RESULT([${depCFLAGS}]) + AC_MSG_RESULT([${depCFLAGS} (source: ${depCFLAGS_SOURCE})]) AC_MSG_CHECKING(for libmodbus ldflags) NUT_ARG_WITH_LIBOPTS_LIBS([modbus], [auto], [libmodbus]) AS_CASE([${nut_with_modbus_libs}], [auto], [], dnl Keep what we had found above - [depLIBS="${nut_with_modbus_libs}"] + [depLIBS="${nut_with_modbus_libs}" + depLIBS_SOURCE="confarg"] ) - AC_MSG_RESULT([${depLIBS}]) + AC_MSG_RESULT([${depLIBS} (source: ${depLIBS_SOURCE})]) dnl check if libmodbus is usable CFLAGS="${CFLAGS_ORIG} ${depCFLAGS}" @@ -254,6 +262,8 @@ if (ctx) modbus_free(ctx);])], [AS_IF([test -x "conftest$ac_exeext"], [ unset depCFLAGS unset depLIBS + unset depCFLAGS_SOURCE + unset depLIBS_SOURCE dnl restore original CFLAGS and LIBS CFLAGS="${CFLAGS_ORIG}" From 51a2396de3dbded08e5db21a602d13d09f89024b Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Wed, 22 Oct 2025 13:23:33 +0200 Subject: [PATCH 386/805] m4/nut_check_libneon.m4: track and report depCFLAGS_SOURCE/depLIBS_SOURCE consistently [#3049] Signed-off-by: Jim Klimov --- m4/nut_check_libneon.m4 | 32 ++++++++++++++++++++++---------- 1 file changed, 22 insertions(+), 10 deletions(-) diff --git a/m4/nut_check_libneon.m4 b/m4/nut_check_libneon.m4 index 15f2830c71..69df17715b 100644 --- a/m4/nut_check_libneon.m4 +++ b/m4/nut_check_libneon.m4 @@ -15,7 +15,9 @@ if test -z "${nut_have_neon_seen}"; then CFLAGS="" LIBS="" depCFLAGS="" + depCFLAGS_SOURCE="" depLIBS="" + depLIBS_SOURCE="" AS_IF([test x"$have_PKG_CONFIG" = xyes], [dnl See which version of the neon library (if any) is installed @@ -37,25 +39,33 @@ if test -z "${nut_have_neon_seen}"; then NUT_ARG_WITH_LIBOPTS_INCLUDES([neon], [auto]) AS_CASE([${nut_with_neon_includes}], [auto], [AS_IF([test x"$have_PKG_CONFIG" = xyes], - [depCFLAGS="`$PKG_CONFIG --silence-errors --cflags neon 2>/dev/null`" \ - || depCFLAGS="-I/usr/include/neon -I/usr/local/include/neon"], - [depCFLAGS="-I/usr/include/neon -I/usr/local/include/neon"] + [ { depCFLAGS="`$PKG_CONFIG --silence-errors --cflags neon 2>/dev/null`" \ + && depCFLAGS_SOURCE="pkg-config" ; } \ + || { depCFLAGS="-I/usr/include/neon -I/usr/local/include/neon" \ + && depCFLAGS_SOURCE="default" ; }], + [depCFLAGS="-I/usr/include/neon -I/usr/local/include/neon" + depCFLAGS_SOURCE="default"] )], - [depCFLAGS="${nut_with_neon_includes}"] + [depCFLAGS="${nut_with_neon_includes}" + depCFLAGS_SOURCE="confarg"] ) - AC_MSG_RESULT([${CFLAGS}]) + AC_MSG_RESULT([${depCFLAGS} (source: ${depCFLAGS_SOURCE})]) AC_MSG_CHECKING(for libneon ldflags) NUT_ARG_WITH_LIBOPTS_LIBS([neon], [auto]) AS_CASE([${nut_with_neon_libs}], [auto], [AS_IF([test x"$have_PKG_CONFIG" = xyes], - [depLIBS="`$PKG_CONFIG --silence-errors --libs neon 2>/dev/null`" \ - || depLIBS="-lneon"], - [depLIBS="-lneon"] + [ { depLIBS="`$PKG_CONFIG --silence-errors --libs neon 2>/dev/null`" \ + && depLIBS_SOURCE="pkg-config" ; } \ + || { depLIBS="-lneon" \ + && depLIBS_SOURCE="default" ; }], + [depLIBS="-lneon" + depLIBS_SOURCE="default"] )], - [depLIBS="${nut_with_neon_libs}"] + [depLIBS="${nut_with_neon_libs}" + depLIBS_SOURCE="confarg"] ) - AC_MSG_RESULT([${depLIBS}]) + AC_MSG_RESULT([${depLIBS} (source: ${depLIBS_SOURCE})]) dnl check if neon is usable CFLAGS="${CFLAGS_ORIG} ${depCFLAGS}" @@ -88,6 +98,8 @@ if test -z "${nut_have_neon_seen}"; then unset depCFLAGS unset depLIBS + unset depCFLAGS_SOURCE + unset depLIBS_SOURCE dnl restore original CFLAGS and LIBS CFLAGS="${CFLAGS_ORIG}" From dc585f2af906167bf6bd5ff8533fa19e800d669d Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Wed, 22 Oct 2025 13:32:34 +0200 Subject: [PATCH 387/805] m4/nut_check_libgpiod.m4: fix the var names we "unset" in the end [#3049] Signed-off-by: Jim Klimov --- m4/nut_check_libgpiod.m4 | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/m4/nut_check_libgpiod.m4 b/m4/nut_check_libgpiod.m4 index 13b83e3830..0be164c010 100644 --- a/m4/nut_check_libgpiod.m4 +++ b/m4/nut_check_libgpiod.m4 @@ -118,8 +118,10 @@ if test -z "${nut_have_gpio_seen}"; then AC_DEFINE_UNQUOTED(WITH_LIBGPIO_VERSION_STR, ["0x00000000"], [Define libgpio C API version generation as string]) fi - unset CFLAGS - unset LIBS + unset depCFLAGS + unset depLIBS + unset depCFLAGS_SOURCE + unset depLIBS_SOURCE dnl restore original CFLAGS and LIBS CFLAGS="${CFLAGS_ORIG}" From b7c37033bfbd250c61f516d6cdc6023d0792634c Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Wed, 22 Oct 2025 13:57:49 +0200 Subject: [PATCH 388/805] m4/nut_check_libnss.m4: track and report depCFLAGS_SOURCE/depLIBS_SOURCE consistently [#3049] Signed-off-by: Jim Klimov --- m4/nut_check_libnss.m4 | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/m4/nut_check_libnss.m4 b/m4/nut_check_libnss.m4 index e33328e67f..3b694c65df 100644 --- a/m4/nut_check_libnss.m4 +++ b/m4/nut_check_libnss.m4 @@ -17,8 +17,11 @@ if test -z "${nut_have_libnss_seen}"; then LIBS="" REQUIRES="" depCFLAGS="" + depCFLAGS_SOURCE="" depLIBS="" + depLIBS_SOURCE="" depREQUIRES="" + depREQUIRES_SOURCE="" AS_IF([test x"$have_PKG_CONFIG" = xyes], [AC_MSG_CHECKING(for Mozilla NSS version via pkg-config) @@ -37,10 +40,16 @@ if test -z "${nut_have_libnss_seen}"; then [depCFLAGS="`$PKG_CONFIG --silence-errors --cflags nss 2>/dev/null`" depLIBS="`$PKG_CONFIG --silence-errors --libs nss 2>/dev/null`" depREQUIRES="nss" + depCFLAGS_SOURCE="pkg-config" + depLIBS_SOURCE="pkg-config" + depREQUIRES_SOURCE="default(pkg-config)" ], [depCFLAGS="" depLIBS="-lnss3 -lnssutil3 -lsmime3 -lssl3 -lplds4 -lplc4 -lnspr4" depREQUIRES="nss" + depCFLAGS_SOURCE="default" + depLIBS_SOURCE="default" + depREQUIRES_SOURCE="default" ] ) @@ -49,17 +58,19 @@ if test -z "${nut_have_libnss_seen}"; then NUT_ARG_WITH_LIBOPTS_INCLUDES([nss], [auto], [Mozilla NSS]) AS_CASE([${nut_with_nss_includes}], [auto], [], dnl Keep what we had found above - [depCFLAGS="${nut_with_nss_includes}"] + [depCFLAGS="${nut_with_nss_includes}" + depCFLAGS_SOURCE="confarg"] ) - AC_MSG_RESULT([${depCFLAGS}]) + AC_MSG_RESULT([${depCFLAGS} (source: ${depCFLAGS_SOURCE})]) AC_MSG_CHECKING(for Mozilla NSS ldflags) NUT_ARG_WITH_LIBOPTS_LIBS([nss], [auto], [Mozilla NSS]) AS_CASE([${nut_with_nss_libs}], [auto], [], dnl Keep what we had found above - [depLIBS="${nut_with_nss_libs}"] + [depLIBS="${nut_with_nss_libs}" + depLIBS_SOURCE="confarg"] ) - AC_MSG_RESULT([${depLIBS}]) + AC_MSG_RESULT([${depLIBS} (source: ${depLIBS_SOURCE})]) dnl check if NSS is usable: we need both the runtime and headers dnl NOTE that caller may have to specify PKG_CONFIG_PATH including @@ -126,6 +137,9 @@ dnl fi unset depCFLAGS unset depLIBS unset depREQUIRES + unset depCFLAGS_SOURCE + unset depLIBS_SOURCE + unset depREQUIRES_SOURCE dnl restore original CFLAGS and LIBS CFLAGS="${CFLAGS_ORIG}" From 77fe04110b4162c19fcc902569a28a64d3915041 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Wed, 22 Oct 2025 13:58:00 +0200 Subject: [PATCH 389/805] m4/nut_check_libopenssl.m4: track and report depCFLAGS_SOURCE/depLIBS_SOURCE consistently [#3049] Signed-off-by: Jim Klimov --- m4/nut_check_libopenssl.m4 | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/m4/nut_check_libopenssl.m4 b/m4/nut_check_libopenssl.m4 index 5b57a417b6..4bf3a83265 100644 --- a/m4/nut_check_libopenssl.m4 +++ b/m4/nut_check_libopenssl.m4 @@ -18,8 +18,11 @@ if test -z "${nut_have_libopenssl_seen}"; then LIBS="" REQUIRES="" depCFLAGS="" + depCFLAGS_SOURCE="" depLIBS="" + depLIBS_SOURCE="" depREQUIRES="" + depREQUIRES_SOURCE="" AS_IF([test x"$have_PKG_CONFIG" = xyes], [AC_MSG_CHECKING(for OpenSSL version via pkg-config) @@ -38,29 +41,37 @@ if test -z "${nut_have_libopenssl_seen}"; then [depCFLAGS="`$PKG_CONFIG --silence-errors --cflags openssl 2>/dev/null`" depLIBS="`$PKG_CONFIG --silence-errors --libs openssl 2>/dev/null`" depREQUIRES="openssl" + depCFLAGS_SOURCE="pkg-config" + depLIBS_SOURCE="pkg-config" + depREQUIRES_SOURCE="default(pkg-config)" ], [depCFLAGS="" depLIBS="-lssl -lcrypto" depREQUIRES="openssl" + depCFLAGS_SOURCE="default" + depLIBS_SOURCE="default" + depREQUIRES_SOURCE="default" ] ) dnl allow overriding OpenSSL settings if the user knows best AC_MSG_CHECKING(for OpenSSL cflags) - NUT_ARG_WITH_LIBOPTS_INCLUDES([openssl], [auto]) + NUT_ARG_WITH_LIBOPTS_INCLUDES([OpenSSL], [auto]) AS_CASE([${nut_with_openssl_includes}], [auto], [], dnl Keep what we had found above - [depCFLAGS="${nut_with_openssl_includes}"] + [depCFLAGS="${nut_with_openssl_includes}" + depCFLAGS_SOURCE="confarg"] ) - AC_MSG_RESULT([${depCFLAGS}]) + AC_MSG_RESULT([${depCFLAGS} (source: ${depCFLAGS_SOURCE})]) AC_MSG_CHECKING(for OpenSSL ldflags) - NUT_ARG_WITH_LIBOPTS_LIBS([openssl], [auto]) + NUT_ARG_WITH_LIBOPTS_LIBS([OpenSSL], [auto]) AS_CASE([${nut_with_openssl_libs}], [auto], [], dnl Keep what we had found above - [depLIBS="${nut_with_openssl_libs}"] + [depLIBS="${nut_with_openssl_libs}" + depLIBS_SOURCE="confarg"] ) - AC_MSG_RESULT([${depLIBS}]) + AC_MSG_RESULT([${depLIBS} (source: ${depLIBS_SOURCE})]) dnl check if openssl is usable CFLAGS="${CFLAGS_ORIG} ${depCFLAGS}" @@ -114,6 +125,9 @@ if test -z "${nut_have_libopenssl_seen}"; then unset depCFLAGS unset depLIBS unset depREQUIRES + unset depCFLAGS_SOURCE + unset depLIBS_SOURCE + unset depREQUIRES_SOURCE dnl restore original CFLAGS and LIBS CFLAGS="${CFLAGS_ORIG}" From e3861edac2807ccb3bafdd001e09afdbe1f52b72 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Wed, 22 Oct 2025 13:58:17 +0200 Subject: [PATCH 390/805] m4/nut_check_libpowerman.m4: track and report depCFLAGS_SOURCE/depLIBS_SOURCE consistently [#3049] Signed-off-by: Jim Klimov --- m4/nut_check_libpowerman.m4 | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/m4/nut_check_libpowerman.m4 b/m4/nut_check_libpowerman.m4 index c8615e06d1..c0f8f437fe 100644 --- a/m4/nut_check_libpowerman.m4 +++ b/m4/nut_check_libpowerman.m4 @@ -15,7 +15,9 @@ if test -z "${nut_have_libpowerman_seen}"; then CFLAGS="" LIBS="" depCFLAGS="" + depCFLAGS_SOURCE="" depLIBS="" + depLIBS_SOURCE="" AS_IF([test x"$have_PKG_CONFIG" = xyes], [AC_MSG_CHECKING([for LLNC libpowerman version via pkg-config]) @@ -39,9 +41,13 @@ if test -z "${nut_have_libpowerman_seen}"; then AS_IF([test x"$POWERMAN_VERSION" != xnone], [depCFLAGS="`$PKG_CONFIG --silence-errors --cflags libpowerman 2>/dev/null`" depLIBS="`$PKG_CONFIG --silence-errors --libs libpowerman 2>/dev/null`" + depCFLAGS_SOURCE="pkg-config" + depLIBS_SOURCE="pkg-config" ], [depCFLAGS="" depLIBS="" + depCFLAGS_SOURCE="default" + depLIBS_SOURCE="default" ] ) @@ -49,17 +55,19 @@ if test -z "${nut_have_libpowerman_seen}"; then NUT_ARG_WITH_LIBOPTS_INCLUDES([powerman], [auto], [libpowerman]) AS_CASE([${nut_with_powerman_includes}], [auto], [], dnl Keep what we had found above - [depCFLAGS="${nut_with_powerman_includes}"] + [depCFLAGS="${nut_with_powerman_includes}" + depCFLAGS_SOURCE="confarg"] ) - AC_MSG_RESULT([${depCFLAGS}]) + AC_MSG_RESULT([${depCFLAGS} (source: ${depCFLAGS_SOURCE})]) AC_MSG_CHECKING(for libpowerman libs) NUT_ARG_WITH_LIBOPTS_LIBS([powerman], [auto], [libpowerman]) AS_CASE([${nut_with_powerman_libs}], [auto], [], dnl Keep what we had found above - [depLIBS="${nut_with_powerman_libs}"] + [depLIBS="${nut_with_powerman_libs}" + depLIBS_SOURCE="confarg"] ) - AC_MSG_RESULT([${depLIBS}]) + AC_MSG_RESULT([${depLIBS} (source: ${depLIBS_SOURCE})]) dnl check if libpowerman is usable CFLAGS="${CFLAGS_ORIG} ${depCFLAGS}" @@ -86,6 +94,8 @@ if test -z "${nut_have_libpowerman_seen}"; then unset depCFLAGS unset depLIBS + unset depCFLAGS_SOURCE + unset depLIBS_SOURCE dnl restore original CFLAGS and LIBS CFLAGS="${CFLAGS_ORIG}" From bb7943fc155dab684df21ab146c2ad1ee0318403 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Wed, 22 Oct 2025 13:58:46 +0200 Subject: [PATCH 391/805] m4/nut_check_libsystemd.m4: track and report depCFLAGS_SOURCE/depLIBS_SOURCE consistently [#3049] Signed-off-by: Jim Klimov --- m4/nut_check_libsystemd.m4 | 32 ++++++++++++++++++++++---------- 1 file changed, 22 insertions(+), 10 deletions(-) diff --git a/m4/nut_check_libsystemd.m4 b/m4/nut_check_libsystemd.m4 index 8852e46fbc..946946be67 100644 --- a/m4/nut_check_libsystemd.m4 +++ b/m4/nut_check_libsystemd.m4 @@ -15,7 +15,9 @@ if test -z "${nut_have_libsystemd_seen}"; then CFLAGS="" LIBS="" depCFLAGS="" + depCFLAGS_SOURCE="" depLIBS="" + depLIBS_SOURCE="" SYSTEMD_VERSION="none" @@ -61,26 +63,34 @@ if test -z "${nut_have_libsystemd_seen}"; then dnl headers are referenced by relative directory dnl and these should be in OS location usually. AS_IF([test x"$have_PKG_CONFIG" = xyes], - [depCFLAGS="`$PKG_CONFIG --silence-errors --cflags libsystemd 2>/dev/null`" \ - || depCFLAGS=""], - [depCFLAGS=""] + [ { depCFLAGS="`$PKG_CONFIG --silence-errors --cflags libsystemd 2>/dev/null`" \ + && depCFLAGS_SOURCE="pkg-config" ; } \ + || { depCFLAGS="" \ + && depCFLAGS_SOURCE="default" ; }], + [depCFLAGS="" + depCFLAGS_SOURCE="default"] )], - [depCFLAGS="${nut_with_libsystemd_includes}"] + [depCFLAGS="${nut_with_libsystemd_includes}" + depCFLAGS_SOURCE="confarg"] ) - AC_MSG_RESULT([${depCFLAGS}]) + AC_MSG_RESULT([${depCFLAGS} (source: ${depCFLAGS_SOURCE})]) AC_MSG_CHECKING(for libsystemd ldflags) NUT_ARG_WITH_LIBOPTS_LIBS([libsystemd], [auto], [systemd]) AS_CASE([${nut_with_libsystemd_libs}], [auto], [ AS_IF([test x"$have_PKG_CONFIG" = xyes], - [depLIBS="`$PKG_CONFIG --silence-errors --libs libsystemd 2>/dev/null`" \ - || depLIBS="-lsystemd"], - [depLIBS="-lsystemd"] + [ { depLIBS="`$PKG_CONFIG --silence-errors --libs libsystemd 2>/dev/null`" \ + && depLIBS_SOURCE="pkg-config" ; } \ + || { depLIBS="-lsystemd" \ + && depLIBS_SOURCE="default" ; }], + [depLIBS="-lsystemd" + depLIBS_SOURCE="default"] )], - [depLIBS="${nut_with_libsystemd_libs}"] + [depLIBS="${nut_with_libsystemd_libs}" + depLIBS_SOURCE="confarg"] ) - AC_MSG_RESULT([${depLIBS}]) + AC_MSG_RESULT([${depLIBS} (source: ${depLIBS_SOURCE})]) dnl check if libsystemd is usable CFLAGS="${CFLAGS_ORIG} ${depCFLAGS}" @@ -117,6 +127,8 @@ if test -z "${nut_have_libsystemd_seen}"; then unset depCFLAGS unset depLIBS + unset depCFLAGS_SOURCE + unset depLIBS_SOURCE dnl restore original CFLAGS and LIBS CFLAGS="${CFLAGS_ORIG}" From 9df413e07c401968c49e5a51ad490b557919601b Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Wed, 22 Oct 2025 14:05:05 +0200 Subject: [PATCH 392/805] NEWS.adoc, docs/nut.dict: update about logging the source of CFLAGS/LIBS/LDFLAGS values [#3049, #3140] Signed-off-by: Jim Klimov --- NEWS.adoc | 4 +++- docs/nut.dict | 3 ++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/NEWS.adoc b/NEWS.adoc index 0df9677fd6..179abbc967 100644 --- a/NEWS.adoc +++ b/NEWS.adoc @@ -189,7 +189,9 @@ several `FSD` notifications into one executed action. [PR #3097] fixed a missed compiler family dependency when handling `--enable-strip`, a few logical mismatches of Solaris/illumos packaging options, and default report vs. setting of `--enable-force-nut-version-header`. Rephrased and - updated many help messages. [#3140] + updated many help messages. The `configure` script logs should now clarify + where CFLAGS/LIBS/LDFLAGS values come from ('pkg-config', 'default', user + provided 'confargs' etc.) [#3140] - Fixed CI recipes for PyPI publication of PyNUT(Client) module to also include the source distribution (was posted for NUT v2.8.1 and v2.8.2 diff --git a/docs/nut.dict b/docs/nut.dict index 36187ed8c1..cb037aea44 100644 --- a/docs/nut.dict +++ b/docs/nut.dict @@ -1,4 +1,4 @@ -personal_ws-1.1 en 3565 utf-8 +personal_ws-1.1 en 3566 utf-8 AAC AAS ABI @@ -1817,6 +1817,7 @@ compareprocnames compat compilerPath conf +confargs confdir config configparser From 285c532d9a138e52455053ec8fbb7cbd08f139c4 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Wed, 22 Oct 2025 14:13:13 +0200 Subject: [PATCH 393/805] m4/nut_check_libregex.m4, NEWS.adoc: Added configure script options for libregex tuning [#3140, #3049] Signed-off-by: Jim Klimov --- NEWS.adoc | 2 ++ m4/nut_check_libregex.m4 | 34 ++++++++++++++++++++++++++++++++++ 2 files changed, 36 insertions(+) diff --git a/NEWS.adoc b/NEWS.adoc index 179abbc967..de8576850f 100644 --- a/NEWS.adoc +++ b/NEWS.adoc @@ -192,6 +192,8 @@ several `FSD` notifications into one executed action. [PR #3097] updated many help messages. The `configure` script logs should now clarify where CFLAGS/LIBS/LDFLAGS values come from ('pkg-config', 'default', user provided 'confargs' etc.) [#3140] + * Added configure script options for 'libregex' tuning, just so it is on par + with our other optional dependencies. [#3140] - Fixed CI recipes for PyPI publication of PyNUT(Client) module to also include the source distribution (was posted for NUT v2.8.1 and v2.8.2 diff --git a/m4/nut_check_libregex.m4 b/m4/nut_check_libregex.m4 index dd4c49b595..8df545890d 100644 --- a/m4/nut_check_libregex.m4 +++ b/m4/nut_check_libregex.m4 @@ -18,8 +18,11 @@ if test -z "${nut_have_libregex_seen}"; then LIBS="" REQUIRES="" depCFLAGS="" + depCFLAGS_SOURCE="" depLIBS="" + depLIBS_SOURCE="" depREQUIRES="" + depREQUIRES_SOURCE="" dnl Actually did not see it in any systems' pkg-config info... dnl Part of standard footprint? @@ -48,13 +51,38 @@ if test -z "${nut_have_libregex_seen}"; then [depCFLAGS="`$PKG_CONFIG --silence-errors --cflags "${LIBREGEX_MODULE}" 2>/dev/null`" depLIBS="`$PKG_CONFIG --silence-errors --libs "${LIBREGEX_MODULE}" 2>/dev/null`" depREQUIRES="${LIBREGEX_MODULE}" + depCFLAGS_SOURCE="pkg-config" + depLIBS_SOURCE="pkg-config" + depREQUIRES_SOURCE="pkg-config" ], [depCFLAGS="" depLIBS="" depREQUIRES="" + depCFLAGS_SOURCE="default" + depLIBS_SOURCE="default" + depREQUIRES_SOURCE="default" ] ) + dnl allow overriding libregex settings if the user knows best + AC_MSG_CHECKING(for libregex cflags) + NUT_ARG_WITH_LIBOPTS_INCLUDES([regex], [auto]) + AS_CASE([${nut_with_regex_includes}], + [auto], [], dnl Keep what we had found above + [depCFLAGS="${nut_with_regex_includes}" + depCFLAGS_SOURCE="confarg"] + ) + AC_MSG_RESULT([${depCFLAGS} (source: ${depCFLAGS_SOURCE})]) + + AC_MSG_CHECKING(for libregex ldflags) + NUT_ARG_WITH_LIBOPTS_LIBS([regex], [auto]) + AS_CASE([${nut_with_regex_libs}], + [auto], [], dnl Keep what we had found above + [depLIBS="${nut_with_regex_libs}" + depLIBS_SOURCE="confarg"] + ) + AC_MSG_RESULT([${depLIBS} (source: ${depLIBS_SOURCE})]) + dnl Check if libregex is usable CFLAGS="${CFLAGS_ORIG} ${depCFLAGS}" LIBS="${LIBS_ORIG} ${depLIBS}" @@ -110,9 +138,15 @@ if test -z "${nut_have_libregex_seen}"; then unset depCFLAGS unset depLIBS unset depREQUIRES + unset depCFLAGS_SOURCE + unset depLIBS_SOURCE + unset depREQUIRES_SOURCE dnl restore original CFLAGS and LIBS CFLAGS="${CFLAGS_ORIG}" LIBS="${LIBS_ORIG}" + + dnl FIXME? We did not restore this value, is this needed by libs checked later? + dnl REQUIRES="${REQUIRES_ORIG}" fi ]) From b1b175f78ae099f76ff1b70730eb62f5a97adf4f Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Wed, 22 Oct 2025 16:14:40 +0200 Subject: [PATCH 394/805] docs/nut.dict: update for NEWS of PR #3141 Signed-off-by: Jim Klimov --- docs/nut.dict | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/docs/nut.dict b/docs/nut.dict index 8598d41b84..c073d9e2e6 100644 --- a/docs/nut.dict +++ b/docs/nut.dict @@ -1,4 +1,4 @@ -personal_ws-1.1 en 3564 utf-8 +personal_ws-1.1 en 3566 utf-8 AAC AAS ABI @@ -1319,6 +1319,7 @@ TSR TST TT TTT +TUD TXF TXG TXV @@ -3087,6 +3088,7 @@ ske skel sl slackpkg +slaveaddr slaveid slavesync slibtool From 824e3ff8fe4defdbe37143f38eb8bfca0d5092e2 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Thu, 23 Oct 2025 12:23:53 +0200 Subject: [PATCH 395/805] NEWS.adoc, UPGRADING.adoc, docs/nut.dict: list new nutdrv_qx_innovatae protocol support [#issue 3137, PR #3139] Signed-off-by: Jim Klimov --- NEWS.adoc | 8 ++++++++ UPGRADING.adoc | 7 +++++++ docs/nut.dict | 3 ++- 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/NEWS.adoc b/NEWS.adoc index 69a27adc3e..18bd65b382 100644 --- a/NEWS.adoc +++ b/NEWS.adoc @@ -67,6 +67,14 @@ https://github.com/networkupstools/nut/milestone/12 well -- namely, that we successfully use reasonably many of the existing mappings. Suggest how user can help improve the driver if too few data points were seen. [PR #3095] + * New `nutdrv_qx_innovatae` adds support for Ippon INNOVA TAE series which + are similar to Q1 except in reporting of nominal `voltage`, `current`, + `frequency` data (that along with `battery_voltage_reports_one_pack` and + `override.battery.packs=12` settings yields reasonable `battery.voltage.*` + data points). Currently there seems to be no good way of auto-detection + to separate the two dialects, so explicit driver options may be required + if a specific `protocol` should be used with a NUT deployment. + [issue #3137, PR #3139] * `nutdrv_qx_masterguard` sub-driver adds a way to call battery test until the battery charge is low, using a new `test.battery.start.low` instant command name (registered in `docs/nut-names.txt`). The difference between diff --git a/UPGRADING.adoc b/UPGRADING.adoc index 44943288b3..24dcd213b5 100644 --- a/UPGRADING.adoc +++ b/UPGRADING.adoc @@ -66,6 +66,13 @@ Changes from 2.8.4 to 2.8.5 to match the driver program name. Packaging recipes may have to be updated. Follow-up from slightly botched renaming in original contribution. [PR #545] +- New `nutdrv_qx_innovatae` adds support for INNOVA TAE series which are + similar to Q1 except in reporting of nominal and manufacturer data. + Currently there seems to be no good way of auto-detection to separate the + two dialects, so explicit driver options may be required if a specific + `protocol` should be used with an existing NUT deployment. [#issue 3137, + PR #3139] + - The `configure` script should now try harder to report specifically the "purelib" location as `PYTHON*_SITE_PACKAGES`. Packaging recipes may have to be updated. [#1209] diff --git a/docs/nut.dict b/docs/nut.dict index cdefc78f54..6128725b26 100644 --- a/docs/nut.dict +++ b/docs/nut.dict @@ -1,4 +1,4 @@ -personal_ws-1.1 en 3565 utf-8 +personal_ws-1.1 en 3566 utf-8 AAC AAS ABI @@ -1295,6 +1295,7 @@ SystemIO Systeme Syu Szady +TAE TBD TBR TCIFLUSH From 122fa231f42293a88e2d4bf8908e71140bc23196 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Thu, 23 Oct 2025 12:43:36 +0200 Subject: [PATCH 396/805] drivers/nutdrv_qx.c: add USB ID based detection for innovatae protocol [#3137, #3139] Signed-off-by: Jim Klimov --- NEWS.adoc | 5 +---- UPGRADING.adoc | 7 ------- drivers/nutdrv_qx.c | 3 ++- 3 files changed, 3 insertions(+), 12 deletions(-) diff --git a/NEWS.adoc b/NEWS.adoc index 18bd65b382..c6eed67638 100644 --- a/NEWS.adoc +++ b/NEWS.adoc @@ -71,10 +71,7 @@ https://github.com/networkupstools/nut/milestone/12 are similar to Q1 except in reporting of nominal `voltage`, `current`, `frequency` data (that along with `battery_voltage_reports_one_pack` and `override.battery.packs=12` settings yields reasonable `battery.voltage.*` - data points). Currently there seems to be no good way of auto-detection - to separate the two dialects, so explicit driver options may be required - if a specific `protocol` should be used with a NUT deployment. - [issue #3137, PR #3139] + data points). [issue #3137, PR #3139] * `nutdrv_qx_masterguard` sub-driver adds a way to call battery test until the battery charge is low, using a new `test.battery.start.low` instant command name (registered in `docs/nut-names.txt`). The difference between diff --git a/UPGRADING.adoc b/UPGRADING.adoc index 24dcd213b5..44943288b3 100644 --- a/UPGRADING.adoc +++ b/UPGRADING.adoc @@ -66,13 +66,6 @@ Changes from 2.8.4 to 2.8.5 to match the driver program name. Packaging recipes may have to be updated. Follow-up from slightly botched renaming in original contribution. [PR #545] -- New `nutdrv_qx_innovatae` adds support for INNOVA TAE series which are - similar to Q1 except in reporting of nominal and manufacturer data. - Currently there seems to be no good way of auto-detection to separate the - two dialects, so explicit driver options may be required if a specific - `protocol` should be used with an existing NUT deployment. [#issue 3137, - PR #3139] - - The `configure` script should now try harder to report specifically the "purelib" location as `PYTHON*_SITE_PACKAGES`. Packaging recipes may have to be updated. [#1209] diff --git a/drivers/nutdrv_qx.c b/drivers/nutdrv_qx.c index 14a229fb27..200ec33c72 100644 --- a/drivers/nutdrv_qx.c +++ b/drivers/nutdrv_qx.c @@ -58,7 +58,7 @@ # define DRIVER_NAME "Generic Q* Serial driver" #endif /* QX_USB */ -#define DRIVER_VERSION "0.47" +#define DRIVER_VERSION "0.48" #ifdef QX_SERIAL # include "serial.h" @@ -2533,6 +2533,7 @@ static qx_usb_device_id_t qx_usb_id[] = { { USB_DEVICE(0x06da, 0x0601), NULL, NULL, &phoenix_subdriver }, /* Online Zinto A */ { USB_DEVICE(0x0f03, 0x0001), NULL, NULL, &cypress_subdriver }, /* Unitek Alpha 1200Sx */ { USB_DEVICE(0x14f0, 0x00c9), NULL, NULL, &phoenix_subdriver }, /* GE EP series */ + { USB_DEVICE(0x1a86, 0x7523), NULL, NULL, NULL }, /* Ippon Innova TAE series, using QinHeng Electronics CH340 serial converter; no specific "USB subdriver" handler defined at the moment */ { USB_DEVICE(0x0483, 0x0035), NULL, NULL, &sgs_subdriver }, /* TS Shara UPSes; vendor ID 0x0483 is from ST Microelectronics - with product IDs delegated to different OEMs */ { USB_DEVICE(0x0001, 0x0000), "MEC", "MEC0003", &fabula_subdriver }, /* Fideltronik/MEC LUPUS 500 USB */ { USB_DEVICE(0x0001, 0x0000), NULL, "MEC0003", &fabula_hunnox_subdriver }, /* Hunnox HNX 850, reported to also help support Powercool and some other devices; closely related to fabula with tweaks */ From 2433b7a196e0357bb0b6622df78f927bb890c460 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Thu, 23 Oct 2025 13:31:02 +0200 Subject: [PATCH 397/805] data/driver.list.in: add Ippon Innova TAE 1000 [#3137, #3139] Signed-off-by: Jim Klimov --- data/driver.list.in | 1 + 1 file changed, 1 insertion(+) diff --git a/data/driver.list.in b/data/driver.list.in index feb72c4c69..ada9858e15 100644 --- a/data/driver.list.in +++ b/data/driver.list.in @@ -634,6 +634,7 @@ "Ippon" "ups" "2" "Ampere 1000/1500/2000/3000 bl" "USB" "usbhid-ups" # https://github.com/networkupstools/nut/issues/2702 "Ippon" "ups" "2" "Innova RT 3/1 10K/10K compact/20K" "USB" "nutdrv_qx" # https://github.com/networkupstools/nut/issues/2712 "Ippon" "ups" "2" "Innova RTB 1000/1500/2000/3000" "USB" "usbhid-ups" # https://github.com/networkupstools/nut/issues/2702 +"Ippon" "ups" "2" "Innova TAE 1000" "USB" "nutdrv_qx (battery_voltage_reports_one_pack override.battery.packs=12)" # https://github.com/networkupstools/nut/issues/3137 "Ippon" "ups" "2" "Innova TBE 1000/2000/3000" "USB" "usbhid-ups" # https://github.com/networkupstools/nut/issues/2702 "Ippon" "ups" "2" "Innova TB 1000/2000/3000" "USB" "usbhid-ups" # https://github.com/networkupstools/nut/issues/2702 "Ippon" "ups" "2" "Back Power Pro II 500/600/800" "USB" "usbhid-ups" # https://github.com/networkupstools/nut/issues/2702 From 6283ef815aa8b8c56ae6d9d457f324cdccabca77 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Thu, 23 Oct 2025 14:01:17 +0200 Subject: [PATCH 398/805] drivers/nutdrv_qx.c: use symbolic names for USB Vendor IDs [#3139] Signed-off-by: Jim Klimov --- drivers/nutdrv_qx.c | 75 ++++++++++++++++++++++++++++++++------------- 1 file changed, 54 insertions(+), 21 deletions(-) diff --git a/drivers/nutdrv_qx.c b/drivers/nutdrv_qx.c index 200ec33c72..e2a08201c0 100644 --- a/drivers/nutdrv_qx.c +++ b/drivers/nutdrv_qx.c @@ -2518,29 +2518,62 @@ typedef struct { void *(*fun)(USBDevice_t *); /* Handler for specific processing */ } qx_usb_device_id_t; +/* Unregistered vendor 0x0001 (commonly identified as Fry's Electronics) */ +#define NONAME0001_VENDORID 0x0001 + +/* Unregistered vendor 0xFFFF */ +#define NONAMEFFFF_VENDORID 0xffff + +/* ST Microelectronics */ +#define STMICRO_VENDORID 0x0483 + +/* Sysgration Ltd. */ +#define SYSGRATION_VENDORID 0x05b8 + +/* Cypress Semiconductor */ +#define CYPRESS_VENDORID 0x0665 + +/* Phoenixtec Power Co., Ltd */ +#define PHOENIXTEC_VENDORID 0x06da + +/* Lakeview Research */ +#define LAKEVIEW_VENDORID 0x0925 + +/* Unitek UPS Systems */ +#define UNITEK_VENDORID 0x0f03 + +/* GE */ +#define GE_VENDORID 0x14f0 + +/* QinHeng Electronics */ +#define QINHENG_VENDORID 0x1a86 + +/* Legrand */ +#define LEGRAND_VENDORID 0x1cb0 + /* USB VendorID/ProductID/iManufacturer/iProduct match - note: rightmost comment is used for naming rules by tools/nut-usbinfo.pl */ static qx_usb_device_id_t qx_usb_id[] = { - { USB_DEVICE(0x05b8, 0x0000), NULL, NULL, &cypress_subdriver }, /* Agiler UPS */ - { USB_DEVICE(0xffff, 0x0000), NULL, NULL, &ablerex_subdriver_fun }, /* Ablerex 625L USB (Note: earlier best-fit was "krauler_subdriver" before PR #1135) */ - { USB_DEVICE(0x1cb0, 0x0035), NULL, NULL, &krauler_subdriver }, /* Legrand Daker DK / DK Plus */ - { USB_DEVICE(0x0665, 0x5161), NULL, NULL, &cypress_subdriver }, /* Belkin F6C1200-UNV/Voltronic Power UPSes */ - { USB_DEVICE(0x06da, 0x0002), "Phoenixtec Power","USB Cable (V2.00)", &phoenixtec_subdriver },/* Masterguard A Series */ - { USB_DEVICE(0x06da, 0x0002), NULL, NULL, &cypress_subdriver }, /* Online Yunto YQ450 */ - { USB_DEVICE(0x06da, 0x0003), NULL, NULL, &ippon_subdriver }, /* Mustek Powermust */ - { USB_DEVICE(0x06da, 0x0004), NULL, NULL, &cypress_subdriver }, /* Phoenixtec Innova 3/1 T */ - { USB_DEVICE(0x06da, 0x0005), NULL, NULL, &cypress_subdriver }, /* Phoenixtec Innova RT */ - { USB_DEVICE(0x06da, 0x0201), NULL, NULL, &cypress_subdriver }, /* Phoenixtec Innova T */ - { USB_DEVICE(0x06da, 0x0601), NULL, NULL, &phoenix_subdriver }, /* Online Zinto A */ - { USB_DEVICE(0x0f03, 0x0001), NULL, NULL, &cypress_subdriver }, /* Unitek Alpha 1200Sx */ - { USB_DEVICE(0x14f0, 0x00c9), NULL, NULL, &phoenix_subdriver }, /* GE EP series */ - { USB_DEVICE(0x1a86, 0x7523), NULL, NULL, NULL }, /* Ippon Innova TAE series, using QinHeng Electronics CH340 serial converter; no specific "USB subdriver" handler defined at the moment */ - { USB_DEVICE(0x0483, 0x0035), NULL, NULL, &sgs_subdriver }, /* TS Shara UPSes; vendor ID 0x0483 is from ST Microelectronics - with product IDs delegated to different OEMs */ - { USB_DEVICE(0x0001, 0x0000), "MEC", "MEC0003", &fabula_subdriver }, /* Fideltronik/MEC LUPUS 500 USB */ - { USB_DEVICE(0x0001, 0x0000), NULL, "MEC0003", &fabula_hunnox_subdriver }, /* Hunnox HNX 850, reported to also help support Powercool and some other devices; closely related to fabula with tweaks */ - { USB_DEVICE(0x0001, 0x0000), "ATCL FOR UPS", "ATCL FOR UPS", &fuji_subdriver }, /* Fuji UPSes */ - { USB_DEVICE(0x0001, 0x0000), NULL, NULL, &krauler_subdriver }, /* Krauler UP-M500VA */ - { USB_DEVICE(0x0001, 0x0000), NULL, "MEC0003", &snr_subdriver }, /* SNR-UPS-LID-XXXX UPSes */ - { USB_DEVICE(0x0925, 0x1234), NULL, NULL, &armac_subdriver }, /* Armac UPS and maybe other richcomm-like or using old PowerManagerII software */ + { USB_DEVICE(SYSGRATION_VENDORID, 0x0000), NULL, NULL, &cypress_subdriver }, /* Agiler UPS */ + { USB_DEVICE(NONAMEFFFF_VENDORID, 0x0000), NULL, NULL, &ablerex_subdriver_fun }, /* Ablerex 625L USB (Note: earlier best-fit was "krauler_subdriver" before PR #1135) */ + { USB_DEVICE(LEGRAND_VENDORID, 0x0035), NULL, NULL, &krauler_subdriver }, /* Legrand Daker DK / DK Plus */ + { USB_DEVICE(CYPRESS_VENDORID, 0x5161), NULL, NULL, &cypress_subdriver }, /* Belkin F6C1200-UNV/Voltronic Power UPSes */ + { USB_DEVICE(PHOENIXTEC_VENDORID, 0x0002), "Phoenixtec Power","USB Cable (V2.00)", &phoenixtec_subdriver },/* Masterguard A Series */ + { USB_DEVICE(PHOENIXTEC_VENDORID, 0x0002), NULL, NULL, &cypress_subdriver }, /* Online Yunto YQ450 */ + { USB_DEVICE(PHOENIXTEC_VENDORID, 0x0003), NULL, NULL, &ippon_subdriver }, /* Mustek Powermust */ + { USB_DEVICE(PHOENIXTEC_VENDORID, 0x0004), NULL, NULL, &cypress_subdriver }, /* Phoenixtec Innova 3/1 T */ + { USB_DEVICE(PHOENIXTEC_VENDORID, 0x0005), NULL, NULL, &cypress_subdriver }, /* Phoenixtec Innova RT */ + { USB_DEVICE(PHOENIXTEC_VENDORID, 0x0201), NULL, NULL, &cypress_subdriver }, /* Phoenixtec Innova T */ + { USB_DEVICE(PHOENIXTEC_VENDORID, 0x0601), NULL, NULL, &phoenix_subdriver }, /* Online Zinto A */ + { USB_DEVICE(UNITEK_VENDORID, 0x0001), NULL, NULL, &cypress_subdriver }, /* Unitek Alpha 1200Sx */ + { USB_DEVICE(GE_VENDORID, 0x00c9), NULL, NULL, &phoenix_subdriver }, /* GE EP series */ + { USB_DEVICE(QINHENG_VENDORID, 0x7523), NULL, NULL, NULL }, /* Ippon Innova TAE series, using QinHeng Electronics CH340 serial converter; no specific "USB subdriver" handler defined at the moment */ + { USB_DEVICE(STMICRO_VENDORID, 0x0035), NULL, NULL, &sgs_subdriver }, /* TS Shara UPSes; vendor ID 0x0483 is from ST Microelectronics - with product IDs delegated to different OEMs */ + { USB_DEVICE(NONAME0001_VENDORID, 0x0000), "MEC", "MEC0003", &fabula_subdriver }, /* Fideltronik/MEC LUPUS 500 USB */ + { USB_DEVICE(NONAME0001_VENDORID, 0x0000), NULL, "MEC0003", &fabula_hunnox_subdriver }, /* Hunnox HNX 850, reported to also help support Powercool and some other devices; closely related to fabula with tweaks */ + { USB_DEVICE(NONAME0001_VENDORID, 0x0000), "ATCL FOR UPS", "ATCL FOR UPS", &fuji_subdriver }, /* Fuji UPSes */ + { USB_DEVICE(NONAME0001_VENDORID, 0x0000), NULL, NULL, &krauler_subdriver }, /* Krauler UP-M500VA */ + { USB_DEVICE(NONAME0001_VENDORID, 0x0000), NULL, "MEC0003", &snr_subdriver }, /* SNR-UPS-LID-XXXX UPSes */ + { USB_DEVICE(LAKEVIEW_VENDORID, 0x1234), NULL, NULL, &armac_subdriver }, /* Armac UPS and maybe other richcomm-like or using old PowerManagerII software */ /* End of list */ { -1, -1, NULL, NULL, NULL } }; From aaa7c338f7a09eb4e4ee64911869ceaacb92949e Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Thu, 23 Oct 2025 14:09:56 +0200 Subject: [PATCH 399/805] drivers/usb-common.h: update comment about USB_DEVICE() macro Signed-off-by: Jim Klimov --- drivers/usb-common.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/usb-common.h b/drivers/usb-common.h index b71bed8a06..7355b20965 100644 --- a/drivers/usb-common.h +++ b/drivers/usb-common.h @@ -534,7 +534,9 @@ void USBFreeExactMatcher(USBDeviceMatcher_t *matcher); void USBFreeRegexMatcher(USBDeviceMatcher_t *matcher); /* dummy USB function and macro, inspired from the Linux kernel - * this allows USB information extraction */ + * this allows USB information extraction; used by tools/nut-usbinfo.pl + * to generate some sources (nut-scanner) and deliverables (udev.rules) + * among other things */ #define USB_DEVICE(vendorID, productID) vendorID, productID typedef struct { From db6bcb870a7292337ec2c3db3501bc712b9b48d4 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Thu, 23 Oct 2025 14:40:34 +0200 Subject: [PATCH 400/805] drivers/*.c, NEWS.adoc: revised use of NUT macros for USB Vendor IDs [#3139] Signed-off-by: Jim Klimov --- NEWS.adoc | 4 +++ drivers/apc-hid.c | 2 +- drivers/apc_modbus.c | 2 +- drivers/arduino-hid.c | 2 +- drivers/bcmxcp_usb.c | 10 +++---- drivers/blazer_usb.c | 57 ++++++++++++++++++++++++++++++--------- drivers/cps-hid.c | 2 +- drivers/delta_ups-hid.c | 4 +-- drivers/legrand-hid.c | 10 ++++--- drivers/liebert-hid.c | 4 +-- drivers/mge-hid.c | 8 +++--- drivers/nutdrv_atcl_usb.c | 5 +++- drivers/richcomm_usb.c | 5 +++- 13 files changed, 80 insertions(+), 35 deletions(-) diff --git a/NEWS.adoc b/NEWS.adoc index c6eed67638..34923a16e3 100644 --- a/NEWS.adoc +++ b/NEWS.adoc @@ -229,6 +229,10 @@ several `FSD` notifications into one executed action. [PR #3097] - The `configure` script should now try harder to report specifically the "purelib" location as `PYTHON*_SITE_PACKAGES`. [#1209] + - Revised use of NUT macros for USB Vendor IDs listed in different drivers, + so the names would be better exposed in generated `udev.rules` and similar + files. [PR #3139] + Release notes for NUT 2.8.4 - what's new since 2.8.3 ---------------------------------------------------- diff --git a/drivers/apc-hid.c b/drivers/apc-hid.c index 49a96b57cb..6f1826d725 100644 --- a/drivers/apc-hid.c +++ b/drivers/apc-hid.c @@ -35,7 +35,7 @@ #define APC_HID_VERSION "APC HID 0.101" /* APC */ -#define APC_VENDORID 0x051d +#define APC_VENDORID 0x051d /* Tweaks */ static char * tweak_max_report[] = { diff --git a/drivers/apc_modbus.c b/drivers/apc_modbus.c index c7c8055639..5f3d77ac1a 100644 --- a/drivers/apc_modbus.c +++ b/drivers/apc_modbus.c @@ -49,7 +49,7 @@ #if defined NUT_MODBUS_HAS_USB /* APC */ -#define APC_VENDORID 0x051D +#define APC_VENDORID 0x051d /* USB IDs device table */ static usb_device_id_t apc_modbus_usb_device_table[] = { diff --git a/drivers/arduino-hid.c b/drivers/arduino-hid.c index c63fff7573..4aa47c685d 100644 --- a/drivers/arduino-hid.c +++ b/drivers/arduino-hid.c @@ -41,7 +41,7 @@ /* Arduino */ #define ARDUINO_VENDORID 0x2341 -#define ARDUINO_VENDORID2 0x2A03 +#define ARDUINO_VENDORID2 0x2a03 /* USB IDs device table */ static usb_device_id_t arduino_usb_device_table[] = { diff --git a/drivers/bcmxcp_usb.c b/drivers/bcmxcp_usb.c index 24bc4781a0..7a2c3730d2 100644 --- a/drivers/bcmxcp_usb.c +++ b/drivers/bcmxcp_usb.c @@ -26,13 +26,13 @@ upsdrv_info_t comm_upsdrv_info = { #define MAX_TRY_OPENUSB 32 /* Powerware */ -#define POWERWARE 0x0592 +#define POWERWARE_VENDORID 0x0592 /* Phoenixtec Power Co., Ltd */ -#define PHOENIXTEC 0x06da +#define PHOENIXTEC_VENDORID 0x06da /* Hewlett Packard */ -#define HP_VENDORID 0x03f0 +#define HP_VENDORID 0x03f0 static USBDevice_t curDevice; @@ -81,10 +81,10 @@ static void *phoenixtec_ups(USBDevice_t *device) { /* USB IDs device table */ static usb_device_id_t pw_usb_device_table[] = { /* various models */ - { USB_DEVICE(POWERWARE, 0x0002), &powerware_ups }, + { USB_DEVICE(POWERWARE_VENDORID, 0x0002), &powerware_ups }, /* various models */ - { USB_DEVICE(PHOENIXTEC, 0x0002), &phoenixtec_ups }, + { USB_DEVICE(PHOENIXTEC_VENDORID, 0x0002), &phoenixtec_ups }, /* T500 */ { USB_DEVICE(HP_VENDORID, 0x1f01), &phoenixtec_ups }, diff --git a/drivers/blazer_usb.c b/drivers/blazer_usb.c index bc0e0aec3e..08ce026931 100644 --- a/drivers/blazer_usb.c +++ b/drivers/blazer_usb.c @@ -49,6 +49,39 @@ upsdrv_info_t upsdrv_info = { { NULL } }; +/* Unregistered vendor 0x0001 (commonly identified as Fry's Electronics) */ +#define NONAME0001_VENDORID 0x0001 + +/* Unregistered vendor 0xFFFF */ +#define NONAMEFFFF_VENDORID 0xffff + +/* ST Microelectronics */ +#define STMICRO_VENDORID 0x0483 + +/* Sysgration Ltd. */ +#define SYSGRATION_VENDORID 0x05b8 + +/* Cypress Semiconductor */ +#define CYPRESS_VENDORID 0x0665 + +/* Phoenixtec Power Co., Ltd */ +#define PHOENIXTEC_VENDORID 0x06da + +/* Lakeview Research */ +#define LAKEVIEW_VENDORID 0x0925 + +/* Unitek UPS Systems */ +#define UNITEK_VENDORID 0x0f03 + +/* GE */ +#define GE_VENDORID 0x14f0 + +/* QinHeng Electronics */ +#define QINHENG_VENDORID 0x1a86 + +/* Legrand */ +#define LEGRAND_VENDORID 0x1cb0 + #ifndef TESTING static usb_communication_subdriver_t *usb = &usb_subdriver; @@ -390,18 +423,18 @@ static void *phoenix_subdriver(USBDevice_t *device) static usb_device_id_t blazer_usb_id[] = { - { USB_DEVICE(0x05b8, 0x0000), &cypress_subdriver }, /* Agiler UPS */ - { USB_DEVICE(0x0001, 0x0000), &krauler_subdriver }, /* Krauler UP-M500VA */ - { USB_DEVICE(0xffff, 0x0000), &krauler_subdriver }, /* Ablerex 625L USB */ - { USB_DEVICE(0x0665, 0x5161), &cypress_subdriver }, /* Belkin F6C1200-UNV */ - { USB_DEVICE(0x06da, 0x0002), &cypress_subdriver }, /* Online Yunto YQ450 */ - { USB_DEVICE(0x06da, 0x0003), &ippon_subdriver }, /* Mustek Powermust */ - { USB_DEVICE(0x06da, 0x0004), &cypress_subdriver }, /* Phoenixtec Innova 3/1 T */ - { USB_DEVICE(0x06da, 0x0005), &cypress_subdriver }, /* Phoenixtec Innova RT */ - { USB_DEVICE(0x06da, 0x0201), &cypress_subdriver }, /* Phoenixtec Innova T */ - { USB_DEVICE(0x06da, 0x0601), &phoenix_subdriver }, /* Online Zinto A */ - { USB_DEVICE(0x0f03, 0x0001), &cypress_subdriver }, /* Unitek Alpha 1200Sx */ - { USB_DEVICE(0x14f0, 0x00c9), &phoenix_subdriver }, /* GE EP series */ + { USB_DEVICE(SYSGRATION_VENDORID, 0x0000), &cypress_subdriver }, /* Agiler UPS */ + { USB_DEVICE(NONAME0001_VENDORID, 0x0000), &krauler_subdriver }, /* Krauler UP-M500VA */ + { USB_DEVICE(NONAMEFFFF_VENDORID, 0x0000), &krauler_subdriver }, /* Ablerex 625L USB */ + { USB_DEVICE(CYPRESS_VENDORID, 0x5161), &cypress_subdriver }, /* Belkin F6C1200-UNV */ + { USB_DEVICE(PHOENIXTEC_VENDORID, 0x0002), &cypress_subdriver }, /* Online Yunto YQ450 */ + { USB_DEVICE(PHOENIXTEC_VENDORID, 0x0003), &ippon_subdriver }, /* Mustek Powermust */ + { USB_DEVICE(PHOENIXTEC_VENDORID, 0x0004), &cypress_subdriver }, /* Phoenixtec Innova 3/1 T */ + { USB_DEVICE(PHOENIXTEC_VENDORID, 0x0005), &cypress_subdriver }, /* Phoenixtec Innova RT */ + { USB_DEVICE(PHOENIXTEC_VENDORID, 0x0201), &cypress_subdriver }, /* Phoenixtec Innova T */ + { USB_DEVICE(PHOENIXTEC_VENDORID, 0x0601), &phoenix_subdriver }, /* Online Zinto A */ + { USB_DEVICE(UNITEK_VENDORID, 0x0001), &cypress_subdriver }, /* Unitek Alpha 1200Sx */ + { USB_DEVICE(GE_VENDORID, 0x00c9), &phoenix_subdriver }, /* GE EP series */ /* Terminating entry */ { 0, 0, NULL } diff --git a/drivers/cps-hid.c b/drivers/cps-hid.c index 254a9ef383..6d4c52e859 100644 --- a/drivers/cps-hid.c +++ b/drivers/cps-hid.c @@ -35,7 +35,7 @@ #define CPS_HID_VERSION "CyberPower HID 0.84" /* Cyber Power Systems */ -#define CPS_VENDORID 0x0764 +#define CPS_VENDORID 0x0764 /* ST Microelectronics */ #define STMICRO_VENDORID 0x0483 diff --git a/drivers/delta_ups-hid.c b/drivers/delta_ups-hid.c index e544a23b93..d35ddd8511 100644 --- a/drivers/delta_ups-hid.c +++ b/drivers/delta_ups-hid.c @@ -33,13 +33,13 @@ #define DELTA_UPS_HID_VERSION "Delta UPS HID 0.6" /* Delta UPS */ -#define DELTA_UPS_VENDORID 0x05dd +#define DELTA_VENDORID 0x05dd /* USB IDs device table */ static usb_device_id_t delta_ups_usb_device_table[] = { /* Delta RT Series, Single Phase, 1/2/3 kVA */ /* Delta UPS Amplon R Series, Single Phase UPS, 1/2/3 kVA */ - { USB_DEVICE(DELTA_UPS_VENDORID, 0x041b), NULL }, + { USB_DEVICE(DELTA_VENDORID, 0x041b), NULL }, /* Terminating entry */ { 0, 0, NULL } diff --git a/drivers/legrand-hid.c b/drivers/legrand-hid.c index 371555328b..7a35513d4e 100644 --- a/drivers/legrand-hid.c +++ b/drivers/legrand-hid.c @@ -30,8 +30,10 @@ #define LEGRAND_HID_VERSION "Legrand HID 0.2" -/* Legrand VendorID and ProductID */ -#define LEGRAND_VID 0x1cb0 /* Legrand */ +/* Legrand */ +#define LEGRAND_VENDORID 0x1cb0 + +/* Legrand ProductIDs */ #define LEGRAND_PID_PDU 0x0038 /* Keor PDU model (800VA) */ #define LEGRAND_PID_SP 0x0032 /* Keor SP model (600, 800, 1000, 1500, 2000VA version) */ @@ -48,8 +50,8 @@ static void *disable_interrupt_pipe(USBDevice_t *device) /* USB IDs device table */ static usb_device_id_t legrand_usb_device_table[] = { - { USB_DEVICE(LEGRAND_VID, LEGRAND_PID_PDU), disable_interrupt_pipe }, /* Legrand Keor PDU */ - { USB_DEVICE(LEGRAND_VID, LEGRAND_PID_SP), disable_interrupt_pipe }, /* Legrand Keor SP */ + { USB_DEVICE(LEGRAND_VENDORID, LEGRAND_PID_PDU), disable_interrupt_pipe }, /* Legrand Keor PDU */ + { USB_DEVICE(LEGRAND_VENDORID, LEGRAND_PID_SP) , disable_interrupt_pipe }, /* Legrand Keor SP */ /* Terminating entry */ { 0, 0, NULL } diff --git a/drivers/liebert-hid.c b/drivers/liebert-hid.c index 7b87706fc5..39094b0fad 100644 --- a/drivers/liebert-hid.c +++ b/drivers/liebert-hid.c @@ -32,7 +32,7 @@ /* FIXME: experimental flag to be put in upsdrv_info */ /* Phoenixtec Power Co., Ltd */ -#define LIEBERT_VENDORID 0x06da +#define PHOENIXTEC_VENDORID 0x06da /*! USB IDs device table. * @@ -42,7 +42,7 @@ * Belkin HID firmware. */ static usb_device_id_t liebert_usb_device_table[] = { /* various models */ - { USB_DEVICE(LIEBERT_VENDORID, 0xffff), NULL }, + { USB_DEVICE(PHOENIXTEC_VENDORID, 0xffff), NULL }, /* Terminating entry */ { 0, 0, NULL } diff --git a/drivers/mge-hid.c b/drivers/mge-hid.c index 5a89bde796..07863bd484 100644 --- a/drivers/mge-hid.c +++ b/drivers/mge-hid.c @@ -73,7 +73,7 @@ /* Note that normally this VID is handled by Liebert/Phoenixtec HID mapping, * here it is just for for AEG PROTECT NAS devices: */ /* Phoenixtec Power Co., Ltd */ -#define PHOENIXTEC 0x06da +#define PHOENIXTEC_VENDORID 0x06da /* IBM */ #define IBM_VENDORID 0x04b3 @@ -106,7 +106,7 @@ static usb_device_id_t mge_usb_device_table[] = { /* PROTECT B / NAS */ { USB_DEVICE(AEG_VENDORID, 0xffff), NULL }, - { USB_DEVICE(PHOENIXTEC, 0xffff), NULL }, + { USB_DEVICE(PHOENIXTEC_VENDORID, 0xffff), NULL }, /* 6000 VA LCD 4U Rack UPS; 5396-1Kx */ { USB_DEVICE(IBM_VENDORID, 0x0001), NULL }, @@ -2465,7 +2465,7 @@ static int mge_claim(HIDDevice_t *hd) { */ return 0; - case PHOENIXTEC: + case PHOENIXTEC_VENDORID: /* The vendorid 0x06da is primarily handled by * liebert-hid, except for (maybe) AEG PROTECT NAS * branded devices */ @@ -2501,7 +2501,7 @@ static int mge_claim(HIDDevice_t *hd) { switch (hd->VendorID) { - case PHOENIXTEC: /* see comments above */ + case PHOENIXTEC_VENDORID: /* see comments above */ if (hd->Vendor && strstr(hd->Vendor, "AEG")) { return 1; } diff --git a/drivers/nutdrv_atcl_usb.c b/drivers/nutdrv_atcl_usb.c index 838f24c511..c306645a01 100644 --- a/drivers/nutdrv_atcl_usb.c +++ b/drivers/nutdrv_atcl_usb.c @@ -53,9 +53,12 @@ upsdrv_info_t upsdrv_info = { #define USB_VENDOR_STRING "ATCL FOR UPS" +/* Unregistered vendor 0x0001 (commonly identified as Fry's Electronics) */ +#define NONAME0001_VENDORID 0x0001 + static usb_device_id_t atcl_usb_id[] = { /* ATCL FOR UPS */ - { USB_DEVICE(0x0001, 0x0000), NULL }, + { USB_DEVICE(NONAME0001_VENDORID, 0x0000), NULL }, /* Terminating entry */ { 0, 0, NULL } diff --git a/drivers/richcomm_usb.c b/drivers/richcomm_usb.c index 32e0c64894..fbdcaf5cfc 100644 --- a/drivers/richcomm_usb.c +++ b/drivers/richcomm_usb.c @@ -54,9 +54,12 @@ upsdrv_info_t upsdrv_info = { #define USB_ERR_LIMIT 10 /* start limiting after 10 in a row */ #define USB_ERR_RATE 10 /* then only print every 10th error */ +/* Lakeview Research */ +#define LAKEVIEW_VENDORID 0x0925 + static usb_device_id_t richcomm_usb_id[] = { /* Sweex 1000VA */ - { USB_DEVICE(0x0925, 0x1234), NULL }, + { USB_DEVICE(LAKEVIEW_VENDORID, 0x1234), NULL }, /* Terminating entry */ { 0, 0, NULL } From 5d51d74f79f216a6cbada7b57df7a06acab247e7 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Thu, 18 Aug 2016 12:08:51 +0200 Subject: [PATCH 401/805] Added packaging metadata used by OBS as of 2016-08-18 (except debian.series) Signed-off-by: Jim Klimov --- obs/debian.Makefile.am | 9 + obs/debian.Makefile.in | 381 ++++ obs/debian.NEWS | 6 + obs/debian.changelog | 1931 +++++++++++++++++ obs/debian.compat | 1 + obs/debian.control | 297 +++ obs/debian.copyright | 69 + obs/debian.description.subst | 1 + obs/debian.gbp.conf | 8 + obs/debian.hotplug | 24 + obs/debian.libnutclient-dev.install | 3 + obs/debian.libnutclient-dev.manpages | 34 + obs/debian.libnutclient0.install | 1 + obs/debian.libnutclient0.lintian-overrides | 1 + obs/debian.libnutscan-dev.install | 6 + obs/debian.libnutscan1.install | 2 + obs/debian.libups-nut-perl.install | 1 + obs/debian.libupsclient-dev.install | 4 + obs/debian.libupsclient-dev.manpages | 2 + obs/debian.libupsclient4.install | 1 + obs/debian.nut-cgi.README.Debian | 39 + obs/debian.nut-cgi.docs | 1 + obs/debian.nut-cgi.install | 6 + obs/debian.nut-cgi.manpages | 6 + obs/debian.nut-cgi.postinst | 55 + obs/debian.nut-cgi.postrm | 47 + obs/debian.nut-client.init | 180 ++ obs/debian.nut-client.install | 20 + obs/debian.nut-client.links | 1 + obs/debian.nut-client.lintian-overrides | 2 + obs/debian.nut-client.maintscript | 1 + obs/debian.nut-client.manpages | 9 + obs/debian.nut-client.postinst | 79 + obs/debian.nut-client.preinst | 23 + obs/debian.nut-client.tmpfiles | 1 + ...ebian.nut-doc.doc-base.nut-developer-guide | 13 + obs/debian.nut-doc.doc-base.nut-faq | 12 + ...debian.nut-doc.doc-base.nut-packager-guide | 15 + obs/debian.nut-doc.doc-base.nut-user-manual | 15 + obs/debian.nut-doc.install | 1 + obs/debian.nut-ipmi.install | 2 + obs/debian.nut-ipmi.manpages | 1 + obs/debian.nut-monitor.install | 7 + obs/debian.nut-monitor.menu | 4 + obs/debian.nut-monitor.xpm | 326 +++ obs/debian.nut-powerman-pdu.install | 1 + obs/debian.nut-powerman-pdu.manpages | 1 + obs/debian.nut-server.dirs | 1 + obs/debian.nut-server.init | 179 ++ obs/debian.nut-server.install | 59 + obs/debian.nut-server.manpages | 53 + obs/debian.nut-server.postinst | 91 + obs/debian.nut-server.postrm | 50 + obs/debian.nut-server.preinst | 12 + obs/debian.nut-server.prerm | 42 + obs/debian.nut-server.tmpfiles | 1 + obs/debian.nut-snmp.docs | 1 + obs/debian.nut-snmp.install | 3 + obs/debian.nut-snmp.manpages | 1 + obs/debian.nut-xml.install | 1 + obs/debian.nut-xml.manpages | 1 + obs/debian.nut.README.Debian | 162 ++ obs/debian.nut.TODO.Debian | 9 + obs/debian.nut.docs | 18 + obs/debian.python-nut.install | 1 + obs/debian.rules | 140 ++ obs/debian.series | 2 + obs/debian.watch | 2 + obs/nut.changes | 0 obs/nut.dsc | 34 + obs/nut.spec | 380 ++++ 71 files changed, 4893 insertions(+) create mode 100644 obs/debian.Makefile.am create mode 100644 obs/debian.Makefile.in create mode 100644 obs/debian.NEWS create mode 100644 obs/debian.changelog create mode 100644 obs/debian.compat create mode 100644 obs/debian.control create mode 100644 obs/debian.copyright create mode 100644 obs/debian.description.subst create mode 100644 obs/debian.gbp.conf create mode 100644 obs/debian.hotplug create mode 100644 obs/debian.libnutclient-dev.install create mode 100644 obs/debian.libnutclient-dev.manpages create mode 100644 obs/debian.libnutclient0.install create mode 100644 obs/debian.libnutclient0.lintian-overrides create mode 100644 obs/debian.libnutscan-dev.install create mode 100644 obs/debian.libnutscan1.install create mode 100644 obs/debian.libups-nut-perl.install create mode 100644 obs/debian.libupsclient-dev.install create mode 100644 obs/debian.libupsclient-dev.manpages create mode 100644 obs/debian.libupsclient4.install create mode 100644 obs/debian.nut-cgi.README.Debian create mode 100644 obs/debian.nut-cgi.docs create mode 100644 obs/debian.nut-cgi.install create mode 100644 obs/debian.nut-cgi.manpages create mode 100644 obs/debian.nut-cgi.postinst create mode 100644 obs/debian.nut-cgi.postrm create mode 100644 obs/debian.nut-client.init create mode 100644 obs/debian.nut-client.install create mode 100644 obs/debian.nut-client.links create mode 100644 obs/debian.nut-client.lintian-overrides create mode 100644 obs/debian.nut-client.maintscript create mode 100644 obs/debian.nut-client.manpages create mode 100644 obs/debian.nut-client.postinst create mode 100644 obs/debian.nut-client.preinst create mode 100644 obs/debian.nut-client.tmpfiles create mode 100644 obs/debian.nut-doc.doc-base.nut-developer-guide create mode 100644 obs/debian.nut-doc.doc-base.nut-faq create mode 100644 obs/debian.nut-doc.doc-base.nut-packager-guide create mode 100644 obs/debian.nut-doc.doc-base.nut-user-manual create mode 100644 obs/debian.nut-doc.install create mode 100644 obs/debian.nut-ipmi.install create mode 100644 obs/debian.nut-ipmi.manpages create mode 100644 obs/debian.nut-monitor.install create mode 100644 obs/debian.nut-monitor.menu create mode 100644 obs/debian.nut-monitor.xpm create mode 100644 obs/debian.nut-powerman-pdu.install create mode 100644 obs/debian.nut-powerman-pdu.manpages create mode 100644 obs/debian.nut-server.dirs create mode 100644 obs/debian.nut-server.init create mode 100644 obs/debian.nut-server.install create mode 100644 obs/debian.nut-server.manpages create mode 100644 obs/debian.nut-server.postinst create mode 100644 obs/debian.nut-server.postrm create mode 100644 obs/debian.nut-server.preinst create mode 100644 obs/debian.nut-server.prerm create mode 100644 obs/debian.nut-server.tmpfiles create mode 100644 obs/debian.nut-snmp.docs create mode 100644 obs/debian.nut-snmp.install create mode 100644 obs/debian.nut-snmp.manpages create mode 100644 obs/debian.nut-xml.install create mode 100644 obs/debian.nut-xml.manpages create mode 100644 obs/debian.nut.README.Debian create mode 100644 obs/debian.nut.TODO.Debian create mode 100644 obs/debian.nut.docs create mode 100644 obs/debian.python-nut.install create mode 100644 obs/debian.rules create mode 100644 obs/debian.series create mode 100644 obs/debian.watch create mode 100644 obs/nut.changes create mode 100644 obs/nut.dsc create mode 100644 obs/nut.spec diff --git a/obs/debian.Makefile.am b/obs/debian.Makefile.am new file mode 100644 index 0000000000..68fdb08494 --- /dev/null +++ b/obs/debian.Makefile.am @@ -0,0 +1,9 @@ +EXTRA_DIST = changelog control copyright description.subst hotplug \ + nut-cgi.config nut-cgi.docs nut-cgi.examples nut-cgi.postinst nut-cgi.postrm \ + nut-cgi.preinst nut-cgi.README.Debian nut-cgi.templates nut.config \ + nut.default nut.dirs nut.docs nut.examples nut-hal-drivers.docs \ + nut-server.init nut-client.init nut-client.links \ + nut.postinst nut.postrm nut.preinst nut.prerm nut.README.Debian \ + nut.templates nut.TODO.Debian rules watch \ + po/ca.po po/cs.po po/de.po po/fr.po po/POTFILES.in \ + po/pt.po po/pt_BR.po po/templates.pot po/vi.po diff --git a/obs/debian.Makefile.in b/obs/debian.Makefile.in new file mode 100644 index 0000000000..aca99247d6 --- /dev/null +++ b/obs/debian.Makefile.in @@ -0,0 +1,381 @@ +# Makefile.in generated by automake 1.10.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +target_triplet = @target@ +subdir = packaging/debian +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/ax_create_stdint_h.m4 \ + $(top_srcdir)/m4/nut_arg_with.m4 \ + $(top_srcdir)/m4/nut_check_hiddev.m4 \ + $(top_srcdir)/m4/nut_check_ipv6.m4 \ + $(top_srcdir)/m4/nut_check_libgd.m4 \ + $(top_srcdir)/m4/nut_check_libhal.m4 \ + $(top_srcdir)/m4/nut_check_libneon.m4 \ + $(top_srcdir)/m4/nut_check_libnetsnmp.m4 \ + $(top_srcdir)/m4/nut_check_libssl.m4 \ + $(top_srcdir)/m4/nut_check_libusb.m4 \ + $(top_srcdir)/m4/nut_report_feature.m4 \ + $(top_srcdir)/m4/nut_type_socklen_t.m4 \ + $(top_srcdir)/configure.in +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/include/config.h +CONFIG_CLEAN_FILES = +SOURCES = +DIST_SOURCES = +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMTAR = @AMTAR@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CONFPATH = @CONFPATH@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DRIVER_BUILD_LIST = @DRIVER_BUILD_LIST@ +DRIVER_INSTALL_TARGET = @DRIVER_INSTALL_TARGET@ +DRIVER_MAN_LIST = @DRIVER_MAN_LIST@ +DSYMUTIL = @DSYMUTIL@ +ECHO = @ECHO@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +F77 = @F77@ +FFLAGS = @FFLAGS@ +GREP = @GREP@ +HAL_CALLOUTS_PATH = @HAL_CALLOUTS_PATH@ +HAL_FDI_PATH = @HAL_FDI_PATH@ +HAL_USER = @HAL_USER@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LDFLAGS = @LDFLAGS@ +LIBGD_CFLAGS = @LIBGD_CFLAGS@ +LIBGD_LDFLAGS = @LIBGD_LDFLAGS@ +LIBHAL_CFLAGS = @LIBHAL_CFLAGS@ +LIBHAL_LDFLAGS = @LIBHAL_LDFLAGS@ +LIBNEON_CFLAGS = @LIBNEON_CFLAGS@ +LIBNEON_LDFLAGS = @LIBNEON_LDFLAGS@ +LIBNETSNMP_CFLAGS = @LIBNETSNMP_CFLAGS@ +LIBNETSNMP_LDFLAGS = @LIBNETSNMP_LDFLAGS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBSSL_CFLAGS = @LIBSSL_CFLAGS@ +LIBSSL_LDFLAGS = @LIBSSL_LDFLAGS@ +LIBTOOL = @LIBTOOL@ +LIBUSB_CFLAGS = @LIBUSB_CFLAGS@ +LIBUSB_LDFLAGS = @LIBUSB_LDFLAGS@ +LINUX_HIDDEV = @LINUX_HIDDEV@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +MAINT = @MAINT@ +MAKEINFO = @MAKEINFO@ +MKDIR_P = @MKDIR_P@ +NETLIBS = @NETLIBS@ +NMEDIT = @NMEDIT@ +OBJEXT = @OBJEXT@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +RANLIB = @RANLIB@ +RUN_AS_GROUP = @RUN_AS_GROUP@ +RUN_AS_USER = @RUN_AS_USER@ +SED = @SED@ +SERLIBS = @SERLIBS@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STATEPATH = @STATEPATH@ +STRIP = @STRIP@ +SUN_LIBUSB = @SUN_LIBUSB@ +VERSION = @VERSION@ +WORDS_BIGENDIAN = @WORDS_BIGENDIAN@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_F77 = @ac_ct_F77@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +cgiexecdir = @cgiexecdir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +driverexecdir = @driverexecdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +hotplugdir = @hotplugdir@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +pkgconfigdir = @pkgconfigdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target = @target@ +target_alias = @target_alias@ +target_cpu = @target_cpu@ +target_os = @target_os@ +target_vendor = @target_vendor@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +udevdir = @udevdir@ +EXTRA_DIST = changelog control copyright description.subst hotplug \ + nut-cgi.config nut-cgi.docs nut-cgi.examples nut-cgi.postinst nut-cgi.postrm \ + nut-cgi.preinst nut-cgi.README.Debian nut-cgi.templates nut.config \ + nut.default nut.dirs nut.docs nut.examples nut-hal-drivers.docs \ + nut.init nut.links nut.postinst nut.postrm nut.preinst nut.prerm \ + nut.README.Debian nut.templates nut.TODO.Debian \ + rules watch po/ca.po po/cs.po po/de.po po/fr.po po/POTFILES.in \ + po/pt.po po/pt_BR.po po/templates.pot po/vi.po + +all: all-am + +.SUFFIXES: +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ + && exit 0; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu packaging/debian/Makefile'; \ + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu packaging/debian/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs +tags: TAGS +TAGS: + +ctags: CTAGS +CTAGS: + + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile +installdirs: +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic clean-libtool mostlyclean-am + +distclean: distclean-am + -rm -f Makefile +distclean-am: clean-am distclean-generic + +dvi: dvi-am + +dvi-am: + +html: html-am + +info: info-am + +info-am: + +install-data-am: + +install-dvi: install-dvi-am + +install-exec-am: + +install-html: install-html-am + +install-info: install-info-am + +install-man: + +install-pdf: install-pdf-am + +install-ps: install-ps-am + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-generic mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: + +.MAKE: install-am install-strip + +.PHONY: all all-am check check-am clean clean-generic clean-libtool \ + distclean distclean-generic distclean-libtool distdir dvi \ + dvi-am html html-am info info-am install install-am \ + install-data install-data-am install-dvi install-dvi-am \ + install-exec install-exec-am install-html install-html-am \ + install-info install-info-am install-man install-pdf \ + install-pdf-am install-ps install-ps-am install-strip \ + installcheck installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-generic \ + mostlyclean-libtool pdf pdf-am ps ps-am uninstall uninstall-am + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/obs/debian.NEWS b/obs/debian.NEWS new file mode 100644 index 0000000000..e42605c871 --- /dev/null +++ b/obs/debian.NEWS @@ -0,0 +1,6 @@ +nut (2.6.5-1) experimental; urgency=low + + mge-shut driver has been replaced by a new implementation (newmge-shut). + In case of issue with this new version, users can revert to oldmge-shut. + + -- Laurent Bigonville Mon, 13 Aug 2012 00:32:18 +0200 diff --git a/obs/debian.changelog b/obs/debian.changelog new file mode 100644 index 0000000000..e071d2e0e2 --- /dev/null +++ b/obs/debian.changelog @@ -0,0 +1,1931 @@ +nut (2.7.4-13) UNRELEASED; urgency=high + + * Base on daisychain+DMF branch from vyskocilm fork @ github + removed patches + * 0024-snmp-ups-Eaton-3ph-UPS-improvements.patch + * 0025-Fix-nut-scanner-compilation-in-some-environments.patch + * 0026-snmp-ups-support-Raritan-Dominion-PX2-PDU.patch + can't be merged, upstream change + * 0028-nut-scanner-additional-search-path.patch + * 0029-netvision-mib-uses-0-as-dfl.patch + daisy chain is upstream + * 0030-daisychain.patch + * 0031-daisychain-complement.patch + * 0032-snmp-ups-fix-some-regression-due-to-daisychain.patch + * 0033-snmp-ups-fix-memory-leaks.patch + part of daisychain+DMF branch + * 0035-daisychain+DMF.patch + * 0036-post-carlos-dmf-fixes.patch + + -- Michal Vyskocil Tue, 16 Aug 2016 11:29:12 +0200 + +nut (2.7.4-12) UNRELEASED; urgency=high + + * Add 0036-post-carlos-dmf-fixes.patch + this fixes bug introduced by Carlos after DMF support was validated + Pushed upstream (DMF branch) as + https://github.com/networkupstools/nut/pull/304 + + -- Michal Vyskocil Mon, 15 Aug 2016 15:25:11 +0200 + +nut (2.7.4-11) UNRELEASED; urgency=high + + * Add 0035-daisychain+DMF.patch + this is combination of daisychain+DMF vyskocilm branch on gh + some + polishing to apply cleanly + + -- Michal Vyskocil Fri, 12 Aug 2016 15:15:18 +0200 + +nut (2.7.4-10) UNRELEASED; urgency=high + + * Add 0034-fix_xmlv4_segfault.patch + + -- Arnaud Quette Tue, 28 Jun 2016 14:17:57 +0200 + +nut (2.7.4-9) UNRELEASED; urgency=high + + * Add 0033-snmp-ups-fix-memory-leaks.patch + + -- Arnaud Quette Thu, 09 Jun 2016 10:36:07 +0200 + +nut (2.7.4-8) UNRELEASED; urgency=high + + * Add 0032-snmp-ups-fix-some-regression-due-to-daisychain.patch + + -- Arnaud Quette Tue, 07 Jun 2016 16:59:19 +0200 + +nut (2.7.4-7) UNRELEASED; urgency=high + + * Add the complementary patch 0031-daisychain-complement.patch + + -- Arnaud Quette Tue, 31 May 2016 16:23:23 +0200 + +nut (2.7.4-6) UNRELEASED; urgency=high + + * Add again patch 0030-daisychain.patch + + -- Arnaud Quette Fri, 27 May 2016 15:46:43 +0200 + +nut (2.7.4-5) UNRELEASED; urgency=high + + * Add patch 0029-netvision-mib-uses-0-as-dfl.patch and + 0030-daisychain.patch + + -- Arnaud Quette Thu, 19 May 2016 13:36:45 +0200 + +nut (2.7.4-4) UNRELEASED; urgency=high + + * Add patch 0028-nut-scanner-additional-search-path.patch + + -- Arnaud Quette Mon, 11 Apr 2016 09:34:15 +0200 + +nut (2.7.4-3) UNRELEASED; urgency=high + + * Add patch 0027-snmp-ups-support-APC-PDU.patch + + -- Tomas Halman Wed, 06 Apr 2016 16:21:47 +0200 + +nut (2.7.4-2) UNRELEASED; urgency=high + + * Add patch 0026-snmp-ups-support-Raritan-Dominion-PX2-PDU.patch + + -- Arnaud Quette Wed, 06 Apr 2016 16:21:47 +0200 + +nut (2.7.4-1) UNRELEASED; urgency=high + + * updated to 2.7.4 + dropped following no longer needed patches: + 0009-systemd.patch + 0010-libnutscanner-2pass-crash.patch + 0012-nutclient-socket-read.patch + 0013-Fix-dummy-ups-for-external-value-changes.patch + 0016-Eaton-ePDU.patch + 0017-Eaton-ePDU-groups.patch + 0018-Eaton-3phase-alarms.patch + 0019-stale-comm-recovery.patch + 0020-stale-comm-detection.patch + 0022-3ph_temp_hum_internal_th.patch + 0023-3ph-outputsource.patch + * Add patch 0024-snmp-ups-Eaton-3ph-UPS-improvements.patch + + -- Arnaud Quette Thu, 10 Mar 2016 11:11:28 +0100 + +nut (2.7.3-23) UNRELEASED; urgency=high + + * Patch SNMP for Eaton 3ph output source status + + -- Arnaud Quette Mon, 08 Feb 2016 11:56:24 +0100 + +nut (2.7.3-22) UNRELEASED; urgency=high + + * Patch SNMP for Eaton 3ph temperature and humidity (internal and external) + + -- Arnaud Quette Wed, 03 Feb 2016 16:21:10 +0100 + +nut (2.7.3-21) UNRELEASED; urgency=high + + * Patch XML scan to actually limit to 3 attempt, and not loop infinitly + + -- Arnaud Quette Tue, 02 Feb 2016 13:01:12 +0100 + +nut (2.7.3-20) UNRELEASED; urgency=high + + * Patch snmp-ups to improve stale communication detection + + -- Arnaud Quette Thu, 14 Jan 2016 15:48:13 +0100 + +nut (2.7.3-19) UNRELEASED; urgency=high + + * Patch snmp-ups to improve stale communication recovery + + -- Arnaud Quette Thu, 07 Jan 2016 13:34:15 +0100 + +nut (2.7.3-18) UNRELEASED; urgency=high + + * Fix typo in nut-driver@.service + + -- Michal Hrusecky Thu, 1 Oct 2015 13:28:07 +0200 + +nut (2.7.3-17) UNRELEASED; urgency=high + + * Add 0018-Eaton-3phase-alarms.patch for 3phase UPS alarms + + -- Arnaud Quette Mon, 28 Sep 2015 16:27:48 +0200 + +nut (2.7.3-16) UNRELEASED; urgency=high + + * Add 0017-Eaton-ePDU-groups.patch for ePDU outlet groups management + and others SNMP improvements + + -- Arnaud Quette Fri, 11 Sep 2015 15:48:36 +0200 + +nut (2.7.3-15) UNRELEASED; urgency=high + + * Complete 0016-Eaton-ePDU.patch for ePDU alarms and SNMP improvements + + -- Arnaud Quette Fri, 11 Sep 2015 15:48:36 +0200 + +nut (2.7.3-14) UNRELEASED; urgency=high + + * added 0016-Eaton-ePDU.patch for ePDU alarms and SNMP improvements + + -- Arnaud Quette Mon, 07 Sep 2015 14:55:11 +0200 + +nut (2.7.3-13) UNRELEASED; urgency=high + + * added 0015-Use-target-for-drivers-in-systemd.patch to implement more + granular systemd support + + -- Michal Hrusecky Fri, 21 Aug 2015 12:15:07 +0200 + +nut (2.7.3-12) UNRELEASED; urgency=high + + * putting 0013-Fix-dummy-ups-for-external-value-changes.patch back + for remote settings through upsrw (for GreenDataNet) + * including 0014-upsrdvctl-nowait.patch. Provides an option to start + The nowait flag allow to tell upsdrvctl to not wait at all for the + driver(s) to execute the request command. The default behavior, when + this variable is omitted, is to wait 'maxstartdelay' seconds + + -- Tomas Halman Mon, 11 Aug 2015 9:20:00 +0100 + +nut (2.7.3-11) UNRELEASED; urgency=high + + * removed 0013-Fix-dummy-ups-for-external-value-changes.patch + probably causes nut unstability + + -- Tomas Halman Mon, 11 Aug 2015 9:20:00 +0100 + +nut (2.7.3-10) UNRELEASED; urgency=high + + * 0013-Fix-dummy-ups-for-external-value-changes.patch: fix dummy-ups + for remote settings through upsrw (for GreenDataNet) + + -- Arnaud Quette Mon, 10 Aug 2015 09:41:28 +0200 + +nut (2.7.3-9) UNRELEASED; urgency=high + + * 0012-nutclient-socket-read.patch fix socket reading + + -- Tomas Halman Mon, 3 Aug 2015 13:12:00 +0100 + +nut (2.7.3-8) UNRELEASED; urgency=low + + * Drop bogus headers from libupsclient-dev + + -- Michal Hrusecky Tue, 30 Jun 2015 8:13:08 +0100 + +nut (2.7.3-7) UNRELEASED; urgency=low + + * 0011-libnutscanner-scan-one-ip-xml-http.patch + + -- Michal Vyskocil Tue, 23 Jun 2015 10:13:08 +0100 + +nut (2.7.3-6) UNRELEASED; urgency=low + + * fix nutscan library crash on second call + + -- Tomas Halman Thu, 18 Jun 2015 8:54:38 +0100 + +nut (2.7.3-5) UNRELEASED; urgency=low + + * add mising dependency between libraries + + -- Michal Hrusecky Wed, 17 Jun 2015 8:54:38 +0100 + +nut (2.7.3-4) UNRELEASED; urgency=low + + * add mising header file for scanner + + -- Michal Hrusecky Mon, 15 Jun 2015 10:54:38 +0100 + +nut (2.7.3-3) UNRELEASED; urgency=low + + * drop static libraries + * add nut-scanner + + -- Michal Hrusecky Fri, 12 Jun 2015 16:54:38 +0100 + +nut (2.7.3-2) UNRELEASED; urgency=low + + * add 0009-systemd.patch + + -- Michal Hrusecky Wed, 13 May 2015 16:54:38 +0100 + +nut (2.7.3-1) UNRELEASED; urgency=low + + * to ease the maintenance switched to OBS format + * updated to 2.7.3 + dropped following no longer needed patches: + 0007-killpower-path.patch + 0009-nut-epdu-input.patch + + -- Michal Hrusecky Wed, 5 May 2015 16:54:38 +0100 + +nut (2.7.2-3) UNRELEASED; urgency=low + + * added 0009-nut-epdu-input.patch + + -- Arnaud Quette Wed, 4 Feb 2015 16:54:38 +0100 + +nut (2.7.2-2) UNRELEASED; urgency=low + + * debian/control: add new packages libnutclient0 and libnutclient-dev + * debian/rules: adapted for the new packages + * debian/libnutclient0.install, debian/libnutclient0.symbols, + debian/libnutclient-dev.install, debian/libnutclient-dev.manpages: + created for the new packages + + -- Arnaud Quette Mon, 20 Oct 2014 20:41:47 +0200 + +nut (2.7.2-1) unstable; urgency=low + + * New upstream release + - Fix the undefined references (Closes: #731156) + - debian/patches/0004-fix-systemd-service.patch: Refreshed + - Drop d/p/0005-Provide-retry-options-for-upsdrvctl-and-drivers.patch: + Merged upstream + - debian/nut-server.install: Upstream is now installing upsdrvctl /sbin + - Rename package libupsclient3 to libupsclient4, soname got bumped again + * debian/rules, debian/control, d/p/0004-fix-systemd-service.patch: Use a + symlink instead of an Alias= to mask the SysV initscript + * debian/control: Bump Standards-Version to 3.9.5 (no further changes) + * debian/tests/control: Add lsb-release and netcat to the dependencies + (Closes: #733189) + * debian/control, debian/rules: Call dh-autoreconf and pass LDFLAGS to + minimize runtime dependencies + * debian/patches/0008-drop-w3c-icons.patch: Remove the link to external W3C + icons to prevent privacy breach (privacy-breach-w3c-valid-html) + * debian/nut-server.install, debian/nut-server.manpages: Install new + nutdrv_atcl_usb driver + + -- Laurent Bigonville Tue, 22 Apr 2014 22:46:12 +0200 + +nut (2.7.1-1) unstable; urgency=low + + * New upstream release (Closes: #730183) + - Refresh debian/patches/0004-fix-systemd-service.patch + - Rename libupsclient1 to libupsclient3 following the soname bump, rename + libupsclient1-dev to libupsclient-dev, the package is not co-installable + anyway + * debian/rules, debian/control: Enable SSL support using libnss3 + * d/p/0005-Provide-retry-options-for-upsdrvctl-and-drivers.patch, + d/p/0006-ups-conf-maxretry.patch: By default, retry to start the drivers + up-to three times, this should mitigate races with slow devices + (Closes: #694717) + * debian/nut-server.install, debian/nut-server.manpages: Install new drivers + * Move bash-completion file to /usr/share/bash-completion/ + * debian/patches/0007-killpower-path.patch: Revert POWERDOWNFLAG back to + /etc/killpower + * debian/nut-client.lintian-overrides: Add override for + systemd-no-service-for-init-script ups-monitor + * debian/rules: Drop static ordering for the initscripts and pass + --restart-after-upgrade option to dh_installinit and dh_systemd_start to + minimize the downtime of the daemons + + -- Laurent Bigonville Sun, 24 Nov 2013 20:57:51 +0100 + +nut (2.6.5-4) unstable; urgency=low + + * debian/control: Do not build nut-ipmi on hurd-i386 as freeipmi is not + available on that platform. + + -- Laurent Bigonville Thu, 11 Jul 2013 12:29:58 +0200 + +nut (2.6.5-3) unstable; urgency=low + + [ Laurent Bigonville ] + * debian/control: + - Move libupsclient1 package to libs Section + - Add libgd-dev to the Build-Depends, keep the other alternatives to ease + the backports + - Bump Standards-Version to 3.9.4 (no further changes) + - Add autotools-dev to the build-dependencies so config.{guess,sub} are + getting updated during build + - Use canonical URL for the VCS-* fields + - Add build-dependency against dh-systemd and bump minimal cdbs version so + systemd helpers are called during build. + * Added dep-8-tests to improve QA (from Ubuntu, closes: #708130) + * debian/nut-monitor.menu, nut-monitor.xpm: Add Debian menu entry (Closes: + #708813) + * debian/rules: Drop manual creation of .service files symlink, this should + be handled by dh_systemd now + * debian/patches/0004-fix-systemd-service.patch: Also add Wants/Before for + systemd-udev-settle.service in the nut-driver.service as it got renamed + after udev merge + * debian/patches/0004-fix-systemd-service.patch: Fix path for upsdrvctl in + scripts/systemd/nutshutdown.in + + [ Ivo De Decker ] + * debian/nut-client.preinst: also revert /etc/nut/nut.conf mangling done + by postinst during upgrade from lenny to squeeze (Really closes: #677054) + Thanks to Andreas Beckmann for the review. + + -- Laurent Bigonville Thu, 11 Jul 2013 00:50:06 +0200 + +nut (2.6.5-2) experimental; urgency=low + + [ Laurent Bigonville ] + * debian/control: Move the nut-monitor Suggests from nut-server to + nut-client + * Restore proper SELinux context for runtime created /var/run/nut directory + * debian/control: Fix typo in package description + * debian/watch: Update watch file URL (Thanks to Bart Martens) + * debian/rules: Alias systemd nut-monitor service file to nut-client to + prevent it from running twice + * d/p/0004-fix-systemd-service.patch: Fix systemd service file for Debian + * Install tmpfiles conf files to create /run/nut directory during boot + + [ Sébastien Villemot ] + * debian/nut-client.preinst: revert /etc/nut/nut.conf mangling done by older + versions of the postinst (Closes: #677054) + + [ Ivo De Decker ] + * Only fix permissions of configfiles on first install. + * Only remove /etc/init.d/nut from previous versions of nut in nut-server + postinst if there are no local changes. + * Also remove /etc/init.d/nut in nut-client postinst. Thanks to + Laurent Bigonville for the hint. + + -- Laurent Bigonville Thu, 31 Jan 2013 21:51:31 +0100 + +nut (2.6.5-1) experimental; urgency=low + + [ Arnaud Quette ] + * debian/control, debian/nut-ipmi.{install,manpages}: create IPMI + support package + * debian/nut-server.install: only install USB udev rules + + [ Laurent Bigonville ] + * New upstream release + - Drop debian/patches/0001-fix-upsmon-regression.patch, applied upstream + * Follow multi-arch policy + * Install systemd .service files (Closes: #679450) + * debian/nut-server.install: Drop newmge-shut, renamed upstream to mge-shut + and install the old implementation (oldmge-shut) instead + * debian/control: Drop ancient Conflicts/Provides/Replaces + * Install all development files under /usr + + -- Laurent Bigonville Mon, 13 Aug 2012 01:59:18 +0200 + +nut (2.6.4-2) unstable; urgency=low + + * debian/rules: Stop the nut-client before nut-server on systems using static + boot ordering (Closes: #679451) + * debian/nut-server.postinst: Remove /etc/init.d/nut on upgrade + (Closes: #677822) + * Rename nut-server.lintian-overrides to nut-client.lintian-overrides and + adjust overrides now that ups-monitor is shipped in nut-client package + (Closes: #677947) + * Add debian/patches/0001-fix-upsmon-regression.patch: Fix upsmon/upssched + regression (Taken from upstream) (Closes: #679513) + * Move nut metapackage to Section: metapackages + * Also create nut user when installing nut-client package and do not delete + it on purge anymore (Closes: #682000) + * Drop /etc/default/nut → /etc/nut/nut.conf migration code, migration + happends before squeeze release and this was against policy to have a + maintainer script modifying a conffile in the first place (Closes: #684392) + * Add dependency against adduser and lsb-base on nut-client package + * Be sure that client is stopped before the server also when using + dependencies based boot + * Fix package descriptions (Closes: #678068) + * Also install /bin/upssched-cmd in nut-client package as this script is + referenced in default upssched.conf config file + * debian/watch: Update watch file + * Be sure that all maintainer scripts are returning 0 at their end + + -- Laurent Bigonville Sun, 12 Aug 2012 20:38:52 +0200 + +nut (2.6.4-1) unstable; urgency=high + + * New upstream release (Closes: #671444) + * acknowledges NMU (Closes: #613643) + * debian/nut-client.init: fix action "start" and use of log_*_*msg + LSB log functions (Closes: #675619) + * debian/nut-server.preinst: remove obsolete file(s) left in + /etc/udev/rules.d and related processing: udev files are now located + in /lib/udev/rules, and there is no reason to modify the dedicated + USB UPS rules (52-nut-usbups.rules) (Closes: #660072) + + -- Arnaud Quette Wed, 06 Jun 2012 21:03:50 +0200 + +nut (2.6.3-2) unstable; urgency=low + + * debian/nut-server.init: rewrite to match upsd / drivers startup scope + * debian/nut-client.init: created to match upsmon startup scope + (Closes: #634858) + * debian/nut.TODO.Debian, debian/Makefile.am: updated to reflect the above + * debian/rules: install nut-client.init, and update to reflect the above + * debian/control, debian/Makefile.am: updated to reflect the above + * debian/control: + - add Breaks on nut-server (<< 2.6.3-1~) + - bump Standards-Version to 3.9.3 + * debian/nut-client.links: renamed from debian/nut-server.links, since + ups-monitor is now provided by nut-client initscript + * debian/nut.README.Debian: renamed from nut-server.README.Debian, + to provide it with both client and server packages + * debian/nut-server.install: add missing drivers (clone-outlet, + liebert-esp2 and microdowell) + * debian/nut-server.manpages: add missing manual pages (apcsmart-old, + ivtscd, liebert-esp2 and microdowell) + + -- Arnaud Quette Tue, 24 Jan 2012 13:14:59 +0100 + +nut (2.6.3-1) unstable; urgency=low + + * New upstream release (Closes: #635186, #598741, #633756, #638221) + * debian/nut-server.{install,manpages}: add richcomm_usb + * debian/nut-server.install, debian/rules: install Avahi service file + * debian/rules, nut-client.install: install Augeas lenses + * debian/nut-server.README.Debian: clarify udev explanation (Closes: #529664) + * debian/patches/0001-fix_spelling_and_typo.patch, + debian/patches/0003-libupsclient-version.patch: removed since these are now + fixed upstream + * debian/patches/series: updated + + -- Arnaud Quette Tue, 24 Jan 2012 13:14:59 +0100 + +nut (2.6.2-1) unstable; urgency=low + + * New upstream release (Closes: #594989) + * debian/control: + - remove legacy Build-Depends for nut-hal-drivers on libdbus and libglib + - Build-Depends-Indep on docbook-xsl for offline document + generation (Closes: #635347) + * debian/nut-server.install: add apcsmart-old + * debian/nut-server.init: + - add udev as Required-Start/Stop (Closes: #642412) + - remove legacy support for /etc/default/nut (Closes: #638021) + * debian/patches/0003-libupsclient-version.patch: added to fix the missing + libupsclient version info bump + * debian/libupsclient1-dev.links: update link name + * debian/libupsclient1.symbols: add with upscli_tryconnect + * debian/nut.TODO.Debian: update and complete the TODO list + + -- Arnaud Quette Thu, 29 Sep 2011 18:39:16 +0200 + +nut (2.6.1-2) unstable; urgency=low + + * debian/nut.README.Debian: Adjust udev rules naming for permissions override + (Closes: #529664) + * Re-add and refresh debian/patches/0001-fix_spelling_and_typo.patch: + Some typos and spelling errors remain. + * Split nut package into nut-client and nut-server, keep nut package as + metapackage + * Generate PDF and html doc and install it in nut-doc package + * debian/rules: + - List non-installed files + - Includes python-module.mk + - Add flags to build documentation and install it + * debian/control: + - Add python-nut package and add python build-dependency + - Set nut-powerman-pdu priority to extras + - Add nut-monitor package + - Add nut-doc package and add required C/R/P + - Add libups-nut-perl package + * debian/nut-server.prerm: Remove /var/run/nut during removal + + -- Laurent Bigonville Sun, 17 Jul 2011 19:03:18 +0200 + +nut (2.6.1-1) unstable; urgency=low + + * New upstream release (Closes: #595953, #614842, #595773) + * debian/patches/*.patch: removed since these are now fixed upstream + [Laurent Bigonville] + * Drop HAL package and build-dependencies (Closes: #613197) + * debian/control: + - Bump Standards-Version to 3.9.2 (no further changes) + - Drop autotools build-dependencies (not needed anymore) + - Drop non-existing build-dependencies + * debian/rules: + - Correctly pass flags to configure + + -- Arnaud Quette Wed, 01 Jun 2011 22:34:28 +0200 + +nut (2.6.0-2) unstable; urgency=low + + * debian/nut-snmp.docs: Distribute snmp.txt doc file (Closes: #548295) + * d/p/0001-fix_spelling_and_typo.patch: Update and refresh + * debian/nut.lintian-overrides: Fix typo + * debian/patch/0002-fix_libupsclient_pc.patch: Fix libupsclient.pc (Closes: + #624255) + * debian/rules: + - Switch to cdbs + - Remove not existing configure options (Closes: #611813) + - Drop Phony rules (Closes: #613699) + * debian/control: + - Add cdbs build-dependency + + -- Laurent Bigonville Sun, 08 May 2011 21:23:46 +0200 + +nut (2.6.0-1) unstable; urgency=low + + * New upstream release (Closes: #575176, #588648, #609597, #687985) + * debian/patches/*.patch: removed since these are now fixed upstream + * debian/patches/0001-fix_spelling_and_typo.patch, + debian/patches/series: reworked to match the new upstream release + * debian/nut.install, debian/nut.manpages: remove obsolete reference to + megatec and megatec_usb, now respectively replaced by blazer_ser and + blazer_usb + * debian/nut.docs: limit distributed documentation + + -- Arnaud Quette Wed, 16 Feb 2011 22:55:26 +0100 + +nut (2.4.3-3) UNRELEASED; urgency=low + + * debian/control: + - Wrap build-dependencies + - Change nut-cgi Recommends to apache2 | httpd-cgi + * debian/nut.postinst: Only trigger USB subsystem, should Closes: #574769 + * debian/patches/0002-fix_udev_action.patch: Use SUBSYSTEM instead of BUS + + -- Laurent Bigonville Tue, 11 Jan 2011 22:24:07 +0100 + +nut (2.4.3-2) unstable; urgency=medium + + * debian/control: + - Bump Standards-Version to 3.9.1 + - Update Vcs-* fields to new GIT repository + - Add myself as Uploaders + * Switch to dpkg-source 3.0 (quilt) format (Closes: #573601) + * debian/patches/0001-low_speed_usb_ups.patch: Use patch system for changes + that were applied directly in the source + * Add debian/gbp.conf file + * debian/watch: Bump version to 3 + * Add debian/patches/0002-fix_udev_action.patch: Also set permission for + "change" udev ACTION (Closes: #557178) + * debian/nut.postrm: Do not try to remove nut user is deluser is not + installed anymore + * debian/nut.manpages: Install manpage nut.conf.5 (Closes: #528222) + * debian/copyright: Fix copyright-with-old-dh-make-debian-copyright + * Remove nut-snmp.lintian-overrides, not needed anymore + * debian/patches/0003-fix_spelling_and_typo.patch: Fix some spelling errors + * Add debian/libupsclient1.symbols file + * Add debian/nut.links: Re-add /etc/init.d/ups-monitor that was lost for + some reasons (Closes: #592351) + * debian/nut.lintian-overrides: Add override for + init.d-script-does-not-provide-itself /etc/init.d/ups-monitor + * Drop libupsclient1.post{inst,rm}: ldconfig call is added automatically by + debhelper + * debian/libupsclient1-dev.install: Do not ship /lib/libupsclient.la anymore + * debian/rules: Remove dpatch logic as we are using package source version + '3.0 (quilt)' + * debian/compat: Bump debhelper compatibility to 8 + + -- Laurent Bigonville Fri, 24 Dec 2010 11:46:22 +0100 + +nut (2.4.3-1.1) unstable; urgency=low + + * Non-maintainer upload. + * drivers/libhid.c: Apply r2407 from upstream to fix bug with some + low speed UPS devices. (Closes: #583371) + + -- Tim Retout Fri, 15 Oct 2010 19:31:39 +0100 + +nut (2.4.3-1) unstable; urgency=low + + * New upstream release (Closes: #544390, #528222, #539747, #526811, + #562064) + * debian/nut.install, debian/nut.manpages: + - remove cyberpower driver and manpage + - add bestfortress, clone and ivtscd drivers and manpages + * debian/rules: + - change udev dir to /lib/udev (Closes: #522327) + - replace deprecated calls to 'dh_clean -k' by dh_prep (Closes: #536599) + * debian/rules, debian/nut.install, debian/nut.install, + debian/nut.README.Debian: install configuration files, without the + sample suffix (Closes: #528641) + * debian/nut.links: restored (Closes: #522506) + * debian/nut.init: + - source nut.conf instead of default/nut for POWEROFF_WAIT(Closes: + #538173) + - fix status checking (Closes: #538785) + - improve detection of non configured system and beautify related + output (Closes: #563112) + - use 'invoke-rc.d' instead of calling the reboot script directly + - add $remote_fs to Required-Start and Required-Stop + * debian/nut.postrm: remove udev files and simplify cleanup (Closes: + #541629) + * debian/control: + - remove Luca Filipozzi from the Uploaders list (Closes: #568987) + - update Standards-Version to 3.8.4 + - remove the debconf dependency + - bump debhelper version to (>= 7) in Build-Depends, for dh_prep + - add Breaks on nut-hal-drivers to ensure we have correct udev version + * Remove debconf support since it was related to really old nut + version (Closes: #518056): + - remove nut-cgi.config, nut.config, nut-cgi.templates, nut.templates, + and po/ directory + - update nut-cgi.postinst + * debian/nut.dirs: remove /var/run/nut to conform to Debian Policy + * debian/nut.postint: + - create /var/run/nut if needed + - improve security checks + * debian/nut.README.Debian: add a security note for ups.conf + * debian/watch: URL update + + -- Arnaud Quette Wed, 24 Feb 2010 22:58:53 +0100 + +nut (2.4.1-3.2) unstable; urgency=low + + * Non-maintainer upload. + * nut.postinst: fix post-processing of nut.conf to avoid overriding + user settings (Closes: #531220) + + -- Stefano Zacchiroli Thu, 26 Nov 2009 09:30:45 +0100 + +nut (2.4.1-3.1) unstable; urgency=low + + * Non-maintainer upload. + * Fix length of extended descriptions of packages + in debian/control + * Fix pending l10n issues. Debconf translations: + - Galician (marce villarino). Closes: #524263 + - Spanish (Noel David Torres Taño). Closes: #525125 + - Vietnamese (Clytie Siddall). Closes: #548170 + + -- Christian Perrier Tue, 20 Oct 2009 21:45:21 +0200 + +nut (2.4.1-3) unstable; urgency=low + + * Debconf templates and debian/control reviewed by the debian-l10n- + english team as part of the Smith review project. Closes: #520591 + * [Debconf translation updates] + - Japanese. Closes: #521350, #518602 + - Czech. Closes: #521662 + - German. Closes: #518005 + - Basque. Closes: #522390 + - French. Closes: #522677 + - Finnish. Closes: #522837 + - Swedish. Closes: #522973 + - Italian. Closes: #522987 + - Russian. Closes: #523122 + - Portuguese. Closes: #523600 + + -- Christian Perrier Sat, 21 Mar 2009 08:08:59 +0100 + +nut (2.4.1-2) unstable; urgency=low + + * debian/control: + - add Build-Depends libwrap0-dev to enable TCP wrappers support, + - remove again dpatch from Build-Depends, + - move back debconf to Depends since we don't use it anymore in the preinst, + - add udev to nut-hal-drivers Depends so that it can use udevadm. + * debian/rules: + - pre merge the needed changes for Ubuntu (udev path and version), + - deactivate again dpatch rules + - move the nut-cgi HTML files off /var/www to /usr/share/nut/www + - set dh_installdocs to ignore Makefile + - remove dh_installexamples + * debian/patches/*: removed since it doesn't address the issue + * debian/nut-snmp.lintian-overrides: added to address NetSNMP overlinking + * debian/nut.install: + - add an precise list of the configuration files (Closes: #254355), + - use a wildcard to specify the udev rules installation path + * debian/nut-hal-drivers.install: use a wildcard to specify the udev rules + installation path (either /etc or /lib) + * debian/nut-cgi.install: add an precise list of the configuration files + * debian/nut.preinst: + - remove previous udev rule if unchanged, otherwise move to new filename (ie + with a dash), + - don't call adduser or addgroup *at all*, since these operations should be + handled in the postinst, + - migrate /etc/default/nut content to /etc/nut/nut.conf (part #1) + * debian/nut-cgi.preinst: removed since its content is addressed by postinst. + * debian/nut-hal-drivers.preinst: + - remove previous udev rule if unchanged, otherwise move to new filename (ie + with a dash), + * debian/nut-hal-drivers.postinst: + - reinstate since it was lost in the 2.2.2-10 merge, + - use the safe way to install udev rules (udevadm trigger --action=change). + * debian/nut.postinst: + - use the safe way to install udev rules, as for nut-hal-drivers.postinst + (udevadm trigger --action=change) + - rework the user/group creation, and a commented add to the dialout group, + - migrate /etc/default/nut content to /etc/nut/nut.conf (part #2) + * debian/nut-cgi.postinst: rework the user/group creation, and a commented add + to the dialout group. + * debian/nut.postinst: reactivate the nut user removal upon purge + * debian/nut.init: + - use nut.conf instead of /etc/default/nut to start the right component(s) + - enforce the configuration checking + - add basic support for the status option (as required per LSB) + * debian/nut.default: removed since its content has been incorporated into + nut.conf + * debian/{nut-cgi,nut}.examples: removed since the sample configuration files + are now installed. + * debian/nut.README.Debian: reworked with a lot of update and completion. + * debian/nut-cgi.README.Debian: reworked with a lot of update and completion. + + -- Arnaud Quette Fri, 20 Feb 2009 10:09:52 +0100 + +nut (2.4.1-1) unstable; urgency=low + + * New upstream release + * Acknowledge the use of debhelpers (Closes: #506583) + * debian/copyright: authors and licensing (GPL2+ and GPL3+) completion + * debian/control: + - add a Pre-Depends on debconf for nut and nut-cgi, and remove the according + Depends + - add ${misc:Depends} to all Depends + - add libpowerman0-dev to the Build-Depends + - add a new nut-powerman-pdu package + - add a Recommends on bash-completion for nut + - remove Shaul Karl from the Uploaders as per his request + * debian/nut-powerman-pdu.install, debian/nut-powerman-pdu.manpages: added for + the nut-powerman-pdu package + * debian/nut.install: + - also list the bash_completion entry + - list update due to upstream changes + * debian/nut.manpages: list update due to upstream changes + * debian/rules: + - comment the patching rules + - install the nut.bash_completion script + * debian/patches/*: removed the previous patches since fixed upstream + * debian/patches/01_snmp_ups_no_lcrypto.dpatch: add a patch to fix snmp-ups + overlinking with lcrypto (lintian possible-gpl-code-linked-with-openssl) + * debian/po/es.po: added Spanish debconf template translation (Closes: + 512494) + * debian/po/ja.po: added Japanese debconf template translation (Closes: + 512865) + * debian/watch: updated for the new 2.4 tree + * debian/nut.prerm: replace the direct call to the init script by invoke-rc.d + + -- Arnaud Quette Tue, 17 Feb 2009 14:15:24 +0100 + +nut (2.2.2-10) unstable; urgency=low + + * Merge from Ubuntu (Morten Kjeldgaard): + * debian/compat: changed to 6 + * debian/control: + - bump Build-Depends on debhelper to (>= 6.0.7~) since we are now using + dh_lintian. + - add hal to Build-Depends since configure attempts to locate /usr/lib/hal + in order to define callouts path and device information path + * debian/rules: --prefix is back to /usr, --exec-prefix=/ and --libdir=/lib + instead, which has the desired effect of moving the libraries to /lib. + The many shell commands in debian/rules, for moving files from the + install directory to the package directories have all been replaced by + dh_* calls and matching .* files. + * debian/{libupsclient1-dev.install, libupsclient1-dev.manpages, + libupsclient1.install, nut-cgi.install, nut-cgi.manpages, + nut-hal-drivers.install, nut-snmp.install, nut-snmp.manpages, + nut-xml.install, nut-xml.manpages, nut.install, nut.lintian-overrides, + nut.manpages}: added debhelper files. + * debian/nut.dirs: modified debhelper files + * debian/libupsclient1-dev.links: added to provide a link from + /usr/lib/libupsclient.so -> /lib/libupsclient.so.1.0.0 + This is a transitional measure, to salvage packages that have not yet + been updated to the new library location. Can be removed sometime in the + future. + * debian/patches/03-configure.in.dpatch: patch to configure.in adding + AC_CONFIG_MACRO_DIR([m4]) + + -- Arnaud Quette Thu, 27 Nov 2008 21:43:59 +0100 + +nut (2.2.2-9) unstable; urgency=low + + * debian/rules: also move libupsclient.so to /lib, otherwise the link is + broken (Closes: #505101) + * debian/nut-cgi.postinst: test if /etc/nut exists before chmod'ing (Closes: + #502757) + * debian/nut.TODO.Debian: some update and completion + + -- Arnaud Quette Wed, 15 Oct 2008 17:20:29 +0200 + +nut (2.2.2-8) unstable; urgency=high + + * debian/nut.links: restored since it's now handled by insserv (Closes: + #500190) + * debian/changelog: fix a typo error + * debian/rules: move libupsclient.so.1 from /usr/lib to /lib (Closes: + #491591) + * debian/nut-cgi.README.Debian: fix the permissions on /etc/nut (Closes: + #492277) + * debian/control: add Vcs-Browser and Vcs-Svn fields + + -- Arnaud Quette Tue, 30 Sep 2008 21:37:59 +0200 + +nut (2.2.2-7) unstable; urgency=high + + * debian/nut.links: removed to satisfy insserv (Closes: #492734) + * debian/po/it.po: add Italian debconf template translation (Closes: + #495781) + * debian/nut.preinst: force the nut user to be part of the extra group nut + (Closes: #493159) + + -- Arnaud Quette Mon, 15 Sep 2008 17:18:28 +0200 + +nut (2.2.2-6) unstable; urgency=low + + * tag this bug as closed by the 2.2.2 release (Closes: #490048) + * debian/nut.README.Debian: + - fix the serial udev advice (Closes: #490182) + - mention the UPS compatibility list (Closes: #447187) + * debian/po/de.po: update German debconf template translation (Closes: + #490128) + * debian/changelog: fix a typo on 2.2.2-2 release urgency + + -- Arnaud Quette Fri, 11 Jul 2008 11:30:55 +0200 + +nut (2.2.2-5) unstable; urgency=low + + * debian/po/eu.po: add Basque debconf template translation (Closes: + #489580) + * debian/control: + - add a Build-Depends on autoconfi, automake, libtool for the below patch + - bump Depends on udev to 0.124-1 to complete the fix of #489831 + * debian/rules: call autoreconf after patches application + * debian/patches/02_g_timeout_add_seconds_patch.dpatch: fix compilation + issue in the nut-hal-drivers code, when using a Glib older than 2.14 + (Closes: #489742) + * debian/nut.postint: replace the call to udevtrigger by udevadm trigger + (Closes: #489831) + + -- Arnaud Quette Mon, 07 Jul 2008 11:04:52 +0200 + +nut (2.2.2-4) unstabl e; urgency=low + + * debian/rules: fix a Lintian warning + (debian-rules-calls-debhelper-in-odd-order) + * debian/po/fi.po: add Finnish debconf template translation (Closes: + #489123) + * debian/po/ru.po: add Russian debconf template translation (Closes: + #489285) + * debian/po/vi.po: update Vietnamese debconf template translation (Closes: + #489393) + * debian/nut.templates: remove nut/change_system_user since it is not used + anymore (Closes: #486783) + + -- Arnaud Quette Sat, 05 Jul 2008 22:56:35 +0200 + +nut (2.2.2-3) unstable; urgency=low + + * debian/rules: reactivate dpatch support + * debian/control: add dpatch back to Build-Depends + * debian/patches/00list: fix the matching of the NUT HAL .fdi file (Closes: + #471828) + * debian/po/fr.po: update French debconf template translation (Closes: + #486740) + * debian.po/de.po: update the German debconf template translation (Closes: + #487187) + * debian/po/sv.po: add Swedish debconf template translation (Closes: #488217) + * debian.po/cs.po: update the Czech debconf template translation (Closes: + #488355) + * debian/po/pt.po: update the Portuguese debconf template translation (Closes: + #488403) + * debian/po/sv.po: add Galician debconf template translation (Closes: #488380) + * debian/nut.config: fix a typo in comment + + -- Arnaud Quette Fri, 27 Jun 2008 16:18:29 +0200 + +nut (2.2.2-2) unstable; urgency=low + + * debian/rules: fix HAL files installation paths (Closes: #486362) + * debian/control: + - fix conflicts (Closes: #486704, #486705) + - update Standards-Version to 3.8.0 + + -- Arnaud Quette Fri, 20 Jun 2008 21:29:31 +0200 + +nut (2.2.2-1) unstable; urgency=low + + * New upstream release (Closes: #471828, #462468, #334105, #463150) + * acknowledges NMUs (Closes: #469855) + * debian/control: + - add the new nut-xml package and its libneon dependency + - add the new libupsclient1 and libupsclient1-dev packages, with the latter + replacing nut-dev (Closes: #419684) + - remove dpatch dependency + * debian/rules: update according to upstream changes + - replace --with-lib by --with-dev + - update HAL integration + - update for the nut-xml package + - distribute the shared version of libupsclient + - comment dpatch calls + * debian/nut.postinst, debian/nut-hal-drivers.postinst: use udevtrigger to + refresh the devices permissions (Closes: #469601, #475262) + * debian/changelog: fix a typo + * debian/nut.templates: fix the short and long descriptions + * debian/libupsclient1.postinst, debian/libupsclient1.postrm: added to + handle the calls to ldconfig + * debian/nut.init: fix the call to /etc/init.d/reboot by adding the missing + "stop" parameter (Closes: 482022) + * debian/*.template: minor rework of the Debconf templates (Closes: 444151) + + -- Arnaud Quette Wed, 04 Jun 2008 13:35:41 +0200 + +nut (2.2.1-2.1) unstable; urgency=low + + * Non-maintainer upload. + * Skip udev restart logic within chroots, closes: #469855. + + -- Joe Nahmias Sun, 09 Mar 2008 13:12:12 -0400 + +nut (2.2.1-2) unstable; urgency=low + + * debian/po/de.po: update the German po-debconf translation (Closes: + #464466) + * nut-hal-drivers.preinst: created to add to HAL user to the NUT group + (Closes: #460392) + * debian/nut-hal-drivers.postinst: created to complete the above by + restarting udev after the rules file installation + * debian/changelog: Fix some Lintian reports (syntax and spelling errors) + * debian/nut.README.Debian: completed a bit more for #334105 + + -- Arnaud Quette Fri, 8 Feb 2008 13:48:23 +0100 + +nut (2.2.1-1) unstable; urgency=low + + * New upstream release (Closes: #439986) + * acknowledges NMUs (Closes: #447961, #445000) + * debian/watch: update the URL to point the 2.2 tree + * debian/rules: + - force --udev-dir to remove udev from Build-Depends while + keeping the feature (complete #447961 fix) + - limit the above fix to linux systems not to break build on + bsd and hurd these architectures (Closes: #460732) + - fix lintian debian-rules-ignores-make-clean-error and do some more + cleanup + - remove the empty directories /usr/{include,lib} from the nut package + * debian/nut.postinst: call invoke-rc.d instead of the udev init script + (Closes: #442331) + * debian/control: + - remove udev from Build-Depends + - update Standards-Version to 3.7.3 + - remove Homepage from description and add it as a tag + - add libsnmp-dev as an alternate Build-Depends to libsnmp9-dev + * debian/po/nl.po: update the Dutch po-debconf translation (Closes: #447720) + * debian/po/fr.po: update the French po-debconf translation (Closes: #442102) + * debian/patches/*: removed since these have been applied upstream + * debian/patches/00list: emptied but kept for future use + + -- Arnaud Quette Wed, 23 Jan 2008 17:13:13 +0100 + +nut (2.2.0-2.1) unstable; urgency=low + + * Non-maintainer upload with Arnaud's permission. + * debian/nut.postinst: restart udev only if it is running already + (Closes: #447961). + * debian/nut.preinst: ignore db_get errors for nut/remove_debian_conf, + thanks to Alexander Gerasiov for the patch (Closes: #445000). + * Fixed typo in the date of the 2.2.0-2 changelog entry (Augl -> Aug). + + -- Sebastian Harl Tue, 8 Jan 2008 13:50:11 +0100 + +nut (2.2.0-2) unstable; urgency=low + + * debian/control: list udev as Build-Depends to allow the udev rules + inclusion (Closes: #437811) + * debian/nut.default: fix a typo error on UPSMON options comment (Closes: + #439407) + * debian/po/: + - add Brazilian Portuguese debconf templates translation (Closes: + #439793) + - update Portuguese debconf templates translation (Closes: 440369) + - update French debconf templates translation (Closes: 440524) + * debian/Makefile.am: update with the missing files + * debian/patches/03_libupsclient-config.dpatch: patch for the missing FLAGS + (Closes: #439985) + + -- Arnaud Quette Wed, 29 Aug 2007 16:14:11 +0200 + +nut (2.2.0-1) unstable; urgency=low + + * New upstream release (Closes: #432909, #420016, #426033) + * debian/control: + - merge the nut-usb package into nut, and update the various needed + fields (Depends, Provides, Conflicts, Suggests and Description) + - requires at least libhal-dev 0.5.8 + - complete the nut-hal-drivers Description (Homepage) + - update to policy 3.7.2 + - add po-debconf to Build-Depends + * debian/rules: + - general rewrite since the upstream now use automake + - force the evaluation of DEB_HOST_ARCH_OS for dh_gencontrol + - force udev to empty on non Linux system, for dh_gencontrol + - remove the DH_COMPAT export + - update the nut-usb specifics, not needed anymore + - nut-hal-drivers also needs the udev rules + - call debconf-updatepo to clean debconf translations + * debian/compat: creation + * debian/nut-usb.*: remove these files, and put the content in the + matching nut.* files + * debian/nut.preinst: remove the old udev rule file (025_nut...) which + was manually installed, and now addressed upstream and called 52_nut. + * debian/nut.postinst: restart udev to apply the USB rules to the + already plugged devices + * debian/nut-hal-drivers.preinst: created to add the HAL user to + the nut group + * debian/po/nl.po: added Dutch po-debconf translation (Closes: #414756) + * debian/po/pt.po: added Portuguese po-debconf translation (Closes: #415189) + * debian/patches/01_udev_rules_subsystem_usb.dpatch: update the patch + * debian/patches/02_libupsclient.dpatch: patch for the missing FLAGS + * debian/nut.templates: rewrite and simplification + * debian/nut.config: rewrite and simplification + * debian/rules: call dh_installinit with the priority set to 50 to (Closes: + #385694) + * debian/nut.default, debian/nut.init: allow to specify options for upsd and + upsmon (Closes: #420020, #434503) + + -- Arnaud Quette Tue, 17 Jul 2007 09:14:11 +0200 + +nut (2.0.5-3) unstable; urgency=low + + * debian/patches/01_udev_rules_subsystem_usb.dpatch: rework that + patch to be more generic + + -- Arnaud Quette Fri, 02 Feb 2007 15:38:59 +0100 + +nut (2.0.5-2) unstable; urgency=low + + * debian/patches/*: add a patch to fix the udev rule SUBSYSTEM from + usb_device to usb (thanks to Joey Hess) (Closes: #409080) + * debian/control: + - replace the udev substvar by udev + - nut Conflicts with nut-{usb,snmps} <= 2.0.4 and nut-{usb,snmp} + Depends upon 2.0.5 (Closes: #407882) + * debian/rules: dh_gencontrol no more calls -V for udev + + -- Arnaud Quette Thu, 01 Feb 2007 14:50:49 +0100 + +nut (2.0.5-1) unstable; urgency=low + + * New upstream release (Closes: #406045, #380304, #399741) + * debian/rules: + - replaces CHANGES by ChangeLog + - replace the dummycons installation by dummy-ups + - integrate the --with-htmlpath option + * debian/nut-cgi.docs: created to install data/html/README + * debian/nut.init: LSB compliance update + * debian/control: add lsb-base (>= 3.0-6) to Depends for LSB compliance + + -- Arnaud Quette Tue, 16 Jan 2007 10:42:36 +0100 + +nut (2.0.4-3) unstable; urgency=high + + * acknowledges NMUs (Closes: #396704, #389350) + * debian/nut-usb.postinst: remove the symlinking of the udev file since it's + not useful anymore (Closes: #400215) + * native udev rules are now used (Closes: #359802, #380304) + * debian/po/de.po: add German po-debconf template translation (Closes: + #400285) + * debian/nut.config: change the medium priorities to high (Closes: #388945) + * debian/nut.init: improve drivers startup report + + -- Arnaud Quette Wed, 20 Dec 2006 11:07:30 +0100 + +nut (2.0.4-2.3) unstable; urgency=high + + * Non-maintainer upload. + * Some polish on top of the previous NMU. + * Remove the hotplug alternative; we no longer support it, so it's no + longer acceptable in place of udev. Correspondingly, rename the + substvar to ${udev}. (Closes: #396704) + * Drop debian/nut-usbups.rules and use upstream's rules instead. Modify + debian/rules correspondigly, patch from Arnaud Quette. + + -- Steinar H. Gunderson Fri, 17 Nov 2006 01:12:54 +0100 + +nut (2.0.4-2.2) unstable; urgency=high + + * Non-maintainer upload. + * In the udev script, replace the RUN actions by MODE and GROUP actions, as + per suggestion from the maintainer; should fix permission issues. + (Closes: #396704) + + -- Steinar H. Gunderson Thu, 16 Nov 2006 15:38:43 +0100 + +nut (2.0.4-2.1) unstable; urgency=low + + * NMU + * not removing nut user on purge (Closes: #389350) + + -- Florian M. Weps Thu, 12 Oct 2006 11:19:37 +0200 + +nut (2.0.4-2) unstable; urgency=low + + * debian/rules: replace $PWD by CURDIR to satisfy buildd + * debian/nut.default, debian/nut.init: make the bug 358696 workaround + optional as it might be dangerous under some circumstances (closes: + #358696) + + -- Arnaud Quette Tue, 01 Aug 2006 08:50:26 +0200 + +nut (2.0.4-1) unstable; urgency=low + + * New upstream release + - driver do not use /var anymore when called for shutdown/poweroff + (closes: #332846) + - fixes the newhidups crash upon device reconnexion (closes: #354305, + #359769) + * debian/nut.preinst: syntax enhancement to avoid issue when the nut user + already exists (closes: #378970) + * debian/nut-cgi.postinst: fix wrong permissions (closes: #378818) + * debian/po/cs.po: update Czech translation of nut debconf messages (closes: + #366738) + * debian/nut.default, debian/nut.init: "poweroff" workaround to deal with + BIOS default of "On/Off state: Last state" and system halting itself + before the UPS cuts power (closes: #358696) + * debian/nut-usbups.rules: fix the broken udev rules (closes: #359801) + + -- Arnaud Quette Thu, 27 Jul 2006 15:20:46 +0200 + +nut (2.0.3-4) unstable; urgency=low + + * debian/nut-usb.postinst: generate the /etc/udev/rules/ file + * debian/rules: + - install the right udev rule file (not the upstream one) + - install the debian/hotplug file as libhidups, as it's compatible + with hotplug and udev styles + + -- Arnaud Quette Mon, 13 Mar 2006 08:52:25 +0100 + +nut (2.0.3-3) unstable; urgency=low + + * debian/rules: + - fix a wrong symlink for the udev rule files (closes: #354262) + - add a temporary workaround to clean drivers/tripplite_usb + + -- Arnaud Quette Mon, 27 Feb 2006 15:35:32 +0100 + +nut (2.0.3-2) unstable; urgency=low + + * debian/nut.init: fix the creation of the PID directory, as /var is now volative. + This bug has been identified in Ubuntu (Launchpad #6679) + * debian/nut-cgi.postrm: suppress the deletion of the nut user as it's not + needed (closes: #319395) + * debian/nut-cgi.preinst: suppress that file as we do not need to check and create + the nut user and group for nut-cgi + * debian/nut-cgi.postinst: enhanced to ensure the /etc/nut directory and nut-cgi + configuration files are readable by others + * debian/nut-cgi.README.Debian: improve the documentation about configuration + files permissions + + -- Arnaud Quette Fri, 24 Feb 2006 10:05:25 +0100 + +nut (2.0.3-1) unstable; urgency=low + + * New upstream release + - include the improved USB driver (closes: #300115) + - fix mge-utalk regression (closes: #315431) + - fix USB device claiming and logging (closes: #322901) + * debian/nut-cgi.config: complete the typo fixes from 2.0.2-1 and remove exit + calls (closes: #308215) + * debian/nut.config: remove exit calls + * debian/hotplug: add this file to manage hotplug and udev style permissions settings + * debian/nut-usbups.rules: embed a modified version of the upstream file + * debian/control: + - make hotplug | udev Depends conditionnal, from rules + - remove libusb-0.1-4 Depends as it is already listed with shlibs:Depends + * debian/rules: + - generate debian/control Depends for hotplug | udev + - also install udev files (closes: #338738, #332939) + - call the clean rule before distclean + * debian/nut.README.Debian: + - update the Installation §2 to reflect udev changes on serial port permissions. + Users need to manually add the nut group to the dialout group (closes: #325878, + #334105) + - some other minor update + + -- Arnaud Quette Tue, 21 Feb 2006 13:57:35 +0100 + +nut (2.0.2-2) unstable; urgency=low + + * debian/nut-cgi.postinst: load confmodule + * debian/nut-hidups/*: remove this unneeded directory + * debian/control: + - Update build dependency from libsnmp5-dev to libsnmp9-dev (closes: + #326410) + - Changes nut-usb wrong dependency from libusb-dev to libusb-0.1-4 (closes: + #320315) + - add debconf (>= 0.5.00) and adduser to nut/nut-cgi Depends + * debian/copyright: update the FSF address and the Authors + * debian/po/vi.po: add the Vietnamese translation for debconf, from Clytie + Siddall ((closes: #316327) + + -- Arnaud Quette Fri, 07 Oct 2005 23:35:55 +0200 + +nut (2.0.2-1) unstable; urgency=low + + * New upstream release: + - build respect LDFLAGS (closes: #265439) + - fix etapro brokeness (closes: #305730) + - fix shutdown/restart problems with mge-shut (closes: #302190) + - fix mge-utalk support for older units (closes: #315431) + * debian/po/fr.po: update the French debconf templates, thanks to Michel + Grentzinger (closes: #306541) + * debian/rules: + - install hotplug files for the newhidups USB driver + - suppress the snmp-ups.8 manpage workaround + * debian/nut-usb.prerm: created to remove hotplug files + * debian/control: + - add hotplug Depends for nut-usb + - upgrade Debian Policy to 3.6.2 + * debian/patches/*: remove all patch and empty 00list as all has + been fixed upstream + * debian/nut-cgi.config: integrate the typo fixes that was blocking + upgrade from woody to sarge + * debian/nut-cgi.preinst: remove an unneeded blank line + * acknowledge NMU from Craig Small (closes: #302189) + + -- Arnaud Quette Mon, 27 Jun 2005 11:29:52 +0200 + +nut (2.0.1-3) unstable; urgency=low + + * debian/patches/01_cleanSourceFromlibupsclient.dpatch: removed as it + has been fixed upstream in 2.0.1 + * debian/patches/00list: re enabled for the below patch + * debian/patches/01_upsstatsCgiNoHostCrash.dpatch: added while waiting + for the upstream fix (closes: #302902) + * debian/nut-cgi.templates: added nut-cgi/major_template_changes + * debian/nut-cgi.config: use nut-cgi/major_template_changes (closes: + #301184) + * debian/nut-cgi.README.Debian: reworked, and mention upgrade and + installation. + * debian/nut.README.Debian: mention the missing UPGRADING file, and complete + the upsmon.conf lines with the mandatory POWERDOWNFLAG and SHUTDOWNCMD + (closes: #302182) + * debian/nut.templates: add nut/2_0_upstream_changes to deal with the new + changes + * debian/nut.config: use the above nut/2_0_upstream_changes (closes: + #301060) + + -- Arnaud Quette Fri, 15 Apr 2005 13:52:32 +0100 + +nut (2.0.1-2.1) unstable; urgency=low + + * Non-maintainer upload + * NUT nows powersdown Closes: #302189 + + -- Craig Small Thu, 7 Apr 2005 11:47:58 +1000 + +nut (2.0.1-2) unstable; urgency=low + + * debian/control: add missing Build-Depends for dpatch, thanks to Kurt + Roeckx (closes: #298218) + + -- Arnaud Quette Mon, 07 Mar 2005 16:29:32 +0100 + +nut (2.0.1-1) unstable; urgency=low + + * New upstream release (closes: #247671, #283539) + * debian/watch: update URL to match the current 2.0 stable tree + * debian/rules: + - change install-misc target to install-lib following the upstream rule + name change + - error reporting enhancements, thanks to Karl Shaul (inserted a set -e at + the start of every for loop ; from Debian Policy §4.5). + - workaround to include dummycons test driver and its manpage in nut-dev + while waiting for an upstream rule + - workaround to remove snmp-ups manpage from the nut package, to avoid a + file conflict with nut-snmp, while waiting for an upstream rule + - remove the workaround from 1.4.2-2 to suppress libupsclient.a and + newhidups upon make clean + - comment the "conf files workaround" as it's no more needed + * debian/control: + - add nut-dev to nut Suggests + - complete nut-dev to include dummycons testing driver + - add libusb (>= 0.1.8) nut-usb Depends to benefit of the kernel driver + unbind feature (needed for USB models other than MGE UPSs) + - suppress libgd1 from Build-Depends to fix a DebCheck warning, as it + is listed in Section oldlibs + * debian/nut.README.Debian: add a section "(3) /etc/nut/upsd.conf" + and add references to sample config files and UPGRADING information + (closes: #269485) + * debian/nut.TODO.Debian: add this file to track planned and unfinished + tasks + * debian/nut-cgi.README.Debian: improve a bit the text + * debian/nut.init: test powerdown flag (upsmon -K) and use the new + upsdrvctl exit codes (thanks to Karl Shaul) + * debian/po/cs.po: add Czech translation of debconf templates (patch from + Miroslav Kure) (closes: #283225) + * debian/patches: add basic infrastructure for dpatch + + -- Arnaud Quette Fri, 04 Mar 2005 11:40:13 +0100 + +nut (1.4.3-2) unstable; urgency=low + + * debian/control: add nut-dev package with NUT lib and headers (closes: + #263937) + * debian/rules: change install-misc for the above nut-dev. + * debian/control: invert apache and httpd in nut-cgi Recommends to solve a + lintian warning + + -- Arnaud Quette Sun, 08 Aug 2004 16:07:04 +0200 + +nut (1.4.3-1) unstable; urgency=low + + * New upstream release + * debian/control: change Homepage URL to "www" instead of "random" and + remove trailing slash / dot (closes: #254084) + * debian/control: add apache to nut-cgi Recommends to have a non-virtual + package alternative + + -- Arnaud Quette Thu, 29 Jul 2004 22:58:03 +0200 + +nut (1.4.2-3) unstable; urgency=low + + * debian/control: add libusb-dev version in Build-Depends (closes: #248952) + * debian/copyright: update upstream URL and copyright owners (closes: + #242422) + * debian/po/ca.po: add Catalan translation of debconf templates (patch from + Aleix Badia i Bosch) (closes: #248741) + * debian/nut-cgi.README.Debian: added to describe nut-cgi configuration + (thanks to Marius Gedminas) (closes: #249825) + * debian/nut.README.Debian: minor change + + -- Arnaud Quette Fri, 28 May 2004 13:10:01 +0200 + +nut (1.4.2-2) unstable; urgency=low + + * debian/control: add libusb-dev to Build-Depends (closes: #240586) + * debian/rules: workaround to clean libupsclient.a and newhidups (complete + the above) + + -- Arnaud Quette Sun, 28 Mar 2004 18:30:01 +0100 + +nut (1.4.2-1) unstable; urgency=low + + * New upstream release + * Fixes mge-shut settings and shutdown problems (closes: #232402, #234037) + * debian/nut.init: fixes powerdown rule to prevent from forced UPS shutoff + upon normal shutdown, and add a warning when POWERDOWN flags isn't + defined, thanks to Loic Le Loarer (closes: #236092) + * debian/control: update nut-usb Description to reflect the add of newhidups + and energizerups drivers. + * debian/rules: update nut-usb build and install rules to match the new ones + + -- Arnaud Quette Thu, 25 Mar 2004 16:30:01 +0100 + +nut (1.4.1-release-2) unstable; urgency=low + + * recall previously malformed closed bug (closes: #227965, #227964) + * debian/control: Build-Depends to allow libgd*-noxpm (closes: #231153) + * debian/control: update Homepage address + * debian/watch: update target address + + -- Arnaud Quette Thu, 05 Feb 2004 19:19:56 +0100 + +nut (1.4.1-release-1) unstable; urgency=low + + * New upstream release + * debian/po/*: add gettext support for debconf templates (patch from Michel + Grentzinger) (Close: #227965) + * debian/po/fr.po: add French translation of debconf templates (patch from + Michel Grentzinger) (Close: #227964) + + -- Arnaud Quette Sun, 18 Jan 2004 21:19:56 +0100 + +nut (1.4.1-pre3-5) unstable; urgency=low + + * debian/nut.postrm: fix inverted test with -z (fix a purge error) + * debian/nut.postrm: same as above + * debian/nut.postrm: suppress check_and_delete_group() as it is not useful + * debian/nut-cgi.postrm: same as above + * debian/nut.postinst: test if /etc/nut exists before chmod'ing (fix an + install error) + + -- Arnaud Quette Sat, 15 Nov 2003 22:10:23 +0100 + +nut (1.4.1-pre3-4) unstable; urgency=low + + * debian/nut.preinst: wider check for user/group creation (closes: #217980) + * debian/nut.postrm: rework purge rule for user/group deletion (2nd part of + the above fix) + * debian/nut-cgi.postrm: rework purge rule for user/group deletion (2nd part of + the above fix) + * debian/nut-cgi.preinst: wider check for user/group creation (same as + above) + * debian/rules: suppress {nut,nut-cgi}/etc/nut/*.sample that were wrongly + installed (linked to #172217) + * debian/nut.examples: created to complete above fix + * debian/nut-cgi.examples: created to complete above fix + * debian/nut.postrm: suppress /etc/nut/*.sample file (to correct above + problem) + * debian/nut-cgi.postrm: suppress /etc/nut/*.sample file (same as above) + * Maintainer upload (forgotten previously), closes: #200182, #203061 + + -- Arnaud Quette Sat, 15 Nov 2003 10:10:23 +0100 + +nut (1.4.1-pre3-3) unstable; urgency=low + + * clients/Makefile.in: install parseconf.h to fix compilation error with wmnut + * man/Makefile.in: fix a broken upstream rule (hidups manpages installed two + times) that prevent from installing nut-usb package. This will be fixed in + the next upstream + + -- Arnaud Quette Mon, 10 Nov 2003 17:10:23 +0100 + +nut (1.4.1-pre3-2) unstable; urgency=low + + * man/Makefile.in: fix a broken upstream rule (powernet and snmp-ups + manpages installed two times) that prevent from installing nut-snmp package + + -- Arnaud Quette Mon, 10 Nov 2003 12:59:23 +0100 + +nut (1.4.1-pre3-1) unstable; urgency=low + + * New upstream release + * clients/Makefile.in: suppress the one line patch to install parseconf.o + (from 1.4.1-pre2-1). This is now cleanly addressed by the upstream source + by installing libupsclient.a (closes: #216496) + * debian/rules: change dh_shlibdeps's exclude from upsfetch.o to libupsclient.a + * debian/nut.preinst: fix install rule to catch all cases of nut user and group + needed creation. Previously, post purge install case was not (closes: #217980) + * debian/rules: suppress the work-around for nut-usb package following + the upstream correction (from 1.4.1-pre1-2) + * debian/control: Final package take over ; switch Luca Filipozzi as + co maintainer, and Arnaud Quette as new maintainer. + * debian/watch: point the authoritative download server (penguin.harrison) + and stable releases ("nut/release/1.4/" directory ; it won't work for + final 1.4.1, but for 1.4.2) + * debian/nut.postrm: rework purge rule to suppress a warning + + -- Arnaud Quette Sat, 8 Nov 2003 12:15:23 +0100 + +nut (1.4.1-pre2-1) unstable; urgency=low + + * New upstream release + * debian/control: created package nut-usb for finer deps management + * debian/rules: added rules for nut-usb package, and a work-around + for install directories creation while waiting for upstream correction. + * drivers/Makefile.in: suppressed hidups from PROGS, thanks to the above + * debian/control: repeat Homepage for every sub-package + * debian/control: completed nut Suggests + * debian/control: changed Arnaud Quette address to the good Debian one + * debian/rules: suppress the work-around for nut-snmp package following + the upstream correction(from 1.4.1-pre1-1) + * debian/nut-cgi.preinst: always test if nut user exist as nut-cgi + can be installed without nut, so not having nut user created (closes: + Bug#213730) + * debian/nut-cgi.postinst: chown root:nut to address a potential security + issue (see 1.2.1-2) + * clients/Makefile.in: one line patch to install parseconf.o. This solve + a problem with wmnut package (can't build anymore due to unresolved + symbols). This point will be more cleanly address in next upstream + + -- Arnaud Quette Sat, 18 Oct 2003 09:05:01 +0200 + +nut (1.4.1-pre1-2) unstable; urgency=low + + * debian/control: rewrotte descriptions to follow Debian Policy. A + further enhancement will be to use debian/nut.substvars (thanks + to Shaul Karl) (closes: Bug#209569) + * drivers/Makefile.in: added back hidups to PROGS (closes: Bug#208248) + * debian/control: added libgd2-* to Build-Depends to allow more choices + * debian/control: added Shaul Karl as co-maintainer + * debian/control: changed Arnaud Quette address to Debian's one + + -- Arnaud Quette Sun, 14 Sep 2003 12:11:45 +0200 + +nut (1.4.1-pre1-1) unstable; urgency=low + + * New upstream release (closes: Bug#203856) + * recall ignored 1.4.0-2 changes (closes: Bug#204193, Bug#199895) + * debian/nut.preinst: already solved bug in 1.4.0-3 (closes:Bug#206229) + * debian/control: created package nut-snmp (closes: Bug#195645) + * debian/rules: added rules for nut-snmp package, and a work-around + for install directories creation while waiting for upstream correction. + * debian/control: change Build-Depends to "libgd-xpm-dev | libgd-dev" to + allow easy woody backport (thanks to Martin Maney) + * debian/nut.prerm: wait for upsd stop before calling the remove tempo + + -- Arnaud Quette Sat, 23 Aug 2003 13:55:32 +0200 + +nut (1.4.0-3) unstable; urgency=low + + * debian/nut.prerm: fix a post removal warning by adding a tempo + (1 sec) before removing /var/run/nut + * debian/nut.preinst: reworked install rule (thanks Shaul) (closes:Bug#204153) + + -- Arnaud Quette Fri, 8 Aug 2003 23:14:26 +0200 + +nut (1.4.0-2) unstable; urgency=low + + * debian/watch: update URL to point NUT 1.4 (thanks to Shaul Karl) + * debian/nut.dirs: add /var/run/nut (thanks Shaul) (closes: Bug#204193) + * debian/nut-cgi.preinst: created for allowing separate installation + (without nut) (closes: Bug#199895) + * debian/rules: remove the "--with-group=nut" call to configure as it + is obsolete (thanks Shaul) + * debian/control: add Arnaud Quette as co-maintainer + + -- Arnaud Quette Thu, 7 Aug 2003 20:14:26 +0200 + +nut (1.4.0-1) unstable; urgency=low + + * New upstream release (closes: Bug#203061) + * debian/nut.init: change Init-script ordering (start_stop_server) to + address data stale warning (closes: Bug#200182) + + -- Arnaud Quette Fri, 1 Aug 2003 18:42:22 +0200 + +nut (1.2.2-1) unstable; urgency=low + + * New upstream release + * debian/rules: gidNumber of group 'nobody' is 65534 not 65535 + (thanks Shaul) (closes: Bug#180532) + + -- Luca Filipozzi Fri, 18 Apr 2003 20:12:17 -0700 + +nut (1.2.1-2) unstable; urgency=low + + * debian/nut.README.Debian: s/smartapc/apcsmart/ (closes: Bug#177713) + * debian/nut.postinst: chown root:nut instead of chown nut:nut for files + in /etc/nut/* and for the dirs /etc/nut, /var/run/nut, /var/lib/nut; + this addresses a potential security issue as described in the comments + contained in /etc/nut/upsmon.conf (closes: Bug#180059) + * debian/nut.init: sysadmins might modify POWERDOWNFLAG in + /etc/nut/upsmon.conf without realizing that it is hard coded in the + /etc/init.d/nut init script; fix the init script to parse the + configuration file for the value of POWERDOWNFLAG (closes: Bug#179686) + * debian/nut.init: print a message prior to shutdown (closes: Bug#180242) + + -- Luca Filipozzi Sat, 8 Feb 2003 18:12:11 -0800 + +nut (1.2.1-1) unstable; urgency=low + + * New upstream release + * debian/control: nut provides/conflicts ups-monitor (closes: Bug#170655) + * debian/nut.postinst and debian/nut-cgi.postinst: + test -f file before chown/chmod (closes: Bug#170553) + * debian/nut.postinst: fix permissions on /var/lib/nut (closes: Bug#173318) + * debian/nut.preinst: change how the 'nut' user/group are detected and + created (closes: Bug#173321) + * between 1.1.11-1 incorrectly installed conffiles into /etc/nut + with the extension .sample; fortunately, this release of the package + did not migrate to testing and since 1.1.11-2 the .sample extension + has not been used (closes: Bug#172217) + * debian/nut.preinst: change the way the nut user/group are detected + before adduser is called (closes: Bug#170653) + * debian/nut.README.Debian: fixed minor doc error (Closes: Bug#173673) + + -- Luca Filipozzi Wed, 11 Dec 2002 19:39:02 -0800 + +nut (1.2.0-1) unstable; urgency=low + + * New upstream release + * debian/nut-cgi.postinst: fix permissions on /etc/nut/hosts.conf and + /etc/nut/upsset.conf so that they are world readable (Closes: Bug#167332) + * debian/nut.init: added sleep 5 to allow for an orderly restart (thanks + to Shaul Karl for pointing this out) + + -- Luca Filipozzi Tue, 19 Nov 2002 09:44:25 -0800 + +nut (1.1.12-1) unstable; urgency=high + + * New upstream release (urgency high due to SECURITY FIX) + * SECURITY FIX: a file permission problem potentially exposes + non-system usernames/passwords in /etc/nut/upsd.users that can be used + to DoS a machine running nut by contacting the nut daemon and instructing + it to power off the machine; fixed. + * debian/nut.postinst: change permissions of /etc/nut/upsd.users and + other conffiles to 640 (Closes: Bug#165445) + * debian/nut.config: use db_fset to reset the boolean question that prompts + users to accept whether to continue with the installation of this version + of nut should they answer no (Closes: Bug#165376) + * debian/control: make nut-cgi Replace nut so that conflicting files + can be installed (Closes: Bug#165049) + * drivers/Makefile.in: restored original version that doesn't build + hidups, snmp-ups or powernet; hidups doesn't build on m68k; snmp-ups + and powernet require libsnmp5-dev but libsnmp5-dev requires OpenSSL; + unfortunately, upstream's license doesn't have the OpenSSL exclusion + clause... work is proceeding on porting to gnutls + * drivers/Makefile.in + debian/rules: figured out a mechanism to build + hidups on those architectures that have /usr/include/linux/hiddev.h + * debian/control: build-depend on libgd-xpm-dev (really closes Bug#164832) + + -- Luca Filipozzi Sat, 19 Oct 2002 16:47:35 -0700 + +nut (1.1.11-2) unstable; urgency=low + + * changed build dependencies to avoid depending on a pure-virtual package + without providing a default (thanks Junichi Uekawa) (Closes: Bug#164832) + * debian/rules calls $(MAKE) install-misc so that the header and the .o file + are released with the nut package (too small for a nut-dev package?) + + -- Luca Filipozzi Tue, 15 Oct 2002 08:50:18 -0700 + +nut (1.1.11-1) unstable; urgency=low + + * New upstream release + (Closes: Bug#151047, Bug#155943, Bug#153174, Bug#160178, Bug#164024) + * the "Hey Dorothy, you aren't in Kansas anymore" release + * warning: significant changes since nut 0.45.5; specifically: + - upsd listens on a different port (was 3305; now 3493 (IANA-assigned)) + - configuration file formats have changed + - ups driver internals haved changed: 'common main.c' + upsdrvctl + - some ups drivers that were not ported to the new common model have + been dropped by the upstream author (submit a patch to rectify) + - the init script is significantly simpler + - the daemons will NOT restart on upgrade from from 0.45.5 or earlier + - there is an /etc/default/nut file that defines whether the daemons + will be started + - removed nut-doc package... far too small to merit being on its own + + -- Luca Filipozzi Mon, 14 Oct 2002 13:33:58 -0700 + +nut (0.45.5-rel-3) unstable; urgency=low + + * "unlink .sock file before starting up; this was keeping the drivers down + after a system crash where the .sock files remained" -- upstream + (Closes: Bug#149150, Bug#139859) + + -- Luca Filipozzi Fri, 7 Jun 2002 22:34:53 -0700 + +nut (0.45.5-rel-2) unstable; urgency=low + + * debian/control: nut and nut-cgi suggest rather than recommend + the documentation package, nut-doc (Closes: Bug#144763) + * debian/nut-cgi.dirs: change absolute paths to relative (Closes: Bug#144746) + * debian/rules: remove upsdrvctl.8 from package (Closes: Bug#143099) + + -- Luca Filipozzi Sun, 2 Jun 2002 21:39:14 -0700 + +nut (0.45.5-rel-1) unstable; urgency=low + + * New upstream release + * debian/rules: moved model daemons to /lib/nut to reduce chance of + namespace conflicts (Closes: Bug#141209) + * debian/rules: moved sample configuration files to + /usr/share/doc/nut/examples (Closes: Bug#140472) + # debian/postinst: change mode and ownership of files in /etc/nut/ on + configure to allow ready by nut/nut (Closes: Bug#142116) + + -- Luca Filipozzi Sun, 14 Apr 2002 13:37:13 -0700 + +nut (0.45.4-rel-3) unstable; urgency=low + + * added runtime dependency on adduser (Closes: Bug#137887) + + -- Luca Filipozzi Sat, 16 Mar 2002 21:41:53 -0800 + +nut (0.45.4-rel-2) unstable; urgency=low + + * Changed debian/rules to call install-misc which installs the development + files upsfetch.[oh]. There are too few development files to merit a + nut-dev package. + + -- Luca Filipozzi Sun, 24 Feb 2002 15:47:56 -0800 + +nut (0.45.4-rel-1) unstable; urgency=low + + * New upstream release + + -- Luca Filipozzi Sun, 24 Feb 2002 11:56:46 -0800 + +nut (0.45.4-pre5-1) unstable; urgency=low + + * New upstream release (Closes: Bug#131673) + + -- Luca Filipozzi Sun, 17 Feb 2002 17:31:32 -0800 + +nut (0.45.1-release-2) unstable; urgency=low + + * applied POWERDOWNFLAG upstream-patch (Closes: Bug#111979) + * applied apcsmart calibration user-patch (Closes: Bug#111978) + * modified models/main.c so that it does a forceshutdown *before* + attempting to chdir into /var/lib/nut (Closes: Bug#112540) + + -- Luca Filipozzi Tue, 23 Oct 2001 16:22:57 -0700 + +nut (0.45.1-release-1) unstable; urgency=low + + * New upstream release + * Fixed conffile problem with nut-cgi package (Closes: #108687) + + -- Luca Filipozzi Sat, 18 Aug 2001 11:58:57 -0700 + +nut (0.45.1-pre4-1) unstable; urgency=low + + * New upstream release (Closes: #101105) + + -- Luca Filipozzi Sun, 5 Aug 2001 13:59:12 -0700 + +nut (0.44.3-pre6-3) unstable; urgency=low + + * Init script now poweroffs the UPS' correctly. (Closes: #96790) + * Changed section of nut-doc to 'doc' (Closes: #94842) + * Not upgrading to new upstream source (0.45.0) until it is released. + * Not upgrading to upstream source (0.44.3) since (0.45.0) is coming soon. + + -- Luca Filipozzi Sun, 3 Jun 2001 16:05:01 -0700 + +nut (0.44.3-pre6-2) unstable; urgency=low + + * init script follows policy (Closes: #90346) + + -- Luca Filipozzi Mon, 19 Mar 2001 15:21:44 -0800 + +nut (0.44.3-pre6-1) unstable; urgency=low + + * New upstream release + * modified configure.in so that it doesn't produce an error when it tests + for the existance of group "nut" (Closes: #88126) + + -- Luca Filipozzi Sun, 11 Mar 2001 11:48:54 -0800 + +nut (0.44.3-pre4-1) unstable; urgency=low + + * New upstream release + * create pidfile modifications reworked to use upstream's writepid() function + * modified init script to support these changes... note that users MUST + follow the convention for the UPS directives in the sample upsd.conf; + a warning has been placed in said file + + -- Luca Filipozzi Sun, 25 Feb 2001 19:19:29 -0800 + +nut (0.44.2-6) unstable; urgency=low + + * modified prerm and postinst so that the daemon(s) is restarted only in the + postinst rather than stopped in prerm and started later in postinst thereby + stopping the daemon(s) shortest possible time (Closes: #83614) + * modified all the daemon(s)' source code so that they create pidfiles + * modified the init script so that it uses the pidfiles + + -- Luca Filipozzi Sun, 11 Feb 2001 18:23:44 -0800 + +nut (0.44.2-5) unstable; urgency=low + + * removed "function" keyword from init script (Closes: #83569) + * modified the pre and post scripts so that #DEBHELPER# is at the bottom + * modified debian/rules so that nut-doc is created (Closes: #85059) + * added support for MGE UPS (thanks to Ryan Murray) (Closes: #83743) + + -- Luca Filipozzi Sat, 10 Feb 2001 20:09:35 -0800 + +nut (0.44.2-4) unstable; urgency=low + + * control file changed such that arch=any for nut-doc (Closes: #83323) + + -- Luca Filipozzi Tue, 23 Jan 2001 17:49:25 -0800 + +nut (0.44.2-3) unstable; urgency=low + + * Added a build conflict against libgd-gif1-dev because it provides + libgd-dev but does not have PNG support. (Closes: #82607) + * Fixed a path problem in debian/rules that had manpages installing + in /share/man/man8 instead of /usr/share/man/man8. + + -- Luca Filipozzi Wed, 17 Jan 2001 19:11:56 -0800 + +nut (0.44.2-2) unstable; urgency=low + + * Modified README.Debian to address bad doc path (Closes: #82460) + * Slight improvements to README.Debian, as well. + + -- Luca Filipozzi Mon, 15 Jan 2001 21:11:39 -0800 + +nut (0.44.2-1) unstable; urgency=low + + * New upstream release + + -- Luca Filipozzi Tue, 9 Jan 2001 08:33:56 -0800 + +nut (0.44.1-4) unstable; urgency=low + + * fixed path problem with cgi files; they *are* in /usr/lib/cgi-bin/nut now + + -- Luca Filipozzi Wed, 22 Nov 2000 08:47:54 -0800 + +nut (0.44.1-3) unstable; urgency=low + + * the following changes suggested by Patrik Rak (Closes: #77144, #77195) + * added better preinst(install) checks for group membership + * modified upstream upsd.conf to use correct paths in the UPS directives + * modified upstream upsd.conf to have better ACCESS directive examples + * modified upstream upsmon.conf to have better MONITOR directive examples + * modified upstream upsmon.conf to use a different POWERDOWNFLAG location + (location must be on the root filesystem... otherwise powerdownflag is + not found!) + * modified init script to parse upsmon.conf for the POWERDOWNFLAG location + * modified init script's poweroff section so that all args are recognized + * improved the documentation, primarily README.Debian + * installation scripts modified so that the dependency on adduser >= 3.14 + can be removed; this allows for the creation of potato packages + * the nut user is no longer part of the dialout group; users will have to + manually change the permissions on the serial port devices; + a nut group is created at the same time as the nut user; users should use + the nut group for the serial port permissions: chown root.nut /dev/ttyS0 + (suggested by Shaul Karl and Patrik Rak) + * the cgi scripts are moved to /usr/lib/cgi-bin/nut/* + (suggested by Shaul Karl) + * init script changed significantly to address argument passing problems + (reported by Shaul Karl) + + -- Luca Filipozzi Thu, 16 Nov 2000 11:42:42 -0800 + +nut (0.44.1-2) unstable; urgency=low + + * removed else clause on detection of existing "nut" user (Closes: #76721) + "install" creates the user nut; "remove" doesn't remove it, "purge" does; + a re-"install" would find an existing "nut" user and exit on error; fixed + * fixed a possible bashism (Closes: #72711) + + -- Luca Filipozzi Fri, 10 Nov 2000 10:06:05 -0800 + +nut (0.44.1-1) unstable; urgency=low + + * New upstream release + * serious repurcussion to existing users of nut... the configuration files + have changed somewhat... a critical debconf warning informs the user of + this fact + * binaries are to remains in /sbin (Closes: #69525) + * init script no longer relies on /usr being mounted (Closes: #70033) + * + + -- Luca Filipozzi Fri, 10 Nov 2000 10:05:55 -0800 + +nut (0.44.0-4) unstable; urgency=low + + * Moved man pages from section 1 to section 8. (Closes: #68819) + * nut-doc suggest rather than recommends nut and nut-cgi. (Closes: #69400) + + -- Luca Filipozzi Fri, 18 Aug 2000 23:15:18 -0700 + +nut (0.44.0-3) unstable; urgency=low + + * Minor fixes to packaging scripts (Closes: #67649). + * Created new doc package: nut-doc. + + -- Luca Filipozzi Mon, 24 Jul 2000 10:18:19 -0700 + +nut (0.44.0-2) unstable; urgency=low + + * Minor fixes to init script and to list of undocumented binaries. + + -- Luca Filipozzi Sat, 22 Jul 2000 19:11:42 -0700 + +nut (0.44.0-1) unstable; urgency=low + + * New upstream release + + -- Luca Filipozzi Thu, 20 Jul 2000 09:26:04 -0700 + +nut (0.43.2-2) unstable; urgency=low + + * fixes: Bug#67316: nut: default permissions could reveal passwords + Files in /etc/nut are now 600 by default. + * fixes: Bug#67314: nut: uses old FHS directory /var/state + Now uses /var/lib as per FHS guidelines. + * fixes: Bug#66988: nut_0.43.2-1(unstable): Missing build dependencies + Added debhelper to the build dependencies. + + -- Luca Filipozzi Tue, 18 Jul 2000 14:55:03 -0700 + +nut (0.43.2-1) unstable; urgency=low + + * Initial Release. + * Modification to upstream source: configure.in, common/common.c, + and models/upscommon.c changed to support different configuration + options... --with-user and --with-group which accept a username + and a groupname (rather than a uid/gid as before). + * Modification to upstream source: /var/state/nut is used instead + of /var/state/ups in conf/upsd.conf. + + -- Luca Filipozzi Wed, 3 May 2000 20:50:30 -0700 + +Local variables: +mode: debian-changelog +End: diff --git a/obs/debian.compat b/obs/debian.compat new file mode 100644 index 0000000000..45a4fb75db --- /dev/null +++ b/obs/debian.compat @@ -0,0 +1 @@ +8 diff --git a/obs/debian.control b/obs/debian.control new file mode 100644 index 0000000000..5454404e5c --- /dev/null +++ b/obs/debian.control @@ -0,0 +1,297 @@ +Source: nut +Section: admin +Priority: optional +Maintainer: Arnaud Quette +Uploaders: Laurent Bigonville +Build-Depends: debhelper (>= 8.1.3), + cdbs (>= 0.4.122~), + autotools-dev, + dh-autoreconf, + dh-systemd (>= 1.14), + libgd-dev | libgd2-xpm-dev | libgd2-noxpm-dev, + libsnmp-dev | libsnmp9-dev, + libusb-dev (>= 0.1.8), + libneon27-gnutls-dev | libneon27-dev, + libpowerman0-dev (>= 2.3.3), + libwrap0-dev (>= 7.6), + python (>= 2.6.6-3~), + libfreeipmi-dev (>= 0.8.5) [!hurd-i386], + libipmimonitoring-dev (>= 1.1.5-2) [!hurd-i386], + libnss3-dev, libtool, libltdl-dev, + liblua5.1-0-dev, + lua5.1 +Build-Depends-Indep: asciidoc (>= 8.6.3), + docbook-xsl, + dblatex (>= 0.2.5), + libxml2-utils +Standards-Version: 3.9.5 +Homepage: http://www.networkupstools.org/ +Vcs-Browser: http://anonscm.debian.org/gitweb/?p=collab-maint/nut.git;a=summary +Vcs-Git: git://anonscm.debian.org/collab-maint/nut.git +X-Python-Version: >= 2.5 +XS-Testsuite: autopkgtest + +Package: nut +Architecture: all +Section: metapackages +Depends: ${misc:Depends}, nut-server, nut-client +Description: network UPS tools - metapackage + Network UPS Tools (NUT) is a client/server monitoring system that + allows computers to share uninterruptible power supply (UPS) and + power distribution unit (PDU) hardware. Clients access the hardware + through the server, and are notified whenever the power status + changes. + . + This package is a metapackage that installs both nut-server and nut-client, + in most cases it is sufficient for a basic UPS monitoring system. + +Package: nut-server +Architecture: any +Depends: ${shlibs:Depends}, ${misc:Depends}, adduser, lsb-base (>= 3.0-6), ${udev}, nut-client (= ${binary:Version}) +Suggests: nut-cgi, nut-snmp, nut-ipmi, nut-xml +Conflicts: nut-hal-drivers +Replaces: nut (<< 2.6.1-2~) +Breaks: nut (<< 2.6.1-2~) +Description: network UPS tools - core system + Network UPS Tools (NUT) is a client/server monitoring system that + allows computers to share uninterruptible power supply (UPS) and + power distribution unit (PDU) hardware. Clients access the hardware + through the server, and are notified whenever the power status + changes. + . + This package provides NUT's core system, and the serial and USB UPS + drivers. + +Package: nut-client +Architecture: any +Depends: ${shlibs:Depends}, ${misc:Depends}, adduser, lsb-base (>= 3.0-6) +Provides: ups-monitor +Conflicts: ups-monitor +Recommends: bash-completion +Suggests: nut-monitor +Replaces: ups-monitor, nut (<< 2.6.1-2~), nut-server (<< 2.6.3-1~) +Breaks: nut (<< 2.6.1-2~), nut-server (<< 2.6.3-1~) +Description: network UPS tools - clients + Network UPS Tools (NUT) is a client/server monitoring system that + allows computers to share uninterruptible power supply (UPS) and + power distribution unit (PDU) hardware. Clients access the hardware + through the server, and are notified whenever the power status + changes. + . + This package provides NUT's clients that allows the user to control + and monitor the UPS. + +Package: nut-cgi +Architecture: any +Depends: ${shlibs:Depends}, ${misc:Depends}, adduser +Recommends: apache2 | httpd-cgi +Suggests: nut +Description: network UPS tools - web interface + Network UPS Tools (NUT) is a client/server monitoring system that + allows computers to share uninterruptible power supply (UPS) and + power distribution unit (PDU) hardware. Clients access the hardware + through the server, and are notified whenever the power status + changes. + . + This package provides an HTTP interface for Network UPS Tools which makes + it possible to monitor the core NUT system with a web browser. + +Package: nut-snmp +Architecture: any +Depends: ${shlibs:Depends}, ${misc:Depends}, nut (>= 1.4.1-pre1) +Description: network UPS tools - SNMP driver + Network UPS Tools (NUT) is a client/server monitoring system that + allows computers to share uninterruptible power supply (UPS) and + power distribution unit (PDU) hardware. Clients access the hardware + through the server, and are notified whenever the power status + changes. + . + This package provides snmp-ups, the SNMP multi-MIB driver for UPS, which + supports various MIBs including IETF, MGE, and APC. It adds an SNMP + Manager interface to the core NUT system. + +Package: nut-ipmi +Architecture: linux-any kfreebsd-any +Depends: ${shlibs:Depends}, ${misc:Depends}, nut (>= 1.4.1-pre1) +Description: network UPS tools - IPMI driver + Network UPS Tools (NUT) is a client/server monitoring system that + allows computers to share uninterruptible power supply (UPS) and + power distribution unit (PDU) hardware. Clients access the hardware + through the server, and are notified whenever the power status + changes. + . + This package currently provides nut-ipmipsu, a driver which allows + to monitor IPMI power supply units (PSU) found in servers of + popular brands, such as Dell, HP, IBM. It adds an IPMI interface + to the core NUT system. + +Package: nut-xml +Architecture: any +Depends: ${shlibs:Depends}, ${misc:Depends}, nut (>= 2.2.2) +Description: network UPS tools - XML/HTTP driver + Network UPS Tools (NUT) is a client/server monitoring system that + allows computers to share uninterruptible power supply (UPS) and + power distribution unit (PDU) hardware. Clients access the hardware + through the server, and are notified whenever the power status + changes. + . + This package provides netxml-ups, which supports UPS models from + Eaton or MGE that use an XML/HTTP-based Network Management Card or + Proxy. + +Package: nut-powerman-pdu +Architecture: any +Priority: extra +Depends: ${shlibs:Depends}, ${misc:Depends}, nut (>= 2.4.0), powerman (>= 2.3.3) +Description: network UPS tools - PowerMan PDU driver + Network UPS Tools (NUT) is a client/server monitoring system that + allows computers to share uninterruptible power supply (UPS) and + power distribution unit (PDU) hardware. Clients access the hardware + through the server, and are notified whenever the power status + changes. + . + This package provides powerman-pdu, which allows NUT clients to communicate + with the PowerMan daemon to support PDUs. + +Package: nut-doc +Architecture: all +Section: doc +Depends: ${misc:Depends} +Suggests: doc-base +Description: network UPS tools - documentation + Network UPS Tools (NUT) is a client/server monitoring system that + allows computers to share uninterruptible power supply (UPS) and + power distribution unit (PDU) hardware. Clients access the hardware + through the server, and are notified whenever the power status + changes. + . + This package contains FAQ, user, developer and packager documentation. + +Package: libupsclient4 +Section: libs +Architecture: any +Depends: ${shlibs:Depends}, ${misc:Depends} +Pre-Depends: ${misc:Pre-Depends} +Multi-Arch: same +Description: network UPS tools - client library + Network UPS Tools (NUT) is a client/server monitoring system that + allows computers to share uninterruptible power supply (UPS) and + power distribution unit (PDU) hardware. Clients access the hardware + through the server, and are notified whenever the power status + changes. + . + This package provides the shared client library. + +Package: libupsclient-dev +Section: libdevel +Architecture: any +Depends: libupsclient4 (= ${binary:Version}), ${shlibs:Depends}, ${misc:Depends} +Conflicts: libupsclient1-dev +Replaces: libupsclient1-dev +Description: network UPS tools - development files + Network UPS Tools (NUT) is a client/server monitoring system that + allows computers to share uninterruptible power supply (UPS) and + power distribution unit (PDU) hardware. Clients access the hardware + through the server, and are notified whenever the power status + changes. + . + This package provides the development files. + +Package: libnutscan1 +Section: libs +Architecture: any +Depends: ${shlibs:Depends}, ${misc:Depends} +Pre-Depends: ${misc:Pre-Depends} +Multi-Arch: same +Description: network UPS tools - scanner library + Network UPS Tools (NUT) is a client/server monitoring system that + allows computers to share uninterruptible power supply (UPS) and + power distribution unit (PDU) hardware. Clients access the hardware + through the server, and are notified whenever the power status + changes. + . + This package provides the shared client library. + +Package: libnutscan-dev +Section: libdevel +Architecture: any +Depends: libnutscan1 (= ${binary:Version}), ${shlibs:Depends}, ${misc:Depends} +Description: network UPS tools - development files + Network UPS Tools (NUT) is a client/server monitoring system that + allows computers to share uninterruptible power supply (UPS) and + power distribution unit (PDU) hardware. Clients access the hardware + through the server, and are notified whenever the power status + changes. + . + This package provides the development files. + +Package: libnutclient0 +Section: libs +Architecture: any +Depends: ${shlibs:Depends}, ${misc:Depends} +Pre-Depends: ${misc:Pre-Depends} +Multi-Arch: same +Description: network UPS tools - new client library + Network UPS Tools (NUT) is a client/server monitoring system that + allows computers to share uninterruptible power supply (UPS) and + power distribution unit (PDU) hardware. Clients access the hardware + through the server, and are notified whenever the power status + changes. + . + This package provides the new shared client library. + +Package: libnutclient-dev +Section: libdevel +Architecture: any +Depends: libnutclient0 (= ${binary:Version}), ${shlibs:Depends}, ${misc:Depends} +Description: network UPS tools - development files + Network UPS Tools (NUT) is a client/server monitoring system that + allows computers to share uninterruptible power supply (UPS) and + power distribution unit (PDU) hardware. Clients access the hardware + through the server, and are notified whenever the power status + changes. + . + This package provides the development files for the new client library. + +Package: python-nut +Section: python +Architecture: all +Depends: ${python:Depends}, ${misc:Depends} +Description: network UPS tools - Python bindings for NUT server + Network UPS Tools (NUT) is a client/server monitoring system that + allows computers to share uninterruptible power supply (UPS) and + power distribution unit (PDU) hardware. Clients access the hardware + through the server, and are notified whenever the power status + changes. + . + This package provides Python bindings to connect to NUT server. + +Package: nut-monitor +Architecture: all +Depends: ${python:Depends}, + ${misc:Depends}, + python-gobject, + python-gtk2, + python-glade2, + python-nut +Description: network UPS tools - GUI application to monitor UPS status + Network UPS Tools (NUT) is a client/server monitoring system that + allows computers to share uninterruptible power supply (UPS) and + power distribution unit (PDU) hardware. Clients access the hardware + through the server, and are notified whenever the power status + changes. + . + This package provides nut-monitor, a GUI application to monitor UPS status. + +Package: libups-nut-perl +Section: perl +Architecture: all +Depends: ${perl:Depends}, ${misc:Depends} +Description: network UPS tools - Perl bindings for NUT server + Network UPS Tools (NUT) is a client/server monitoring system that + allows computers to share uninterruptible power supply (UPS) and + power distribution unit (PDU) hardware. Clients access the hardware + through the server, and are notified whenever the power status + changes. + . + This package provides Perl bindings to connect to NUT server. diff --git a/obs/debian.copyright b/obs/debian.copyright new file mode 100644 index 0000000000..01fea182b6 --- /dev/null +++ b/obs/debian.copyright @@ -0,0 +1,69 @@ +This package was debianized by Luca Filipozzi on +Wed Jun 28 19:48:05 PDT 2000 + +It was downloaded from http://www.networkupstools.org/ + +Upstream Authors: + + Russell Kroll + Arnaud Quette + Arjen de Korte + Charles Lepple + Kjell Claesson + David Goncalves + and the NUT Team + +Copyright: + + Copyright (C) 2000-2008 Russell Kroll, Arnaud Quette and the NUT Team + +Licenses: + + Most files are licensed under the GNU General Public License (GPL) version 2, + or (at your option) any later version. + + The files in the scripts/python/ directory are released under GNU General + Public License (GPL) version 3, or (at your option) any later version. + + GPL-2 + ----- + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along + with this program; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + On Debian systems, the full text of the GNU General Public License v2 + may be found in /usr/share/common-licenses/GPL-2. + + GPL-3 + ----- + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + + On Debian systems, the full text of the GNU General Public License v3 + may be found in /usr/share/common-licenses/GPL-3. + + +The Debian packaging is Copyright (C) 2008, Arnaud Quette +and is licensed under the GPL, see `/usr/share/common-licenses/GPL'. diff --git a/obs/debian.description.subst b/obs/debian.description.subst new file mode 100644 index 0000000000..1ba1c3d148 --- /dev/null +++ b/obs/debian.description.subst @@ -0,0 +1 @@ +description=nut is a client/server uninterruptible power supply (UPS) monitoring system${Newline}${Space}that permits the sharing of one (or more) UPS between several machines. The${Newline}${Space}'server' monitors the UPS and notifies the 'clients' when the UPS is on${Newline}${Space}battery or has a low battery. diff --git a/obs/debian.gbp.conf b/obs/debian.gbp.conf new file mode 100644 index 0000000000..6837223f66 --- /dev/null +++ b/obs/debian.gbp.conf @@ -0,0 +1,8 @@ +[DEFAULT] +debian-branch = debian +upstream-branch = upstream +pristine-tar = True + +[git-buildpackage] +tarball-dir = ../tarballs/ +export-dir = ../build-area/ diff --git a/obs/debian.hotplug b/obs/debian.hotplug new file mode 100644 index 0000000000..36069fe5ee --- /dev/null +++ b/obs/debian.hotplug @@ -0,0 +1,24 @@ +#!/bin/bash +# taken from libgphoto2 + +GROUP=nut + +# for previous udev versions +if [ "$ACTION" = "add" ] && [ -f "$DEVICE" ] +then + # check if $GROUP really exists + if getent group $GROUP > /dev/null; then + chmod 660 "$DEVICE" + chown root:$GROUP "$DEVICE" + fi +fi + +# for recent udev versions +if [ "$ACTION" = "add" ] && [ -r "$DEVNAME" ] +then + # check if $GROUP really exists + if getent group $GROUP > /dev/null; then + chmod 660 "$DEVNAME" + chown root:$GROUP "$DEVNAME" + fi +fi diff --git a/obs/debian.libnutclient-dev.install b/obs/debian.libnutclient-dev.install new file mode 100644 index 0000000000..6f780df0ac --- /dev/null +++ b/obs/debian.libnutclient-dev.install @@ -0,0 +1,3 @@ +usr/lib/*/libnutclient.so +usr/lib/*/pkgconfig/libnutclient.pc +usr/include/nutclient.h diff --git a/obs/debian.libnutclient-dev.manpages b/obs/debian.libnutclient-dev.manpages new file mode 100644 index 0000000000..7ac2971ea8 --- /dev/null +++ b/obs/debian.libnutclient-dev.manpages @@ -0,0 +1,34 @@ +debian/tmp/usr/share/man/man3/libnutclient.3 +debian/tmp/usr/share/man/man3/libnutclient_commands.3 +debian/tmp/usr/share/man/man3/libnutclient_devices.3 +debian/tmp/usr/share/man/man3/libnutclient_general.3 +debian/tmp/usr/share/man/man3/libnutclient_misc.3 +debian/tmp/usr/share/man/man3/libnutclient_tcp.3 +debian/tmp/usr/share/man/man3/libnutclient_variables.3 +debian/tmp/usr/share/man/man3/nutclient_authenticate.3 +debian/tmp/usr/share/man/man3/nutclient_destroy.3 +debian/tmp/usr/share/man/man3/nutclient_device_forced_shutdown.3 +debian/tmp/usr/share/man/man3/nutclient_device_login.3 +debian/tmp/usr/share/man/man3/nutclient_device_master.3 +debian/tmp/usr/share/man/man3/nutclient_execute_device_command.3 +debian/tmp/usr/share/man/man3/nutclient_get_device_command_description.3 +debian/tmp/usr/share/man/man3/nutclient_get_device_commands.3 +debian/tmp/usr/share/man/man3/nutclient_get_device_description.3 +debian/tmp/usr/share/man/man3/nutclient_get_device_num_logins.3 +debian/tmp/usr/share/man/man3/nutclient_get_device_rw_variables.3 +debian/tmp/usr/share/man/man3/nutclient_get_devices.3 +debian/tmp/usr/share/man/man3/nutclient_get_device_variable_description.3 +debian/tmp/usr/share/man/man3/nutclient_get_device_variables.3 +debian/tmp/usr/share/man/man3/nutclient_get_device_variable_values.3 +debian/tmp/usr/share/man/man3/nutclient_has_device.3 +debian/tmp/usr/share/man/man3/nutclient_has_device_command.3 +debian/tmp/usr/share/man/man3/nutclient_has_device_variable.3 +debian/tmp/usr/share/man/man3/nutclient_logout.3 +debian/tmp/usr/share/man/man3/nutclient_set_device_variable_value.3 +debian/tmp/usr/share/man/man3/nutclient_set_device_variable_values.3 +debian/tmp/usr/share/man/man3/nutclient_tcp_create_client.3 +debian/tmp/usr/share/man/man3/nutclient_tcp_disconnect.3 +debian/tmp/usr/share/man/man3/nutclient_tcp_get_timeout.3 +debian/tmp/usr/share/man/man3/nutclient_tcp_is_connected.3 +debian/tmp/usr/share/man/man3/nutclient_tcp_reconnect.3 +debian/tmp/usr/share/man/man3/nutclient_tcp_set_timeout.3 diff --git a/obs/debian.libnutclient0.install b/obs/debian.libnutclient0.install new file mode 100644 index 0000000000..e5a792e829 --- /dev/null +++ b/obs/debian.libnutclient0.install @@ -0,0 +1 @@ +lib/*/libnutclient.so.* diff --git a/obs/debian.libnutclient0.lintian-overrides b/obs/debian.libnutclient0.lintian-overrides new file mode 100644 index 0000000000..6f2da5475a --- /dev/null +++ b/obs/debian.libnutclient0.lintian-overrides @@ -0,0 +1 @@ +libnutclient0: no-symbols-control-file shlib-missing-in-symbols-control-file diff --git a/obs/debian.libnutscan-dev.install b/obs/debian.libnutscan-dev.install new file mode 100644 index 0000000000..7ec9050380 --- /dev/null +++ b/obs/debian.libnutscan-dev.install @@ -0,0 +1,6 @@ +usr/lib/*/libnutscan.so +usr/lib/*/pkgconfig/libnutscan.pc +usr/include/nut-scan.h +usr/include/nutscan-ip.h +usr/include/nutscan-device.h +usr/include/nutscan-init.h diff --git a/obs/debian.libnutscan1.install b/obs/debian.libnutscan1.install new file mode 100644 index 0000000000..55d88d748b --- /dev/null +++ b/obs/debian.libnutscan1.install @@ -0,0 +1,2 @@ +lib/*/libnutscan.so.* +usr/share/nut/dmfnutscan/* diff --git a/obs/debian.libups-nut-perl.install b/obs/debian.libups-nut-perl.install new file mode 100644 index 0000000000..355c6fe0a5 --- /dev/null +++ b/obs/debian.libups-nut-perl.install @@ -0,0 +1 @@ +scripts/perl/Nut.pm /usr/share/perl5/UPS/ diff --git a/obs/debian.libupsclient-dev.install b/obs/debian.libupsclient-dev.install new file mode 100644 index 0000000000..e72f788135 --- /dev/null +++ b/obs/debian.libupsclient-dev.install @@ -0,0 +1,4 @@ +usr/lib/*/libupsclient.so +usr/lib/*/pkgconfig/libupsclient.pc +usr/include/parseconf.h +usr/include/upsclient.h diff --git a/obs/debian.libupsclient-dev.manpages b/obs/debian.libupsclient-dev.manpages new file mode 100644 index 0000000000..141a1b1c7a --- /dev/null +++ b/obs/debian.libupsclient-dev.manpages @@ -0,0 +1,2 @@ +debian/tmp/usr/share/man/man3/nutscan*.3 +debian/tmp/usr/share/man/man3/upscli*.3 diff --git a/obs/debian.libupsclient4.install b/obs/debian.libupsclient4.install new file mode 100644 index 0000000000..132d81a96d --- /dev/null +++ b/obs/debian.libupsclient4.install @@ -0,0 +1 @@ +lib/*/libupsclient.so.* diff --git a/obs/debian.nut-cgi.README.Debian b/obs/debian.nut-cgi.README.Debian new file mode 100644 index 0000000000..03277173ca --- /dev/null +++ b/obs/debian.nut-cgi.README.Debian @@ -0,0 +1,39 @@ +Network UPS Tools - CGI Interface - Quick Start for Debian +---------------------------------------------------------- + +(I) Installation +================= + +1) Sample configuration files are provided in /etc/nut/ +Rename without the ".sample" suffix the files hosts.conf, upsstats.html, +upsstats-single.html and optionaly upsset.conf. +Then edit these to match your configuration. + +2) Ensure these configuration files are readable by others + + chmod 755 /etc/nut + chmod 644 /etc/nut/upsset.conf + chmod 644 /etc/nut/hosts.conf + chmod 644 /etc/nut/upsstats.html + chmod 644 /etc/nut/upsstats-single.html + +3) You will then be able to access NUT CGI through a Web browser. +The URL, which depends on your httpd configuration, is: + + http://localhost/cgi-bin/nut/upsstats.cgi + +4) NUT also provides a set of HTML files to wrap the CGIs. +To use it, create a new virtual host with your preferred webserver, and point the +Document Root to: /usr/share/nut/www/ + + You can also add an alias to an existing site, if it is supported: + Alias /nut/ "/usr/share/nut/www/" + + Also ensure that the files in this directory have the suitable permissions. + +For more information on nut-cgi configuration, have a look at the following +manual pages: +- upsstats.html (5) +- hosts.conf (5) +- upsset.conf (5) + diff --git a/obs/debian.nut-cgi.docs b/obs/debian.nut-cgi.docs new file mode 100644 index 0000000000..80796c9b00 --- /dev/null +++ b/obs/debian.nut-cgi.docs @@ -0,0 +1 @@ +data/html/README diff --git a/obs/debian.nut-cgi.install b/obs/debian.nut-cgi.install new file mode 100644 index 0000000000..3dc88ccc3d --- /dev/null +++ b/obs/debian.nut-cgi.install @@ -0,0 +1,6 @@ +debian/tmp/etc/nut/hosts.conf +debian/tmp/etc/nut/upsset.conf +debian/tmp/etc/nut/upsstats.html +debian/tmp/etc/nut/upsstats-single.html +debian/tmp/usr/lib/cgi-bin/ +debian/tmp/usr/share/nut/www diff --git a/obs/debian.nut-cgi.manpages b/obs/debian.nut-cgi.manpages new file mode 100644 index 0000000000..36a14498f2 --- /dev/null +++ b/obs/debian.nut-cgi.manpages @@ -0,0 +1,6 @@ +debian/tmp/usr/share/man/man5/hosts.conf.5 +debian/tmp/usr/share/man/man5/upsset.conf.5 +debian/tmp/usr/share/man/man5/upsstats.html.5 +debian/tmp/usr/share/man/man8/upsimage.cgi.8 +debian/tmp/usr/share/man/man8/upsset.cgi.8 +debian/tmp/usr/share/man/man8/upsstats.cgi.8 diff --git a/obs/debian.nut-cgi.postinst b/obs/debian.nut-cgi.postinst new file mode 100644 index 0000000000..e082532566 --- /dev/null +++ b/obs/debian.nut-cgi.postinst @@ -0,0 +1,55 @@ +#!/bin/sh -e + +case "$1" in + + configure) + + # make sure the nut user exists and has correct memberships + if ! getent group nut >/dev/null; then + addgroup --quiet --system nut + fi + if ! getent passwd nut >/dev/null; then + adduser --quiet --system --ingroup nut --home /var/lib/nut --no-create-home nut + elif ! groups nut | grep -qw nut; then + adduser nut nut + fi +# for Ubuntu, while waiting for a proper debconf +# if ! groups nut | grep -qw dialout; then +# adduser nut dialout +# fi + + # Ensure /etc/nut is readable/crossable for others + if [ -d /etc/nut/ ] ; then + chmod 755 /etc/nut + fi + + # Ensure nut-cgi configuration files are readable by others + for file in upsset.conf hosts.conf upsstats.html upsstats-single.html ; do + if [ -f /etc/nut/$file ] ; then + chmod 644 /etc/nut/$file + fi + done + ;; + + abort-upgrade) + # do nothing + ;; + + abort-remove) + # do nothing + ;; + + abort-deconfigure) + # do nothing + ;; + + *) + echo "$0: incorrect arguments: $*" >&2 + exit 1 + ;; + +esac + +#DEBHELPER# + +exit 0 diff --git a/obs/debian.nut-cgi.postrm b/obs/debian.nut-cgi.postrm new file mode 100644 index 0000000000..91be66ddc6 --- /dev/null +++ b/obs/debian.nut-cgi.postrm @@ -0,0 +1,47 @@ +#!/bin/sh -e + +case "$1" in + + remove) + # remove sample file if those were previously (wrongly) installed + for file in upsset.conf hosts.conf upsstats.html upsstats-single.html ; do + if [ -f /etc/nut/${file}.sample ] ; then + rm -f /etc/nut/${file}.sample + fi + done + ;; + + purge) + # do nothing + ;; + + upgrade) + # do nothing + ;; + + failed-upgrade) + # do nothing + ;; + + abort-install) + # do nothing + ;; + + abort-upgrade) + # do nothing + ;; + + disappear) + # do nothing + ;; + + *) + echo "$0: incorrect arguments: $*" >&2 + exit 1 + ;; + +esac + +#DEBHELPER# + +exit 0 diff --git a/obs/debian.nut-client.init b/obs/debian.nut-client.init new file mode 100644 index 0000000000..15a9f75f37 --- /dev/null +++ b/obs/debian.nut-client.init @@ -0,0 +1,180 @@ +#! /bin/sh +### BEGIN INIT INFO +# Provides: nut-client upsmon ups-monitor +# Required-Start: $local_fs $syslog $network $remote_fs +# Required-Stop: $local_fs $syslog $network $remote_fs +# Should-Start: nut-server +# Should-Stop: +# Default-Start: 2 3 4 5 +# Default-Stop: 0 1 6 +# Short-Description: Network UPS Tools monitor initscript +# Description: This script take care of starting and stopping the +# Network UPS Tools monitoring component (upsmon). +### END INIT INFO + +# Author: Arnaud Quette + +PATH=/sbin:/usr/sbin:/bin:/usr/bin:/usr/local/sbin:/usr/local/bin + +NAME=nut-client +DESC="NUT - power device monitor and shutdown controller" +CONFIG=/etc/nut/nut.conf +pid_dir=/var/run/nut +upsmon_pid=${pid_dir}/upsmon.pid +upsmon=/sbin/upsmon +log=">/dev/null 2>/dev/null" + +# Define LSB log_* functions. +# Depend on lsb-base (>= 3.0-6) to ensure that this file is present. +. /lib/lsb/init-functions + +# set upsmon specific options. use "man upsmon" for more info +# this parameter is now located in nut.conf, and not in /etc/default/nut anymore +# FIXME: retrieved from 'nut' script during update +UPSMON_OPTIONS="" + +# Exit if the package is not installed +[ -x "$upsmon" ] || exit 0 + +# Include NUT nut.conf +[ -r $CONFIG ] && . $CONFIG + +# FIXME: put all common bits, between nut-client and nut-server, +# into a common nut-function + +# Explicitly require the configuration to be done in /etc/nut/nut.conf +if [ "x$MODE" = "xnone" -o -z "$MODE" ] ; then + log_action_msg "$NAME disabled, please adjust the configuration to your needs" + log_action_msg "Then set MODE to a suitable value in $CONFIG to enable it" + # exit success to avoid breaking the install process! + exit 0 +fi + +# Check if /var/run/nut exists and has the correct perms +check_var_directory() { + [ ! -d ${pid_dir} ] && mkdir -p ${pid_dir} \ + && chown root:nut ${pid_dir} \ + && chmod 770 ${pid_dir} \ + && [ -x /sbin/restorecon ] && /sbin/restorecon ${pid_dir} +} + +# check if the right components are running +check_status() { + case "$MODE" in + standalone|netserver|netclient) + status_of_proc -p $upsmon_pid $upsmon upsmon + ;; + none|*) + ;; + esac +} + +start_stop_client () { + case "$MODE" in + standalone|netserver|netclient) + # FIXME: for standalone|netserver, ensure 'nut-server status' returns ? + case "$1" in + start) + start-stop-daemon -S -q -p $upsmon_pid -x $upsmon \ + -- $UPSMON_OPTIONS >/dev/null 2>&1 && return 0 || return 1 + ;; + stop) + start-stop-daemon -K -o -q -p $upsmon_pid -n upsmon >/dev/null 2>&1 \ + && return 0 || return 1 + ;; + esac + ;; + none|*) + return 1 + ;; + esac +} + +case "$1" in + + start) + log_daemon_msg "Starting $DESC" "$NAME" + check_var_directory + start_stop_client start + log_end_msg $? + ;; + + stop) + log_daemon_msg "Stopping $DESC" "$NAME" + start_stop_client stop + log_end_msg $? + ;; + + reload) + log_daemon_msg "Reloading $DESC" "$NAME" + $upsmon -c reload >/dev/null 2>&1 + log_end_msg $? + ;; + + restart|force-reload) + # FIXME: lack consistency, due to initscript split. + # This only addresses partial reload. + # Full reload requires to: + # - stop nut-client + # - restart (Ie stop+start) nut-server + # - start nut-client + log_daemon_msg "Restarting $DESC" "$NAME" + start_stop_client stop || true + # should then 'start_stop_server stop', Ie /etc/init.d/nut-server stop + #sleep 5 + check_var_directory + # should first 'start_stop_server start', Ie /etc/init.d/nut-server start + start_stop_client start + log_end_msg $? + ;; + + status) + #log_daemon_msg "Checking status of $DESC" + echo "Checking status of $DESC" + check_status + exit $? + ;; + + poweroff) + case "$MODE" in + standalone|netserver) + # Sanity check + flag=`sed -ne 's#^ *POWERDOWNFLAG *\(.*\)$#\1#p' /etc/nut/upsmon.conf` + if [ -z "$flag" ] ; then + log_action_msg "##########################################################" + log_action_msg "## POWERDOWNFLAG is not defined in /etc/nut/upsmon.conf ##" + log_action_msg "## ##" + log_action_msg "## Please read the Manual page upsmon.conf(5) ##" + log_action_msg "##########################################################" + exit 1 + fi + + # Defer to nut-server to actually poweroff the UPS, if needed + # (the need is tested here though!) + if $upsmon -K >/dev/null 2>&1 ; then + log_daemon_msg "UPS poweroff required..." + log_end_msg 0 + if [ -x /etc/init.d/nut-server ] ; then + exec /etc/init.d/nut-server poweroff + else + log_action_msg "Failure: /etc/init.d/nut-server script missing" + fi + else + log_action_msg "Power down flag is not set (UPS poweroff not needed)" + fi + ;; + none|netclient|*) + # nothing to do + log_action_msg "'$MODE' configuration does not require UPS poweroff" + ;; + esac + ;; + + *) + N=/etc/init.d/$NAME + echo "Usage: $N {start|stop|reload|restart|force-reload|status|poweroff}" >&2 + exit 1 + ;; +esac + +exit 0 diff --git a/obs/debian.nut-client.install b/obs/debian.nut-client.install new file mode 100644 index 0000000000..b899f84d60 --- /dev/null +++ b/obs/debian.nut-client.install @@ -0,0 +1,20 @@ +debian/tmp/bin/upslog +debian/tmp/bin/upsc +debian/tmp/bin/upsrw +debian/tmp/bin/upscmd +debian/tmp/sbin/upsmon +debian/tmp/sbin/upssched +debian/tmp/bin/upssched-cmd +debian/tmp/etc/nut/nut.conf +debian/tmp/etc/nut/upsmon.conf +debian/tmp/etc/nut/upssched.conf +debian/tmp/usr/share/augeas/lenses/dist/nuthostsconf.aug +debian/tmp/usr/share/augeas/lenses/dist/nutnutconf.aug +debian/tmp/usr/share/augeas/lenses/dist/nutupsconf.aug +debian/tmp/usr/share/augeas/lenses/dist/nutupsdconf.aug +debian/tmp/usr/share/augeas/lenses/dist/nutupsdusers.aug +debian/tmp/usr/share/augeas/lenses/dist/nutupsmonconf.aug +debian/tmp/usr/share/augeas/lenses/dist/nutupsschedconf.aug +debian/tmp/usr/share/augeas/lenses/dist/nutupssetconf.aug +debian/tmp/usr/share/augeas/lenses/dist/tests/test_nut.aug +debian/tmp/usr/share/bash-completion/completions/nut diff --git a/obs/debian.nut-client.links b/obs/debian.nut-client.links new file mode 100644 index 0000000000..c8d27c5584 --- /dev/null +++ b/obs/debian.nut-client.links @@ -0,0 +1 @@ +etc/init.d/nut-client etc/init.d/ups-monitor diff --git a/obs/debian.nut-client.lintian-overrides b/obs/debian.nut-client.lintian-overrides new file mode 100644 index 0000000000..4830620aef --- /dev/null +++ b/obs/debian.nut-client.lintian-overrides @@ -0,0 +1,2 @@ +nut-client: script-in-etc-init.d-not-registered-via-update-rc.d +nut-client: systemd-no-service-for-init-script ups-monitor diff --git a/obs/debian.nut-client.maintscript b/obs/debian.nut-client.maintscript new file mode 100644 index 0000000000..692b715bc3 --- /dev/null +++ b/obs/debian.nut-client.maintscript @@ -0,0 +1 @@ +rm_conffile /etc/bash_completion.d/nut 2.7.1-1~ diff --git a/obs/debian.nut-client.manpages b/obs/debian.nut-client.manpages new file mode 100644 index 0000000000..115e821706 --- /dev/null +++ b/obs/debian.nut-client.manpages @@ -0,0 +1,9 @@ +debian/tmp/usr/share/man/man8/upsc.8 +debian/tmp/usr/share/man/man8/upscmd.8 +debian/tmp/usr/share/man/man8/upsmon.8 +debian/tmp/usr/share/man/man8/upsrw.8 +debian/tmp/usr/share/man/man8/upssched.8 +debian/tmp/usr/share/man/man5/nut.conf.5 +debian/tmp/usr/share/man/man5/upsmon.conf.5 +debian/tmp/usr/share/man/man5/upssched.conf.5 +debian/tmp/usr/share/man/man8/upslog.8 diff --git a/obs/debian.nut-client.postinst b/obs/debian.nut-client.postinst new file mode 100644 index 0000000000..4b0485045a --- /dev/null +++ b/obs/debian.nut-client.postinst @@ -0,0 +1,79 @@ +#!/bin/sh -e + +case "$1" in + + configure) + + # make sure the nut user exists and has correct memberships + if ! getent group nut >/dev/null; then + addgroup --quiet --system nut + fi + if ! getent passwd nut >/dev/null; then + adduser --quiet --system --ingroup nut --home /var/lib/nut --no-create-home nut + elif ! groups nut | grep -qw nut; then + adduser nut nut + fi +# for Ubuntu, while waiting for a proper debconf +# if ! groups nut | grep -qw dialout; then +# adduser nut dialout +# fi + + # make sure that conffiles are secured and have the correct ownerships + # on first install + if [ -z "$2" ] ; then + if [ -d /etc/nut/ ] ; then + chown root:nut /etc/nut/ + fi + for file in nut.conf upsmon.conf upssched.conf ; do + if [ -f /etc/nut/$file ] ; then + chown root:nut /etc/nut/$file + chmod 640 /etc/nut/$file + fi + done + fi + + # make sure that /var/run/nut exists and has the correct ownerships + if [ ! -d /var/run/nut ] ; then + mkdir -p /var/run/nut + fi + if [ -d /var/run/nut ] ; then + chown root:nut /var/run/nut + chmod 770 /var/run/nut + if which restorecon >/dev/null 2>&1; then + restorecon /var/run/nut + fi + fi + + if dpkg --compare-versions "$2" le "2.6.4-2~" && + [ -f /etc/init.d/nut ] ; then + if [ "`md5sum /etc/init.d/nut | cut -d ' ' -f 1`" = 72f1dbc6b92cb4407f26605d05b12681 ]; then + rm -f /etc/init.d/nut + else + mv /etc/init.d/nut /etc/init.d/nut.dpkg-old + fi + update-rc.d nut remove >/dev/null + fi + ;; + + abort-upgrade) + # do nothing + ;; + + abort-remove) + # do nothing + ;; + + abort-deconfigure) + # do nothing + ;; + + *) + echo "$0: incorrect arguments: $*" >&2 + exit 1 + ;; + +esac + +#DEBHELPER# + +exit 0 diff --git a/obs/debian.nut-client.preinst b/obs/debian.nut-client.preinst new file mode 100644 index 0000000000..fa1bd014ee --- /dev/null +++ b/obs/debian.nut-client.preinst @@ -0,0 +1,23 @@ +#!/bin/sh + +set -e + +# Revert /etc/nut/nut.conf mangling done by older versions of the postinst +# See #677054 +# changed configfile created by a fresh install in lenny, upgraded to squeeze +if [ "$1" = "install" -o "$1" = "upgrade" ] \ + && dpkg --compare-versions "$2" lt "2.6.4-2" \ + && [ -f /etc/nut/nut.conf ] \ + && [ "`md5sum /etc/nut/nut.conf | cut -d ' ' -f 1`" = 331cca39153f451c2968f4b734c1cf3f ]; then + sed -i '29,$ d' /etc/nut/nut.conf +fi + +# changed configfile created by a fresh install in squeeze +if [ "$1" = "install" -o "$1" = "upgrade" ] \ + && dpkg --compare-versions "$2" lt "2.6.4-2" \ + && [ -f /etc/nut/nut.conf ] \ + && [ "`md5sum /etc/nut/nut.conf | cut -d ' ' -f 1`" = f9b571ae65952e3a761fac2202633478 ]; then + sed -i 's/^MODE=none$/MODE = none/' /etc/nut/nut.conf +fi + +#DEBHELPER# diff --git a/obs/debian.nut-client.tmpfiles b/obs/debian.nut-client.tmpfiles new file mode 100644 index 0000000000..bf195cf142 --- /dev/null +++ b/obs/debian.nut-client.tmpfiles @@ -0,0 +1 @@ +d /run/nut 0770 root nut - - diff --git a/obs/debian.nut-doc.doc-base.nut-developer-guide b/obs/debian.nut-doc.doc-base.nut-developer-guide new file mode 100644 index 0000000000..ed3ad0d8b7 --- /dev/null +++ b/obs/debian.nut-doc.doc-base.nut-developer-guide @@ -0,0 +1,13 @@ +Document: nut-developer-guide +Title: Network UPS Tools Developer Guide +Author: Russell Kroll, Arnaud Quette, Charles Lepple and Peter Selinger +Abstract: This document intend to describe how NUT is designed, + and the way to develop new device drivers and client applications. +Section: Programming + +Format: PDF +Files: /usr/share/doc/nut-doc/pdf/developer-guide.pdf + +Format: HTML +Index: /usr/share/doc/nut-doc/html/developer-guide/index.html +Files: /usr/share/doc/nut-doc/html/developer-guide/*.html diff --git a/obs/debian.nut-doc.doc-base.nut-faq b/obs/debian.nut-doc.doc-base.nut-faq new file mode 100644 index 0000000000..098042f7c8 --- /dev/null +++ b/obs/debian.nut-doc.doc-base.nut-faq @@ -0,0 +1,12 @@ +Document: nut-faq +Title: NUT Frequently asked questions +Author: Arnaud Quette +Abstract: Frequently asked questions for Network UPS Tools (NUT) +Section: Help/FAQ + +Format: PDF +Files: /usr/share/doc/nut-doc/pdf/FAQ.pdf + +Format: HTML +Index: /usr/share/doc/nut-doc/html/FAQ.html +Files: /usr/share/doc/nut-doc/html/FAQ.html diff --git a/obs/debian.nut-doc.doc-base.nut-packager-guide b/obs/debian.nut-doc.doc-base.nut-packager-guide new file mode 100644 index 0000000000..61d6b46665 --- /dev/null +++ b/obs/debian.nut-doc.doc-base.nut-packager-guide @@ -0,0 +1,15 @@ +Document: nut-packager-guide +Title: NUT Packager and Integrators Guide +Author: Arnaud Quette +Abstract: Packaging is a final aim for software. + It eases and completes the software integration into an OS, + and allows users to have an easy software installation and support out of the box. + This document describes best practice for packaging NUT. +Section: Debian + +Format: PDF +Files: /usr/share/doc/nut-doc/pdf/packager-guide.pdf + +Format: HTML +Index: /usr/share/doc/nut-doc/html/packager-guide/index.html +Files: /usr/share/doc/nut-doc/html/packager-guide/*.html diff --git a/obs/debian.nut-doc.doc-base.nut-user-manual b/obs/debian.nut-doc.doc-base.nut-user-manual new file mode 100644 index 0000000000..76db720fa1 --- /dev/null +++ b/obs/debian.nut-doc.doc-base.nut-user-manual @@ -0,0 +1,15 @@ +Document: nut-user-manual +Title: Network UPS Tools User Manual +Author: Russell Kroll, Arnaud Quette and Arjen de Korte +Abstract: This document intend to describe how to install software support + for your Power Devices (UPS, PDU, …), and how to use the NUT project. + It is not intended to explain what are, nor distinguish the different technologies that exist. + For such information, have a look at the General Power Devices Information. +Section: System/Administration + +Format: PDF +Files: /usr/share/doc/nut-doc/pdf/user-manual.pdf + +Format: HTML +Index: /usr/share/doc/nut-doc/html/user-manual/index.html +Files: /usr/share/doc/nut-doc/html/user-manual/*.html diff --git a/obs/debian.nut-doc.install b/obs/debian.nut-doc.install new file mode 100644 index 0000000000..e3f78faf8e --- /dev/null +++ b/obs/debian.nut-doc.install @@ -0,0 +1 @@ +debian/tmp/usr/share/doc/nut-doc/ diff --git a/obs/debian.nut-ipmi.install b/obs/debian.nut-ipmi.install new file mode 100644 index 0000000000..2d9854d88d --- /dev/null +++ b/obs/debian.nut-ipmi.install @@ -0,0 +1,2 @@ +debian/tmp/lib/nut/nut-ipmipsu +debian/tmp/*/udev/rules.d/52-nut-ipmipsu.rules diff --git a/obs/debian.nut-ipmi.manpages b/obs/debian.nut-ipmi.manpages new file mode 100644 index 0000000000..5da576ff9c --- /dev/null +++ b/obs/debian.nut-ipmi.manpages @@ -0,0 +1 @@ +debian/tmp/usr/share/man/man8/nut-ipmipsu.8 diff --git a/obs/debian.nut-monitor.install b/obs/debian.nut-monitor.install new file mode 100644 index 0000000000..6cbef89947 --- /dev/null +++ b/obs/debian.nut-monitor.install @@ -0,0 +1,7 @@ +scripts/python/app/NUT-Monitor usr/bin/ +scripts/python/app/nut-monitor.desktop usr/share/applications/ +scripts/python/app/gui-*.glade usr/share/nut-monitor/ +scripts/python/app/locale/ usr/share/ +scripts/python/app/nut-monitor.png usr/share/pixmaps/ +scripts/python/app/pixmaps usr/share/nut-monitor/ +debian/nut-monitor.xpm usr/share/pixmaps/ diff --git a/obs/debian.nut-monitor.menu b/obs/debian.nut-monitor.menu new file mode 100644 index 0000000000..2b849cba47 --- /dev/null +++ b/obs/debian.nut-monitor.menu @@ -0,0 +1,4 @@ +?package(nut-monitor): needs="X11" section="Applications/System/Monitoring"\ + title="NUT Monitor" command="/usr/bin/NUT-Monitor"\ + icon="/usr/share/pixmaps/nut-monitor.xpm"\ + longtitle="Network UPS Tools GUI client" diff --git a/obs/debian.nut-monitor.xpm b/obs/debian.nut-monitor.xpm new file mode 100644 index 0000000000..6bfa642f89 --- /dev/null +++ b/obs/debian.nut-monitor.xpm @@ -0,0 +1,326 @@ +/* XPM */ +static char * nut_monitor_xpm[] = { +"32 32 291 2", +" c None", +". c #C7A509", +"+ c #D0B123", +"@ c #CEAF21", +"# c #CBAB15", +"$ c #C5A305", +"% c #C4A100", +"& c #CAAB1A", +"* c #E0C74E", +"= c #E0C949", +"- c #ECDA6F", +"; c #FCF6C6", +"> c #FDF7B5", +", c #E8D663", +"' c #CEAF0E", +") c #CAA915", +"! c #DFC858", +"~ c #D1B42E", +"{ c #C29E00", +"] c #D6BB34", +"^ c #FBEE92", +"/ c #FFF792", +"( c #FEF07A", +"_ c #F9E857", +": c #F6E558", +"< c #F5E55D", +"[ c #EED500", +"} c #D7B800", +"| c #CCAB00", +"1 c #CAA80A", +"2 c #EFDA59", +"3 c #EFDC69", +"4 c #F0E289", +"5 c #DBC350", +"6 c #C8A714", +"7 c #BE9700", +"8 c #FFFEAA", +"9 c #FCE955", +"0 c #FCED74", +"a c #FCF194", +"b c #FDF4AD", +"c c #F5E565", +"d c #EFD91D", +"e c #E6CA00", +"f c #D2B000", +"g c #D0B226", +"h c #EAD65F", +"i c #EDD852", +"j c #E9D037", +"k c #E6CC2E", +"l c #ECD856", +"m c #CDAF23", +"n c #BD9500", +"o c #FFFFD2", +"p c #FCED72", +"q c #FCEE7A", +"r c #FDF087", +"s c #FDF195", +"t c #FDF4AB", +"u c #FEF8C2", +"v c #FEF9C0", +"w c #FEF5AA", +"x c #FBEE8A", +"y c #F4E269", +"z c #F4E058", +"A c #F0DA49", +"B c #EDD851", +"C c #EBD96F", +"D c #CCAD23", +"E c #BC9400", +"F c #FFFFD9", +"G c #FDF5B0", +"H c #FDFAD9", +"I c #FDF9D4", +"J c #FEF9D8", +"K c #FEFBE3", +"L c #FFFDEA", +"M c #FFFCE4", +"N c #FEFAD4", +"O c #FBF3B8", +"P c #F5E99B", +"Q c #EBDA75", +"R c #E0CA52", +"S c #D8C03D", +"T c #D6BE48", +"U c #CCAC21", +"V c #FFFFD6", +"W c #FDF3A5", +"X c #FDF9D0", +"Y c #FCF4B9", +"Z c #F9F2AB", +"` c #F5E561", +" . c #F1DE3B", +".. c #EFD91C", +"+. c #E8CF1B", +"@. c #E0C61C", +"#. c #DBC01E", +"$. c #D9BD21", +"%. c #D6BA26", +"&. c #D5B729", +"*. c #D7BD43", +"=. c #FFFFD4", +"-. c #FCF3A2", +";. c #FDF9CE", +">. c #FBF4B9", +",. c #FAF2AA", +"'. c #F5E86D", +"). c #F3E14B", +"!. c #F0DC2D", +"~. c #EAD329", +"{. c #E1C927", +"]. c #DCC224", +"^. c #D9BD23", +"/. c #D5B921", +"(. c #D2B522", +"_. c #D3BA3E", +":. c #CBAC22", +"<. c #A68E1A", +"[. c #FFFCD8", +"}. c #FCF2A0", +"|. c #FEF8C9", +"1. c #FCF4B1", +"2. c #FAF1A2", +"3. c #F5E666", +"4. c #F2E045", +"5. c #F0DB28", +"6. c #E8D123", +"7. c #E1C720", +"8. c #DCC01D", +"9. c #D9BC1A", +"0. c #D7B916", +"a. c #D3B41A", +"b. c #C8B140", +"c. c #B6A34A", +"d. c #777B7D", +"e. c #EFF0ED", +"f. c #DCDECF", +"g. c #F0EEDC", +"h. c #F2ECC0", +"i. c #F4EDA6", +"j. c #F2E568", +"k. c #F2DF3E", +"l. c #F4DD12", +"m. c #EBD118", +"n. c #DDC420", +"o. c #D1BA27", +"p. c #C0AD37", +"q. c #A5994E", +"r. c #898464", +"s. c #7F8077", +"t. c #8F9396", +"u. c #72746E", +"v. c #D8DAD4", +"w. c #E7E8E5", +"x. c #E0E2E1", +"y. c #DBDDDE", +"z. c #CACDD3", +"A. c #C2C6CD", +"B. c #B7BBC8", +"C. c #A9AFB8", +"D. c #9CA0A7", +"E. c #8E9396", +"F. c #848888", +"G. c #7E7F7B", +"H. c #76786F", +"I. c #7B7C77", +"J. c #8C8E8A", +"K. c #676965", +"L. c #EFF1EE", +"M. c #D6D9D4", +"N. c #E4E5E3", +"O. c #DFE0DC", +"P. c #D9DCD7", +"Q. c #CCCEC8", +"R. c #C4C7BF", +"S. c #BABDB5", +"T. c #ADAFA7", +"U. c #9FA199", +"V. c #91938B", +"W. c #84877F", +"X. c #7B7D76", +"Y. c #71736E", +"Z. c #787975", +"`. c #858783", +" + c #5F615C", +".+ c #EFF0EE", +"++ c #D5D8D3", +"@+ c #E3E5E1", +"#+ c #DCDDDA", +"$+ c #D6D9D5", +"%+ c #C9CCC7", +"&+ c #C2C5BE", +"*+ c #B8BBB4", +"=+ c #ABAEA6", +"-+ c #9C9F97", +";+ c #8E9089", +">+ c #81847D", +",+ c #787A74", +"'+ c #6E716B", +")+ c #757772", +"!+ c #7E807C", +"~+ c #555752", +"{+ c #D5D7D3", +"]+ c #E0E2DE", +"^+ c #DADBD8", +"/+ c #D4D6D1", +"(+ c #C8CAC5", +"_+ c #C1C4BD", +":+ c #B6B9B3", +"<+ c #A9ACA4", +"[+ c #999C95", +"}+ c #8A8D85", +"|+ c #7F827B", +"1+ c #767771", +"2+ c #6D6F6A", +"3+ c #757773", +"4+ c #777975", +"5+ c #4B4E49", +"6+ c #F0F2EE", +"7+ c #D3D6D1", +"8+ c #DEE0DE", +"9+ c #D8D9D6", +"0+ c #D1D3CF", +"a+ c #C6C8C3", +"b+ c #BFC2BB", +"c+ c #B5B8B1", +"d+ c #A6A9A2", +"e+ c #989B93", +"f+ c #767773", +"g+ c #70726F", +"h+ c #434540", +"i+ c #D2D5D0", +"j+ c #DCDDDB", +"k+ c #D4D6D2", +"l+ c #CED0CB", +"m+ c #C5C7C2", +"n+ c #BEC1BA", +"o+ c #B4B7B0", +"p+ c #A7AAA2", +"q+ c #767874", +"r+ c #6A6C68", +"s+ c #424440", +"t+ c #EFF1ED", +"u+ c #D1D4CF", +"v+ c #DADCD8", +"w+ c #D3D5D0", +"x+ c #CCCFC9", +"y+ c #C4C7C1", +"z+ c #6A6B68", +"A+ c #41433F", +"B+ c #EDEFEC", +"C+ c #D2D5CF", +"D+ c #D9DAD7", +"E+ c #D2D4CF", +"F+ c #CBCEC8", +"G+ c #D7D9D5", +"H+ c #D1D3CE", +"I+ c #CBCDC8", +"J+ c #8A8C85", +"K+ c #7D8079", +"L+ c #696B65", +"M+ c #7F807C", +"N+ c #6A6C69", +"O+ c #81827E", +"P+ c #DEE0DD", +"Q+ c #F1F2EF", +"R+ c #DEE0DC", +"S+ c #CFD2CC", +"T+ c #C3C6C0", +"U+ c #BBBEB7", +"V+ c #ADB0A9", +"W+ c #A2A59D", +"X+ c #979A92", +"Y+ c #8F928A", +"Z+ c #92948F", +"`+ c #9D9E99", +" @ c #A9AAA6", +".@ c #868784", +"+@ c #4B4D49", +"@@ c #5E605B", +"#@ c #959794", +"$@ c #AEAFAC", +"%@ c #B6B8B5", +"&@ c #BABCB8", +"*@ c #BDBEBB", +"=@ c #B4B6B2", +"-@ c #AAABA7", +";@ c #9E9F9B", +">@ c #888986", +",@ c #686A66", +"'@ c #454743", +" ", +" ", +" ", +" ", +" ", +" ", +" . + @ # $ ", +" % & * = - ; > , ' ) ! ~ { ", +" ] ^ / ( _ : < [ } | 1 2 3 4 5 6 ", +" 7 8 9 0 a b c d e f g h i j k l m ", +" n o p q r s t u v w x y z A B C D ", +" E F G H I J K L M N O P Q R S T U ", +" E V W X Y Z ` ...+.@.#.$.%.&.*.U ", +" E =.-.;.>.,.'.).!.~.{.].^./.(._.:. ", +" <.[.}.|.1.2.3.4.5.6.7.8.9.0.a.b.c. ", +" d.e.f.g.h.i.j.k.l.m.n.o.p.q.r.s.t. ", +" u.e.v.w.x.y.z.A.B.C.D.E.F.G.H.I.J. ", +" K.L.M.N.O.P.Q.R.S.T.U.V.W.X.Y.Z.`. ", +" +.+++@+#+$+%+&+*+=+-+;+>+,+'+)+!+ ", +" ~+.+{+]+^+/+(+_+:+<+[+}+|+1+2+3+4+ ", +" 5+6+7+8+9+0+a+b+c+d+e+}+|+1+2+f+g+ ", +" h+6+i+j+k+l+m+n+o+p+e+}+|+1+2+q+r+ ", +" s+t+u+v+w+x+y+n+o+p+e+}+|+1+2+q+z+ ", +" A+B+C+D+E+F+y+n+o+p+e+}+|+1+2+4+z+ ", +" s+6+7+G+H+I+y+n+c+p+e+J+K+u.L+M+N+ ", +" O+P+Q+R+S+T+U+V+W+X+Y+Z+`+ @.@+@ ", +" A+@@#@$@%@&@*@=@-@;@>@,@'@ ", +" ", +" ", +" ", +" ", +" "}; diff --git a/obs/debian.nut-powerman-pdu.install b/obs/debian.nut-powerman-pdu.install new file mode 100644 index 0000000000..f0acaa4eaf --- /dev/null +++ b/obs/debian.nut-powerman-pdu.install @@ -0,0 +1 @@ +debian/tmp/lib/nut/powerman-pdu diff --git a/obs/debian.nut-powerman-pdu.manpages b/obs/debian.nut-powerman-pdu.manpages new file mode 100644 index 0000000000..43bbc81a04 --- /dev/null +++ b/obs/debian.nut-powerman-pdu.manpages @@ -0,0 +1 @@ +debian/tmp/usr/share/man/man8/powerman-pdu.8 diff --git a/obs/debian.nut-server.dirs b/obs/debian.nut-server.dirs new file mode 100644 index 0000000000..a80531140f --- /dev/null +++ b/obs/debian.nut-server.dirs @@ -0,0 +1 @@ +/var/lib/nut diff --git a/obs/debian.nut-server.init b/obs/debian.nut-server.init new file mode 100644 index 0000000000..c539bd5ebe --- /dev/null +++ b/obs/debian.nut-server.init @@ -0,0 +1,179 @@ +#! /bin/sh +### BEGIN INIT INFO +# Provides: nut-server upsd +# Required-Start: $local_fs $syslog $network $remote_fs udev +# Required-Stop: $local_fs $syslog $network $remote_fs udev +# Default-Start: 2 3 4 5 +# Default-Stop: 0 1 6 +# Short-Description: Network UPS Tools initscript +# Description: This script take care of starting and stopping the +# Network UPS Tools components. When needed, it also +# handle the UPS hardware shutdown. +### END INIT INFO + +# Author: Arnaud Quette + +PATH=/sbin:/usr/sbin:/bin:/usr/bin:/usr/local/sbin:/usr/local/bin + +NAME=nut-server +DESC="NUT - power devices information server and drivers" +CONFIG=/etc/nut/nut.conf +pid_dir=/var/run/nut +upsd_pid=${pid_dir}/upsd.pid +upsd=/sbin/upsd +upsdrvctl=/sbin/upsdrvctl +log=">/dev/null 2>/dev/null" + +# Define LSB log_* functions. +# Depend on lsb-base (>= 3.0-6) to ensure that this file is present. +. /lib/lsb/init-functions + +# set upsd specific options. use "man upsd" for more info +# this parameter is now located in nut.conf, and not in /etc/default/nut anymore +# FIXME: retrieved from 'nut' script during update +UPSD_OPTIONS="" + +# Exit if the package is not installed +[ -x "$upsd" ] || exit 0 + +# Include NUT nut.conf +[ -r $CONFIG ] && . $CONFIG + +# Explicitly require the configuration to be done in /etc/nut/nut.conf +# redundant with nut-client +if [ "x$MODE" = "xnone" -o -z "$MODE" ] ; then + log_action_msg "$NAME disabled, please adjust the configuration to your needs" + log_action_msg "Then set MODE to a suitable value in $CONFIG to enable it" + # exit success to avoid breaking the install process! + exit 0 +fi + +# Check if /var/run/nut exists and has the correct perms +check_var_directory() { + [ ! -d ${pid_dir} ] && mkdir -p ${pid_dir} \ + && chown root:nut ${pid_dir} \ + && chmod 770 ${pid_dir} \ + && [ -x /sbin/restorecon ] && /sbin/restorecon ${pid_dir} +} + +# check if the right components are running +check_status() { + case "$MODE" in + standalone|netserver) + status_of_proc -p $upsd_pid $upsd upsd + # FIXME: need driver(s) status too! + ;; + none|netclient|*) + # defered to nut-client + #status_of_proc -p $upsmon_pid $upsmon upsmon + ;; + esac +} + +start_stop_server () { + case "$MODE" in + standalone|netserver) + case "$1" in + start) + # First, start driver(s) + ! $upsdrvctl start >/dev/null 2>&1 && \ + log_progress_msg " (driver(s) failed)." || log_progress_msg " driver(s)." + # Then, data server (upsd) + start-stop-daemon -S -p $upsd_pid -x $upsd \ + -- $UPSD_OPTIONS >/dev/null 2>&1 && + log_progress_msg "upsd" || log_progress_msg "(upsd failed)" + ;; + stop) + # FIXME: should stop nut-client first! + # Reverse order for stop + start-stop-daemon -K -o -p $upsd_pid -n upsd && #>/dev/null 2>&1 && + log_progress_msg "upsd" || log_progress_msg "(upsd failed)" + ! /sbin/upsdrvctl stop >/dev/null 2>&1 && \ + log_progress_msg "(driver(s) failed)" || log_progress_msg "driver(s)" + ;; + esac + ;; + none|netclient|*) + # now handled by nut-client + return 1 + ;; + esac +} + +case "$1" in + + start) + log_daemon_msg "Starting $DESC" + check_var_directory + start_stop_server start #&& log_progress_msg "upsd" + #start_stop_client start && log_progress_msg "upsmon" + log_end_msg 0 + ;; + + stop) + log_daemon_msg "Stopping $DESC" + start_stop_server stop #&& log_progress_msg "upsd" + #start_stop_client stop && log_progress_msg "upsmon" + log_end_msg 0 + ;; + + reload) + $upsd -c reload >/dev/null 2>&1 + #$upsmon -c reload >/dev/null 2>&1 + ;; + + restart|force-reload) + log_daemon_msg "Restarting $DESC" + #start_stop_client stop + start_stop_server stop + sleep 5 + check_var_directory + start_stop_server start #&& log_progress_msg "upsd" + #start_stop_client start && log_progress_msg "upsmon" + log_end_msg 0 + ;; + + status) + #log_daemon_msg "Checking status of $DESC" + echo "Checking status of $DESC" + check_status + exit $? + ;; + + poweroff) + wait_delay=`sed -ne 's#^ *POWEROFF_WAIT= *\(.*\)$#\1#p' /etc/nut/nut.conf` + # UPS poweroff action is actually done here. + # But nut-monitor (Ie nut-client) does the check and call nut-server if needed! + # This action MUST NOT be called directly, and thus is not exposed in 'Usage' + case "$MODE" in + standalone|netserver) + log_daemon_msg "Shutting down the UPS ..." + if $upsdrvctl shutdown ; then + # FIXME (needed?): sleep 5 + log_progress_msg "Waiting for UPS to cut the power" + log_end_msg 0 + else + log_progress_msg "Shutdown failed." + log_progress_msg "Waiting for UPS batteries to run down" + log_end_msg 0 + fi + if [ -n "$wait_delay" ] ; then + log_daemon_msg " (will reboot after $wait_delay) ..." + sleep "$wait_delay" + invoke-rc.d reboot stop + fi + ;; + none|netclient|*) + # nothing to do + ;; + esac + ;; + + *) + N=/etc/init.d/$NAME + echo "Usage: $N {start|stop|reload|restart|force-reload|status}" >&2 + exit 1 + ;; +esac + +exit 0 diff --git a/obs/debian.nut-server.install b/obs/debian.nut-server.install new file mode 100644 index 0000000000..4c0f50e069 --- /dev/null +++ b/obs/debian.nut-server.install @@ -0,0 +1,59 @@ +debian/tmp/bin/nut-scanner +debian/tmp/sbin/upsd +debian/tmp/sbin/upsdrvctl +debian/tmp/usr/share/nut/cmdvartab +debian/tmp/usr/share/nut/driver.list +debian/tmp/*/udev/rules.d/[0-9][0-9]-*.rules +debian/tmp/etc/avahi/services/nut.service +debian/tmp/etc/nut/ups.conf +debian/tmp/etc/nut/upsd.conf +debian/tmp/etc/nut/upsd.users +debian/tmp/lib/nut/genericups +debian/tmp/lib/nut/mge-shut +debian/tmp/lib/nut/rhino +debian/tmp/lib/nut/bestups +debian/tmp/lib/nut/bestfortress +debian/tmp/lib/nut/usbhid-ups +debian/tmp/lib/nut/apcsmart +debian/tmp/lib/nut/apcsmart-old +debian/tmp/lib/nut/belkin +debian/tmp/lib/nut/blazer_ser +debian/tmp/lib/nut/blazer_usb +debian/tmp/lib/nut/clone +debian/tmp/lib/nut/clone-outlet +debian/tmp/lib/nut/ivtscd +debian/tmp/lib/nut/metasys +debian/tmp/lib/nut/etapro +debian/tmp/lib/nut/tripplite_usb +debian/tmp/lib/nut/bcmxcp +debian/tmp/lib/nut/bestuferrups +debian/tmp/lib/nut/gamatronic +debian/tmp/lib/nut/oldmge-shut +debian/tmp/lib/nut/safenet +debian/tmp/lib/nut/isbmex +debian/tmp/lib/nut/masterguard +debian/tmp/lib/nut/belkinunv +debian/tmp/lib/nut/tripplite +debian/tmp/lib/nut/upscode2 +debian/tmp/lib/nut/solis +debian/tmp/lib/nut/oneac +debian/tmp/lib/nut/mge-utalk +debian/tmp/lib/nut/powerpanel +debian/tmp/lib/nut/bestfcom +debian/tmp/lib/nut/liebert +debian/tmp/lib/nut/powercom +debian/tmp/lib/nut/bcmxcp_usb +debian/tmp/lib/nut/victronups +debian/tmp/lib/nut/tripplitesu +debian/tmp/lib/nut/optiups +debian/tmp/lib/nut/everups +debian/tmp/lib/nut/dummy-ups +debian/tmp/lib/nut/richcomm_usb +debian/tmp/lib/nut/liebert-esp2 +debian/tmp/lib/nut/microdowell +debian/tmp/lib/nut/al175 +debian/tmp/lib/nut/apcupsd-ups +debian/tmp/lib/nut/nutdrv_atcl_usb +debian/tmp/lib/nut/nutdrv_qx +debian/tmp/lib/nut/riello_ser +debian/tmp/lib/nut/riello_usb diff --git a/obs/debian.nut-server.manpages b/obs/debian.nut-server.manpages new file mode 100644 index 0000000000..d5cf07ed18 --- /dev/null +++ b/obs/debian.nut-server.manpages @@ -0,0 +1,53 @@ +debian/tmp/usr/share/man/man5/ups.conf.5 +debian/tmp/usr/share/man/man5/upsd.conf.5 +debian/tmp/usr/share/man/man5/upsd.users.5 +debian/tmp/usr/share/man/man8/apcsmart.8 +debian/tmp/usr/share/man/man8/apcsmart-old.8 +debian/tmp/usr/share/man/man8/bcmxcp.8 +debian/tmp/usr/share/man/man8/bcmxcp_usb.8 +debian/tmp/usr/share/man/man8/belkin.8 +debian/tmp/usr/share/man/man8/belkinunv.8 +debian/tmp/usr/share/man/man8/bestfcom.8 +debian/tmp/usr/share/man/man8/bestuferrups.8 +debian/tmp/usr/share/man/man8/bestups.8 +debian/tmp/usr/share/man/man8/bestfortress.8 +debian/tmp/usr/share/man/man8/clone.8 +debian/tmp/usr/share/man/man8/dummy-ups.8 +debian/tmp/usr/share/man/man8/etapro.8 +debian/tmp/usr/share/man/man8/everups.8 +debian/tmp/usr/share/man/man8/gamatronic.8 +debian/tmp/usr/share/man/man8/genericups.8 +debian/tmp/usr/share/man/man8/isbmex.8 +debian/tmp/usr/share/man/man8/ivtscd.8 +debian/tmp/usr/share/man/man8/liebert.8 +debian/tmp/usr/share/man/man8/liebert-esp2.8 +debian/tmp/usr/share/man/man8/masterguard.8 +debian/tmp/usr/share/man/man8/metasys.8 +debian/tmp/usr/share/man/man8/mge-shut.8 +debian/tmp/usr/share/man/man8/mge-utalk.8 +debian/tmp/usr/share/man/man8/microdowell.8 +debian/tmp/usr/share/man/man8/nutupsdrv.8 +debian/tmp/usr/share/man/man8/oneac.8 +debian/tmp/usr/share/man/man8/optiups.8 +debian/tmp/usr/share/man/man8/powercom.8 +debian/tmp/usr/share/man/man8/powerpanel.8 +debian/tmp/usr/share/man/man8/rhino.8 +debian/tmp/usr/share/man/man8/richcomm_usb.8 +debian/tmp/usr/share/man/man8/safenet.8 +debian/tmp/usr/share/man/man8/solis.8 +debian/tmp/usr/share/man/man8/tripplite.8 +debian/tmp/usr/share/man/man8/tripplitesu.8 +debian/tmp/usr/share/man/man8/tripplite_usb.8 +debian/tmp/usr/share/man/man8/upscode2.8 +debian/tmp/usr/share/man/man8/upsd.8 +debian/tmp/usr/share/man/man8/upsdrvctl.8 +debian/tmp/usr/share/man/man8/usbhid-ups.8 +debian/tmp/usr/share/man/man8/victronups.8 +debian/tmp/usr/share/man/man8/al175.8 +debian/tmp/usr/share/man/man8/apcupsd-ups.8 +debian/tmp/usr/share/man/man8/blazer_ser.8 +debian/tmp/usr/share/man/man8/blazer_usb.8 +debian/tmp/usr/share/man/man8/nutdrv_atcl_usb.8 +debian/tmp/usr/share/man/man8/nutdrv_qx.8 +debian/tmp/usr/share/man/man8/riello_ser.8 +debian/tmp/usr/share/man/man8/riello_usb.8 diff --git a/obs/debian.nut-server.postinst b/obs/debian.nut-server.postinst new file mode 100644 index 0000000000..33221262fe --- /dev/null +++ b/obs/debian.nut-server.postinst @@ -0,0 +1,91 @@ +#!/bin/sh -e + +case "$1" in + + configure) + + # make sure the nut user exists and has correct memberships + if ! getent group nut >/dev/null; then + addgroup --quiet --system nut + fi + if ! getent passwd nut >/dev/null; then + adduser --quiet --system --ingroup nut --home /var/lib/nut --no-create-home nut + elif ! groups nut | grep -qw nut; then + adduser nut nut + fi +# for Ubuntu, while waiting for a proper debconf +# if ! groups nut | grep -qw dialout; then +# adduser nut dialout +# fi + + # make sure that conffiles are secured and have the correct ownerships + # on first install + if [ -z "$2" ] ; then + if [ -d /etc/nut/ ] ; then + chown root:nut /etc/nut/ + fi + for file in ups.conf upsd.conf upsd.users ; do + if [ -f /etc/nut/$file ] ; then + chown root:nut /etc/nut/$file + chmod 640 /etc/nut/$file + fi + done + fi + + # make sure that /var/run/nut exists and has the correct ownerships + if [ ! -d /var/run/nut ] ; then + mkdir -p /var/run/nut + fi + if [ -d /var/run/nut ] ; then + chown root:nut /var/run/nut + chmod 770 /var/run/nut + if which restorecon >/dev/null 2>&1; then + restorecon /var/run/nut + fi + fi + + # make sure that /var/lib/nut has the correct permissions and ownerships + if [ -d /var/lib/nut ] ; then + chown root:nut /var/lib/nut + chmod 770 /var/lib/nut + fi + + # ask udev to check for new udev rules + [ -x /etc/init.d/udev ] && pidof udevd > /dev/null \ + && udevadm trigger --subsystem-match=usb --action=change + + # 557178 udevadm trigger --subsystem-match=usb + + if dpkg --compare-versions "$2" le "2.6.4-2~" && + [ -f /etc/init.d/nut ] ; then + if [ "`md5sum /etc/init.d/nut | cut -d ' ' -f 1`" = 72f1dbc6b92cb4407f26605d05b12681 ]; then + rm -f /etc/init.d/nut + else + mv /etc/init.d/nut /etc/init.d/nut.dpkg-old + fi + update-rc.d nut remove >/dev/null + fi + ;; + + abort-upgrade) + # do nothing + ;; + + abort-remove) + # do nothing + ;; + + abort-deconfigure) + # do nothing + ;; + + *) + echo "$0: incorrect arguments: $*" >&2 + exit 1 + ;; + +esac + +#DEBHELPER# + +exit 0 diff --git a/obs/debian.nut-server.postrm b/obs/debian.nut-server.postrm new file mode 100644 index 0000000000..b95b26f6f5 --- /dev/null +++ b/obs/debian.nut-server.postrm @@ -0,0 +1,50 @@ +#!/bin/sh -e + +case "$1" in + + remove) + # remove sample file if those were previously (wrongly) installed + for file in ups.conf upsd.conf upsmon.conf upsd.users upssched.conf ; do + rm -f /etc/nut/${file}.sample + done + ;; + + purge) + # remove udev rules files + rm -f /etc/udev/rules.d/025_nut-usbups.rules + rm -f /etc/udev/rules.d/52_nut-usbups.rules + rm -f /etc/udev/rules.d/52-nut-usbups.rules + # handle a dpkg bug + [ -d /etc/nut ] && rmdir --ignore-fail-on-non-empty /etc/nut >/dev/null 2>&1 + ;; + + upgrade) + # do nothing + ;; + + failed-upgrade) + # do nothing + ;; + + abort-install) + # do nothing + ;; + + abort-upgrade) + # do nothing + ;; + + disappear) + # do nothing + ;; + + *) + echo "$0: incorrect arguments: $*" >&2 + exit 1 + ;; + +esac + +#DEBHELPER# + +exit 0 diff --git a/obs/debian.nut-server.preinst b/obs/debian.nut-server.preinst new file mode 100644 index 0000000000..f3e949fd35 --- /dev/null +++ b/obs/debian.nut-server.preinst @@ -0,0 +1,12 @@ +#!/bin/sh -e + +if [ "$1" = upgrade ]; then + # remove the obsolete udev file(s) + [ -f /etc/udev/rules.d/025_nut-usbups.rules ] && rm -f /etc/udev/rules.d/025_nut-usbups.rules + [ -f /etc/udev/rules.d/52_nut-usbups.rules ] && rm -f /etc/udev/rules.d/52_nut-usbups.rules + [ -f /etc/udev/rules.d/52-nut-usbups.rules ] && rm -f /etc/udev/rules.d/52-nut-usbups.rules +fi + +#DEBHELPER# + +exit 0 diff --git a/obs/debian.nut-server.prerm b/obs/debian.nut-server.prerm new file mode 100644 index 0000000000..6292ef83c7 --- /dev/null +++ b/obs/debian.nut-server.prerm @@ -0,0 +1,42 @@ +#!/bin/sh -e + +# the DEBHELPER token is purposely not used +# because we don't want the daemon to be +# stopped during an upgrade + +case "$1" in + + remove) + # nut-usb specifics + [ -f /etc/hotplug/usb/libhid.usermap ] && rm -f /etc/hotplug/usb/libhid.usermap + [ -f /etc/hotplug/usb/libhidups ] && rm -f /etc/hotplug/usb/libhidups + + [ -L /usr/doc/nut ] && rm -f /usr/doc/nut + # do stop the daemon on remove + invoke-rc.d nut stop && sleep 1 + [ -d /var/run/nut ] && rm -rf /var/run/nut/ + ;; + + upgrade) + [ -L /usr/doc/nut ] && rm -f /usr/doc/nut + # do not stop the daemon on upgrade + ;; + + failed-upgrade) + # do nothing + ;; + + deconfigure) + # do nothing + ;; + + *) + echo "$0: incorrect arguments: $*" >&2 + exit 1 + ;; + +esac + +#DEBHELPER# + +exit 0 diff --git a/obs/debian.nut-server.tmpfiles b/obs/debian.nut-server.tmpfiles new file mode 100644 index 0000000000..bf195cf142 --- /dev/null +++ b/obs/debian.nut-server.tmpfiles @@ -0,0 +1 @@ +d /run/nut 0770 root nut - - diff --git a/obs/debian.nut-snmp.docs b/obs/debian.nut-snmp.docs new file mode 100644 index 0000000000..9611f52b41 --- /dev/null +++ b/obs/debian.nut-snmp.docs @@ -0,0 +1 @@ +docs/snmp.txt diff --git a/obs/debian.nut-snmp.install b/obs/debian.nut-snmp.install new file mode 100644 index 0000000000..3c04aff520 --- /dev/null +++ b/obs/debian.nut-snmp.install @@ -0,0 +1,3 @@ +debian/tmp/lib/nut/snmp-ups +debian/tmp/lib/nut/snmp-ups-dmf +usr/share/nut/dmfsnmp diff --git a/obs/debian.nut-snmp.manpages b/obs/debian.nut-snmp.manpages new file mode 100644 index 0000000000..3c9644ed7c --- /dev/null +++ b/obs/debian.nut-snmp.manpages @@ -0,0 +1 @@ +debian/tmp/usr/share/man/man8/snmp-ups.8 diff --git a/obs/debian.nut-xml.install b/obs/debian.nut-xml.install new file mode 100644 index 0000000000..9c6d56dd6e --- /dev/null +++ b/obs/debian.nut-xml.install @@ -0,0 +1 @@ +debian/tmp/lib/nut/netxml-ups diff --git a/obs/debian.nut-xml.manpages b/obs/debian.nut-xml.manpages new file mode 100644 index 0000000000..91a537eadd --- /dev/null +++ b/obs/debian.nut-xml.manpages @@ -0,0 +1 @@ +debian/tmp/usr/share/man/man8/netxml-ups.8 diff --git a/obs/debian.nut.README.Debian b/obs/debian.nut.README.Debian new file mode 100644 index 0000000000..882e2afd65 --- /dev/null +++ b/obs/debian.nut.README.Debian @@ -0,0 +1,162 @@ +Network UPS Tools - Quick Start for Debian +------------------------------------------ + +Anyway, here are the quick start instructions for using nut: + +These Quick Start instructions are useful for a UPS connected to a single +machine. For a UPS connected to multiple machines, additional steps must be +taken, as outlined at the end of this file, including the notice regarding +SECURITY CONSIDERATIONS. + +(I) Upgrading +============= + +In case of upgrading, follow instructions given in: +/usr/share/doc/nut/UPGRADING + +Note that service(s) (driver(s), upsd, upsmon) are not restarted upon +upgrade, to avoid service disruption. You have to manually do it. + +(II) Installation +================= + +Configuration files are located in /etc/nut/ +In order to tune NUT configuration according to your needs, follow the below +information, along with the one provided inside these files. + +(1) /etc/nut/nut.conf (see 'man 5 nut.conf' for more information) + Edit /etc/nut/nut.conf and modify the "MODE" variable according to your + configuration. + + You can also fine tune the daemons options through UPSD_OPTIONS and + UPSMON_OPTIONS. + +The steps 2 to 5 are only required if you use a "standalone" or "netserver" +MODE. If you are running in "netclient" MODE, jump directly to section 6. + +(2) /etc/nut/ups.conf (see 'man 5 ups.conf' for more information) + + Edit /etc/nut/ups.conf and add something like: + [myups] + driver = usbhid-ups + port = auto + Use the appropriate driver for your UPS and select the correct port. + To select the driver, take a look at the UPS compatibility list: + /usr/share/nut/driver.list + + If you have more than one UPS, add as many entries as needed. + + If you wish to test manually whether your configuration of ups.conf is + correct, you may invoke upsdrvctl by hand (as root): + /sbin/upsdrvctl start [myups] + /sbin/upsdrvctl stop [myups] + + Ensure that the permissions of ups.conf do not permit the world to + read it. It should already be thus, but the following command + accomplishes this: + chown root:nut /etc/nut/ups.conf + chmod 640 /etc/nut/ups.conf + +(3) device port permissions + The nut user need to be able to access the device port both for reading and + writing. + + For serial devices, there are two possibilities: + + a) You can add the nut user to the dialout group. + The following command accomplishes this: + addgroup nut dialout + + This is not done by default for security reason on Debian, but is applied + on Ubuntu. + + b) Another solution, for system supporting udev, is to create a file, + For example /etc/udev/rules.d/92-nut-serialups.rules. It will + be used after /lib/udev/rules.d/91-permissions.rules, and + contains something like: + + KERNEL=="ttyS1", GROUP="nut" + + where 'ttyS1' has to be replaced by the exact name of your serial port. + + For USB devices, permissions are automatically set by the + /lib/udev/rules.d/52-nut-usbups.rules udev rules file. + +(4) /etc/nut/upsd.conf (see 'man 5 upsd.conf' for more information) + the default /etc/nut/upsd.conf is fine for a "standalone" configuration. + If you are in "netserver" MODE, you will have to modify the LISTEN option + to something suitable. + + Ensure that the permissions of upsd.conf do not permit the world to + read it. It should already be thus, but the following command + accomplishes this: + chown root:nut /etc/nut/upsd.conf + chmod 640 /etc/nut/upsd.conf + +(5) /etc/nut/upsd.users (see 'man 5 upsd.users' for more information) + Edit /etc/nut/upsd.users and add something like the following, + without the comments, in order to define a user: + [monmaster] + password = blah + upsmon master + Please use *different* usernames and passwords than you use on your + system; see the note regarding SECURITY CONSIDERATIONS at the end + of this file. + + Ensure that the permissions of upsd.users do not permit the world to + read it. It should already be thus, but the following command + accomplishes this: + chown root:nut /etc/nut/upsd.users + chmod 640 /etc/nut/upsd.users + +(6) /etc/nut/upsmon.conf (see 'man 5 upsmon.conf' for more information) + Edit /etc/nut/upsmon.conf and add something like the following: + MONITOR myups@localhost 1 monmaster blah master + POWERDOWNFLAG /etc/killpower + SHUTDOWNCMD "/sbin/shutdown -h +0" + + Ensure that the permissions of upsmon.conf do not permit the world to + read it. It should already be thus, but the following commands + accomplishes this: + chown root:nut /etc/nut/upsmon.conf + chmod 640 /etc/nut/upsmon.conf + +(7) /etc/default/nut + This file is not used anymore. + nut.conf provides all the needed features to replace this file. + +(8) start the daemon + If you use a "standalone" or "netserver" MODE, invoke: + - '/etc/init.d/nut-server start' to start upsd and appropriate driver(s), + - '/etc/init.d/nut-client start' to start upsmon. + + If you are running in "netclient" MODE, invoke: + - '/etc/init.d/nut-client start' to start upsmon. + + Check /var/log/syslog to ensure that daemon(s) started up correctly. + + +Additional Notes for Sharing a UPS +---------------------------------- +If you have multiple machines connected to the same UPS, you will need to +(a) modify the access control lists in upsd.conf on the server; +(b) add additional users to upsd.users on the server; and +(c) configure upsmon.conf on the clients. + +Please note that upsmon on a client machine and upsd on a server machine need +to communicate via your network. This means that you need to ensure that all +the networking equipment (hub, switch, router, etc.) between the client and the +server is powered by the UPS. Otherwise, when the power goes down, the network +connection between the client machine will be broken and the client will not +be told to shut down. + +SECURITY CONSIDERATIONS +----------------------- +Finally, please be aware of the following SECURITY CONSIDERATIONS: the TCP +communications between the client daemon, upsmon, and the server daemon, upsd, +send the username and passwords defined in upsd.users and used in upsmon.conf +over the wire UNENCRYPTED. This means that somebody could sniff the username +and password. A version that encrypts the connection using SSL should be +available someday. + +Please see the documentation in /usr/share/doc/nut/docs for more information. diff --git a/obs/debian.nut.TODO.Debian b/obs/debian.nut.TODO.Debian new file mode 100644 index 0000000000..b8fe9dd56b --- /dev/null +++ b/obs/debian.nut.TODO.Debian @@ -0,0 +1,9 @@ +- how to distribute the nut-scanner and its library? Ie, a single package, + or using the nut-{xml,snmp,...} packages. + this requires libusb (0.1), Net SNMP, FreeIPMi, Avahi, libupsclient and Neon! +- consider an SSL/TLS set of packages (ie nut-ssl, ...) + or help the port to NSS +- install the device-recorder.sh script (with libupsclient-dev or a more + generic nut-dev that depends?) +- address the /var/www issue with upstream +- audit and solve the lintian reports... diff --git a/obs/debian.nut.docs b/obs/debian.nut.docs new file mode 100644 index 0000000000..d0026f76e3 --- /dev/null +++ b/obs/debian.nut.docs @@ -0,0 +1,18 @@ +AUTHORS +MAINTAINERS +README +UPGRADING +docs/acknowledgements.txt +docs/config-notes.txt +docs/documentation.txt +docs/download.txt +docs/FAQ.txt +docs/features.txt +docs/history.txt +docs/nut-names.txt +docs/outlets.txt +docs/packager-guide.txt +docs/scheduling.txt +docs/security.txt +docs/support.txt +docs/user-manual.txt diff --git a/obs/debian.python-nut.install b/obs/debian.python-nut.install new file mode 100644 index 0000000000..fa24bc5bd3 --- /dev/null +++ b/obs/debian.python-nut.install @@ -0,0 +1 @@ +scripts/python/module/PyNUT.py usr/share/pyshared/ diff --git a/obs/debian.rules b/obs/debian.rules new file mode 100644 index 0000000000..b203467949 --- /dev/null +++ b/obs/debian.rules @@ -0,0 +1,140 @@ +#!/usr/bin/make -f + +include /usr/share/cdbs/1/rules/debhelper.mk +include /usr/share/cdbs/1/class/autotools.mk +include /usr/share/cdbs/1/class/python-module.mk + +include /usr/share/cdbs/1/rules/autoreconf.mk +# We cannot call autoreconf -f -i as it updates INSTALL which is used for doc +# generation +DEB_DH_AUTORECONF_ARGS = --as-needed + +DEB_HOST_ARCH_OS := $(shell dpkg-architecture -qDEB_HOST_ARCH_OS 2>/dev/null) + +# List any files which are not installed +include /usr/share/cdbs/1/rules/utils.mk +common-binary-post-install-arch:: list-missing + +DEB_LDFLAGS_MAINT_APPEND=-Wl,-z,defs -Wl,-O1 -Wl,--as-needed +include /usr/share/dpkg/buildflags.mk + +DEB_CONFIGURE_PREFIX := +DEB_CONFIGURE_SYSCONFDIR := /etc/nut +DEB_CONFIGURE_INCLUDEDIR := /usr/include +DEB_CONFIGURE_MANDIR := /usr/share/man +DEB_CONFIGURE_EXTRA_FLAGS := --libdir=\$${prefix}/lib/$(DEB_HOST_MULTIARCH) \ + --with-ssl --with-openssl --with-libltdl=yes \ + --with-cgi=auto --with-powerman=auto \ + --with-serial --with-usb --with-snmp --with-neon --with-ipmi \ + --with-dmf=yes \ + --with-dev \ + --disable-static \ + --with-statepath=/var/run/nut \ + --with-altpidpath=/var/run/nut \ + --with-drvpath=/lib/nut \ + --with-cgipath=/usr/lib/cgi-bin/nut \ + --with-htmlpath=/usr/share/nut/www \ + --with-pidpath=/var/run/nut \ + --datadir=/usr/share/nut \ + --with-pkgconfig-dir=/usr/lib/$(DEB_HOST_MULTIARCH)/pkgconfig \ + --with-user=nut --with-group=nut + +ifeq (linux,$(DEB_HOST_ARCH_OS)) + DEB_CONFIGURE_EXTRA_FLAGS+=--with-udev-dir=/lib/udev --with-systemdsystemunitdir=/lib/systemd/system +endif + +# only build documentation if asciidoc is installed +ifneq ($(shell which asciidoc),) +# DEB_CONFIGURE_EXTRA_FLAGS+=--with-doc=html-chunked,pdf + DEB_CONFIGURE_EXTRA_FLAGS+=--with-doc=man +endif + +pre-build:: debian/compat + (cd tools; python nut-snmpinfo.py) + +common-install-arch:: + # install the bash completion script + mkdir -p $(CURDIR)/debian/tmp/usr/share/bash-completion/completions/ + cp $(CURDIR)/scripts/misc/nut.bash_completion \ + $(CURDIR)/debian/tmp/usr/share/bash-completion/completions/nut + + # install the avahi service file + mkdir -p $(CURDIR)/debian/tmp/etc/avahi/services + cp $(CURDIR)/scripts/avahi/nut.service \ + $(CURDIR)/debian/tmp/etc/avahi/services + + # install Augeas lenses + mkdir -p $(CURDIR)/debian/tmp/usr/share/augeas/lenses/dist/tests + cp $(CURDIR)/scripts/augeas/*.aug \ + $(CURDIR)/debian/tmp/usr/share/augeas/lenses/dist/ + cp $(CURDIR)/scripts/augeas/tests/test_nut.aug \ + $(CURDIR)/debian/tmp/usr/share/augeas/lenses/dist/tests/ + + # install the default configuration + for f in $(CURDIR)/debian/tmp/etc/nut/*; do \ + nf=`basename $${f} | sed 's/\(.*\).sample/\1/'`; \ + mv $${f} $(CURDIR)/debian/tmp/etc/nut/$${nf}; \ + done + + # Move -dev file to /usr + rm -f $(CURDIR)/debian/tmp/lib/$(DEB_HOST_MULTIARCH)/libupsclient.so + ln -s /lib/$(DEB_HOST_MULTIARCH)/libupsclient.so.4 \ + $(CURDIR)/debian/tmp/usr/lib/$(DEB_HOST_MULTIARCH)/libupsclient.so + rm -f $(CURDIR)/debian/tmp/lib/$(DEB_HOST_MULTIARCH)/libnutclient.so + ln -s /lib/$(DEB_HOST_MULTIARCH)/libnutclient.so.0 \ + $(CURDIR)/debian/tmp/usr/lib/$(DEB_HOST_MULTIARCH)/libnutclient.so + rm -f $(CURDIR)/debian/tmp/lib/$(DEB_HOST_MULTIARCH)/libnutscan.so + ln -s /lib/$(DEB_HOST_MULTIARCH)/libnutscan.so.1 \ + $(CURDIR)/debian/tmp/usr/lib/$(DEB_HOST_MULTIARCH)/libnutscan.so + + # Install systemd files only on systems where it's supported + install -m 644 -D $(CURDIR)/debian/tmp/lib/systemd/system/nut-monitor.service \ + $(CURDIR)/debian/nut-client/lib/systemd/system/nut-monitor.service + install -D $(CURDIR)/debian/tmp/lib/$(DEB_HOST_MULTIARCH)/systemd/system-shutdown/nutshutdown \ + $(CURDIR)/debian/nut-server/lib/systemd/system-shutdown/nutshutdown + install -m 644 -D $(CURDIR)/debian/tmp/lib/systemd/system/nut-server.service \ + $(CURDIR)/debian/nut-server/lib/systemd/system/nut-server.service + install -m 644 -t $(CURDIR)/debian/nut-server/lib/systemd/system \ + $(CURDIR)/debian/tmp/lib/systemd/system/nut-driver* + + # Add a symlink to mask the LSB initscript + ln -s nut-monitor.service $(CURDIR)/debian/nut-client/lib/systemd/system/nut-client.service + + # Install tmpfiles config file to create /run/nut directory + install -m 644 -D $(CURDIR)/debian/nut-client.tmpfiles \ + $(CURDIR)/debian/nut-client/usr/lib/tmpfiles.d/nut-client.conf + install -m 644 -D $(CURDIR)/debian/nut-server.tmpfiles \ + $(CURDIR)/debian/nut-server/usr/lib/tmpfiles.d/nut-server.conf + +extradocs-install: + #install documentation + mkdir -p $(CURDIR)/debian/tmp/usr/share/doc/nut-doc/pdf + mkdir -p $(CURDIR)/debian/tmp/usr/share/doc/nut-doc/html + cp $(CURDIR)/docs/*.pdf $(CURDIR)/debian/tmp/usr/share/doc/nut-doc/pdf + cp $(CURDIR)/docs/FAQ.html $(CURDIR)/debian/tmp/usr/share/doc/nut-doc/html + + for f in $(CURDIR)/docs/*.chunked/; do \ + nf=`basename $${f} | sed 's/\(.*\)\.chunked/\1/'`; \ + cp -a $${f} $(CURDIR)/debian/tmp/usr/share/doc/nut-doc/html/$${nf}/; \ + done + +#common-install-indep:: extradocs-install +common-install-indep:: + # Make sure this exists for packaging to be consistent + mkdir -p $(CURDIR)/debian/tmp/usr/share/doc/nut-doc + +binary-install/nut-monitor:: + dh_python2 -pnut-monitor + +DEB_DH_INSTALLINIT_ARGS_nut-server := --init-script=nut-server --restart-after-upgrade +DEB_DH_INSTALLINIT_ARGS_nut-client := --init-script=nut-client --restart-after-upgrade +DEB_DH_SYSTEMD_START_ARGS_nut-server := --restart-after-upgrade +DEB_DH_SYSTEMD_START_ARGS_nut-client := --restart-after-upgrade +DEB_DH_COMPRESS_ARGS_nut-doc := -X.pdf + +ifeq (linux,$(DEB_HOST_ARCH_OS)) +# for Debian + DEB_DH_GENCONTROL_ARGS := -- -Vudev="udev (>= 0.124-1)" +# for Ubuntu +# DEB_DH_GENCONTROL_ARGS := -- -Vudev="udev (>= 136-1)" +endif diff --git a/obs/debian.series b/obs/debian.series new file mode 100644 index 0000000000..a75b428046 --- /dev/null +++ b/obs/debian.series @@ -0,0 +1,2 @@ +# This source tarball is taken from a dedicated Git branch head, so +# no further patches are to be applied (change the repo if needed). diff --git a/obs/debian.watch b/obs/debian.watch new file mode 100644 index 0000000000..606e46065f --- /dev/null +++ b/obs/debian.watch @@ -0,0 +1,2 @@ +version=3 +http://www.networkupstools.org/download.html .*/nut-(.*)\.tar\.(?:gz|bz2|xz) diff --git a/obs/nut.changes b/obs/nut.changes new file mode 100644 index 0000000000..e69de29bb2 diff --git a/obs/nut.dsc b/obs/nut.dsc new file mode 100644 index 0000000000..bdb3391923 --- /dev/null +++ b/obs/nut.dsc @@ -0,0 +1,34 @@ +Format: 1.0 +Source: nut +Binary: nut, nut-server, nut-client, nut-cgi, nut-snmp, nut-ipmi, nut-xml, nut-powerman-pdu, nut-doc, libupsclient4, libupsclient-dev, libnutclient0, libnutclient-dev, python-nut, nut-monitor, libups-nut-perl +Architecture: any all +Version: 2.7.4-11 +Maintainer: Arnaud Quette +Uploaders: Laurent Bigonville +Homepage: http://www.networkupstools.org/ +Standards-Version: 3.9.6 +Vcs-Browser: http://anonscm.debian.org/gitweb/?p=collab-maint/nut.git;a=summary +Vcs-Git: git://anonscm.debian.org/collab-maint/nut.git +Testsuite: autopkgtest +Build-Depends: debhelper (>= 8.1.3), cdbs (>= 0.4.122~), autotools-dev, dh-autoreconf, dh-systemd (>= 1.14), libgd-dev | libgd2-xpm-dev | libgd2-noxpm-dev, libsnmp-dev | libsnmp9-dev, libusb-dev (>= 0.1.8), libneon27-gnutls-dev | libneon27-dev, libpowerman0-dev (>= 2.3.3), libwrap0-dev (>= 7.6), python (>= 2.6.6-3~), libfreeipmi-dev (>= 0.8.5) [!hurd-i386], libipmimonitoring-dev (>= 1.1.5-2) [!hurd-i386], libnss3-dev, libtool, libltdl-dev, liblua5.1-0-dev, lua5.1 +Build-Depends-Indep: asciidoc (>= 8.6.3), docbook-xsl, dblatex (>= 0.2.5), libxml2-utils +Package-List: + libnutclient-dev deb libdevel optional arch=any + libnutclient0 deb libs optional arch=any + libnutscan-dev deb libdevel optional arch=any + libnutscan1 deb libs optional arch=any + libups-nut-perl deb perl optional arch=all + libupsclient-dev deb libdevel optional arch=any + libupsclient4 deb libs optional arch=any + nut deb metapackages optional arch=all + nut-cgi deb admin optional arch=any + nut-client deb admin optional arch=any + nut-doc deb doc optional arch=all + nut-ipmi deb admin optional arch=linux-any,kfreebsd-any + nut-monitor deb admin optional arch=all + nut-powerman-pdu deb admin extra arch=any + nut-server deb admin optional arch=any + nut-snmp deb admin optional arch=any + nut-xml deb admin optional arch=any + python-nut deb python optional arch=all +DEBTRANSFORM-TAR: nut-2.7.4-DMF+daisychain-cb7c7ea8b0d.tar.gz diff --git a/obs/nut.spec b/obs/nut.spec new file mode 100644 index 0000000000..32e3d78ba6 --- /dev/null +++ b/obs/nut.spec @@ -0,0 +1,380 @@ +# +# spec file for package nut.spec +# +# Copyright (c) 2015 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2016 Eaton EEIC. +# +# All modifications and additions to the file contributed by third parties +# remain the property of their copyright owners, unless otherwise agreed +# upon. The license for this file, and modifications and additions to the +# file, is the same license as for the pristine package itself (unless the +# license for the pristine package is not an Open Source License, in which +# case the license is the MIT License). An "Open Source License" is a +# license that conforms to the Open Source Definition (Version 1.9) +# published by the Open Source Initiative. + +# Please submit bugfixes or comments via http://bugs.opensuse.org/ +# + + +%define apache_serverroot %(%{_sbindir}/apxs2 -q datadir 2>/dev/null || %{_sbindir}/apxs -q PREFIX) +%define CGIPATH %{apache_serverroot}/cgi-bin +%define HTMLPATH %{apache_serverroot}/htdocs +%define MODELPATH %{_libexecdir}/ups/driver +%define STATEPATH %{_localstatedir}/lib/ups +%define CONFPATH %{_sysconfdir}/ups +%define USER upsd +%define GROUP daemon +%define LBRACE ( +%define RBRACE ) +%define QUOTE " +%define BACKSLASH \\ +# Collect all devices listed in ups-nut-device.fdi: +%define USBHIDDRIVERS %(zcat %{SOURCE0} | tr a-z A-Z | fgrep -a -A1 USBHID-UPS | sed -n 's/.*ATTR{IDVENDOR}==%{QUOTE}%{BACKSLASH}%{LBRACE}[^%{QUOTE}]*%{BACKSLASH}%{RBRACE}%{QUOTE}, ATTR{IDPRODUCT}==%{QUOTE}%{BACKSLASH}%{LBRACE}[^%{QUOTE}]*%{BACKSLASH}%{RBRACE}%{QUOTE}, MODE=.*/modalias%{LBRACE}usb:v%{BACKSLASH}1p%{BACKSLASH}2d*dc*dsc*dp*ic*isc*ip*%{RBRACE}/p' | tr '%{BACKSLASH}n' ' ') +%define USBNONHIDDRIVERS %(zcat %{SOURCE0} | tr a-z A-Z | fgrep -a -A1 _USB | sed -n 's/.*ATTR{IDVENDOR}==%{QUOTE}%{BACKSLASH}%{LBRACE}[^%{QUOTE}]*%{BACKSLASH}%{RBRACE}%{QUOTE}, ATTR{IDPRODUCT}==%{QUOTE}%{BACKSLASH}%{LBRACE}[^%{QUOTE}]*%{BACKSLASH}%{RBRACE}%{QUOTE}, MODE=.*/modalias%{LBRACE}usb:v%{BACKSLASH}1p%{BACKSLASH}2d*dc*dsc*dp*ic*isc*ip*%{RBRACE}/p' | tr '%{BACKSLASH}n' ' ') +%define systemdsystemunitdir %(pkg-config --variable=systemdsystemunitdir systemd) +%define systemdsystemdutildir %(pkg-config --variable=systemdutildir systemd) + +Name: nut +Version: 2.7.4 +Release: 4 +Summary: Network UPS Tools Core (Uninterruptible Power Supply Monitoring) +License: GPL-2.0+ +Group: Hardware/UPS +Url: http://www.networkupstools.org/ +#Source: http://www.networkupstools.org/source/2.7/%{name}-%{version}.tar.gz + +# git clone https://github.com/vyskocilm/nut daisychain+DMF +# git archive --prefix nut-2.7.4/ -o ~/work/BIOS/ROZ-OBS/Pool\:master/nut/nut-2.7.4-DMF+daisychain-cb7c7ea8b0d.tar.gz HEAD +Source: nut-2.7.4-DMF+daisychain-cb7c7ea8b0d.tar.gz +Patch2: 0002-nut-monitor-paths.patch +Patch3: 0003-install-dev-files-in-usr.patch +Patch4: 0004-fix-systemd-service.patch +Patch6: 0006-ups-conf-maxretry.patch +Patch8: 0008-drop-w3c-icons.patch +Patch11: 0011-libnutscanner-scan-one-ip-xml-http.patch +Patch14: 0014-upsrdvctl-nowait.patch +Patch15: 0015-Use-target-for-drivers-in-systemd.patch +Patch16: 0021-xml_scan_3tries.patch +# already upstream +#Patch17: 0024-snmp-ups-Eaton-3ph-UPS-improvements.patch +#Patch18: 0025-Fix-nut-scanner-compilation-in-some-environments.patch +#Patch19: 0026-snmp-ups-support-Raritan-Dominion-PX2-PDU.patch +Patch20: 0027-snmp-ups-support-APC-PDU.patch +# can't be merged, upstream change +#Patch21: 0028-nut-scanner-additional-search-path.patch +# can't be merged, upstream change +#Patch29: 0029-netvision-mib-uses-0-as-dfl.patch +# daisy chain is upstream +# Patch30: 0030-daisychain.patch +# Patch31: 0031-daisychain-complement.patch +# Patch32: 0032-snmp-ups-fix-some-regression-due-to-daisychain.patch +# Patch33: 0033-snmp-ups-fix-memory-leaks.patch +Patch34: 0034-fix_xmlv4_segfault.patch +#Patch35: 0035-daisychain+DMF.patch +#Patch36: 0036-post-carlos-dmf-fixes.patch + +Requires: %{_bindir}/fgrep +Requires: %{_bindir}/grep +Requires: %{_bindir}/pgrep +Requires: %{_bindir}/pkill +Requires: %{_bindir}/readlink +Requires: usbutils +#Requires(post): udev +BuildRoot: %{_tmppath}/%{name}-%{version}-build + +BuildRequires: avahi-devel +# To fix end-of-line encoding: +BuildRequires: dos2unix +BuildRequires: freeipmi-devel +BuildRequires: gcc-c++ +BuildRequires: gd-devel +BuildRequires: libtool +BuildRequires: libtool-ltdl-devel +BuildRequires: libusb-devel +BuildRequires: net-snmp-devel +BuildRequires: pkg-config +BuildRequires: python +BuildRequires: lua-devel >= 5.1 + +%if 0%{?suse_version} +BuildRequires: apache2-devel +BuildRequires: dbus-1-glib-devel +BuildRequires: libcppunit-devel +BuildRequires: libneon-devel +BuildRequires: libopenssl-devel +BuildRequires: systemd-rpm-macros +BuildRequires: powerman-devel +BuildRequires: tcpd-devel +# TODO: For doc build: move out of opensuse +BuildRequires: asciidoc +BuildRequires: dblatex +BuildRequires: libxslt-tools +%endif + +%if 0%{?centos_version} +BuildRequires: cppunit-devel +BuildRequires: dbus-glib-devel +BuildRequires: httpd-devel +BuildRequires: neon-devel +BuildRequires: openssl-devel +BuildRequires: tcp_wrappers-devel +BuildRequires: libxslt +%endif + +%if 0%{?rhel_version}>=7 +BuildRequires: dbus-glib-devel +BuildRequires: httpd-devel +BuildRequires: libusb +BuildRequires: neon +BuildRequires: openssl-devel +BuildRequires: tcp_wrappers-devel +BuildRequires: libxslt +%endif + +%if %{defined opensuse_version} +# Package provides driver for USB HID UPSes, but people can live with hal addon: +Enhances: %{USBHIDDRIVERS} +# Package provides the only avalailable driver for other USB UPSes: +Supplements: %{USBNONHIDDRIVERS} +%systemd_requires +%endif + +%description +Core package of Network UPS Tools. + +Network UPS Tools is a collection of programs which provide a common +interface for monitoring and administering UPS hardware. + +Detailed information about supported hardware can be found in +%{_docdir}/nut. + +%package drivers-net +Summary: Network UPS Tools - Extra Networking Drivers (for Network Monitoring) +Group: Hardware/UPS +Requires: %{name} = %{version} + +%description drivers-net +Networking drivers for the Network UPS Tools. You will need them +together with nut to provide UPS networking support. + +Network UPS Tools is a collection of programs which provide a common +interface for monitoring and administering UPS hardware. + +Detailed information about supported hardware can be found in +%{_docdir}/nut. + +%package -n libupsclient1 +Summary: Network UPS Tools Library (Uninterruptible Power Supply Monitoring) +Group: System/Libraries + +%description -n libupsclient1 +Shared library for the Network UPS Tools. + +Network UPS Tools is a collection of programs which provide a common +interface for monitoring and administering UPS hardware. + +Detailed information about supported hardware can be found in +%{_docdir}/nut. + +%package cgi +Summary: Network UPS Tools Web Server Support (UPS Status Pages) +Group: Hardware/UPS +Requires: %{name} = %{version} + +%description cgi +Web server support package for the Network UPS Tools. + +Predefined URL is http://localhost/nut/index.html + +Network UPS Tools is a collection of programs which provide a common +interface for monitoring and administering UPS hardware. + +Detailed information about supported hardware can be found in +%{_docdir}/nut. + +%package devel +Summary: Network UPS Tools (Uninterruptible Power Supply Monitoring) +Group: Development/Libraries/C and C++ +Requires: %{name} = %{version} +Requires: openssl-devel + +%description devel +Network UPS Tools is a collection of programs which provide a common +interface for monitoring and administering UPS hardware. + +Detailed information about supported hardware can be found in +%{_docdir}/nut. + +%prep +%setup -q +%patch2 -p1 +%patch3 -p1 +%patch4 -p1 +%patch6 -p1 +%patch8 -p1 +%patch11 -p1 +%patch14 -p1 +%patch15 -p1 +%patch16 -p1 +# % patch17 -p1 +# % patch18 -p1 +# % patch19 -p1 +%patch20 -p1 +# % patch21 -p1 +# % patch29 -p1 +# % patch30 -p1 +# % patch31 -p1 +# % patch32 -p1 +# % patch33 -p1 +%patch34 -p1 +# % patch35 -p1 +# % patch36 -p1 + +%build +autoreconf -f -i +%configure --disable-static --with-pic --libexecdir=%{_prefix}/lib\ + --sysconfdir=%{CONFPATH}\ + --datadir=%{_datadir}/nut\ + --with-ssl --with-openssl\ + --with-libltdl=yes\ + --with-cgi=auto\ + --with-serial\ + --with-usb\ + --with-snmp\ + --with-neon\ + --with-dev\ + --with-ipmi \ + --with-powerman=auto\ + --with-doc=man\ + --with-htmlpath=%{HTMLPATH}\ + --with-cgipath=%{CGIPATH}\ + --with-statepath=%{STATEPATH}\ + --with-drvpath=%{MODELPATH}\ + --with-user=%{USER}\ + --with-group=%{GROUP} \ + --with-udev-dir=%{_sysconfdir}/udev \ + --enable-option-checking=fatal + +(cd tools; python nut-snmpinfo.py) + +make %{?_smp_mflags} +PORT=$(sed -n 's/#define PORT //p' config.log) +if test "$PORT" = 3493 ; then + PORT=nut +fi + +%install +make DESTDIR=%{buildroot} install %{?_smp_mflags} +mkdir -p %{buildroot}%{STATEPATH} +# SuSE rc +mkdir -p %{buildroot}%{_sbindir} +mkdir -p %{buildroot}%{_sysconfdir}/logrotate.d +install -m 644 scripts/logrotate/nutlogd %{buildroot}%{_sysconfdir}/logrotate.d/ +mkdir -p %{buildroot}%{STATEPATH} +rename .sample "" %{buildroot}%{_sysconfdir}/ups/*.sample +mkdir %{buildroot}/bin +mv %{buildroot}%{_bindir}/upssched-cmd %{buildroot}/bin/upssched-cmd +# Rename web pages to not conflict with apache2-example-pages or user home page: +mkdir %{buildroot}%{HTMLPATH}/nut %{buildroot}%{CGIPATH}/nut +mv %{buildroot}%{HTMLPATH}/*.{html,png} %{buildroot}%{HTMLPATH}/nut/ +mv %{buildroot}%{CGIPATH}/*.cgi %{buildroot}%{CGIPATH}/nut +find %{buildroot} -type f -name "*.la" -delete -print +mkdir -p %{buildroot}%{_sysconfdir}/bash_completion.d +install -m0644 scripts/misc/nut.bash_completion %{buildroot}%{_sysconfdir}/bash_completion.d/ + +%pre +usr/sbin/useradd -r -g %{GROUP} -s /bin/false \ + -c "UPS daemon" -d /sbin %{USER} 2>/dev/null || : +%if %{defined opensuse_version} +%service_add_pre nut-driver.service nut-server.service nut-monitor.service +%endif + +%post +# Be sure that all files are owned by a dedicated user. +bin/chown -R %{USER}:%{GROUP} %{STATEPATH} +# Be sure that all files are owned by a dedicated user. +bin/chown %{USER}:root %{CONFPATH}/upsd.conf %{CONFPATH}/upsmon.conf %{CONFPATH}/upsd.users +bin/chmod 600 %{CONFPATH}/upsd.conf %{CONFPATH}/upsmon.conf %{CONFPATH}/upsd.users +# And finally trigger udev to set permissions according to newly installed rules files. +/sbin/udevadm trigger --subsystem-match=usb --property-match=DEVTYPE=usb_device +%if %{defined opensuse_version} +%service_add_post nut-driver.service nut-server.service nut-monitor.service +%endif + +%preun +%if %{defined opensuse_version} +%service_del_preun nut-driver.service nut-server.service nut-monitor.service +%endif + +%postun +%if %{defined opensuse_version} +%service_del_postun nut-driver.service nut-server.service nut-monitor.service +%endif + +%post -n libupsclient1 -p /sbin/ldconfig + +%postun -n libupsclient1 -p /sbin/ldconfig + +%files +%defattr(-,root,root) +%doc AUTHORS COPYING ChangeLog MAINTAINERS NEWS README UPGRADING docs/*.txt docs/cables +/bin/* +%{_sysconfdir}/bash_completion.d/* +%{_sysconfdir}/logrotate.d/* +%{_bindir}/* +%{_datadir}/nut +%{_mandir}/man5/*.* +%{_mandir}/man8/*.* +%exclude %{_mandir}/man8/netxml-ups*.* +%exclude %{_mandir}/man8/snmp-ups*.* +%dir %{_libexecdir}/ups +%{_sbindir}/* +%dir %{_sysconfdir}/udev +%dir %{_sysconfdir}/udev/rules.d +%config(noreplace) %{_sysconfdir}/udev/rules.d/*.rules +%config(noreplace) %{CONFPATH}/hosts.conf +%config(noreplace) %attr(600,%{USER},root) %{CONFPATH}/upsd.conf +%config(noreplace) %attr(600,%{USER},root) %{CONFPATH}/upsd.users +%config(noreplace) %attr(600,%{USER},root) %{CONFPATH}/upsmon.conf +%dir %{CONFPATH} +%config(noreplace) %{CONFPATH}/nut.conf +%config(noreplace) %{CONFPATH}/ups.conf +%config(noreplace) %{CONFPATH}/upsset.conf +%config(noreplace) %{CONFPATH}/upssched.conf +%dir %{MODELPATH} +%{MODELPATH}/* +%exclude %{MODELPATH}/snmp-ups +%exclude %{MODELPATH}/netxml-ups +%attr(700,%{USER},%{GROUP}) %{STATEPATH} +%{systemdsystemunitdir}/* +%dir %{_libdir}/systemd/ +%dir %{_libdir}/systemd/system-shutdown/ +%{_libdir}/systemd/system-shutdown/nutshutdown + +%files drivers-net +%defattr(-,root,root) +%{MODELPATH}/snmp-ups +%{MODELPATH}/netxml-ups +%{_mandir}/man8/netxml-ups*.* +%{_mandir}/man8/snmp-ups*.* + +%files -n libupsclient1 +%defattr(-,root,root) +%{_libdir}/*.so.* + +%files cgi +%defattr(-,root,root) +%{CGIPATH}/nut +%{HTMLPATH}/nut +%config(noreplace) %{CONFPATH}/upsstats-single.html +%config(noreplace) %{CONFPATH}/upsstats.html + +%files devel +%defattr(-,root,root) +%{_includedir}/*.h +%{_libdir}/*.so +%{_libdir}/pkgconfig/*.pc +%{_mandir}/man3/*.* + +%changelog From b89e4e0ea64084f015e0b6a4ab694e4e02b79d7c Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Fri, 19 Aug 2016 00:37:49 +0200 Subject: [PATCH 402/805] Seems OBS mkpac.sh wants a file named "control" in any debian-pkg directory type (obs/ too) Signed-off-by: Jim Klimov --- obs/control | 1 + 1 file changed, 1 insertion(+) create mode 120000 obs/control diff --git a/obs/control b/obs/control new file mode 120000 index 0000000000..467d6decea --- /dev/null +++ b/obs/control @@ -0,0 +1 @@ +debian.control \ No newline at end of file From b977a05de0aaa6c7f414c0b2e83a5ee19b3b307e Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Fri, 19 Aug 2016 00:48:21 +0200 Subject: [PATCH 403/805] Update packaging files to install DMF data files Signed-off-by: Jim Klimov --- obs/debian.nut-snmp.install | 1 + obs/debian.rules | 2 +- obs/nut.spec | 61 +++++++++++++++++++++---------------- 3 files changed, 37 insertions(+), 27 deletions(-) diff --git a/obs/debian.nut-snmp.install b/obs/debian.nut-snmp.install index 3c04aff520..767eb3bb8f 100644 --- a/obs/debian.nut-snmp.install +++ b/obs/debian.nut-snmp.install @@ -1,3 +1,4 @@ debian/tmp/lib/nut/snmp-ups debian/tmp/lib/nut/snmp-ups-dmf usr/share/nut/dmfsnmp +usr/share/nut/dmfnutscan diff --git a/obs/debian.rules b/obs/debian.rules index b203467949..945921b7c0 100644 --- a/obs/debian.rules +++ b/obs/debian.rules @@ -26,7 +26,7 @@ DEB_CONFIGURE_EXTRA_FLAGS := --libdir=\$${prefix}/lib/$(DEB_HOST_MULTIARCH) \ --with-ssl --with-openssl --with-libltdl=yes \ --with-cgi=auto --with-powerman=auto \ --with-serial --with-usb --with-snmp --with-neon --with-ipmi \ - --with-dmf=yes \ + --with-snmp_dmf_lua=yes \ --with-dev \ --disable-static \ --with-statepath=/var/run/nut \ diff --git a/obs/nut.spec b/obs/nut.spec index 32e3d78ba6..495ab4fe3c 100644 --- a/obs/nut.spec +++ b/obs/nut.spec @@ -47,32 +47,32 @@ Url: http://www.networkupstools.org/ # git clone https://github.com/vyskocilm/nut daisychain+DMF # git archive --prefix nut-2.7.4/ -o ~/work/BIOS/ROZ-OBS/Pool\:master/nut/nut-2.7.4-DMF+daisychain-cb7c7ea8b0d.tar.gz HEAD Source: nut-2.7.4-DMF+daisychain-cb7c7ea8b0d.tar.gz -Patch2: 0002-nut-monitor-paths.patch -Patch3: 0003-install-dev-files-in-usr.patch -Patch4: 0004-fix-systemd-service.patch -Patch6: 0006-ups-conf-maxretry.patch -Patch8: 0008-drop-w3c-icons.patch -Patch11: 0011-libnutscanner-scan-one-ip-xml-http.patch -Patch14: 0014-upsrdvctl-nowait.patch -Patch15: 0015-Use-target-for-drivers-in-systemd.patch -Patch16: 0021-xml_scan_3tries.patch -# already upstream -#Patch17: 0024-snmp-ups-Eaton-3ph-UPS-improvements.patch -#Patch18: 0025-Fix-nut-scanner-compilation-in-some-environments.patch -#Patch19: 0026-snmp-ups-support-Raritan-Dominion-PX2-PDU.patch -Patch20: 0027-snmp-ups-support-APC-PDU.patch -# can't be merged, upstream change -#Patch21: 0028-nut-scanner-additional-search-path.patch -# can't be merged, upstream change -#Patch29: 0029-netvision-mib-uses-0-as-dfl.patch -# daisy chain is upstream -# Patch30: 0030-daisychain.patch -# Patch31: 0031-daisychain-complement.patch -# Patch32: 0032-snmp-ups-fix-some-regression-due-to-daisychain.patch -# Patch33: 0033-snmp-ups-fix-memory-leaks.patch -Patch34: 0034-fix_xmlv4_segfault.patch -#Patch35: 0035-daisychain+DMF.patch -#Patch36: 0036-post-carlos-dmf-fixes.patch +#Patch2: 0002-nut-monitor-paths.patch +#Patch3: 0003-install-dev-files-in-usr.patch +#Patch4: 0004-fix-systemd-service.patch +#Patch6: 0006-ups-conf-maxretry.patch +#Patch8: 0008-drop-w3c-icons.patch +#Patch11: 0011-libnutscanner-scan-one-ip-xml-http.patch +#Patch14: 0014-upsrdvctl-nowait.patch +#Patch15: 0015-Use-target-for-drivers-in-systemd.patch +#Patch16: 0021-xml_scan_3tries.patch +### already upstream +###Patch17: 0024-snmp-ups-Eaton-3ph-UPS-improvements.patch +###Patch18: 0025-Fix-nut-scanner-compilation-in-some-environments.patch +###Patch19: 0026-snmp-ups-support-Raritan-Dominion-PX2-PDU.patch +#Patch20: 0027-snmp-ups-support-APC-PDU.patch +### can't be merged, upstream change +###Patch21: 0028-nut-scanner-additional-search-path.patch +### can't be merged, upstream change +###Patch29: 0029-netvision-mib-uses-0-as-dfl.patch +### daisy chain is upstream +### Patch30: 0030-daisychain.patch +### Patch31: 0031-daisychain-complement.patch +### Patch32: 0032-snmp-ups-fix-some-regression-due-to-daisychain.patch +### Patch33: 0033-snmp-ups-fix-memory-leaks.patch +#Patch34: 0034-fix_xmlv4_segfault.patch +###Patch35: 0035-daisychain+DMF.patch +###Patch36: 0036-post-carlos-dmf-fixes.patch Requires: %{_bindir}/fgrep Requires: %{_bindir}/grep @@ -243,6 +243,7 @@ autoreconf -f -i --with-usb\ --with-snmp\ --with-neon\ + --with-snmp_dmf_lua\ --with-dev\ --with-ipmi \ --with-powerman=auto\ @@ -324,6 +325,8 @@ bin/chmod 600 %{CONFPATH}/upsd.conf %{CONFPATH}/upsmon.conf %{CONFPATH}/upsd.use %{_sysconfdir}/logrotate.d/* %{_bindir}/* %{_datadir}/nut +%exclude %{_datadir}/nut/dmfnutscan +%exclude %{_datadir}/nut/dmfsnmp %{_mandir}/man5/*.* %{_mandir}/man8/*.* %exclude %{_mandir}/man8/netxml-ups*.* @@ -358,6 +361,12 @@ bin/chmod 600 %{CONFPATH}/upsd.conf %{CONFPATH}/upsmon.conf %{CONFPATH}/upsd.use %{MODELPATH}/netxml-ups %{_mandir}/man8/netxml-ups*.* %{_mandir}/man8/snmp-ups*.* +%dir %{_datadir}/nut/dmfnutscan +%dir %{_datadir}/nut/dmfsnmp +%{_datadir}/nut/dmfnutscan/*.dmf +%{_datadir}/nut/dmfsnmp/*.dmf +%{_datadir}/nut/dmfnutscan/*.xsd +%{_datadir}/nut/dmfsnmp/*.xsd %files -n libupsclient1 %defattr(-,root,root) From a5bc5b5de5119bd16613e5f1f8913a6652e0e07c Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Fri, 19 Aug 2016 01:03:24 +0200 Subject: [PATCH 404/805] Update OBS packaging to deliver bin/nut-scanner-reindex-dmfsnmp Signed-off-by: Jim Klimov --- obs/debian.nut-snmp.install | 1 + obs/nut.spec | 2 ++ 2 files changed, 3 insertions(+) diff --git a/obs/debian.nut-snmp.install b/obs/debian.nut-snmp.install index 767eb3bb8f..60d066444d 100644 --- a/obs/debian.nut-snmp.install +++ b/obs/debian.nut-snmp.install @@ -1,4 +1,5 @@ debian/tmp/lib/nut/snmp-ups debian/tmp/lib/nut/snmp-ups-dmf +debian/tmp/bin/nut-scanner-reindex-dmfsnmp usr/share/nut/dmfsnmp usr/share/nut/dmfnutscan diff --git a/obs/nut.spec b/obs/nut.spec index 495ab4fe3c..2fdfb80d46 100644 --- a/obs/nut.spec +++ b/obs/nut.spec @@ -324,6 +324,7 @@ bin/chmod 600 %{CONFPATH}/upsd.conf %{CONFPATH}/upsmon.conf %{CONFPATH}/upsd.use %{_sysconfdir}/bash_completion.d/* %{_sysconfdir}/logrotate.d/* %{_bindir}/* +%exclude %{bindir}/nut-scanner-reindex-dmfsnmp %{_datadir}/nut %exclude %{_datadir}/nut/dmfnutscan %exclude %{_datadir}/nut/dmfsnmp @@ -359,6 +360,7 @@ bin/chmod 600 %{CONFPATH}/upsd.conf %{CONFPATH}/upsmon.conf %{CONFPATH}/upsd.use %defattr(-,root,root) %{MODELPATH}/snmp-ups %{MODELPATH}/netxml-ups +%{bindir}/nut-scanner-reindex-dmfsnmp %{_mandir}/man8/netxml-ups*.* %{_mandir}/man8/snmp-ups*.* %dir %{_datadir}/nut/dmfnutscan From 660ab27b7823da976daeac379fe1142567f8992f Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Fri, 19 Aug 2016 01:10:22 +0200 Subject: [PATCH 405/805] OBS nut.dsc : comment away DEBTRANSFORM of teh tarball Signed-off-by: Jim Klimov --- obs/nut.dsc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/obs/nut.dsc b/obs/nut.dsc index bdb3391923..5869cbb257 100644 --- a/obs/nut.dsc +++ b/obs/nut.dsc @@ -31,4 +31,4 @@ Package-List: nut-snmp deb admin optional arch=any nut-xml deb admin optional arch=any python-nut deb python optional arch=all -DEBTRANSFORM-TAR: nut-2.7.4-DMF+daisychain-cb7c7ea8b0d.tar.gz +# DEBTRANSFORM-TAR: nut-2.7.4-DMF+daisychain-cb7c7ea8b0d.tar.gz From be2c7693ef644c388ba7a1ecf5baac022be9118a Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Fri, 19 Aug 2016 01:17:14 +0200 Subject: [PATCH 406/805] OBS nut.spec : use common tarball filename pattern Signed-off-by: Jim Klimov --- obs/nut.spec | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/obs/nut.spec b/obs/nut.spec index 2fdfb80d46..95f19939f3 100644 --- a/obs/nut.spec +++ b/obs/nut.spec @@ -37,7 +37,7 @@ Name: nut Version: 2.7.4 -Release: 4 +Release: 11 Summary: Network UPS Tools Core (Uninterruptible Power Supply Monitoring) License: GPL-2.0+ Group: Hardware/UPS @@ -46,7 +46,8 @@ Url: http://www.networkupstools.org/ # git clone https://github.com/vyskocilm/nut daisychain+DMF # git archive --prefix nut-2.7.4/ -o ~/work/BIOS/ROZ-OBS/Pool\:master/nut/nut-2.7.4-DMF+daisychain-cb7c7ea8b0d.tar.gz HEAD -Source: nut-2.7.4-DMF+daisychain-cb7c7ea8b0d.tar.gz +Source0: %{name}-%{version}.tar.gz +#Source: nut-2.7.4-DMF+daisychain-cb7c7ea8b0d.tar.gz #Patch2: 0002-nut-monitor-paths.patch #Patch3: 0003-install-dev-files-in-usr.patch #Patch4: 0004-fix-systemd-service.patch From 16e4e7229370bdeff5dd0c03c077125f76e388f4 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Fri, 19 Aug 2016 01:29:27 +0200 Subject: [PATCH 407/805] OBS : try to call autogen.sh before configuring sources Signed-off-by: Jim Klimov --- obs/debian.rules | 1 + obs/nut.spec | 46 +++++++++++++++++++++++----------------------- 2 files changed, 24 insertions(+), 23 deletions(-) diff --git a/obs/debian.rules b/obs/debian.rules index 945921b7c0..4bb1d5034f 100644 --- a/obs/debian.rules +++ b/obs/debian.rules @@ -51,6 +51,7 @@ endif pre-build:: debian/compat (cd tools; python nut-snmpinfo.py) + sh autogen.sh common-install-arch:: # install the bash completion script diff --git a/obs/nut.spec b/obs/nut.spec index 95f19939f3..9f87e264df 100644 --- a/obs/nut.spec +++ b/obs/nut.spec @@ -209,31 +209,31 @@ Detailed information about supported hardware can be found in %prep %setup -q -%patch2 -p1 -%patch3 -p1 -%patch4 -p1 -%patch6 -p1 -%patch8 -p1 -%patch11 -p1 -%patch14 -p1 -%patch15 -p1 -%patch16 -p1 -# % patch17 -p1 -# % patch18 -p1 -# % patch19 -p1 -%patch20 -p1 -# % patch21 -p1 -# % patch29 -p1 -# % patch30 -p1 -# % patch31 -p1 -# % patch32 -p1 -# % patch33 -p1 -%patch34 -p1 -# % patch35 -p1 -# % patch36 -p1 +#%patch2 -p1 +#%patch3 -p1 +#%patch4 -p1 +#%patch6 -p1 +#%patch8 -p1 +#%patch11 -p1 +#%patch14 -p1 +#%patch15 -p1 +#%patch16 -p1 +### % patch17 -p1 +### % patch18 -p1 +### % patch19 -p1 +#%patch20 -p1 +### % patch21 -p1 +### % patch29 -p1 +### % patch30 -p1 +### % patch31 -p1 +### % patch32 -p1 +### % patch33 -p1 +#%patch34 -p1 +### % patch35 -p1 +### % patch36 -p1 %build -autoreconf -f -i +sh autogen.sh %configure --disable-static --with-pic --libexecdir=%{_prefix}/lib\ --sysconfdir=%{CONFPATH}\ --datadir=%{_datadir}/nut\ From 65463e48a47ed7708d8218212a9d56eb02ecbabf Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Fri, 19 Aug 2016 01:38:37 +0200 Subject: [PATCH 408/805] nut.spec : make asciidoc a common dependency Signed-off-by: Jim Klimov --- obs/nut.spec | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/obs/nut.spec b/obs/nut.spec index 9f87e264df..92e11a1f62 100644 --- a/obs/nut.spec +++ b/obs/nut.spec @@ -108,10 +108,11 @@ BuildRequires: systemd-rpm-macros BuildRequires: powerman-devel BuildRequires: tcpd-devel # TODO: For doc build: move out of opensuse -BuildRequires: asciidoc +###BuildRequires: asciidoc BuildRequires: dblatex BuildRequires: libxslt-tools %endif +BuildRequires: asciidoc %if 0%{?centos_version} BuildRequires: cppunit-devel From 2b136c5277bdae34113a510b35fb42b8d13f31b8 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Fri, 19 Aug 2016 01:40:14 +0200 Subject: [PATCH 409/805] OBS nut.spec : fix LUA requirement at == 5.1 (not >= 5.1) Signed-off-by: Jim Klimov --- obs/nut.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/obs/nut.spec b/obs/nut.spec index 92e11a1f62..d80e509a5f 100644 --- a/obs/nut.spec +++ b/obs/nut.spec @@ -96,7 +96,7 @@ BuildRequires: libusb-devel BuildRequires: net-snmp-devel BuildRequires: pkg-config BuildRequires: python -BuildRequires: lua-devel >= 5.1 +BuildRequires: lua-devel == 5.1 %if 0%{?suse_version} BuildRequires: apache2-devel From 2531f49b64f9706bba425c3c31a7da2d32836581 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Fri, 19 Aug 2016 01:43:48 +0200 Subject: [PATCH 410/805] OBS nut.spec : make manpages optional Signed-off-by: Jim Klimov --- obs/nut.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/obs/nut.spec b/obs/nut.spec index d80e509a5f..b1a51d3125 100644 --- a/obs/nut.spec +++ b/obs/nut.spec @@ -249,7 +249,7 @@ sh autogen.sh --with-dev\ --with-ipmi \ --with-powerman=auto\ - --with-doc=man\ + --with-doc=man=auto\ --with-htmlpath=%{HTMLPATH}\ --with-cgipath=%{CGIPATH}\ --with-statepath=%{STATEPATH}\ From e5390d35c399b1b22272671568fd215cf5e18560 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Fri, 19 Aug 2016 01:47:49 +0200 Subject: [PATCH 411/805] Build Requires python-pycparser Signed-off-by: Jim Klimov --- obs/nut.dsc | 2 +- obs/nut.spec | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/obs/nut.dsc b/obs/nut.dsc index 5869cbb257..59f7fc63b1 100644 --- a/obs/nut.dsc +++ b/obs/nut.dsc @@ -10,7 +10,7 @@ Standards-Version: 3.9.6 Vcs-Browser: http://anonscm.debian.org/gitweb/?p=collab-maint/nut.git;a=summary Vcs-Git: git://anonscm.debian.org/collab-maint/nut.git Testsuite: autopkgtest -Build-Depends: debhelper (>= 8.1.3), cdbs (>= 0.4.122~), autotools-dev, dh-autoreconf, dh-systemd (>= 1.14), libgd-dev | libgd2-xpm-dev | libgd2-noxpm-dev, libsnmp-dev | libsnmp9-dev, libusb-dev (>= 0.1.8), libneon27-gnutls-dev | libneon27-dev, libpowerman0-dev (>= 2.3.3), libwrap0-dev (>= 7.6), python (>= 2.6.6-3~), libfreeipmi-dev (>= 0.8.5) [!hurd-i386], libipmimonitoring-dev (>= 1.1.5-2) [!hurd-i386], libnss3-dev, libtool, libltdl-dev, liblua5.1-0-dev, lua5.1 +Build-Depends: debhelper (>= 8.1.3), cdbs (>= 0.4.122~), autotools-dev, dh-autoreconf, dh-systemd (>= 1.14), libgd-dev | libgd2-xpm-dev | libgd2-noxpm-dev, libsnmp-dev | libsnmp9-dev, libusb-dev (>= 0.1.8), libneon27-gnutls-dev | libneon27-dev, libpowerman0-dev (>= 2.3.3), libwrap0-dev (>= 7.6), python (>= 2.6.6-3~), libfreeipmi-dev (>= 0.8.5) [!hurd-i386], libipmimonitoring-dev (>= 1.1.5-2) [!hurd-i386], libnss3-dev, libtool, libltdl-dev, liblua5.1-0-dev, lua5.1, python-pycparser Build-Depends-Indep: asciidoc (>= 8.6.3), docbook-xsl, dblatex (>= 0.2.5), libxml2-utils Package-List: libnutclient-dev deb libdevel optional arch=any diff --git a/obs/nut.spec b/obs/nut.spec index b1a51d3125..26c5d3af72 100644 --- a/obs/nut.spec +++ b/obs/nut.spec @@ -96,6 +96,8 @@ BuildRequires: libusb-devel BuildRequires: net-snmp-devel BuildRequires: pkg-config BuildRequires: python +# TODO: Make sure how this is named +BuildRequires: python-pycparser BuildRequires: lua-devel == 5.1 %if 0%{?suse_version} From b059871b4ec672ead626a89576a1526c7521f2e6 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Fri, 19 Aug 2016 14:48:43 +0200 Subject: [PATCH 412/805] OBS: Try to rectify package numbering and dependencies of sub-packages for Debian Signed-off-by: Jim Klimov --- obs/debian.control | 14 +++++++------- obs/nut.dsc | 2 +- obs/nut.spec | 2 +- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/obs/debian.control b/obs/debian.control index 5454404e5c..6b5e6df58e 100644 --- a/obs/debian.control +++ b/obs/debian.control @@ -34,7 +34,7 @@ XS-Testsuite: autopkgtest Package: nut Architecture: all Section: metapackages -Depends: ${misc:Depends}, nut-server, nut-client +Depends: ${misc:Depends}, nut-server (= ${binary:Version}), nut-client (= ${binary:Version}) Description: network UPS tools - metapackage Network UPS Tools (NUT) is a client/server monitoring system that allows computers to share uninterruptible power supply (UPS) and @@ -50,7 +50,7 @@ Architecture: any Depends: ${shlibs:Depends}, ${misc:Depends}, adduser, lsb-base (>= 3.0-6), ${udev}, nut-client (= ${binary:Version}) Suggests: nut-cgi, nut-snmp, nut-ipmi, nut-xml Conflicts: nut-hal-drivers -Replaces: nut (<< 2.6.1-2~) +Replaces: nut (<< 2.7.4-11~) Breaks: nut (<< 2.6.1-2~) Description: network UPS tools - core system Network UPS Tools (NUT) is a client/server monitoring system that @@ -69,7 +69,7 @@ Provides: ups-monitor Conflicts: ups-monitor Recommends: bash-completion Suggests: nut-monitor -Replaces: ups-monitor, nut (<< 2.6.1-2~), nut-server (<< 2.6.3-1~) +Replaces: ups-monitor, nut (<< 2.7.4-11~), nut-server (<< 2.7.4-11~) Breaks: nut (<< 2.6.1-2~), nut-server (<< 2.6.3-1~) Description: network UPS tools - clients Network UPS Tools (NUT) is a client/server monitoring system that @@ -98,7 +98,7 @@ Description: network UPS tools - web interface Package: nut-snmp Architecture: any -Depends: ${shlibs:Depends}, ${misc:Depends}, nut (>= 1.4.1-pre1) +Depends: ${shlibs:Depends}, ${misc:Depends}, nut (= ${binary:Version}) Description: network UPS tools - SNMP driver Network UPS Tools (NUT) is a client/server monitoring system that allows computers to share uninterruptible power supply (UPS) and @@ -112,7 +112,7 @@ Description: network UPS tools - SNMP driver Package: nut-ipmi Architecture: linux-any kfreebsd-any -Depends: ${shlibs:Depends}, ${misc:Depends}, nut (>= 1.4.1-pre1) +Depends: ${shlibs:Depends}, ${misc:Depends}, nut (= ${binary:Version}) Description: network UPS tools - IPMI driver Network UPS Tools (NUT) is a client/server monitoring system that allows computers to share uninterruptible power supply (UPS) and @@ -127,7 +127,7 @@ Description: network UPS tools - IPMI driver Package: nut-xml Architecture: any -Depends: ${shlibs:Depends}, ${misc:Depends}, nut (>= 2.2.2) +Depends: ${shlibs:Depends}, ${misc:Depends}, nut (= ${binary:Version}) Description: network UPS tools - XML/HTTP driver Network UPS Tools (NUT) is a client/server monitoring system that allows computers to share uninterruptible power supply (UPS) and @@ -142,7 +142,7 @@ Description: network UPS tools - XML/HTTP driver Package: nut-powerman-pdu Architecture: any Priority: extra -Depends: ${shlibs:Depends}, ${misc:Depends}, nut (>= 2.4.0), powerman (>= 2.3.3) +Depends: ${shlibs:Depends}, ${misc:Depends}, nut (= ${binary:Version}), powerman (>= 2.3.3) Description: network UPS tools - PowerMan PDU driver Network UPS Tools (NUT) is a client/server monitoring system that allows computers to share uninterruptible power supply (UPS) and diff --git a/obs/nut.dsc b/obs/nut.dsc index 59f7fc63b1..a014bdc05f 100644 --- a/obs/nut.dsc +++ b/obs/nut.dsc @@ -2,7 +2,7 @@ Format: 1.0 Source: nut Binary: nut, nut-server, nut-client, nut-cgi, nut-snmp, nut-ipmi, nut-xml, nut-powerman-pdu, nut-doc, libupsclient4, libupsclient-dev, libnutclient0, libnutclient-dev, python-nut, nut-monitor, libups-nut-perl Architecture: any all -Version: 2.7.4-11 +Version: 2.7.4-12 Maintainer: Arnaud Quette Uploaders: Laurent Bigonville Homepage: http://www.networkupstools.org/ diff --git a/obs/nut.spec b/obs/nut.spec index 26c5d3af72..e05254be1c 100644 --- a/obs/nut.spec +++ b/obs/nut.spec @@ -37,7 +37,7 @@ Name: nut Version: 2.7.4 -Release: 11 +Release: 12 Summary: Network UPS Tools Core (Uninterruptible Power Supply Monitoring) License: GPL-2.0+ Group: Hardware/UPS From 34391922c267b7ee30974ff3512f751062ed9af0 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Wed, 14 Sep 2016 04:58:10 +0200 Subject: [PATCH 413/805] RPM/DEB : deliver the sorted symlinks in packages Signed-off-by: Jim Klimov --- obs/debian.nut-snmp.install | 2 ++ obs/nut.spec | 6 ++++++ 2 files changed, 8 insertions(+) diff --git a/obs/debian.nut-snmp.install b/obs/debian.nut-snmp.install index 60d066444d..eaacebada2 100644 --- a/obs/debian.nut-snmp.install +++ b/obs/debian.nut-snmp.install @@ -3,3 +3,5 @@ debian/tmp/lib/nut/snmp-ups-dmf debian/tmp/bin/nut-scanner-reindex-dmfsnmp usr/share/nut/dmfsnmp usr/share/nut/dmfnutscan +usr/share/nut/dmfsnmp.d +usr/share/nut/dmfnutscan.d diff --git a/obs/nut.spec b/obs/nut.spec index e05254be1c..b7ecce0c25 100644 --- a/obs/nut.spec +++ b/obs/nut.spec @@ -332,6 +332,8 @@ bin/chmod 600 %{CONFPATH}/upsd.conf %{CONFPATH}/upsmon.conf %{CONFPATH}/upsd.use %{_datadir}/nut %exclude %{_datadir}/nut/dmfnutscan %exclude %{_datadir}/nut/dmfsnmp +%exclude %{_datadir}/nut/dmfnutscan.d +%exclude %{_datadir}/nut/dmfsnmp.d %{_mandir}/man5/*.* %{_mandir}/man8/*.* %exclude %{_mandir}/man8/netxml-ups*.* @@ -373,6 +375,10 @@ bin/chmod 600 %{CONFPATH}/upsd.conf %{CONFPATH}/upsmon.conf %{CONFPATH}/upsd.use %{_datadir}/nut/dmfsnmp/*.dmf %{_datadir}/nut/dmfnutscan/*.xsd %{_datadir}/nut/dmfsnmp/*.xsd +%dir %{_datadir}/nut/dmfnutscan.d +%dir %{_datadir}/nut/dmfsnmp.d +%{_datadir}/nut/dmfnutscan.d/*.dmf +%{_datadir}/nut/dmfsnmp.d/*.dmf %files -n libupsclient1 %defattr(-,root,root) From 7615bd3806391cd7d3135d4b261d12865fc61e6f Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Wed, 14 Sep 2016 10:57:06 +0200 Subject: [PATCH 414/805] nut.spec : fix mixed spaces vs tabs Signed-off-by: Jim Klimov --- obs/nut.spec | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/obs/nut.spec b/obs/nut.spec index b7ecce0c25..abe9c78dba 100644 --- a/obs/nut.spec +++ b/obs/nut.spec @@ -240,18 +240,18 @@ sh autogen.sh %configure --disable-static --with-pic --libexecdir=%{_prefix}/lib\ --sysconfdir=%{CONFPATH}\ --datadir=%{_datadir}/nut\ - --with-ssl --with-openssl\ - --with-libltdl=yes\ + --with-ssl --with-openssl\ + --with-libltdl=yes\ --with-cgi=auto\ - --with-serial\ - --with-usb\ - --with-snmp\ - --with-neon\ - --with-snmp_dmf_lua\ + --with-serial\ + --with-usb\ + --with-snmp\ + --with-neon\ + --with-snmp_dmf_lua\ --with-dev\ - --with-ipmi \ + --with-ipmi \ --with-powerman=auto\ - --with-doc=man=auto\ + --with-doc=man=auto\ --with-htmlpath=%{HTMLPATH}\ --with-cgipath=%{CGIPATH}\ --with-statepath=%{STATEPATH}\ @@ -259,7 +259,7 @@ sh autogen.sh --with-user=%{USER}\ --with-group=%{GROUP} \ --with-udev-dir=%{_sysconfdir}/udev \ - --enable-option-checking=fatal + --enable-option-checking=fatal (cd tools; python nut-snmpinfo.py) From 3eb5042e7ac5d8236c936facd424490b8ec04522 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Wed, 14 Sep 2016 10:58:51 +0200 Subject: [PATCH 415/805] debian.nut-snmp.install debian.libnutscan1.install : fix conflict for dmfnutscan resource dirs delivered by both packages Signed-off-by: Jim Klimov --- obs/debian.libnutscan1.install | 4 +++- obs/debian.nut-snmp.install | 3 --- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/obs/debian.libnutscan1.install b/obs/debian.libnutscan1.install index 55d88d748b..ce7992a799 100644 --- a/obs/debian.libnutscan1.install +++ b/obs/debian.libnutscan1.install @@ -1,2 +1,4 @@ lib/*/libnutscan.so.* -usr/share/nut/dmfnutscan/* +debian/tmp/bin/nut-scanner-reindex-dmfsnmp +usr/share/nut/dmfnutscan +usr/share/nut/dmfnutscan.d diff --git a/obs/debian.nut-snmp.install b/obs/debian.nut-snmp.install index eaacebada2..cf590d9caa 100644 --- a/obs/debian.nut-snmp.install +++ b/obs/debian.nut-snmp.install @@ -1,7 +1,4 @@ debian/tmp/lib/nut/snmp-ups debian/tmp/lib/nut/snmp-ups-dmf -debian/tmp/bin/nut-scanner-reindex-dmfsnmp usr/share/nut/dmfsnmp -usr/share/nut/dmfnutscan usr/share/nut/dmfsnmp.d -usr/share/nut/dmfnutscan.d From e513b1ca7ce2657d66493922952a6ce785b34167 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Thu, 22 Sep 2016 13:56:27 +0200 Subject: [PATCH 416/805] nut.spec : try to fix inability to detect LUA on some RPM buildhosts Signed-off-by: Jim Klimov --- obs/nut.spec | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/obs/nut.spec b/obs/nut.spec index abe9c78dba..14e7f339b1 100644 --- a/obs/nut.spec +++ b/obs/nut.spec @@ -96,9 +96,10 @@ BuildRequires: libusb-devel BuildRequires: net-snmp-devel BuildRequires: pkg-config BuildRequires: python -# TODO: Make sure how this is named +# LUA 5.1 or 5.2 is known ok for us, both are modern in current distros (201609xx) +BuildRequires: lua-devel +# TODO: Make sure how this is named to use in CentOS/RHEL (may be not in core but EPEL repos) BuildRequires: python-pycparser -BuildRequires: lua-devel == 5.1 %if 0%{?suse_version} BuildRequires: apache2-devel From 6cc80e5c8fc524a8d88598e25fd55b967f248cac Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Thu, 22 Sep 2016 14:04:48 +0200 Subject: [PATCH 417/805] nut.dsc / nut.spec : do not request rebuild and revalidation of DMF files - they were tested in Jenkins NUT-master job (remove build dependency on pycparser and speed up the build) Signed-off-by: Jim Klimov --- obs/debian.rules | 1 + obs/nut.dsc | 7 ++++++- obs/nut.spec | 9 +++++++-- 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/obs/debian.rules b/obs/debian.rules index 4bb1d5034f..8934c08ebb 100644 --- a/obs/debian.rules +++ b/obs/debian.rules @@ -27,6 +27,7 @@ DEB_CONFIGURE_EXTRA_FLAGS := --libdir=\$${prefix}/lib/$(DEB_HOST_MULTIARCH) \ --with-cgi=auto --with-powerman=auto \ --with-serial --with-usb --with-snmp --with-neon --with-ipmi \ --with-snmp_dmf_lua=yes \ + --with-dmfsnmp-regenerate=no --with-dmfnutscan-regenerate=no --with-dmfsnmp-validate=no --with-dmfnutscan-validate=no \ --with-dev \ --disable-static \ --with-statepath=/var/run/nut \ diff --git a/obs/nut.dsc b/obs/nut.dsc index a014bdc05f..9509b2c12b 100644 --- a/obs/nut.dsc +++ b/obs/nut.dsc @@ -10,7 +10,12 @@ Standards-Version: 3.9.6 Vcs-Browser: http://anonscm.debian.org/gitweb/?p=collab-maint/nut.git;a=summary Vcs-Git: git://anonscm.debian.org/collab-maint/nut.git Testsuite: autopkgtest -Build-Depends: debhelper (>= 8.1.3), cdbs (>= 0.4.122~), autotools-dev, dh-autoreconf, dh-systemd (>= 1.14), libgd-dev | libgd2-xpm-dev | libgd2-noxpm-dev, libsnmp-dev | libsnmp9-dev, libusb-dev (>= 0.1.8), libneon27-gnutls-dev | libneon27-dev, libpowerman0-dev (>= 2.3.3), libwrap0-dev (>= 7.6), python (>= 2.6.6-3~), libfreeipmi-dev (>= 0.8.5) [!hurd-i386], libipmimonitoring-dev (>= 1.1.5-2) [!hurd-i386], libnss3-dev, libtool, libltdl-dev, liblua5.1-0-dev, lua5.1, python-pycparser +Build-Depends: debhelper (>= 8.1.3), cdbs (>= 0.4.122~), autotools-dev, dh-autoreconf, dh-systemd (>= 1.14), libgd-dev | libgd2-xpm-dev | libgd2-noxpm-dev, libsnmp-dev | libsnmp9-dev, libusb-dev (>= 0.1.8), libneon27-gnutls-dev | libneon27-dev, libpowerman0-dev (>= 2.3.3), libwrap0-dev (>= 7.6), python (>= 2.6.6-3~), libfreeipmi-dev (>= 0.8.5) [!hurd-i386], libipmimonitoring-dev (>= 1.1.5-2) [!hurd-i386], libnss3-dev, libtool, libltdl-dev, liblua5.1-0-dev, lua5.1 +#+++ python-pycparser +# The pycparser is required to rebuild DMF files, but those pre-built +# copies in the git repo/tarball "should" be in sync with original +# C files, so we don't require regeneration for packaging. Also the +# Jenkins NUT-master job should have verified this. Build-Depends-Indep: asciidoc (>= 8.6.3), docbook-xsl, dblatex (>= 0.2.5), libxml2-utils Package-List: libnutclient-dev deb libdevel optional arch=any diff --git a/obs/nut.spec b/obs/nut.spec index 14e7f339b1..f3da4b82bc 100644 --- a/obs/nut.spec +++ b/obs/nut.spec @@ -99,7 +99,11 @@ BuildRequires: python # LUA 5.1 or 5.2 is known ok for us, both are modern in current distros (201609xx) BuildRequires: lua-devel # TODO: Make sure how this is named to use in CentOS/RHEL (may be not in core but EPEL repos) -BuildRequires: python-pycparser +# The pycparser is required to rebuild DMF files, but those pre-built +# copies in the git repo/tarball "should" be in sync with original +# C files, so we don't require regeneration for packaging. Also the +# Jenkins NUT-master job should have verified this. +#BuildRequires: python-pycparser %if 0%{?suse_version} BuildRequires: apache2-devel @@ -260,7 +264,8 @@ sh autogen.sh --with-user=%{USER}\ --with-group=%{GROUP} \ --with-udev-dir=%{_sysconfdir}/udev \ - --enable-option-checking=fatal + --enable-option-checking=fatal\ + --with-dmfsnmp-regenerate=no --with-dmfnutscan-regenerate=no --with-dmfsnmp-validate=no --with-dmfnutscan-validate=no (cd tools; python nut-snmpinfo.py) From be08124994122b197b1aff157d03d95eae5a1bc7 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Thu, 22 Sep 2016 14:05:17 +0200 Subject: [PATCH 418/805] debian.rules : whitespace fixes Signed-off-by: Jim Klimov --- obs/debian.rules | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/obs/debian.rules b/obs/debian.rules index 8934c08ebb..8542a11d00 100644 --- a/obs/debian.rules +++ b/obs/debian.rules @@ -23,22 +23,22 @@ DEB_CONFIGURE_SYSCONFDIR := /etc/nut DEB_CONFIGURE_INCLUDEDIR := /usr/include DEB_CONFIGURE_MANDIR := /usr/share/man DEB_CONFIGURE_EXTRA_FLAGS := --libdir=\$${prefix}/lib/$(DEB_HOST_MULTIARCH) \ - --with-ssl --with-openssl --with-libltdl=yes \ - --with-cgi=auto --with-powerman=auto \ - --with-serial --with-usb --with-snmp --with-neon --with-ipmi \ - --with-snmp_dmf_lua=yes \ + --with-ssl --with-openssl --with-libltdl=yes \ + --with-cgi=auto --with-powerman=auto \ + --with-serial --with-usb --with-snmp --with-neon --with-ipmi \ + --with-snmp_dmf_lua=yes \ --with-dmfsnmp-regenerate=no --with-dmfnutscan-regenerate=no --with-dmfsnmp-validate=no --with-dmfnutscan-validate=no \ - --with-dev \ - --disable-static \ - --with-statepath=/var/run/nut \ - --with-altpidpath=/var/run/nut \ - --with-drvpath=/lib/nut \ - --with-cgipath=/usr/lib/cgi-bin/nut \ - --with-htmlpath=/usr/share/nut/www \ - --with-pidpath=/var/run/nut \ - --datadir=/usr/share/nut \ - --with-pkgconfig-dir=/usr/lib/$(DEB_HOST_MULTIARCH)/pkgconfig \ - --with-user=nut --with-group=nut + --with-dev \ + --disable-static \ + --with-statepath=/var/run/nut \ + --with-altpidpath=/var/run/nut \ + --with-drvpath=/lib/nut \ + --with-cgipath=/usr/lib/cgi-bin/nut \ + --with-htmlpath=/usr/share/nut/www \ + --with-pidpath=/var/run/nut \ + --datadir=/usr/share/nut \ + --with-pkgconfig-dir=/usr/lib/$(DEB_HOST_MULTIARCH)/pkgconfig \ + --with-user=nut --with-group=nut ifeq (linux,$(DEB_HOST_ARCH_OS)) DEB_CONFIGURE_EXTRA_FLAGS+=--with-udev-dir=/lib/udev --with-systemdsystemunitdir=/lib/systemd/system From 057356e729c51cf246cc8b5499c7e2e186744aea Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Thu, 22 Sep 2016 14:07:42 +0200 Subject: [PATCH 419/805] debian.rules : skip even the manpages if the host cannot build them Signed-off-by: Jim Klimov --- obs/debian.rules | 2 ++ 1 file changed, 2 insertions(+) diff --git a/obs/debian.rules b/obs/debian.rules index 8542a11d00..941ab67db4 100644 --- a/obs/debian.rules +++ b/obs/debian.rules @@ -48,6 +48,8 @@ endif ifneq ($(shell which asciidoc),) # DEB_CONFIGURE_EXTRA_FLAGS+=--with-doc=html-chunked,pdf DEB_CONFIGURE_EXTRA_FLAGS+=--with-doc=man +else + DEB_CONFIGURE_EXTRA_FLAGS+=--with-doc=skip endif pre-build:: debian/compat From e6198652d37f3f009639747fa89378d960b7839d Mon Sep 17 00:00:00 2001 From: Arnaud Quette Date: Thu, 6 Oct 2016 14:52:29 +0200 Subject: [PATCH 420/805] Distribute gen-snmp-subdriver.sh with nut-snmp Signed-off-by: Jim Klimov --- obs/debian.nut-snmp.install | 1 + obs/debian.rules | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/obs/debian.nut-snmp.install b/obs/debian.nut-snmp.install index cf590d9caa..5195c9c507 100644 --- a/obs/debian.nut-snmp.install +++ b/obs/debian.nut-snmp.install @@ -1,4 +1,5 @@ debian/tmp/lib/nut/snmp-ups debian/tmp/lib/nut/snmp-ups-dmf +debian/tmp/usr/sbin/gen-snmp-subdriver.sh usr/share/nut/dmfsnmp usr/share/nut/dmfsnmp.d diff --git a/obs/debian.rules b/obs/debian.rules index 941ab67db4..fa4560e139 100644 --- a/obs/debian.rules +++ b/obs/debian.rules @@ -110,6 +110,10 @@ common-install-arch:: install -m 644 -D $(CURDIR)/debian/nut-server.tmpfiles \ $(CURDIR)/debian/nut-server/usr/lib/tmpfiles.d/nut-server.conf + # Install gen-snmp-subdriver.sh for nut-snmp + install -m 755 -D $(CURDIR)/scripts/subdriver/gen-snmp-subdriver.sh \ + $(CURDIR)/debian/tmp/usr/sbin/gen-snmp-subdriver.sh + extradocs-install: #install documentation mkdir -p $(CURDIR)/debian/tmp/usr/share/doc/nut-doc/pdf From df8b117dce490ca05fc64b6a3424b5abe8df1131 Mon Sep 17 00:00:00 2001 From: Arnaud Quette Date: Thu, 6 Oct 2016 15:40:38 +0200 Subject: [PATCH 421/805] Distribute gen-snmp-subdriver.sh with nut-snmp for RPM Signed-off-by: Jim Klimov --- obs/nut.spec | 2 ++ 1 file changed, 2 insertions(+) diff --git a/obs/nut.spec b/obs/nut.spec index f3da4b82bc..84200c8bc5 100644 --- a/obs/nut.spec +++ b/obs/nut.spec @@ -293,6 +293,7 @@ mv %{buildroot}%{CGIPATH}/*.cgi %{buildroot}%{CGIPATH}/nut find %{buildroot} -type f -name "*.la" -delete -print mkdir -p %{buildroot}%{_sysconfdir}/bash_completion.d install -m0644 scripts/misc/nut.bash_completion %{buildroot}%{_sysconfdir}/bash_completion.d/ +install -m0755 scripts/subdriver/gen-snmp-subdriver.sh %{buildroot}%{_sbindir}/ %pre usr/sbin/useradd -r -g %{GROUP} -s /bin/false \ @@ -385,6 +386,7 @@ bin/chmod 600 %{CONFPATH}/upsd.conf %{CONFPATH}/upsmon.conf %{CONFPATH}/upsd.use %dir %{_datadir}/nut/dmfsnmp.d %{_datadir}/nut/dmfnutscan.d/*.dmf %{_datadir}/nut/dmfsnmp.d/*.dmf +%{_sbindir}/gen-snmp-subdriver.sh %files -n libupsclient1 %defattr(-,root,root) From 4625c376cf92e30967d824cd8bce4916e64d8e1d Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Wed, 12 Apr 2017 16:01:03 +0200 Subject: [PATCH 422/805] Drop remaining references to oldmge-shut Signed-off-by: Jim Klimov --- obs/debian.nut-server.install | 1 - 1 file changed, 1 deletion(-) diff --git a/obs/debian.nut-server.install b/obs/debian.nut-server.install index 4c0f50e069..55d150f8a2 100644 --- a/obs/debian.nut-server.install +++ b/obs/debian.nut-server.install @@ -28,7 +28,6 @@ debian/tmp/lib/nut/tripplite_usb debian/tmp/lib/nut/bcmxcp debian/tmp/lib/nut/bestuferrups debian/tmp/lib/nut/gamatronic -debian/tmp/lib/nut/oldmge-shut debian/tmp/lib/nut/safenet debian/tmp/lib/nut/isbmex debian/tmp/lib/nut/masterguard From 209b41ea1dbcd17a49e6fbd56cb21a14d27d0431 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Fri, 13 Oct 2017 18:59:55 +0200 Subject: [PATCH 423/805] debian.rules : enable parallelized packaging Signed-off-by: Jim Klimov --- obs/debian.rules | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/obs/debian.rules b/obs/debian.rules index fa4560e139..f40f2b1396 100644 --- a/obs/debian.rules +++ b/obs/debian.rules @@ -5,6 +5,9 @@ include /usr/share/cdbs/1/class/autotools.mk include /usr/share/cdbs/1/class/python-module.mk include /usr/share/cdbs/1/rules/autoreconf.mk + +export DH_OPTIONS + # We cannot call autoreconf -f -i as it updates INSTALL which is used for doc # generation DEB_DH_AUTORECONF_ARGS = --as-needed @@ -146,3 +149,6 @@ ifeq (linux,$(DEB_HOST_ARCH_OS)) # for Ubuntu # DEB_DH_GENCONTROL_ARGS := -- -Vudev="udev (>= 136-1)" endif + +all check dist distcheck install: + dh $@ --parallel From 2c3a54668aa853eff4d318bdca62128df3657dda Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Thu, 19 Oct 2017 00:53:15 +0200 Subject: [PATCH 424/805] Use DH_COMPAT=10 to enable parallel build support by default Signed-off-by: Jim Klimov --- obs/debian.compat | 2 +- obs/debian.rules | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/obs/debian.compat b/obs/debian.compat index 45a4fb75db..f599e28b8a 100644 --- a/obs/debian.compat +++ b/obs/debian.compat @@ -1 +1 @@ -8 +10 diff --git a/obs/debian.rules b/obs/debian.rules index f40f2b1396..e77d01ae98 100644 --- a/obs/debian.rules +++ b/obs/debian.rules @@ -8,6 +8,10 @@ include /usr/share/cdbs/1/rules/autoreconf.mk export DH_OPTIONS +# This is the debhelper compatibility version to use. +# JIM: 10+ enables parallel builds by default +export DH_COMPAT=10 + # We cannot call autoreconf -f -i as it updates INSTALL which is used for doc # generation DEB_DH_AUTORECONF_ARGS = --as-needed From 5c2eb90e3c0b23c6d39fb2c426439cff07a41135 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Sun, 31 Dec 2017 15:59:28 +0100 Subject: [PATCH 425/805] packaging : use --with-docs=man=dist-auto Signed-off-by: Jim Klimov --- obs/debian.rules | 12 +++++++----- obs/nut.spec | 2 +- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/obs/debian.rules b/obs/debian.rules index e77d01ae98..66f89dd5cf 100644 --- a/obs/debian.rules +++ b/obs/debian.rules @@ -52,12 +52,14 @@ ifeq (linux,$(DEB_HOST_ARCH_OS)) endif # only build documentation if asciidoc is installed -ifneq ($(shell which asciidoc),) +#ifneq ($(shell which asciidoc),) # DEB_CONFIGURE_EXTRA_FLAGS+=--with-doc=html-chunked,pdf - DEB_CONFIGURE_EXTRA_FLAGS+=--with-doc=man -else - DEB_CONFIGURE_EXTRA_FLAGS+=--with-doc=skip -endif +#else +# DEB_CONFIGURE_EXTRA_FLAGS+=--with-doc=skip +#endif + +# Try to use dist'ed docs if available, fall back to auto in other cases +DEB_CONFIGURE_EXTRA_FLAGS+=--with-doc=man=dist-auto pre-build:: debian/compat (cd tools; python nut-snmpinfo.py) diff --git a/obs/nut.spec b/obs/nut.spec index 84200c8bc5..2f98df0ff9 100644 --- a/obs/nut.spec +++ b/obs/nut.spec @@ -256,7 +256,7 @@ sh autogen.sh --with-dev\ --with-ipmi \ --with-powerman=auto\ - --with-doc=man=auto\ + --with-doc=man=dist-auto\ --with-htmlpath=%{HTMLPATH}\ --with-cgipath=%{CGIPATH}\ --with-statepath=%{STATEPATH}\ From d23f8f888724e07d9bdeb16e821b505bdd979132 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Sun, 31 Dec 2017 18:58:34 +0100 Subject: [PATCH 426/805] debian.rules : avoid re-configuring before "make install" again Signed-off-by: Jim Klimov --- obs/debian.rules | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/obs/debian.rules b/obs/debian.rules index 66f89dd5cf..0c4787f310 100644 --- a/obs/debian.rules +++ b/obs/debian.rules @@ -61,10 +61,12 @@ endif # Try to use dist'ed docs if available, fall back to auto in other cases DEB_CONFIGURE_EXTRA_FLAGS+=--with-doc=man=dist-auto -pre-build:: debian/compat +configure: configure.ac (cd tools; python nut-snmpinfo.py) sh autogen.sh +pre-build:: debian/compat configure + common-install-arch:: # install the bash completion script mkdir -p $(CURDIR)/debian/tmp/usr/share/bash-completion/completions/ From b1ca53a5d1e98280ef663198866072b1a9492ead Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Tue, 2 Jan 2018 14:57:48 +0100 Subject: [PATCH 427/805] nut.spec : fix "bindir" macro to "_bindir" Signed-off-by: Jim Klimov --- obs/nut.spec | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/obs/nut.spec b/obs/nut.spec index 2f98df0ff9..24cc7fd19c 100644 --- a/obs/nut.spec +++ b/obs/nut.spec @@ -2,7 +2,7 @@ # spec file for package nut.spec # # Copyright (c) 2015 SUSE LINUX GmbH, Nuernberg, Germany. -# Copyright (c) 2016 Eaton EEIC. +# Copyright (c) 2016-2018 Eaton EEIC. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -335,7 +335,7 @@ bin/chmod 600 %{CONFPATH}/upsd.conf %{CONFPATH}/upsmon.conf %{CONFPATH}/upsd.use %{_sysconfdir}/bash_completion.d/* %{_sysconfdir}/logrotate.d/* %{_bindir}/* -%exclude %{bindir}/nut-scanner-reindex-dmfsnmp +%exclude %{_bindir}/nut-scanner-reindex-dmfsnmp %{_datadir}/nut %exclude %{_datadir}/nut/dmfnutscan %exclude %{_datadir}/nut/dmfsnmp @@ -373,7 +373,7 @@ bin/chmod 600 %{CONFPATH}/upsd.conf %{CONFPATH}/upsmon.conf %{CONFPATH}/upsd.use %defattr(-,root,root) %{MODELPATH}/snmp-ups %{MODELPATH}/netxml-ups -%{bindir}/nut-scanner-reindex-dmfsnmp +%{_bindir}/nut-scanner-reindex-dmfsnmp %{_mandir}/man8/netxml-ups*.* %{_mandir}/man8/snmp-ups*.* %dir %{_datadir}/nut/dmfnutscan From 475a5eab793f709559a601b3bc1b33313c266bc1 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Tue, 2 Jan 2018 15:16:27 +0100 Subject: [PATCH 428/805] nut.spec : use proper systemdshutdowndir relevant for current distro/arch Signed-off-by: Jim Klimov --- obs/nut.spec | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/obs/nut.spec b/obs/nut.spec index 24cc7fd19c..69bf67ecd5 100644 --- a/obs/nut.spec +++ b/obs/nut.spec @@ -34,6 +34,7 @@ %define USBNONHIDDRIVERS %(zcat %{SOURCE0} | tr a-z A-Z | fgrep -a -A1 _USB | sed -n 's/.*ATTR{IDVENDOR}==%{QUOTE}%{BACKSLASH}%{LBRACE}[^%{QUOTE}]*%{BACKSLASH}%{RBRACE}%{QUOTE}, ATTR{IDPRODUCT}==%{QUOTE}%{BACKSLASH}%{LBRACE}[^%{QUOTE}]*%{BACKSLASH}%{RBRACE}%{QUOTE}, MODE=.*/modalias%{LBRACE}usb:v%{BACKSLASH}1p%{BACKSLASH}2d*dc*dsc*dp*ic*isc*ip*%{RBRACE}/p' | tr '%{BACKSLASH}n' ' ') %define systemdsystemunitdir %(pkg-config --variable=systemdsystemunitdir systemd) %define systemdsystemdutildir %(pkg-config --variable=systemdutildir systemd) +%define systemdshutdowndir %(pkg-config --variable=systemdshutdowndir systemd) Name: nut Version: 2.7.4 @@ -365,9 +366,7 @@ bin/chmod 600 %{CONFPATH}/upsd.conf %{CONFPATH}/upsmon.conf %{CONFPATH}/upsd.use %exclude %{MODELPATH}/netxml-ups %attr(700,%{USER},%{GROUP}) %{STATEPATH} %{systemdsystemunitdir}/* -%dir %{_libdir}/systemd/ -%dir %{_libdir}/systemd/system-shutdown/ -%{_libdir}/systemd/system-shutdown/nutshutdown +%{systemdshutdowndir}/nutshutdown %files drivers-net %defattr(-,root,root) From b62a626031b567ff04942cae502ecefb8acb3a2f Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Tue, 2 Jan 2018 15:53:48 +0100 Subject: [PATCH 429/805] Packaging : pass the systemd*dir arguments to configure script Signed-off-by: Jim Klimov --- obs/debian.rules | 27 +++++++++++++++++---------- obs/nut.spec | 1 + 2 files changed, 18 insertions(+), 10 deletions(-) diff --git a/obs/debian.rules b/obs/debian.rules index 0c4787f310..118cb12036 100644 --- a/obs/debian.rules +++ b/obs/debian.rules @@ -17,6 +17,9 @@ export DH_COMPAT=10 DEB_DH_AUTORECONF_ARGS = --as-needed DEB_HOST_ARCH_OS := $(shell dpkg-architecture -qDEB_HOST_ARCH_OS 2>/dev/null) +systemdsystemunitdir := $(shell pkg-config --variable=systemdsystemunitdir systemd) +systemdsystemdutildir := $(shell pkg-config --variable=systemdutildir systemd) +systemdshutdowndir := $(shell pkg-config --variable=systemdshutdowndir systemd) # List any files which are not installed include /usr/share/cdbs/1/rules/utils.mk @@ -48,7 +51,11 @@ DEB_CONFIGURE_EXTRA_FLAGS := --libdir=\$${prefix}/lib/$(DEB_HOST_MULTIARCH) \ --with-user=nut --with-group=nut ifeq (linux,$(DEB_HOST_ARCH_OS)) - DEB_CONFIGURE_EXTRA_FLAGS+=--with-udev-dir=/lib/udev --with-systemdsystemunitdir=/lib/systemd/system + DEB_CONFIGURE_EXTRA_FLAGS+=--with-udev-dir=/lib/udev + DEB_CONFIGURE_EXTRA_FLAGS+=--with-systemdsystemunitdir + DEB_CONFIGURE_EXTRA_FLAGS+=--with-systemdshutdowndir +### DEB_CONFIGURE_EXTRA_FLAGS+=--with-systemdsystemunitdir=$(systemdsystemunitdir) +### DEB_CONFIGURE_EXTRA_FLAGS+=--with-systemdsystemunitdir=/lib/systemd/system endif # only build documentation if asciidoc is installed @@ -103,17 +110,17 @@ common-install-arch:: $(CURDIR)/debian/tmp/usr/lib/$(DEB_HOST_MULTIARCH)/libnutscan.so # Install systemd files only on systems where it's supported - install -m 644 -D $(CURDIR)/debian/tmp/lib/systemd/system/nut-monitor.service \ - $(CURDIR)/debian/nut-client/lib/systemd/system/nut-monitor.service - install -D $(CURDIR)/debian/tmp/lib/$(DEB_HOST_MULTIARCH)/systemd/system-shutdown/nutshutdown \ - $(CURDIR)/debian/nut-server/lib/systemd/system-shutdown/nutshutdown - install -m 644 -D $(CURDIR)/debian/tmp/lib/systemd/system/nut-server.service \ - $(CURDIR)/debian/nut-server/lib/systemd/system/nut-server.service - install -m 644 -t $(CURDIR)/debian/nut-server/lib/systemd/system \ - $(CURDIR)/debian/tmp/lib/systemd/system/nut-driver* + install -m 644 -D $(CURDIR)/debian/tmp/$(systemdsystemunitdir)/nut-monitor.service \ + $(CURDIR)/debian/nut-client/$(systemdsystemunitdir)/nut-monitor.service + install -D $(CURDIR)/debian/tmp/$(systemdshutdowndir)/nutshutdown \ + $(CURDIR)/debian/nut-server/$(systemdshutdowndir)/nutshutdown + install -m 644 -D $(CURDIR)/debian/tmp/$(systemdsystemunitdir)/nut-server.service \ + $(CURDIR)/debian/nut-server/$(systemdsystemunitdir)/nut-server.service + install -m 644 -t $(CURDIR)/debian/nut-server/$(systemdsystemunitdir) \ + $(CURDIR)/debian/tmp/$(systemdsystemunitdir)/nut-driver* # Add a symlink to mask the LSB initscript - ln -s nut-monitor.service $(CURDIR)/debian/nut-client/lib/systemd/system/nut-client.service + ln -s nut-monitor.service $(CURDIR)/debian/nut-client/$(systemdsystemunitdir)/nut-client.service # Install tmpfiles config file to create /run/nut directory install -m 644 -D $(CURDIR)/debian/nut-client.tmpfiles \ diff --git a/obs/nut.spec b/obs/nut.spec index 69bf67ecd5..9138b6c1c9 100644 --- a/obs/nut.spec +++ b/obs/nut.spec @@ -266,6 +266,7 @@ sh autogen.sh --with-group=%{GROUP} \ --with-udev-dir=%{_sysconfdir}/udev \ --enable-option-checking=fatal\ + --with-systemdsystemunitdir --with-systemdshutdowndir \ --with-dmfsnmp-regenerate=no --with-dmfnutscan-regenerate=no --with-dmfsnmp-validate=no --with-dmfnutscan-validate=no (cd tools; python nut-snmpinfo.py) From 74dfbc4f3d9fdcedf588624d9db6f015fc6e4bbd Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Tue, 2 Jan 2018 16:13:02 +0100 Subject: [PATCH 430/805] nut.spec : dist augeas files Signed-off-by: Jim Klimov --- obs/nut.spec | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/obs/nut.spec b/obs/nut.spec index 9138b6c1c9..73d4a8dc49 100644 --- a/obs/nut.spec +++ b/obs/nut.spec @@ -368,6 +368,19 @@ bin/chmod 600 %{CONFPATH}/upsd.conf %{CONFPATH}/upsmon.conf %{CONFPATH}/upsd.use %attr(700,%{USER},%{GROUP}) %{STATEPATH} %{systemdsystemunitdir}/* %{systemdshutdowndir}/nutshutdown +%{_datadir}/augeas/lenses/dist/nuthostsconf.aug +%{_datadir}/augeas/lenses/dist/nutnutconf.aug +%{_datadir}/augeas/lenses/dist/nutupsconf.aug +%{_datadir}/augeas/lenses/dist/nutupsdconf.aug +%{_datadir}/augeas/lenses/dist/nutupsdusers.aug +%{_datadir}/augeas/lenses/dist/nutupsmonconf.aug +%{_datadir}/augeas/lenses/dist/nutupsschedconf.aug +%{_datadir}/augeas/lenses/dist/nutupssetconf.aug +%{_datadir}/augeas/lenses/dist/tests/test_nut.aug +%dir %{_datadir}/augeas +%dir %{_datadir}/augeas/lenses +%dir %{_datadir}/augeas/lenses/dist +%dir %{_datadir}/augeas/lenses/dist/tests %files drivers-net %defattr(-,root,root) From 59fa094112b9e1a2f2e9f52d934c09e1962f5a27 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Tue, 2 Jan 2018 16:16:30 +0100 Subject: [PATCH 431/805] nut.spec : suse wants a package Signed-off-by: Jim Klimov --- obs/nut.spec | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/obs/nut.spec b/obs/nut.spec index 73d4a8dc49..d0fd1ab7ff 100644 --- a/obs/nut.spec +++ b/obs/nut.spec @@ -82,7 +82,9 @@ Requires: %{_bindir}/pgrep Requires: %{_bindir}/pkill Requires: %{_bindir}/readlink Requires: usbutils -#Requires(post): udev +%if 0%{?suse_version} +Requires(post): udev +%endif BuildRoot: %{_tmppath}/%{name}-%{version}-build BuildRequires: avahi-devel From b3d939cd5b6ae902f788a7fd2413ed38ffa4856f Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Tue, 2 Jan 2018 16:33:04 +0100 Subject: [PATCH 432/805] Debian packaging : require pkg-config, and provide some fallbacks if systemd dirs are unknown Signed-off-by: Jim Klimov --- obs/debian.control | 3 ++- obs/debian.rules | 14 ++++++++------ obs/nut.dsc | 2 +- 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/obs/debian.control b/obs/debian.control index 6b5e6df58e..96103c9989 100644 --- a/obs/debian.control +++ b/obs/debian.control @@ -19,7 +19,8 @@ Build-Depends: debhelper (>= 8.1.3), libipmimonitoring-dev (>= 1.1.5-2) [!hurd-i386], libnss3-dev, libtool, libltdl-dev, liblua5.1-0-dev, - lua5.1 + lua5.1, + pkg-config Build-Depends-Indep: asciidoc (>= 8.6.3), docbook-xsl, dblatex (>= 0.2.5), diff --git a/obs/debian.rules b/obs/debian.rules index 118cb12036..d881d29315 100644 --- a/obs/debian.rules +++ b/obs/debian.rules @@ -17,9 +17,11 @@ export DH_COMPAT=10 DEB_DH_AUTORECONF_ARGS = --as-needed DEB_HOST_ARCH_OS := $(shell dpkg-architecture -qDEB_HOST_ARCH_OS 2>/dev/null) -systemdsystemunitdir := $(shell pkg-config --variable=systemdsystemunitdir systemd) -systemdsystemdutildir := $(shell pkg-config --variable=systemdutildir systemd) -systemdshutdowndir := $(shell pkg-config --variable=systemdshutdowndir systemd) + +# echoed fallbacks are for Ubuntu primarily +systemdsystemunitdir := $(shell pkg-config --variable=systemdsystemunitdir systemd || echo /lib/systemd/system) +systemdsystemdutildir := $(shell pkg-config --variable=systemdutildir systemd || echo /lib/systemd) +systemdshutdowndir := $(shell pkg-config --variable=systemdshutdowndir systemd || echo /lib/systemd/system-shutdown) # List any files which are not installed include /usr/share/cdbs/1/rules/utils.mk @@ -52,10 +54,10 @@ DEB_CONFIGURE_EXTRA_FLAGS := --libdir=\$${prefix}/lib/$(DEB_HOST_MULTIARCH) \ ifeq (linux,$(DEB_HOST_ARCH_OS)) DEB_CONFIGURE_EXTRA_FLAGS+=--with-udev-dir=/lib/udev - DEB_CONFIGURE_EXTRA_FLAGS+=--with-systemdsystemunitdir - DEB_CONFIGURE_EXTRA_FLAGS+=--with-systemdshutdowndir -### DEB_CONFIGURE_EXTRA_FLAGS+=--with-systemdsystemunitdir=$(systemdsystemunitdir) +### DEB_CONFIGURE_EXTRA_FLAGS+=--with-systemdsystemunitdir ### DEB_CONFIGURE_EXTRA_FLAGS+=--with-systemdsystemunitdir=/lib/systemd/system + DEB_CONFIGURE_EXTRA_FLAGS+=--with-systemdsystemunitdir=$(systemdsystemunitdir) + DEB_CONFIGURE_EXTRA_FLAGS+=--with-systemdshutdowndir=$(systemdshutdowndir) endif # only build documentation if asciidoc is installed diff --git a/obs/nut.dsc b/obs/nut.dsc index 9509b2c12b..a8bf06c3e4 100644 --- a/obs/nut.dsc +++ b/obs/nut.dsc @@ -10,7 +10,7 @@ Standards-Version: 3.9.6 Vcs-Browser: http://anonscm.debian.org/gitweb/?p=collab-maint/nut.git;a=summary Vcs-Git: git://anonscm.debian.org/collab-maint/nut.git Testsuite: autopkgtest -Build-Depends: debhelper (>= 8.1.3), cdbs (>= 0.4.122~), autotools-dev, dh-autoreconf, dh-systemd (>= 1.14), libgd-dev | libgd2-xpm-dev | libgd2-noxpm-dev, libsnmp-dev | libsnmp9-dev, libusb-dev (>= 0.1.8), libneon27-gnutls-dev | libneon27-dev, libpowerman0-dev (>= 2.3.3), libwrap0-dev (>= 7.6), python (>= 2.6.6-3~), libfreeipmi-dev (>= 0.8.5) [!hurd-i386], libipmimonitoring-dev (>= 1.1.5-2) [!hurd-i386], libnss3-dev, libtool, libltdl-dev, liblua5.1-0-dev, lua5.1 +Build-Depends: debhelper (>= 8.1.3), cdbs (>= 0.4.122~), autotools-dev, dh-autoreconf, dh-systemd (>= 1.14), libgd-dev | libgd2-xpm-dev | libgd2-noxpm-dev, libsnmp-dev | libsnmp9-dev, libusb-dev (>= 0.1.8), libneon27-gnutls-dev | libneon27-dev, libpowerman0-dev (>= 2.3.3), libwrap0-dev (>= 7.6), python (>= 2.6.6-3~), libfreeipmi-dev (>= 0.8.5) [!hurd-i386], libipmimonitoring-dev (>= 1.1.5-2) [!hurd-i386], libnss3-dev, libtool, libltdl-dev, liblua5.1-0-dev, lua5.1, pkg-config #+++ python-pycparser # The pycparser is required to rebuild DMF files, but those pre-built # copies in the git repo/tarball "should" be in sync with original From eb38be4e3ba451cb2f7d4603d47a4b97cacce45a Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Wed, 3 Jan 2018 09:34:26 +0100 Subject: [PATCH 433/805] nut.spec : publish augeas files Signed-off-by: Jim Klimov --- obs/nut.spec | 1 + 1 file changed, 1 insertion(+) diff --git a/obs/nut.spec b/obs/nut.spec index d0fd1ab7ff..1ec8b49225 100644 --- a/obs/nut.spec +++ b/obs/nut.spec @@ -269,6 +269,7 @@ sh autogen.sh --with-udev-dir=%{_sysconfdir}/udev \ --enable-option-checking=fatal\ --with-systemdsystemunitdir --with-systemdshutdowndir \ + --with-augeas-lenses-dir=/usr/share/augeas/lenses/dist \ --with-dmfsnmp-regenerate=no --with-dmfnutscan-regenerate=no --with-dmfsnmp-validate=no --with-dmfnutscan-validate=no (cd tools; python nut-snmpinfo.py) From eb8b773da181b979f83bffc78732a268db63861e Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Mon, 15 Jan 2018 21:58:37 +0100 Subject: [PATCH 434/805] nut.spec : avoid "nut" vs "nut-drivers-net" conflict over gen-snmp-subdriver.sh Signed-off-by: Jim Klimov --- obs/nut.spec | 1 + 1 file changed, 1 insertion(+) diff --git a/obs/nut.spec b/obs/nut.spec index 1ec8b49225..60fe8f650a 100644 --- a/obs/nut.spec +++ b/obs/nut.spec @@ -368,6 +368,7 @@ bin/chmod 600 %{CONFPATH}/upsd.conf %{CONFPATH}/upsmon.conf %{CONFPATH}/upsd.use %{MODELPATH}/* %exclude %{MODELPATH}/snmp-ups %exclude %{MODELPATH}/netxml-ups +%exclude %{_sbindir}/gen-snmp-subdriver.sh %attr(700,%{USER},%{GROUP}) %{STATEPATH} %{systemdsystemunitdir}/* %{systemdshutdowndir}/nutshutdown From c6206ee17a954de495c990ee3a737fbda60f4224 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Mon, 3 Sep 2018 21:00:33 +0200 Subject: [PATCH 435/805] nut.spec : fix RPM packaging for OBS Signed-off-by: Jim Klimov --- obs/debian.nut-server.install | 2 ++ obs/nut.spec | 9 +++++---- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/obs/debian.nut-server.install b/obs/debian.nut-server.install index 55d150f8a2..d00e0bad2f 100644 --- a/obs/debian.nut-server.install +++ b/obs/debian.nut-server.install @@ -1,6 +1,7 @@ debian/tmp/bin/nut-scanner debian/tmp/sbin/upsd debian/tmp/sbin/upsdrvctl +debian/tmp/sbin/upsdrvsvcctl debian/tmp/usr/share/nut/cmdvartab debian/tmp/usr/share/nut/driver.list debian/tmp/*/udev/rules.d/[0-9][0-9]-*.rules @@ -8,6 +9,7 @@ debian/tmp/etc/avahi/services/nut.service debian/tmp/etc/nut/ups.conf debian/tmp/etc/nut/upsd.conf debian/tmp/etc/nut/upsd.users +debian/tmp/lib/nut/nut-driver-enumerator.sh debian/tmp/lib/nut/genericups debian/tmp/lib/nut/mge-shut debian/tmp/lib/nut/rhino diff --git a/obs/nut.spec b/obs/nut.spec index 60fe8f650a..5d9488f7e2 100644 --- a/obs/nut.spec +++ b/obs/nut.spec @@ -304,7 +304,7 @@ install -m0755 scripts/subdriver/gen-snmp-subdriver.sh %{buildroot}%{_sbindir}/ usr/sbin/useradd -r -g %{GROUP} -s /bin/false \ -c "UPS daemon" -d /sbin %{USER} 2>/dev/null || : %if %{defined opensuse_version} -%service_add_pre nut-driver.service nut-server.service nut-monitor.service +%service_add_pre nut-driver@.service nut-server.service nut-monitor.service nut-driver.target nut.target %endif %post @@ -316,17 +316,17 @@ bin/chmod 600 %{CONFPATH}/upsd.conf %{CONFPATH}/upsmon.conf %{CONFPATH}/upsd.use # And finally trigger udev to set permissions according to newly installed rules files. /sbin/udevadm trigger --subsystem-match=usb --property-match=DEVTYPE=usb_device %if %{defined opensuse_version} -%service_add_post nut-driver.service nut-server.service nut-monitor.service +%service_add_post nut-driver@.service nut-server.service nut-monitor.service nut-driver-enumerator.service nut-driver.target nut.target %endif %preun %if %{defined opensuse_version} -%service_del_preun nut-driver.service nut-server.service nut-monitor.service +%service_del_preun nut-driver@.service nut-server.service nut-monitor.service nut-driver-enumerator.service nut-driver.target nut.target %endif %postun %if %{defined opensuse_version} -%service_del_postun nut-driver.service nut-server.service nut-monitor.service +%service_del_postun nut-driver@.service nut-server.service nut-monitor.service nut-driver-enumerator.service nut-driver.target nut.target %endif %post -n libupsclient1 -p /sbin/ldconfig @@ -385,6 +385,7 @@ bin/chmod 600 %{CONFPATH}/upsd.conf %{CONFPATH}/upsmon.conf %{CONFPATH}/upsd.use %dir %{_datadir}/augeas/lenses %dir %{_datadir}/augeas/lenses/dist %dir %{_datadir}/augeas/lenses/dist/tests +%{_libexecdir}/nut-driver-enumerator.sh %files drivers-net %defattr(-,root,root) From b9dcb8b9a0b72462a0786bab73dd48c3fe3ce334 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Wed, 5 Sep 2018 17:05:37 +0200 Subject: [PATCH 436/805] nut.spec : remove commented-away references to private OBS patches that are not used anymore Signed-off-by: Jim Klimov --- obs/nut.spec | 53 ---------------------------------------------------- 1 file changed, 53 deletions(-) diff --git a/obs/nut.spec b/obs/nut.spec index 5d9488f7e2..d97d18b604 100644 --- a/obs/nut.spec +++ b/obs/nut.spec @@ -43,38 +43,7 @@ Summary: Network UPS Tools Core (Uninterruptible Power Supply Monitoring) License: GPL-2.0+ Group: Hardware/UPS Url: http://www.networkupstools.org/ -#Source: http://www.networkupstools.org/source/2.7/%{name}-%{version}.tar.gz - -# git clone https://github.com/vyskocilm/nut daisychain+DMF -# git archive --prefix nut-2.7.4/ -o ~/work/BIOS/ROZ-OBS/Pool\:master/nut/nut-2.7.4-DMF+daisychain-cb7c7ea8b0d.tar.gz HEAD Source0: %{name}-%{version}.tar.gz -#Source: nut-2.7.4-DMF+daisychain-cb7c7ea8b0d.tar.gz -#Patch2: 0002-nut-monitor-paths.patch -#Patch3: 0003-install-dev-files-in-usr.patch -#Patch4: 0004-fix-systemd-service.patch -#Patch6: 0006-ups-conf-maxretry.patch -#Patch8: 0008-drop-w3c-icons.patch -#Patch11: 0011-libnutscanner-scan-one-ip-xml-http.patch -#Patch14: 0014-upsrdvctl-nowait.patch -#Patch15: 0015-Use-target-for-drivers-in-systemd.patch -#Patch16: 0021-xml_scan_3tries.patch -### already upstream -###Patch17: 0024-snmp-ups-Eaton-3ph-UPS-improvements.patch -###Patch18: 0025-Fix-nut-scanner-compilation-in-some-environments.patch -###Patch19: 0026-snmp-ups-support-Raritan-Dominion-PX2-PDU.patch -#Patch20: 0027-snmp-ups-support-APC-PDU.patch -### can't be merged, upstream change -###Patch21: 0028-nut-scanner-additional-search-path.patch -### can't be merged, upstream change -###Patch29: 0029-netvision-mib-uses-0-as-dfl.patch -### daisy chain is upstream -### Patch30: 0030-daisychain.patch -### Patch31: 0031-daisychain-complement.patch -### Patch32: 0032-snmp-ups-fix-some-regression-due-to-daisychain.patch -### Patch33: 0033-snmp-ups-fix-memory-leaks.patch -#Patch34: 0034-fix_xmlv4_segfault.patch -###Patch35: 0035-daisychain+DMF.patch -###Patch36: 0036-post-carlos-dmf-fixes.patch Requires: %{_bindir}/fgrep Requires: %{_bindir}/grep @@ -220,28 +189,6 @@ Detailed information about supported hardware can be found in %prep %setup -q -#%patch2 -p1 -#%patch3 -p1 -#%patch4 -p1 -#%patch6 -p1 -#%patch8 -p1 -#%patch11 -p1 -#%patch14 -p1 -#%patch15 -p1 -#%patch16 -p1 -### % patch17 -p1 -### % patch18 -p1 -### % patch19 -p1 -#%patch20 -p1 -### % patch21 -p1 -### % patch29 -p1 -### % patch30 -p1 -### % patch31 -p1 -### % patch32 -p1 -### % patch33 -p1 -#%patch34 -p1 -### % patch35 -p1 -### % patch36 -p1 %build sh autogen.sh From 3a23d4f0fcf48eabd9586fdaab063e4b93f1627f Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Wed, 5 Sep 2018 17:11:22 +0200 Subject: [PATCH 437/805] nut.spec : whitespace Signed-off-by: Jim Klimov --- obs/nut.spec | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/obs/nut.spec b/obs/nut.spec index d97d18b604..e8feb017af 100644 --- a/obs/nut.spec +++ b/obs/nut.spec @@ -20,8 +20,8 @@ %define apache_serverroot %(%{_sbindir}/apxs2 -q datadir 2>/dev/null || %{_sbindir}/apxs -q PREFIX) %define CGIPATH %{apache_serverroot}/cgi-bin %define HTMLPATH %{apache_serverroot}/htdocs -%define MODELPATH %{_libexecdir}/ups/driver -%define STATEPATH %{_localstatedir}/lib/ups +%define MODELPATH %{_libexecdir}/ups/driver +%define STATEPATH %{_localstatedir}/lib/ups %define CONFPATH %{_sysconfdir}/ups %define USER upsd %define GROUP daemon From d27841a379bafbb2b716ef6353e456640f37cc44 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Wed, 5 Sep 2018 17:22:08 +0200 Subject: [PATCH 438/805] nut.spec : do not redefine (differently) paths set by %configure macro, try to set them directly Signed-off-by: Jim Klimov --- obs/nut.spec | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/obs/nut.spec b/obs/nut.spec index e8feb017af..86a7016997 100644 --- a/obs/nut.spec +++ b/obs/nut.spec @@ -23,6 +23,9 @@ %define MODELPATH %{_libexecdir}/ups/driver %define STATEPATH %{_localstatedir}/lib/ups %define CONFPATH %{_sysconfdir}/ups +### Note: this is /etc/nut in Debian version +%define _sysconfdir /etc/ups +%define _datadir %{_datadir}/nut %define USER upsd %define GROUP daemon %define LBRACE ( @@ -192,9 +195,7 @@ Detailed information about supported hardware can be found in %build sh autogen.sh -%configure --disable-static --with-pic --libexecdir=%{_prefix}/lib\ - --sysconfdir=%{CONFPATH}\ - --datadir=%{_datadir}/nut\ +%configure --disable-static --with-pic \ --with-ssl --with-openssl\ --with-libltdl=yes\ --with-cgi=auto\ From 52f2e409a5edf1aff53efd0ba249e26301886a07 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Thu, 6 Sep 2018 22:18:56 +0200 Subject: [PATCH 439/805] nut.spec : do not use the configure macro Signed-off-by: Jim Klimov --- obs/nut.spec | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/obs/nut.spec b/obs/nut.spec index 86a7016997..6e9bd59fdb 100644 --- a/obs/nut.spec +++ b/obs/nut.spec @@ -24,8 +24,6 @@ %define STATEPATH %{_localstatedir}/lib/ups %define CONFPATH %{_sysconfdir}/ups ### Note: this is /etc/nut in Debian version -%define _sysconfdir /etc/ups -%define _datadir %{_datadir}/nut %define USER upsd %define GROUP daemon %define LBRACE ( @@ -193,9 +191,19 @@ Detailed information about supported hardware can be found in %prep %setup -q +# Note: NOT configure macro, due to override of --sysconfdir and --datadir +# values just for the recipe part but not for whole specfile %build sh autogen.sh -%configure --disable-static --with-pic \ +./configure --disable-static --with-pic \ + --prefix=%{_prefix}\ + --execdir=%{_prefix}\ + --bindir=%{_bindir}\ + --sbindir=%{_sbindir}\ + --libdir=%{_libdir}\ + --libexecdir=%{_libexecdir}\ + --sysconfdir=%{CONFPATH}\ + --datadir=%{_datadir}/nut\ --with-ssl --with-openssl\ --with-libltdl=yes\ --with-cgi=auto\ From dfa1a6eab0f2b43692170e02fde347d4ab2c125d Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Thu, 6 Sep 2018 22:30:41 +0200 Subject: [PATCH 440/805] nut.spec : do not use the configure macro Signed-off-by: Jim Klimov --- obs/nut.spec | 1 - 1 file changed, 1 deletion(-) diff --git a/obs/nut.spec b/obs/nut.spec index 6e9bd59fdb..79b71ddc7e 100644 --- a/obs/nut.spec +++ b/obs/nut.spec @@ -197,7 +197,6 @@ Detailed information about supported hardware can be found in sh autogen.sh ./configure --disable-static --with-pic \ --prefix=%{_prefix}\ - --execdir=%{_prefix}\ --bindir=%{_bindir}\ --sbindir=%{_sbindir}\ --libdir=%{_libdir}\ From 0478c426c53b3651d2625e8b560fe24768494d53 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Wed, 26 Sep 2018 09:32:44 +0200 Subject: [PATCH 441/805] Introduce (debian) nut-common package for user account and shared FS objects Signed-off-by: Jim Klimov --- obs/debian.control | 6 +- obs/debian.nut-cgi.postinst | 22 +----- obs/debian.nut-client.postinst | 36 ++-------- obs/debian.nut-common.install | 1 + obs/debian.nut-common.postinst | 72 +++++++++++++++++++ obs/debian.nut-common.prerm | 36 ++++++++++ ...nt.tmpfiles => debian.nut-common.tmpfiles} | 0 obs/debian.nut-server.postinst | 36 ++-------- obs/debian.nut-server.tmpfiles | 1 - obs/debian.rules | 10 ++- 10 files changed, 133 insertions(+), 87 deletions(-) create mode 100644 obs/debian.nut-common.install create mode 100644 obs/debian.nut-common.postinst create mode 100644 obs/debian.nut-common.prerm rename obs/{debian.nut-client.tmpfiles => debian.nut-common.tmpfiles} (100%) delete mode 100644 obs/debian.nut-server.tmpfiles diff --git a/obs/debian.control b/obs/debian.control index 96103c9989..6f6e413188 100644 --- a/obs/debian.control +++ b/obs/debian.control @@ -48,7 +48,7 @@ Description: network UPS tools - metapackage Package: nut-server Architecture: any -Depends: ${shlibs:Depends}, ${misc:Depends}, adduser, lsb-base (>= 3.0-6), ${udev}, nut-client (= ${binary:Version}) +Depends: ${shlibs:Depends}, ${misc:Depends}, adduser, lsb-base (>= 3.0-6), ${udev}, nut-common (= ${binary:Version}), nut-client (= ${binary:Version}) Suggests: nut-cgi, nut-snmp, nut-ipmi, nut-xml Conflicts: nut-hal-drivers Replaces: nut (<< 2.7.4-11~) @@ -65,7 +65,7 @@ Description: network UPS tools - core system Package: nut-client Architecture: any -Depends: ${shlibs:Depends}, ${misc:Depends}, adduser, lsb-base (>= 3.0-6) +Depends: ${shlibs:Depends}, ${misc:Depends}, adduser, lsb-base (>= 3.0-6), nut-common (= ${binary:Version}) Provides: ups-monitor Conflicts: ups-monitor Recommends: bash-completion @@ -84,7 +84,7 @@ Description: network UPS tools - clients Package: nut-cgi Architecture: any -Depends: ${shlibs:Depends}, ${misc:Depends}, adduser +Depends: ${shlibs:Depends}, ${misc:Depends}, adduser, nut-common (= ${binary:Version}) Recommends: apache2 | httpd-cgi Suggests: nut Description: network UPS tools - web interface diff --git a/obs/debian.nut-cgi.postinst b/obs/debian.nut-cgi.postinst index e082532566..66a7cdba4d 100644 --- a/obs/debian.nut-cgi.postinst +++ b/obs/debian.nut-cgi.postinst @@ -1,28 +1,12 @@ #!/bin/sh -e +# Note: nut-common should be installed first and it delivers +# the user accounts and the sysconfdir (/etc/nut) + case "$1" in configure) - # make sure the nut user exists and has correct memberships - if ! getent group nut >/dev/null; then - addgroup --quiet --system nut - fi - if ! getent passwd nut >/dev/null; then - adduser --quiet --system --ingroup nut --home /var/lib/nut --no-create-home nut - elif ! groups nut | grep -qw nut; then - adduser nut nut - fi -# for Ubuntu, while waiting for a proper debconf -# if ! groups nut | grep -qw dialout; then -# adduser nut dialout -# fi - - # Ensure /etc/nut is readable/crossable for others - if [ -d /etc/nut/ ] ; then - chmod 755 /etc/nut - fi - # Ensure nut-cgi configuration files are readable by others for file in upsset.conf hosts.conf upsstats.html upsstats-single.html ; do if [ -f /etc/nut/$file ] ; then diff --git a/obs/debian.nut-client.postinst b/obs/debian.nut-client.postinst index 4b0485045a..79cb62fb1f 100644 --- a/obs/debian.nut-client.postinst +++ b/obs/debian.nut-client.postinst @@ -1,29 +1,15 @@ #!/bin/sh -e +# Note: nut-common should be installed first and it delivers +# the user accounts and the sysconfdir (/etc/nut) + case "$1" in configure) - # make sure the nut user exists and has correct memberships - if ! getent group nut >/dev/null; then - addgroup --quiet --system nut - fi - if ! getent passwd nut >/dev/null; then - adduser --quiet --system --ingroup nut --home /var/lib/nut --no-create-home nut - elif ! groups nut | grep -qw nut; then - adduser nut nut - fi -# for Ubuntu, while waiting for a proper debconf -# if ! groups nut | grep -qw dialout; then -# adduser nut dialout -# fi - - # make sure that conffiles are secured and have the correct ownerships - # on first install + # make sure that nut-client conffiles are secured and have + # the correct ownerships on first install if [ -z "$2" ] ; then - if [ -d /etc/nut/ ] ; then - chown root:nut /etc/nut/ - fi for file in nut.conf upsmon.conf upssched.conf ; do if [ -f /etc/nut/$file ] ; then chown root:nut /etc/nut/$file @@ -32,18 +18,6 @@ case "$1" in done fi - # make sure that /var/run/nut exists and has the correct ownerships - if [ ! -d /var/run/nut ] ; then - mkdir -p /var/run/nut - fi - if [ -d /var/run/nut ] ; then - chown root:nut /var/run/nut - chmod 770 /var/run/nut - if which restorecon >/dev/null 2>&1; then - restorecon /var/run/nut - fi - fi - if dpkg --compare-versions "$2" le "2.6.4-2~" && [ -f /etc/init.d/nut ] ; then if [ "`md5sum /etc/init.d/nut | cut -d ' ' -f 1`" = 72f1dbc6b92cb4407f26605d05b12681 ]; then diff --git a/obs/debian.nut-common.install b/obs/debian.nut-common.install new file mode 100644 index 0000000000..1297259bd2 --- /dev/null +++ b/obs/debian.nut-common.install @@ -0,0 +1 @@ +debian/tmp/lib/systemd/system/nut.target diff --git a/obs/debian.nut-common.postinst b/obs/debian.nut-common.postinst new file mode 100644 index 0000000000..f8f1c30a4f --- /dev/null +++ b/obs/debian.nut-common.postinst @@ -0,0 +1,72 @@ +#!/bin/sh -e + +# This package is a common prerequisite for nut-server, nut-client, nut-cgi +# and other NUT packages that deliver running programs. It creates the user +# accounts and delivers some common files (e.g. the sysconfdir /etc/nut and +# systemd nut.target) that are not quite attributable to any one particular +# package. + +case "$1" in + + configure) + + # make sure the nut user exists and has correct memberships + if ! getent group nut >/dev/null; then + addgroup --quiet --system nut + fi + if ! getent passwd nut >/dev/null; then + adduser --quiet --system --ingroup nut --home /var/lib/nut --no-create-home nut + elif ! groups nut | grep -qw nut; then + adduser nut nut + fi +# for Ubuntu, while waiting for a proper debconf +# if ! groups nut | grep -qw dialout; then +# adduser nut dialout +# fi + + # Ensure /etc/nut is readable/crossable for others + # If the (old) config directory exists, retain existing rights + # that the user might have set up for their local system needs + if [ ! -d /etc/nut ] ; then + mkdir -p /etc/nut/ + chown root:nut /etc/nut/ + chmod 755 /etc/nut/ + fi + + # make sure that /var/run/nut exists and has the correct ownerships + # (note that on newer systems, after reboot, the /run/nut is created + # by systemd using the tmpfiles configuration snippet) + if [ ! -d /var/run/nut ] ; then + mkdir -p /var/run/nut + fi + if [ -d /var/run/nut ] ; then + chown root:nut /var/run/nut + chmod 770 /var/run/nut + if which restorecon >/dev/null 2>&1; then + restorecon /var/run/nut + fi + fi + ;; + + abort-upgrade) + # do nothing + ;; + + abort-remove) + # do nothing + ;; + + abort-deconfigure) + # do nothing + ;; + + *) + echo "$0: incorrect arguments: $*" >&2 + exit 1 + ;; + +esac + +#DEBHELPER# + +exit 0 diff --git a/obs/debian.nut-common.prerm b/obs/debian.nut-common.prerm new file mode 100644 index 0000000000..a158bc572b --- /dev/null +++ b/obs/debian.nut-common.prerm @@ -0,0 +1,36 @@ +#!/bin/sh -e + +# the DEBHELPER token is purposely not used +# because we don't want the daemon to be +# stopped during an upgrade + +case "$1" in + + remove) + # Packaging assumes that this package is removed last + # of all its dependencies, so remove what we created + [ -d /var/run/nut ] && rm -rf /var/run/nut/ + ;; + + upgrade) + # do nothing + ;; + + failed-upgrade) + # do nothing + ;; + + deconfigure) + # do nothing + ;; + + *) + echo "$0: incorrect arguments: $*" >&2 + exit 1 + ;; + +esac + +#DEBHELPER# + +exit 0 diff --git a/obs/debian.nut-client.tmpfiles b/obs/debian.nut-common.tmpfiles similarity index 100% rename from obs/debian.nut-client.tmpfiles rename to obs/debian.nut-common.tmpfiles diff --git a/obs/debian.nut-server.postinst b/obs/debian.nut-server.postinst index 33221262fe..1d55bcd2c3 100644 --- a/obs/debian.nut-server.postinst +++ b/obs/debian.nut-server.postinst @@ -1,29 +1,15 @@ #!/bin/sh -e +# Note: nut-common should be installed first and it delivers +# the user accounts and the sysconfdir (/etc/nut) + case "$1" in configure) - # make sure the nut user exists and has correct memberships - if ! getent group nut >/dev/null; then - addgroup --quiet --system nut - fi - if ! getent passwd nut >/dev/null; then - adduser --quiet --system --ingroup nut --home /var/lib/nut --no-create-home nut - elif ! groups nut | grep -qw nut; then - adduser nut nut - fi -# for Ubuntu, while waiting for a proper debconf -# if ! groups nut | grep -qw dialout; then -# adduser nut dialout -# fi - - # make sure that conffiles are secured and have the correct ownerships - # on first install + # make sure that nut-server conffiles are secured and have + # the correct ownerships on first install if [ -z "$2" ] ; then - if [ -d /etc/nut/ ] ; then - chown root:nut /etc/nut/ - fi for file in ups.conf upsd.conf upsd.users ; do if [ -f /etc/nut/$file ] ; then chown root:nut /etc/nut/$file @@ -32,18 +18,6 @@ case "$1" in done fi - # make sure that /var/run/nut exists and has the correct ownerships - if [ ! -d /var/run/nut ] ; then - mkdir -p /var/run/nut - fi - if [ -d /var/run/nut ] ; then - chown root:nut /var/run/nut - chmod 770 /var/run/nut - if which restorecon >/dev/null 2>&1; then - restorecon /var/run/nut - fi - fi - # make sure that /var/lib/nut has the correct permissions and ownerships if [ -d /var/lib/nut ] ; then chown root:nut /var/lib/nut diff --git a/obs/debian.nut-server.tmpfiles b/obs/debian.nut-server.tmpfiles deleted file mode 100644 index bf195cf142..0000000000 --- a/obs/debian.nut-server.tmpfiles +++ /dev/null @@ -1 +0,0 @@ -d /run/nut 0770 root nut - - diff --git a/obs/debian.rules b/obs/debian.rules index d881d29315..f2c678f8c9 100644 --- a/obs/debian.rules +++ b/obs/debian.rules @@ -112,21 +112,27 @@ common-install-arch:: $(CURDIR)/debian/tmp/usr/lib/$(DEB_HOST_MULTIARCH)/libnutscan.so # Install systemd files only on systems where it's supported + ### Package files for nut-client: install -m 644 -D $(CURDIR)/debian/tmp/$(systemdsystemunitdir)/nut-monitor.service \ $(CURDIR)/debian/nut-client/$(systemdsystemunitdir)/nut-monitor.service + ### Package files for nut-server: install -D $(CURDIR)/debian/tmp/$(systemdshutdowndir)/nutshutdown \ $(CURDIR)/debian/nut-server/$(systemdshutdowndir)/nutshutdown install -m 644 -D $(CURDIR)/debian/tmp/$(systemdsystemunitdir)/nut-server.service \ $(CURDIR)/debian/nut-server/$(systemdsystemunitdir)/nut-server.service + # This should cover nut-driver.target, nut-driver@.service, + # nut-driver-enumerator.path, nut-driver-enumerator.service install -m 644 -t $(CURDIR)/debian/nut-server/$(systemdsystemunitdir) \ - $(CURDIR)/debian/tmp/$(systemdsystemunitdir)/nut-driver* + $(CURDIR)/debian/tmp/$(systemdsystemunitdir)/nut-driver* - # Add a symlink to mask the LSB initscript + # Add a symlink to mask the LSB initscript for nut-client: ln -s nut-monitor.service $(CURDIR)/debian/nut-client/$(systemdsystemunitdir)/nut-client.service # Install tmpfiles config file to create /run/nut directory + ### Package files for nut-client: install -m 644 -D $(CURDIR)/debian/nut-client.tmpfiles \ $(CURDIR)/debian/nut-client/usr/lib/tmpfiles.d/nut-client.conf + ### Package files for nut-server: install -m 644 -D $(CURDIR)/debian/nut-server.tmpfiles \ $(CURDIR)/debian/nut-server/usr/lib/tmpfiles.d/nut-server.conf From f8f2e81b7afe5943d05f3f33993bdfba8da9f09d Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Wed, 26 Sep 2018 10:10:37 +0200 Subject: [PATCH 442/805] Add systemd registration of installed units Signed-off-by: Jim Klimov --- obs/debian.nut-client.postinst | 4 ++++ obs/debian.nut-common.postinst | 4 ++++ obs/debian.nut-server.postinst | 6 ++++++ 3 files changed, 14 insertions(+) diff --git a/obs/debian.nut-client.postinst b/obs/debian.nut-client.postinst index 79cb62fb1f..c6ffece89d 100644 --- a/obs/debian.nut-client.postinst +++ b/obs/debian.nut-client.postinst @@ -27,6 +27,10 @@ case "$1" in fi update-rc.d nut remove >/dev/null fi + + /bin/systemctl daemon-reload + /bin/systemctl enable nut-monitor.service + ;; abort-upgrade) diff --git a/obs/debian.nut-common.postinst b/obs/debian.nut-common.postinst index f8f1c30a4f..014a2c3ffd 100644 --- a/obs/debian.nut-common.postinst +++ b/obs/debian.nut-common.postinst @@ -46,6 +46,10 @@ case "$1" in restorecon /var/run/nut fi fi + + /bin/systemctl daemon-reload + /bin/systemctl enable nut.target + ;; abort-upgrade) diff --git a/obs/debian.nut-server.postinst b/obs/debian.nut-server.postinst index 1d55bcd2c3..37bcfdadb3 100644 --- a/obs/debian.nut-server.postinst +++ b/obs/debian.nut-server.postinst @@ -39,6 +39,12 @@ case "$1" in fi update-rc.d nut remove >/dev/null fi + + /bin/systemctl daemon-reload + /bin/systemctl enable nut-driver.target + /bin/systemctl enable nut-driver-enumerator.service + /bin/systemctl enable nut-driver-enumerator.path + ;; abort-upgrade) From 63e4ff5ebdd3be0ff4af115558893b83c7ecba67 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Wed, 26 Sep 2018 11:44:02 +0200 Subject: [PATCH 443/805] Add systemd startup of installed units Signed-off-by: Jim Klimov --- obs/debian.nut-client.postinst | 3 +++ obs/debian.nut-common.postinst | 1 + obs/debian.nut-server.postinst | 18 +++++++++++++++++- 3 files changed, 21 insertions(+), 1 deletion(-) diff --git a/obs/debian.nut-client.postinst b/obs/debian.nut-client.postinst index c6ffece89d..b26dff7aee 100644 --- a/obs/debian.nut-client.postinst +++ b/obs/debian.nut-client.postinst @@ -30,6 +30,9 @@ case "$1" in /bin/systemctl daemon-reload /bin/systemctl enable nut-monitor.service + if [ -s /etc/nut/upsmon.conf ] ; then + /bin/systemctl start nut-monitor.service + fi ;; diff --git a/obs/debian.nut-common.postinst b/obs/debian.nut-common.postinst index 014a2c3ffd..e704fb7d5e 100644 --- a/obs/debian.nut-common.postinst +++ b/obs/debian.nut-common.postinst @@ -49,6 +49,7 @@ case "$1" in /bin/systemctl daemon-reload /bin/systemctl enable nut.target + /bin/systemctl start nut.target ;; diff --git a/obs/debian.nut-server.postinst b/obs/debian.nut-server.postinst index 37bcfdadb3..bc7ca21485 100644 --- a/obs/debian.nut-server.postinst +++ b/obs/debian.nut-server.postinst @@ -42,8 +42,24 @@ case "$1" in /bin/systemctl daemon-reload /bin/systemctl enable nut-driver.target - /bin/systemctl enable nut-driver-enumerator.service + /bin/systemctl start nut-driver.target + + # Watch *changes* to /etc/nut/ups.conf and trigger nut-driver-enumerator.service then /bin/systemctl enable nut-driver-enumerator.path + /bin/systemctl start nut-driver-enumerator.path + + # The nut-driver-enumerator.path reacts to changes of /etc/nut/ups.conf + # but does not execute the service handler (to add or remove nut-driver + # service instances) initially, whether the configuration exists or not. + # Running the script allows to handle that properly. + /bin/systemctl enable nut-driver-enumerator.service + /bin/systemctl start nut-driver-enumerator.service + + /bin/systemctl enable nut-server.service + # upsd accounts must be defined (if existed before) to start the service + if [ -s /etc/nut/upsd.conf ] && [ -s /etc/nut/ups.conf ]; then + /bin/systemctl start nut-server.service + fi ;; From 49135ee0f55997f3c6d0ee03d488d1f7bd1167be Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Wed, 26 Sep 2018 11:58:38 +0200 Subject: [PATCH 444/805] Add systemd shutdown of installed units during uninstallation of the packages Signed-off-by: Jim Klimov --- obs/debian.nut-client.prerm | 36 ++++++++++++++++++++++++++++++++++++ obs/debian.nut-common.prerm | 3 +++ obs/debian.nut-server.prerm | 22 +++++++++++++++++++++- 3 files changed, 60 insertions(+), 1 deletion(-) create mode 100644 obs/debian.nut-client.prerm diff --git a/obs/debian.nut-client.prerm b/obs/debian.nut-client.prerm new file mode 100644 index 0000000000..c2761a6d1e --- /dev/null +++ b/obs/debian.nut-client.prerm @@ -0,0 +1,36 @@ +#!/bin/sh -e + +# the DEBHELPER token is purposely not used +# because we don't want the daemon to be +# stopped during an upgrade + +case "$1" in + + remove) + /bin/systemctl stop nut-client.service + /bin/systemctl disable nut-client.service + + ;; + + upgrade) + # do nothing + ;; + + failed-upgrade) + # do nothing + ;; + + deconfigure) + # do nothing + ;; + + *) + echo "$0: incorrect arguments: $*" >&2 + exit 1 + ;; + +esac + +#DEBHELPER# + +exit 0 diff --git a/obs/debian.nut-common.prerm b/obs/debian.nut-common.prerm index a158bc572b..54f374288b 100644 --- a/obs/debian.nut-common.prerm +++ b/obs/debian.nut-common.prerm @@ -9,6 +9,9 @@ case "$1" in remove) # Packaging assumes that this package is removed last # of all its dependencies, so remove what we created + /bin/systemctl stop nut.target + /bin/systemctl disable nut.target + [ -d /var/run/nut ] && rm -rf /var/run/nut/ ;; diff --git a/obs/debian.nut-server.prerm b/obs/debian.nut-server.prerm index 6292ef83c7..ab68f66fcd 100644 --- a/obs/debian.nut-server.prerm +++ b/obs/debian.nut-server.prerm @@ -12,7 +12,27 @@ case "$1" in [ -f /etc/hotplug/usb/libhidups ] && rm -f /etc/hotplug/usb/libhidups [ -L /usr/doc/nut ] && rm -f /usr/doc/nut - # do stop the daemon on remove + + # do stop the daemons on remove + /bin/systemctl stop nut-driver.target + /bin/systemctl disable nut-driver.target + + /bin/systemctl stop nut-driver-enumerator.path + /bin/systemctl disable nut-driver-enumerator.path + + /bin/systemctl stop nut-driver-enumerator.service + /bin/systemctl disable nut-driver-enumerator.service + + /bin/systemctl stop nut-server.service + /bin/systemctl disable nut-server.service + + if [ -x /lib/nut/nut-driver-enumerator.sh ] ; then + for DRV in `/lib/nut/nut-driver-enumerator.sh --list-services 2>/dev/null` ; do + /bin/systemctl stop "$DRV" + /bin/systemctl disable "$DRV" + done + fi + invoke-rc.d nut stop && sleep 1 [ -d /var/run/nut ] && rm -rf /var/run/nut/ ;; From 9bbfd95b36ad861ad60f568a0284fa1f4f87fe1f Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Wed, 26 Sep 2018 12:05:03 +0200 Subject: [PATCH 445/805] debian.control : clarify where packages provide clients for "a local or remote NUT server" Signed-off-by: Jim Klimov --- obs/debian.control | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/obs/debian.control b/obs/debian.control index 6f6e413188..9905c071cc 100644 --- a/obs/debian.control +++ b/obs/debian.control @@ -80,7 +80,7 @@ Description: network UPS tools - clients changes. . This package provides NUT's clients that allows the user to control - and monitor the UPS. + and monitor the UPS by connecting to a local or remote NUT server. Package: nut-cgi Architecture: any @@ -96,6 +96,8 @@ Description: network UPS tools - web interface . This package provides an HTTP interface for Network UPS Tools which makes it possible to monitor the core NUT system with a web browser. + Note that the CGI script would connect from web-server context to its local + or remote NUT server. Package: nut-snmp Architecture: any @@ -282,7 +284,8 @@ Description: network UPS tools - GUI application to monitor UPS status through the server, and are notified whenever the power status changes. . - This package provides nut-monitor, a GUI application to monitor UPS status. + This package provides nut-monitor, a GUI application to monitor the + UPS status on a local or remote NUT server. Package: libups-nut-perl Section: perl From 957ad8e87e49d0247aa4ca61c3745046c7e8efc1 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Wed, 26 Sep 2018 12:05:41 +0200 Subject: [PATCH 446/805] debian.control : update sub-driver packages to rely on just the nut-server package, not nut metapackage Signed-off-by: Jim Klimov --- obs/debian.control | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/obs/debian.control b/obs/debian.control index 9905c071cc..770d47c3e3 100644 --- a/obs/debian.control +++ b/obs/debian.control @@ -101,7 +101,7 @@ Description: network UPS tools - web interface Package: nut-snmp Architecture: any -Depends: ${shlibs:Depends}, ${misc:Depends}, nut (= ${binary:Version}) +Depends: ${shlibs:Depends}, ${misc:Depends}, nut-server (= ${binary:Version}) Description: network UPS tools - SNMP driver Network UPS Tools (NUT) is a client/server monitoring system that allows computers to share uninterruptible power supply (UPS) and @@ -115,7 +115,7 @@ Description: network UPS tools - SNMP driver Package: nut-ipmi Architecture: linux-any kfreebsd-any -Depends: ${shlibs:Depends}, ${misc:Depends}, nut (= ${binary:Version}) +Depends: ${shlibs:Depends}, ${misc:Depends}, nut-server (= ${binary:Version}) Description: network UPS tools - IPMI driver Network UPS Tools (NUT) is a client/server monitoring system that allows computers to share uninterruptible power supply (UPS) and @@ -130,7 +130,7 @@ Description: network UPS tools - IPMI driver Package: nut-xml Architecture: any -Depends: ${shlibs:Depends}, ${misc:Depends}, nut (= ${binary:Version}) +Depends: ${shlibs:Depends}, ${misc:Depends}, nut-server (= ${binary:Version}) Description: network UPS tools - XML/HTTP driver Network UPS Tools (NUT) is a client/server monitoring system that allows computers to share uninterruptible power supply (UPS) and @@ -145,7 +145,7 @@ Description: network UPS tools - XML/HTTP driver Package: nut-powerman-pdu Architecture: any Priority: extra -Depends: ${shlibs:Depends}, ${misc:Depends}, nut (= ${binary:Version}), powerman (>= 2.3.3) +Depends: ${shlibs:Depends}, ${misc:Depends}, nut-server (= ${binary:Version}), powerman (>= 2.3.3) Description: network UPS tools - PowerMan PDU driver Network UPS Tools (NUT) is a client/server monitoring system that allows computers to share uninterruptible power supply (UPS) and From 1066962e1cbc4cd3eb563e456b2d957d51d5b6c7 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Wed, 26 Sep 2018 14:11:00 +0200 Subject: [PATCH 447/805] debian.rules : deliver one nut-common.conf tmpfiles config instead of two same files for client and server Signed-off-by: Jim Klimov --- obs/debian.rules | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/obs/debian.rules b/obs/debian.rules index f2c678f8c9..71b5788b76 100644 --- a/obs/debian.rules +++ b/obs/debian.rules @@ -129,12 +129,8 @@ common-install-arch:: ln -s nut-monitor.service $(CURDIR)/debian/nut-client/$(systemdsystemunitdir)/nut-client.service # Install tmpfiles config file to create /run/nut directory - ### Package files for nut-client: - install -m 644 -D $(CURDIR)/debian/nut-client.tmpfiles \ - $(CURDIR)/debian/nut-client/usr/lib/tmpfiles.d/nut-client.conf - ### Package files for nut-server: - install -m 644 -D $(CURDIR)/debian/nut-server.tmpfiles \ - $(CURDIR)/debian/nut-server/usr/lib/tmpfiles.d/nut-server.conf + install -m 644 -D $(CURDIR)/debian/nut-common.tmpfiles \ + $(CURDIR)/debian/nut-common/usr/lib/tmpfiles.d/nut-common.conf # Install gen-snmp-subdriver.sh for nut-snmp install -m 755 -D $(CURDIR)/scripts/subdriver/gen-snmp-subdriver.sh \ From 6550c2cfe3b7b31eb74c14569abf9332b9893fdd Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Wed, 26 Sep 2018 16:03:03 +0200 Subject: [PATCH 448/805] debian.control : reference nut-common Signed-off-by: Jim Klimov --- obs/debian.control | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/obs/debian.control b/obs/debian.control index 770d47c3e3..131c3ef5dc 100644 --- a/obs/debian.control +++ b/obs/debian.control @@ -46,6 +46,22 @@ Description: network UPS tools - metapackage This package is a metapackage that installs both nut-server and nut-client, in most cases it is sufficient for a basic UPS monitoring system. +Package: nut-common +Architecture: any +Depends: ${shlibs:Depends}, ${misc:Depends}, adduser, lsb-base (>= 3.0-6) +Suggests: nut-cgi, nut-snmp, nut-ipmi, nut-xml +Conflicts: nut-hal-drivers +Replaces: nut (<< 2.7.4-11~) +Breaks: nut (<< 2.6.1-2~) +Description: network UPS tools - core system + Network UPS Tools (NUT) is a client/server monitoring system that + allows computers to share uninterruptible power supply (UPS) and + power distribution unit (PDU) hardware. Clients access the hardware + through the server, and are notified whenever the power status + changes. + . + This package provides shared files for NUT's core system. + Package: nut-server Architecture: any Depends: ${shlibs:Depends}, ${misc:Depends}, adduser, lsb-base (>= 3.0-6), ${udev}, nut-common (= ${binary:Version}), nut-client (= ${binary:Version}) From 5c17ba942fbfccc56884be822c787392bc4a6487 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Thu, 27 Sep 2018 11:54:31 +0200 Subject: [PATCH 449/805] debian.nut-*.post/pre-inst/rm : call /bin/systemctl only on systems where it is available, and do not block on attempts to start the services Signed-off-by: Jim Klimov --- obs/debian.nut-client.postinst | 11 +++++---- obs/debian.nut-client.prerm | 8 ++++--- obs/debian.nut-common.postinst | 10 ++++---- obs/debian.nut-common.prerm | 7 ++++-- obs/debian.nut-server.postinst | 43 ++++++++++++++++++---------------- obs/debian.nut-server.prerm | 37 +++++++++++++++-------------- 6 files changed, 66 insertions(+), 50 deletions(-) diff --git a/obs/debian.nut-client.postinst b/obs/debian.nut-client.postinst index b26dff7aee..c8812e96f8 100644 --- a/obs/debian.nut-client.postinst +++ b/obs/debian.nut-client.postinst @@ -28,10 +28,13 @@ case "$1" in update-rc.d nut remove >/dev/null fi - /bin/systemctl daemon-reload - /bin/systemctl enable nut-monitor.service - if [ -s /etc/nut/upsmon.conf ] ; then - /bin/systemctl start nut-monitor.service + # SystemD-specific actions + if [ -x /bin/systemctl ] ; then + /bin/systemctl daemon-reload + /bin/systemctl enable nut-monitor.service + if [ -s /etc/nut/upsmon.conf ] ; then + /bin/systemctl start --no-block nut-monitor.service + fi fi ;; diff --git a/obs/debian.nut-client.prerm b/obs/debian.nut-client.prerm index c2761a6d1e..0e96a1fef4 100644 --- a/obs/debian.nut-client.prerm +++ b/obs/debian.nut-client.prerm @@ -7,9 +7,11 @@ case "$1" in remove) - /bin/systemctl stop nut-client.service - /bin/systemctl disable nut-client.service - + # SystemD-specific actions + if [ -x /bin/systemctl ] ; then + /bin/systemctl stop nut-client.service + /bin/systemctl disable nut-client.service + fi ;; upgrade) diff --git a/obs/debian.nut-common.postinst b/obs/debian.nut-common.postinst index e704fb7d5e..56c8da4ea3 100644 --- a/obs/debian.nut-common.postinst +++ b/obs/debian.nut-common.postinst @@ -47,10 +47,12 @@ case "$1" in fi fi - /bin/systemctl daemon-reload - /bin/systemctl enable nut.target - /bin/systemctl start nut.target - + # SystemD-specific actions + if [ -x /bin/systemctl ] ; then + /bin/systemctl daemon-reload + /bin/systemctl enable nut.target + /bin/systemctl start --no-block nut.target + fi ;; abort-upgrade) diff --git a/obs/debian.nut-common.prerm b/obs/debian.nut-common.prerm index 54f374288b..07b8cfbd92 100644 --- a/obs/debian.nut-common.prerm +++ b/obs/debian.nut-common.prerm @@ -9,8 +9,11 @@ case "$1" in remove) # Packaging assumes that this package is removed last # of all its dependencies, so remove what we created - /bin/systemctl stop nut.target - /bin/systemctl disable nut.target + # SystemD-specific actions + if [ -x /bin/systemctl ] ; then + /bin/systemctl stop nut.target + /bin/systemctl disable nut.target + fi [ -d /var/run/nut ] && rm -rf /var/run/nut/ ;; diff --git a/obs/debian.nut-server.postinst b/obs/debian.nut-server.postinst index bc7ca21485..79a6c58d20 100644 --- a/obs/debian.nut-server.postinst +++ b/obs/debian.nut-server.postinst @@ -40,27 +40,30 @@ case "$1" in update-rc.d nut remove >/dev/null fi - /bin/systemctl daemon-reload - /bin/systemctl enable nut-driver.target - /bin/systemctl start nut-driver.target - - # Watch *changes* to /etc/nut/ups.conf and trigger nut-driver-enumerator.service then - /bin/systemctl enable nut-driver-enumerator.path - /bin/systemctl start nut-driver-enumerator.path - - # The nut-driver-enumerator.path reacts to changes of /etc/nut/ups.conf - # but does not execute the service handler (to add or remove nut-driver - # service instances) initially, whether the configuration exists or not. - # Running the script allows to handle that properly. - /bin/systemctl enable nut-driver-enumerator.service - /bin/systemctl start nut-driver-enumerator.service - - /bin/systemctl enable nut-server.service - # upsd accounts must be defined (if existed before) to start the service - if [ -s /etc/nut/upsd.conf ] && [ -s /etc/nut/ups.conf ]; then - /bin/systemctl start nut-server.service - fi + # SystemD-specific actions + if [ -x /bin/systemctl ] ; then + /bin/systemctl daemon-reload + + # Watch *changes* to /etc/nut/ups.conf and trigger nut-driver-enumerator.service then + /bin/systemctl enable nut-driver-enumerator.path + /bin/systemctl start --no-block nut-driver-enumerator.path + + # The nut-driver-enumerator.path reacts to changes of /etc/nut/ups.conf + # but does not execute the service handler (to add or remove nut-driver + # service instances) initially, whether the configuration exists or not. + # Running the script allows to handle that properly. + /bin/systemctl enable nut-driver-enumerator.service + /bin/systemctl start --no-block nut-driver-enumerator.service + + /bin/systemctl enable nut-server.service + # upsd accounts must be defined (if existed before) to start the service + if [ -s /etc/nut/upsd.conf ] && [ -s /etc/nut/ups.conf ]; then + /bin/systemctl start --no-block nut-server.service + fi + /bin/systemctl enable nut-driver.target + /bin/systemctl start --no-block nut-driver.target + fi ;; abort-upgrade) diff --git a/obs/debian.nut-server.prerm b/obs/debian.nut-server.prerm index ab68f66fcd..ab4e6de0d3 100644 --- a/obs/debian.nut-server.prerm +++ b/obs/debian.nut-server.prerm @@ -14,23 +14,26 @@ case "$1" in [ -L /usr/doc/nut ] && rm -f /usr/doc/nut # do stop the daemons on remove - /bin/systemctl stop nut-driver.target - /bin/systemctl disable nut-driver.target - - /bin/systemctl stop nut-driver-enumerator.path - /bin/systemctl disable nut-driver-enumerator.path - - /bin/systemctl stop nut-driver-enumerator.service - /bin/systemctl disable nut-driver-enumerator.service - - /bin/systemctl stop nut-server.service - /bin/systemctl disable nut-server.service - - if [ -x /lib/nut/nut-driver-enumerator.sh ] ; then - for DRV in `/lib/nut/nut-driver-enumerator.sh --list-services 2>/dev/null` ; do - /bin/systemctl stop "$DRV" - /bin/systemctl disable "$DRV" - done + # SystemD-specific actions + if [ -x /bin/systemctl ] ; then + /bin/systemctl stop nut-driver.target + /bin/systemctl disable nut-driver.target + + /bin/systemctl stop nut-driver-enumerator.path + /bin/systemctl disable nut-driver-enumerator.path + + /bin/systemctl stop nut-driver-enumerator.service + /bin/systemctl disable nut-driver-enumerator.service + + /bin/systemctl stop nut-server.service + /bin/systemctl disable nut-server.service + + if [ -x /lib/nut/nut-driver-enumerator.sh ] ; then + for DRV in `/lib/nut/nut-driver-enumerator.sh --list-services 2>/dev/null` ; do + /bin/systemctl stop "$DRV" + /bin/systemctl disable "$DRV" + done + fi fi invoke-rc.d nut stop && sleep 1 From e60c7ec27fbca1bbc63f6c825f4c39dde495e3dc Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Thu, 27 Sep 2018 12:06:16 +0200 Subject: [PATCH 450/805] debian.nut-*.post/pre-inst/rm : do not fail package installation if could not start services Signed-off-by: Jim Klimov --- obs/debian.nut-client.postinst | 2 +- obs/debian.nut-common.postinst | 2 +- obs/debian.nut-server.postinst | 8 ++++---- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/obs/debian.nut-client.postinst b/obs/debian.nut-client.postinst index c8812e96f8..6b21d2d183 100644 --- a/obs/debian.nut-client.postinst +++ b/obs/debian.nut-client.postinst @@ -33,7 +33,7 @@ case "$1" in /bin/systemctl daemon-reload /bin/systemctl enable nut-monitor.service if [ -s /etc/nut/upsmon.conf ] ; then - /bin/systemctl start --no-block nut-monitor.service + /bin/systemctl start --no-block nut-monitor.service || true fi fi diff --git a/obs/debian.nut-common.postinst b/obs/debian.nut-common.postinst index 56c8da4ea3..a60c891d27 100644 --- a/obs/debian.nut-common.postinst +++ b/obs/debian.nut-common.postinst @@ -51,7 +51,7 @@ case "$1" in if [ -x /bin/systemctl ] ; then /bin/systemctl daemon-reload /bin/systemctl enable nut.target - /bin/systemctl start --no-block nut.target + /bin/systemctl start --no-block nut.target || true fi ;; diff --git a/obs/debian.nut-server.postinst b/obs/debian.nut-server.postinst index 79a6c58d20..2706bd1a0c 100644 --- a/obs/debian.nut-server.postinst +++ b/obs/debian.nut-server.postinst @@ -46,23 +46,23 @@ case "$1" in # Watch *changes* to /etc/nut/ups.conf and trigger nut-driver-enumerator.service then /bin/systemctl enable nut-driver-enumerator.path - /bin/systemctl start --no-block nut-driver-enumerator.path + /bin/systemctl start --no-block nut-driver-enumerator.path || true # The nut-driver-enumerator.path reacts to changes of /etc/nut/ups.conf # but does not execute the service handler (to add or remove nut-driver # service instances) initially, whether the configuration exists or not. # Running the script allows to handle that properly. /bin/systemctl enable nut-driver-enumerator.service - /bin/systemctl start --no-block nut-driver-enumerator.service + /bin/systemctl start --no-block nut-driver-enumerator.service || true /bin/systemctl enable nut-server.service # upsd accounts must be defined (if existed before) to start the service if [ -s /etc/nut/upsd.conf ] && [ -s /etc/nut/ups.conf ]; then - /bin/systemctl start --no-block nut-server.service + /bin/systemctl start --no-block nut-server.service || true fi /bin/systemctl enable nut-driver.target - /bin/systemctl start --no-block nut-driver.target + /bin/systemctl start --no-block nut-driver.target || true fi ;; From e6ca41884733aaa61f7244121abb1873a296bb79 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Thu, 27 Sep 2018 12:50:05 +0200 Subject: [PATCH 451/805] debian.control : new nut-common has no opinion about old nut-hal-drivers Signed-off-by: Jim Klimov --- obs/debian.control | 1 - 1 file changed, 1 deletion(-) diff --git a/obs/debian.control b/obs/debian.control index 131c3ef5dc..3f1d26a58a 100644 --- a/obs/debian.control +++ b/obs/debian.control @@ -50,7 +50,6 @@ Package: nut-common Architecture: any Depends: ${shlibs:Depends}, ${misc:Depends}, adduser, lsb-base (>= 3.0-6) Suggests: nut-cgi, nut-snmp, nut-ipmi, nut-xml -Conflicts: nut-hal-drivers Replaces: nut (<< 2.7.4-11~) Breaks: nut (<< 2.6.1-2~) Description: network UPS tools - core system From 6b0c65637eb8ae000fe20e8631e6b8cf0201142e Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Thu, 27 Sep 2018 13:11:04 +0200 Subject: [PATCH 452/805] debian.control : have "nut" metapackage explicitly depend on nut-common to pre-create things Signed-off-by: Jim Klimov --- obs/debian.control | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/obs/debian.control b/obs/debian.control index 3f1d26a58a..641a308b2a 100644 --- a/obs/debian.control +++ b/obs/debian.control @@ -35,7 +35,7 @@ XS-Testsuite: autopkgtest Package: nut Architecture: all Section: metapackages -Depends: ${misc:Depends}, nut-server (= ${binary:Version}), nut-client (= ${binary:Version}) +Depends: ${misc:Depends}, nut-common (= ${binary:Version}), nut-server (= ${binary:Version}), nut-client (= ${binary:Version}) Description: network UPS tools - metapackage Network UPS Tools (NUT) is a client/server monitoring system that allows computers to share uninterruptible power supply (UPS) and From f33af06822376b20cc9ac0c024ae2e1fc5642bc2 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Thu, 27 Sep 2018 13:11:41 +0200 Subject: [PATCH 453/805] debian.control : "nut-server" should have no business requiring "nut-client" Signed-off-by: Jim Klimov --- obs/debian.control | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/obs/debian.control b/obs/debian.control index 641a308b2a..eef2728b13 100644 --- a/obs/debian.control +++ b/obs/debian.control @@ -63,7 +63,7 @@ Description: network UPS tools - core system Package: nut-server Architecture: any -Depends: ${shlibs:Depends}, ${misc:Depends}, adduser, lsb-base (>= 3.0-6), ${udev}, nut-common (= ${binary:Version}), nut-client (= ${binary:Version}) +Depends: ${shlibs:Depends}, ${misc:Depends}, adduser, lsb-base (>= 3.0-6), ${udev}, nut-common (= ${binary:Version}) Suggests: nut-cgi, nut-snmp, nut-ipmi, nut-xml Conflicts: nut-hal-drivers Replaces: nut (<< 2.7.4-11~) From 0a62338663e0188e6202a3563a8d2edc8aec65eb Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Fri, 28 Sep 2018 00:11:36 +0200 Subject: [PATCH 454/805] nut-(client|server|common).postinst : skip DEBHELPER in our case Signed-off-by: Jim Klimov --- obs/debian.nut-client.postinst | 2 +- obs/debian.nut-common.postinst | 2 +- obs/debian.nut-server.postinst | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/obs/debian.nut-client.postinst b/obs/debian.nut-client.postinst index 6b21d2d183..32273a7d9b 100644 --- a/obs/debian.nut-client.postinst +++ b/obs/debian.nut-client.postinst @@ -58,6 +58,6 @@ case "$1" in esac -#DEBHELPER# +# Skip DEBHELPER because in this case we handle systemd in target OS better by ourselves # exit 0 diff --git a/obs/debian.nut-common.postinst b/obs/debian.nut-common.postinst index a60c891d27..0121d233c6 100644 --- a/obs/debian.nut-common.postinst +++ b/obs/debian.nut-common.postinst @@ -74,6 +74,6 @@ case "$1" in esac -#DEBHELPER# +# Skip DEBHELPER because in this case we handle systemd in target OS better by ourselves # exit 0 diff --git a/obs/debian.nut-server.postinst b/obs/debian.nut-server.postinst index 2706bd1a0c..9dde53a458 100644 --- a/obs/debian.nut-server.postinst +++ b/obs/debian.nut-server.postinst @@ -85,6 +85,6 @@ case "$1" in esac -#DEBHELPER# +# Skip DEBHELPER because in this case we handle systemd in target OS better by ourselves # exit 0 From d73855ad506b38ef21a72b00fff6be9ffc18ed0a Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Fri, 5 Oct 2018 00:05:49 +0200 Subject: [PATCH 455/805] nut-driver-enumerator : use --reconfigure to remake units from scratch in Debian postinstall Signed-off-by: Jim Klimov --- obs/debian.nut-server.postinst | 3 +++ 1 file changed, 3 insertions(+) diff --git a/obs/debian.nut-server.postinst b/obs/debian.nut-server.postinst index 9dde53a458..7b8e80a72a 100644 --- a/obs/debian.nut-server.postinst +++ b/obs/debian.nut-server.postinst @@ -42,6 +42,9 @@ case "$1" in # SystemD-specific actions if [ -x /bin/systemctl ] ; then + echo "Register NUT drivers (if any)..." + AUTO_START=no /lib/nut/nut-driver-enumerator.sh --reconfigure + /bin/systemctl daemon-reload # Watch *changes* to /etc/nut/ups.conf and trigger nut-driver-enumerator.service then From 4563117816588a411c8eebbabe47db1b5dc15c6b Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Fri, 5 Oct 2018 03:08:19 +0200 Subject: [PATCH 456/805] debian.nut-server.postinst : REPORT_RESTART_42=no when reconfiguring Signed-off-by: Jim Klimov --- obs/debian.nut-server.postinst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/obs/debian.nut-server.postinst b/obs/debian.nut-server.postinst index 7b8e80a72a..26502724c5 100644 --- a/obs/debian.nut-server.postinst +++ b/obs/debian.nut-server.postinst @@ -43,7 +43,7 @@ case "$1" in # SystemD-specific actions if [ -x /bin/systemctl ] ; then echo "Register NUT drivers (if any)..." - AUTO_START=no /lib/nut/nut-driver-enumerator.sh --reconfigure + REPORT_RESTART_42=no AUTO_START=no /lib/nut/nut-driver-enumerator.sh --reconfigure /bin/systemctl daemon-reload From 260a5974d953dfe6a59b5becf9c8e1da21ce70dc Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Thu, 6 Dec 2018 00:24:43 +0100 Subject: [PATCH 457/805] debian.control : rephrase nut-server description Signed-off-by: Jim Klimov --- obs/debian.control | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/obs/debian.control b/obs/debian.control index eef2728b13..9c1c4e4999 100644 --- a/obs/debian.control +++ b/obs/debian.control @@ -68,7 +68,7 @@ Suggests: nut-cgi, nut-snmp, nut-ipmi, nut-xml Conflicts: nut-hal-drivers Replaces: nut (<< 2.7.4-11~) Breaks: nut (<< 2.6.1-2~) -Description: network UPS tools - core system +Description: network UPS tools - data server, serial and USB drivers Network UPS Tools (NUT) is a client/server monitoring system that allows computers to share uninterruptible power supply (UPS) and power distribution unit (PDU) hardware. Clients access the hardware From 10c86ac3b4128493f6fa167656453075b675478c Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Thu, 6 Dec 2018 00:25:09 +0100 Subject: [PATCH 458/805] debian.control : nut-ipmi should have run-time deps on IPMI libs Signed-off-by: Jim Klimov --- obs/debian.control | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/obs/debian.control b/obs/debian.control index 9c1c4e4999..f2cf4beedd 100644 --- a/obs/debian.control +++ b/obs/debian.control @@ -130,7 +130,7 @@ Description: network UPS tools - SNMP driver Package: nut-ipmi Architecture: linux-any kfreebsd-any -Depends: ${shlibs:Depends}, ${misc:Depends}, nut-server (= ${binary:Version}) +Depends: ${shlibs:Depends}, ${misc:Depends}, nut-server (= ${binary:Version}), libfreeipmi (>= 0.8.5) [!hurd-i386], libipmimonitoring (>= 1.1.5-2) [!hurd-i386] Description: network UPS tools - IPMI driver Network UPS Tools (NUT) is a client/server monitoring system that allows computers to share uninterruptible power supply (UPS) and From c737a89fc6e1f476d92f4ecbb414f507ce3990da Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Wed, 20 Feb 2019 20:45:35 +0100 Subject: [PATCH 459/805] Problem: libnutclient not found in consumer packaged builds Solution: update the hardcoded pathnames in recipes, leave some comments for improvement Signed-off-by: Jim Klimov Signed-off-by: Jim Klimov --- obs/debian.control | 4 ++-- obs/debian.libnutclient0.lintian-overrides | 1 - ...nt0.install => debian.libnutclient1.install} | 0 obs/debian.libnutclient1.lintian-overrides | 1 + obs/debian.rules | 17 ++++++++++++++--- obs/nut.dsc | 4 ++-- 6 files changed, 19 insertions(+), 8 deletions(-) delete mode 100644 obs/debian.libnutclient0.lintian-overrides rename obs/{debian.libnutclient0.install => debian.libnutclient1.install} (100%) create mode 100644 obs/debian.libnutclient1.lintian-overrides diff --git a/obs/debian.control b/obs/debian.control index f2cf4beedd..d5fd9786bc 100644 --- a/obs/debian.control +++ b/obs/debian.control @@ -243,7 +243,7 @@ Description: network UPS tools - development files . This package provides the development files. -Package: libnutclient0 +Package: libnutclient1 Section: libs Architecture: any Depends: ${shlibs:Depends}, ${misc:Depends} @@ -261,7 +261,7 @@ Description: network UPS tools - new client library Package: libnutclient-dev Section: libdevel Architecture: any -Depends: libnutclient0 (= ${binary:Version}), ${shlibs:Depends}, ${misc:Depends} +Depends: libnutclient1 (= ${binary:Version}), ${shlibs:Depends}, ${misc:Depends} Description: network UPS tools - development files Network UPS Tools (NUT) is a client/server monitoring system that allows computers to share uninterruptible power supply (UPS) and diff --git a/obs/debian.libnutclient0.lintian-overrides b/obs/debian.libnutclient0.lintian-overrides deleted file mode 100644 index 6f2da5475a..0000000000 --- a/obs/debian.libnutclient0.lintian-overrides +++ /dev/null @@ -1 +0,0 @@ -libnutclient0: no-symbols-control-file shlib-missing-in-symbols-control-file diff --git a/obs/debian.libnutclient0.install b/obs/debian.libnutclient1.install similarity index 100% rename from obs/debian.libnutclient0.install rename to obs/debian.libnutclient1.install diff --git a/obs/debian.libnutclient1.lintian-overrides b/obs/debian.libnutclient1.lintian-overrides new file mode 100644 index 0000000000..19a0063f09 --- /dev/null +++ b/obs/debian.libnutclient1.lintian-overrides @@ -0,0 +1 @@ +libnutclient1: no-symbols-control-file shlib-missing-in-symbols-control-file diff --git a/obs/debian.rules b/obs/debian.rules index 71b5788b76..bed2ba8314 100644 --- a/obs/debian.rules +++ b/obs/debian.rules @@ -23,6 +23,12 @@ systemdsystemunitdir := $(shell pkg-config --variable=systemdsystemunitdir syste systemdsystemdutildir := $(shell pkg-config --variable=systemdutildir systemd || echo /lib/systemd) systemdshutdowndir := $(shell pkg-config --variable=systemdshutdowndir systemd || echo /lib/systemd/system-shutdown) +# FIXME: Find a smarter way to set those from main codebase recipes... +# Something like `grep 'version-info' **/Makefile.am` ? +SO_MAJOR_LIBUPSCLIENT=4 +SO_MAJOR_LIBNUTCLIENT=1 +SO_MAJOR_LIBNUTSCAN=1 + # List any files which are not installed include /usr/share/cdbs/1/rules/utils.mk common-binary-post-install-arch:: list-missing @@ -76,6 +82,11 @@ configure: configure.ac pre-build:: debian/compat configure +# FIXME : The recipe below is a crime scene regarding hardcoded paths that +# are more or less relevant for a particular OS distribution and version, +# and for certain nearby packages that are impacted by this, as was relevant +# at the time this recipe was written. Maybe more proper make macros can be +# used to rectify paths below and allow better manageable per-distro builds. common-install-arch:: # install the bash completion script mkdir -p $(CURDIR)/debian/tmp/usr/share/bash-completion/completions/ @@ -102,13 +113,13 @@ common-install-arch:: # Move -dev file to /usr rm -f $(CURDIR)/debian/tmp/lib/$(DEB_HOST_MULTIARCH)/libupsclient.so - ln -s /lib/$(DEB_HOST_MULTIARCH)/libupsclient.so.4 \ + ln -s /lib/$(DEB_HOST_MULTIARCH)/libupsclient.so.$(SO_MAJOR_LIBUPSCLIENT) \ $(CURDIR)/debian/tmp/usr/lib/$(DEB_HOST_MULTIARCH)/libupsclient.so rm -f $(CURDIR)/debian/tmp/lib/$(DEB_HOST_MULTIARCH)/libnutclient.so - ln -s /lib/$(DEB_HOST_MULTIARCH)/libnutclient.so.0 \ + ln -s /lib/$(DEB_HOST_MULTIARCH)/libnutclient.so.$(SO_MAJOR_LIBNUTCLIENT) \ $(CURDIR)/debian/tmp/usr/lib/$(DEB_HOST_MULTIARCH)/libnutclient.so rm -f $(CURDIR)/debian/tmp/lib/$(DEB_HOST_MULTIARCH)/libnutscan.so - ln -s /lib/$(DEB_HOST_MULTIARCH)/libnutscan.so.1 \ + ln -s /lib/$(DEB_HOST_MULTIARCH)/libnutscan.so.$(SO_MAJOR_LIBNUTSCAN) \ $(CURDIR)/debian/tmp/usr/lib/$(DEB_HOST_MULTIARCH)/libnutscan.so # Install systemd files only on systems where it's supported diff --git a/obs/nut.dsc b/obs/nut.dsc index a8bf06c3e4..744c1c0ef0 100644 --- a/obs/nut.dsc +++ b/obs/nut.dsc @@ -1,6 +1,6 @@ Format: 1.0 Source: nut -Binary: nut, nut-server, nut-client, nut-cgi, nut-snmp, nut-ipmi, nut-xml, nut-powerman-pdu, nut-doc, libupsclient4, libupsclient-dev, libnutclient0, libnutclient-dev, python-nut, nut-monitor, libups-nut-perl +Binary: nut, nut-server, nut-client, nut-cgi, nut-snmp, nut-ipmi, nut-xml, nut-powerman-pdu, nut-doc, libupsclient4, libupsclient-dev, libnutclient1, libnutclient-dev, python-nut, nut-monitor, libups-nut-perl Architecture: any all Version: 2.7.4-12 Maintainer: Arnaud Quette @@ -19,7 +19,7 @@ Build-Depends: debhelper (>= 8.1.3), cdbs (>= 0.4.122~), autotools-dev, dh-autor Build-Depends-Indep: asciidoc (>= 8.6.3), docbook-xsl, dblatex (>= 0.2.5), libxml2-utils Package-List: libnutclient-dev deb libdevel optional arch=any - libnutclient0 deb libs optional arch=any + libnutclient1 deb libs optional arch=any libnutscan-dev deb libdevel optional arch=any libnutscan1 deb libs optional arch=any libups-nut-perl deb perl optional arch=all From f542c4bdbaf9462b5ad1fa8a99289704df417b3d Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Wed, 20 Feb 2019 21:07:40 +0100 Subject: [PATCH 460/805] debian.rules : make sure wanted SONAMES exist (numbers remained unchanged) Signed-off-by: Jim Klimov --- obs/debian.rules | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/obs/debian.rules b/obs/debian.rules index bed2ba8314..998eae82eb 100644 --- a/obs/debian.rules +++ b/obs/debian.rules @@ -111,14 +111,17 @@ common-install-arch:: mv $${f} $(CURDIR)/debian/tmp/etc/nut/$${nf}; \ done - # Move -dev file to /usr + # Move -dev file to /usr; make sure wanted SONAMES exist (numbers unchanged) rm -f $(CURDIR)/debian/tmp/lib/$(DEB_HOST_MULTIARCH)/libupsclient.so + test -s $(CURDIR)/debian/tmp/lib/$(DEB_HOST_MULTIARCH)/libupsclient.so.$(SO_MAJOR_LIBUPSCLIENT) && \ ln -s /lib/$(DEB_HOST_MULTIARCH)/libupsclient.so.$(SO_MAJOR_LIBUPSCLIENT) \ $(CURDIR)/debian/tmp/usr/lib/$(DEB_HOST_MULTIARCH)/libupsclient.so rm -f $(CURDIR)/debian/tmp/lib/$(DEB_HOST_MULTIARCH)/libnutclient.so + test -s $(CURDIR)/debian/tmp/lib/$(DEB_HOST_MULTIARCH)/libnutclient.so.$(SO_MAJOR_LIBNUTCLIENT) && \ ln -s /lib/$(DEB_HOST_MULTIARCH)/libnutclient.so.$(SO_MAJOR_LIBNUTCLIENT) \ $(CURDIR)/debian/tmp/usr/lib/$(DEB_HOST_MULTIARCH)/libnutclient.so rm -f $(CURDIR)/debian/tmp/lib/$(DEB_HOST_MULTIARCH)/libnutscan.so + test -s $(CURDIR)/debian/tmp/lib/$(DEB_HOST_MULTIARCH)/libnutscan.so.$(SO_MAJOR_LIBNUTSCAN) && \ ln -s /lib/$(DEB_HOST_MULTIARCH)/libnutscan.so.$(SO_MAJOR_LIBNUTSCAN) \ $(CURDIR)/debian/tmp/usr/lib/$(DEB_HOST_MULTIARCH)/libnutscan.so From fed0573aa49153fa4c74f555810ad511b209f1fb Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Wed, 3 Apr 2019 13:10:34 +0200 Subject: [PATCH 461/805] debian.rules : update SO_MAJOR_LIBUPSCLIENT for 42ity packaging Signed-off-by: Jim Klimov --- obs/debian.rules | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/obs/debian.rules b/obs/debian.rules index 998eae82eb..f197a28637 100644 --- a/obs/debian.rules +++ b/obs/debian.rules @@ -25,7 +25,7 @@ systemdshutdowndir := $(shell pkg-config --variable=systemdshutdowndir systemd | # FIXME: Find a smarter way to set those from main codebase recipes... # Something like `grep 'version-info' **/Makefile.am` ? -SO_MAJOR_LIBUPSCLIENT=4 +SO_MAJOR_LIBUPSCLIENT=5 SO_MAJOR_LIBNUTCLIENT=1 SO_MAJOR_LIBNUTSCAN=1 From a36768395865a3c51363efb2d5d4004748bc193e Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Fri, 12 Apr 2019 17:41:27 +0200 Subject: [PATCH 462/805] Debian packaging: explicitly request libjpeg-dev so OBS is not confused for Debian 9 options Signed-off-by: Jim Klimov --- obs/debian.control | 1 + obs/nut.dsc | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/obs/debian.control b/obs/debian.control index d5fd9786bc..f3d552cf8a 100644 --- a/obs/debian.control +++ b/obs/debian.control @@ -9,6 +9,7 @@ Build-Depends: debhelper (>= 8.1.3), dh-autoreconf, dh-systemd (>= 1.14), libgd-dev | libgd2-xpm-dev | libgd2-noxpm-dev, + libjpeg-dev, libsnmp-dev | libsnmp9-dev, libusb-dev (>= 0.1.8), libneon27-gnutls-dev | libneon27-dev, diff --git a/obs/nut.dsc b/obs/nut.dsc index 744c1c0ef0..5745583f63 100644 --- a/obs/nut.dsc +++ b/obs/nut.dsc @@ -10,7 +10,7 @@ Standards-Version: 3.9.6 Vcs-Browser: http://anonscm.debian.org/gitweb/?p=collab-maint/nut.git;a=summary Vcs-Git: git://anonscm.debian.org/collab-maint/nut.git Testsuite: autopkgtest -Build-Depends: debhelper (>= 8.1.3), cdbs (>= 0.4.122~), autotools-dev, dh-autoreconf, dh-systemd (>= 1.14), libgd-dev | libgd2-xpm-dev | libgd2-noxpm-dev, libsnmp-dev | libsnmp9-dev, libusb-dev (>= 0.1.8), libneon27-gnutls-dev | libneon27-dev, libpowerman0-dev (>= 2.3.3), libwrap0-dev (>= 7.6), python (>= 2.6.6-3~), libfreeipmi-dev (>= 0.8.5) [!hurd-i386], libipmimonitoring-dev (>= 1.1.5-2) [!hurd-i386], libnss3-dev, libtool, libltdl-dev, liblua5.1-0-dev, lua5.1, pkg-config +Build-Depends: debhelper (>= 8.1.3), cdbs (>= 0.4.122~), autotools-dev, dh-autoreconf, dh-systemd (>= 1.14), libjpeg-dev, libgd-dev | libgd2-xpm-dev | libgd2-noxpm-dev, libsnmp-dev | libsnmp9-dev, libusb-dev (>= 0.1.8), libneon27-gnutls-dev | libneon27-dev, libpowerman0-dev (>= 2.3.3), libwrap0-dev (>= 7.6), python (>= 2.6.6-3~), libfreeipmi-dev (>= 0.8.5) [!hurd-i386], libipmimonitoring-dev (>= 1.1.5-2) [!hurd-i386], libnss3-dev, libtool, libltdl-dev, liblua5.1-0-dev, lua5.1, pkg-config #+++ python-pycparser # The pycparser is required to rebuild DMF files, but those pre-built # copies in the git repo/tarball "should" be in sync with original From 7986cc35a4ce632af51c4af2695231ce4fcf8283 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Fri, 12 Apr 2019 17:42:58 +0200 Subject: [PATCH 463/805] nut.spec : do not fail making build dir trees Signed-off-by: Jim Klimov --- obs/nut.spec | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/obs/nut.spec b/obs/nut.spec index 79b71ddc7e..ab28be0f30 100644 --- a/obs/nut.spec +++ b/obs/nut.spec @@ -244,10 +244,10 @@ mkdir -p %{buildroot}%{_sysconfdir}/logrotate.d install -m 644 scripts/logrotate/nutlogd %{buildroot}%{_sysconfdir}/logrotate.d/ mkdir -p %{buildroot}%{STATEPATH} rename .sample "" %{buildroot}%{_sysconfdir}/ups/*.sample -mkdir %{buildroot}/bin +mkdir -p %{buildroot}/bin mv %{buildroot}%{_bindir}/upssched-cmd %{buildroot}/bin/upssched-cmd # Rename web pages to not conflict with apache2-example-pages or user home page: -mkdir %{buildroot}%{HTMLPATH}/nut %{buildroot}%{CGIPATH}/nut +mkdir -p %{buildroot}%{HTMLPATH}/nut %{buildroot}%{CGIPATH}/nut mv %{buildroot}%{HTMLPATH}/*.{html,png} %{buildroot}%{HTMLPATH}/nut/ mv %{buildroot}%{CGIPATH}/*.cgi %{buildroot}%{CGIPATH}/nut find %{buildroot} -type f -name "*.la" -delete -print From 9664c7bd5f117dbbae3744a68fb13c0d50595307 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Fri, 12 Apr 2019 18:37:31 +0200 Subject: [PATCH 464/805] Debian packaging: explicitly request libssl*-dev so OBS is not confused for Debian 9 options Signed-off-by: Jim Klimov --- obs/debian.control | 1 + obs/nut.dsc | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/obs/debian.control b/obs/debian.control index f3d552cf8a..c3a3564535 100644 --- a/obs/debian.control +++ b/obs/debian.control @@ -11,6 +11,7 @@ Build-Depends: debhelper (>= 8.1.3), libgd-dev | libgd2-xpm-dev | libgd2-noxpm-dev, libjpeg-dev, libsnmp-dev | libsnmp9-dev, + libssl1.0-dev | libssl-dev, libusb-dev (>= 0.1.8), libneon27-gnutls-dev | libneon27-dev, libpowerman0-dev (>= 2.3.3), diff --git a/obs/nut.dsc b/obs/nut.dsc index 5745583f63..7008dabf07 100644 --- a/obs/nut.dsc +++ b/obs/nut.dsc @@ -10,7 +10,7 @@ Standards-Version: 3.9.6 Vcs-Browser: http://anonscm.debian.org/gitweb/?p=collab-maint/nut.git;a=summary Vcs-Git: git://anonscm.debian.org/collab-maint/nut.git Testsuite: autopkgtest -Build-Depends: debhelper (>= 8.1.3), cdbs (>= 0.4.122~), autotools-dev, dh-autoreconf, dh-systemd (>= 1.14), libjpeg-dev, libgd-dev | libgd2-xpm-dev | libgd2-noxpm-dev, libsnmp-dev | libsnmp9-dev, libusb-dev (>= 0.1.8), libneon27-gnutls-dev | libneon27-dev, libpowerman0-dev (>= 2.3.3), libwrap0-dev (>= 7.6), python (>= 2.6.6-3~), libfreeipmi-dev (>= 0.8.5) [!hurd-i386], libipmimonitoring-dev (>= 1.1.5-2) [!hurd-i386], libnss3-dev, libtool, libltdl-dev, liblua5.1-0-dev, lua5.1, pkg-config +Build-Depends: debhelper (>= 8.1.3), cdbs (>= 0.4.122~), autotools-dev, dh-autoreconf, dh-systemd (>= 1.14), libjpeg-dev, libgd-dev | libgd2-xpm-dev | libgd2-noxpm-dev, libssl1.0-dev | libssl-dev, libsnmp-dev | libsnmp9-dev, libusb-dev (>= 0.1.8), libneon27-gnutls-dev | libneon27-dev, libpowerman0-dev (>= 2.3.3), libwrap0-dev (>= 7.6), python (>= 2.6.6-3~), libfreeipmi-dev (>= 0.8.5) [!hurd-i386], libipmimonitoring-dev (>= 1.1.5-2) [!hurd-i386], libnss3-dev, libtool, libltdl-dev, liblua5.1-0-dev, lua5.1, pkg-config #+++ python-pycparser # The pycparser is required to rebuild DMF files, but those pre-built # copies in the git repo/tarball "should" be in sync with original From ac9ea2366133685b5fd3937a024ee6488ea1491d Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Sat, 14 Mar 2020 22:57:13 +0100 Subject: [PATCH 465/805] Fix formal 42ity packaging for nut-monitor.png icon (recent master branch added different resolutions) Signed-off-by: Jim Klimov --- obs/debian.nut-monitor.install | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/obs/debian.nut-monitor.install b/obs/debian.nut-monitor.install index 6cbef89947..f92d0850ee 100644 --- a/obs/debian.nut-monitor.install +++ b/obs/debian.nut-monitor.install @@ -2,6 +2,6 @@ scripts/python/app/NUT-Monitor usr/bin/ scripts/python/app/nut-monitor.desktop usr/share/applications/ scripts/python/app/gui-*.glade usr/share/nut-monitor/ scripts/python/app/locale/ usr/share/ -scripts/python/app/nut-monitor.png usr/share/pixmaps/ +scripts/python/app/icons/48x48/nut-monitor.png usr/share/pixmaps/ scripts/python/app/pixmaps usr/share/nut-monitor/ debian/nut-monitor.xpm usr/share/pixmaps/ From 2ad29cf9ffa25f7655405ce97473bcbd5936b189 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Fri, 6 Dec 2019 17:51:10 +0100 Subject: [PATCH 466/805] Introduce "runbasedir" in debian packaging on OBS to use /run or /var/run as appropriate Signed-off-by: Jim Klimov --- obs/debian.Makefile.in | 381 ------------------ ...-client.init => debian.nut-client.init.in} | 4 +- ...postinst => debian.nut-common.postinst.in} | 14 +- ...ommon.prerm => debian.nut-common.prerm.in} | 2 +- obs/debian.nut-common.tmpfiles | 1 - obs/debian.nut-common.tmpfiles.in | 1 + ...-server.init => debian.nut-server.init.in} | 4 +- ...erver.prerm => debian.nut-server.prerm.in} | 2 +- obs/debian.rules | 16 +- 9 files changed, 27 insertions(+), 398 deletions(-) delete mode 100644 obs/debian.Makefile.in rename obs/{debian.nut-client.init => debian.nut-client.init.in} (98%) rename obs/{debian.nut-common.postinst => debian.nut-common.postinst.in} (86%) rename obs/{debian.nut-common.prerm => debian.nut-common.prerm.in} (91%) delete mode 100644 obs/debian.nut-common.tmpfiles create mode 100644 obs/debian.nut-common.tmpfiles.in rename obs/{debian.nut-server.init => debian.nut-server.init.in} (98%) rename obs/{debian.nut-server.prerm => debian.nut-server.prerm.in} (96%) mode change 100644 => 100755 obs/debian.rules diff --git a/obs/debian.Makefile.in b/obs/debian.Makefile.in deleted file mode 100644 index aca99247d6..0000000000 --- a/obs/debian.Makefile.in +++ /dev/null @@ -1,381 +0,0 @@ -# Makefile.in generated by automake 1.10.1 from Makefile.am. -# @configure_input@ - -# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. -# This Makefile.in is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -@SET_MAKE@ -VPATH = @srcdir@ -pkgdatadir = $(datadir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ -pkgincludedir = $(includedir)/@PACKAGE@ -am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -install_sh_DATA = $(install_sh) -c -m 644 -install_sh_PROGRAM = $(install_sh) -c -install_sh_SCRIPT = $(install_sh) -c -INSTALL_HEADER = $(INSTALL_DATA) -transform = $(program_transform_name) -NORMAL_INSTALL = : -PRE_INSTALL = : -POST_INSTALL = : -NORMAL_UNINSTALL = : -PRE_UNINSTALL = : -POST_UNINSTALL = : -build_triplet = @build@ -host_triplet = @host@ -target_triplet = @target@ -subdir = packaging/debian -DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/m4/ax_create_stdint_h.m4 \ - $(top_srcdir)/m4/nut_arg_with.m4 \ - $(top_srcdir)/m4/nut_check_hiddev.m4 \ - $(top_srcdir)/m4/nut_check_ipv6.m4 \ - $(top_srcdir)/m4/nut_check_libgd.m4 \ - $(top_srcdir)/m4/nut_check_libhal.m4 \ - $(top_srcdir)/m4/nut_check_libneon.m4 \ - $(top_srcdir)/m4/nut_check_libnetsnmp.m4 \ - $(top_srcdir)/m4/nut_check_libssl.m4 \ - $(top_srcdir)/m4/nut_check_libusb.m4 \ - $(top_srcdir)/m4/nut_report_feature.m4 \ - $(top_srcdir)/m4/nut_type_socklen_t.m4 \ - $(top_srcdir)/configure.in -am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ - $(ACLOCAL_M4) -mkinstalldirs = $(install_sh) -d -CONFIG_HEADER = $(top_builddir)/include/config.h -CONFIG_CLEAN_FILES = -SOURCES = -DIST_SOURCES = -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) -ACLOCAL = @ACLOCAL@ -AMTAR = @AMTAR@ -AR = @AR@ -AUTOCONF = @AUTOCONF@ -AUTOHEADER = @AUTOHEADER@ -AUTOMAKE = @AUTOMAKE@ -AWK = @AWK@ -CC = @CC@ -CCDEPMODE = @CCDEPMODE@ -CFLAGS = @CFLAGS@ -CONFPATH = @CONFPATH@ -CPP = @CPP@ -CPPFLAGS = @CPPFLAGS@ -CXX = @CXX@ -CXXCPP = @CXXCPP@ -CXXDEPMODE = @CXXDEPMODE@ -CXXFLAGS = @CXXFLAGS@ -CYGPATH_W = @CYGPATH_W@ -DEFS = @DEFS@ -DEPDIR = @DEPDIR@ -DRIVER_BUILD_LIST = @DRIVER_BUILD_LIST@ -DRIVER_INSTALL_TARGET = @DRIVER_INSTALL_TARGET@ -DRIVER_MAN_LIST = @DRIVER_MAN_LIST@ -DSYMUTIL = @DSYMUTIL@ -ECHO = @ECHO@ -ECHO_C = @ECHO_C@ -ECHO_N = @ECHO_N@ -ECHO_T = @ECHO_T@ -EGREP = @EGREP@ -EXEEXT = @EXEEXT@ -F77 = @F77@ -FFLAGS = @FFLAGS@ -GREP = @GREP@ -HAL_CALLOUTS_PATH = @HAL_CALLOUTS_PATH@ -HAL_FDI_PATH = @HAL_FDI_PATH@ -HAL_USER = @HAL_USER@ -INSTALL = @INSTALL@ -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ -LDFLAGS = @LDFLAGS@ -LIBGD_CFLAGS = @LIBGD_CFLAGS@ -LIBGD_LDFLAGS = @LIBGD_LDFLAGS@ -LIBHAL_CFLAGS = @LIBHAL_CFLAGS@ -LIBHAL_LDFLAGS = @LIBHAL_LDFLAGS@ -LIBNEON_CFLAGS = @LIBNEON_CFLAGS@ -LIBNEON_LDFLAGS = @LIBNEON_LDFLAGS@ -LIBNETSNMP_CFLAGS = @LIBNETSNMP_CFLAGS@ -LIBNETSNMP_LDFLAGS = @LIBNETSNMP_LDFLAGS@ -LIBOBJS = @LIBOBJS@ -LIBS = @LIBS@ -LIBSSL_CFLAGS = @LIBSSL_CFLAGS@ -LIBSSL_LDFLAGS = @LIBSSL_LDFLAGS@ -LIBTOOL = @LIBTOOL@ -LIBUSB_CFLAGS = @LIBUSB_CFLAGS@ -LIBUSB_LDFLAGS = @LIBUSB_LDFLAGS@ -LINUX_HIDDEV = @LINUX_HIDDEV@ -LN_S = @LN_S@ -LTLIBOBJS = @LTLIBOBJS@ -MAINT = @MAINT@ -MAKEINFO = @MAKEINFO@ -MKDIR_P = @MKDIR_P@ -NETLIBS = @NETLIBS@ -NMEDIT = @NMEDIT@ -OBJEXT = @OBJEXT@ -PACKAGE = @PACKAGE@ -PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ -PACKAGE_NAME = @PACKAGE_NAME@ -PACKAGE_STRING = @PACKAGE_STRING@ -PACKAGE_TARNAME = @PACKAGE_TARNAME@ -PACKAGE_VERSION = @PACKAGE_VERSION@ -PATH_SEPARATOR = @PATH_SEPARATOR@ -RANLIB = @RANLIB@ -RUN_AS_GROUP = @RUN_AS_GROUP@ -RUN_AS_USER = @RUN_AS_USER@ -SED = @SED@ -SERLIBS = @SERLIBS@ -SET_MAKE = @SET_MAKE@ -SHELL = @SHELL@ -STATEPATH = @STATEPATH@ -STRIP = @STRIP@ -SUN_LIBUSB = @SUN_LIBUSB@ -VERSION = @VERSION@ -WORDS_BIGENDIAN = @WORDS_BIGENDIAN@ -abs_builddir = @abs_builddir@ -abs_srcdir = @abs_srcdir@ -abs_top_builddir = @abs_top_builddir@ -abs_top_srcdir = @abs_top_srcdir@ -ac_ct_CC = @ac_ct_CC@ -ac_ct_CXX = @ac_ct_CXX@ -ac_ct_F77 = @ac_ct_F77@ -am__include = @am__include@ -am__leading_dot = @am__leading_dot@ -am__quote = @am__quote@ -am__tar = @am__tar@ -am__untar = @am__untar@ -bindir = @bindir@ -build = @build@ -build_alias = @build_alias@ -build_cpu = @build_cpu@ -build_os = @build_os@ -build_vendor = @build_vendor@ -builddir = @builddir@ -cgiexecdir = @cgiexecdir@ -datadir = @datadir@ -datarootdir = @datarootdir@ -docdir = @docdir@ -driverexecdir = @driverexecdir@ -dvidir = @dvidir@ -exec_prefix = @exec_prefix@ -host = @host@ -host_alias = @host_alias@ -host_cpu = @host_cpu@ -host_os = @host_os@ -host_vendor = @host_vendor@ -hotplugdir = @hotplugdir@ -htmldir = @htmldir@ -includedir = @includedir@ -infodir = @infodir@ -install_sh = @install_sh@ -libdir = @libdir@ -libexecdir = @libexecdir@ -localedir = @localedir@ -localstatedir = @localstatedir@ -mandir = @mandir@ -mkdir_p = @mkdir_p@ -oldincludedir = @oldincludedir@ -pdfdir = @pdfdir@ -pkgconfigdir = @pkgconfigdir@ -prefix = @prefix@ -program_transform_name = @program_transform_name@ -psdir = @psdir@ -sbindir = @sbindir@ -sharedstatedir = @sharedstatedir@ -srcdir = @srcdir@ -sysconfdir = @sysconfdir@ -target = @target@ -target_alias = @target_alias@ -target_cpu = @target_cpu@ -target_os = @target_os@ -target_vendor = @target_vendor@ -top_builddir = @top_builddir@ -top_srcdir = @top_srcdir@ -udevdir = @udevdir@ -EXTRA_DIST = changelog control copyright description.subst hotplug \ - nut-cgi.config nut-cgi.docs nut-cgi.examples nut-cgi.postinst nut-cgi.postrm \ - nut-cgi.preinst nut-cgi.README.Debian nut-cgi.templates nut.config \ - nut.default nut.dirs nut.docs nut.examples nut-hal-drivers.docs \ - nut.init nut.links nut.postinst nut.postrm nut.preinst nut.prerm \ - nut.README.Debian nut.templates nut.TODO.Debian \ - rules watch po/ca.po po/cs.po po/de.po po/fr.po po/POTFILES.in \ - po/pt.po po/pt_BR.po po/templates.pot po/vi.po - -all: all-am - -.SUFFIXES: -$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) - @for dep in $?; do \ - case '$(am__configure_deps)' in \ - *$$dep*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ - && exit 0; \ - exit 1;; \ - esac; \ - done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu packaging/debian/Makefile'; \ - cd $(top_srcdir) && \ - $(AUTOMAKE) --gnu packaging/debian/Makefile -.PRECIOUS: Makefile -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status - @case '$?' in \ - *config.status*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ - *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ - esac; - -$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -mostlyclean-libtool: - -rm -f *.lo - -clean-libtool: - -rm -rf .libs _libs -tags: TAGS -TAGS: - -ctags: CTAGS -CTAGS: - - -distdir: $(DISTFILES) - @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ - list='$(DISTFILES)'; \ - dist_files=`for file in $$list; do echo $$file; done | \ - sed -e "s|^$$srcdirstrip/||;t" \ - -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ - case $$dist_files in \ - */*) $(MKDIR_P) `echo "$$dist_files" | \ - sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ - sort -u` ;; \ - esac; \ - for file in $$dist_files; do \ - if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - if test -d $$d/$$file; then \ - dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ - fi; \ - cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ - else \ - test -f $(distdir)/$$file \ - || cp -p $$d/$$file $(distdir)/$$file \ - || exit 1; \ - fi; \ - done -check-am: all-am -check: check-am -all-am: Makefile -installdirs: -install: install-am -install-exec: install-exec-am -install-data: install-data-am -uninstall: uninstall-am - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am - -installcheck: installcheck-am -install-strip: - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - `test -z '$(STRIP)' || \ - echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install -mostlyclean-generic: - -clean-generic: - -distclean-generic: - -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) - -maintainer-clean-generic: - @echo "This command is intended for maintainers to use" - @echo "it deletes files that may require special tools to rebuild." -clean: clean-am - -clean-am: clean-generic clean-libtool mostlyclean-am - -distclean: distclean-am - -rm -f Makefile -distclean-am: clean-am distclean-generic - -dvi: dvi-am - -dvi-am: - -html: html-am - -info: info-am - -info-am: - -install-data-am: - -install-dvi: install-dvi-am - -install-exec-am: - -install-html: install-html-am - -install-info: install-info-am - -install-man: - -install-pdf: install-pdf-am - -install-ps: install-ps-am - -installcheck-am: - -maintainer-clean: maintainer-clean-am - -rm -f Makefile -maintainer-clean-am: distclean-am maintainer-clean-generic - -mostlyclean: mostlyclean-am - -mostlyclean-am: mostlyclean-generic mostlyclean-libtool - -pdf: pdf-am - -pdf-am: - -ps: ps-am - -ps-am: - -uninstall-am: - -.MAKE: install-am install-strip - -.PHONY: all all-am check check-am clean clean-generic clean-libtool \ - distclean distclean-generic distclean-libtool distdir dvi \ - dvi-am html html-am info info-am install install-am \ - install-data install-data-am install-dvi install-dvi-am \ - install-exec install-exec-am install-html install-html-am \ - install-info install-info-am install-man install-pdf \ - install-pdf-am install-ps install-ps-am install-strip \ - installcheck installcheck-am installdirs maintainer-clean \ - maintainer-clean-generic mostlyclean mostlyclean-generic \ - mostlyclean-libtool pdf pdf-am ps ps-am uninstall uninstall-am - -# Tell versions [3.59,3.63) of GNU make to not export all variables. -# Otherwise a system limit (for SysV at least) may be exceeded. -.NOEXPORT: diff --git a/obs/debian.nut-client.init b/obs/debian.nut-client.init.in similarity index 98% rename from obs/debian.nut-client.init rename to obs/debian.nut-client.init.in index 15a9f75f37..c582cdaac2 100644 --- a/obs/debian.nut-client.init +++ b/obs/debian.nut-client.init.in @@ -19,7 +19,7 @@ PATH=/sbin:/usr/sbin:/bin:/usr/bin:/usr/local/sbin:/usr/local/bin NAME=nut-client DESC="NUT - power device monitor and shutdown controller" CONFIG=/etc/nut/nut.conf -pid_dir=/var/run/nut +pid_dir=@runbasedir@/nut upsmon_pid=${pid_dir}/upsmon.pid upsmon=/sbin/upsmon log=">/dev/null 2>/dev/null" @@ -50,7 +50,7 @@ if [ "x$MODE" = "xnone" -o -z "$MODE" ] ; then exit 0 fi -# Check if /var/run/nut exists and has the correct perms +# Check if (/var)/run/nut exists and has the correct perms check_var_directory() { [ ! -d ${pid_dir} ] && mkdir -p ${pid_dir} \ && chown root:nut ${pid_dir} \ diff --git a/obs/debian.nut-common.postinst b/obs/debian.nut-common.postinst.in similarity index 86% rename from obs/debian.nut-common.postinst rename to obs/debian.nut-common.postinst.in index 0121d233c6..74c96a34da 100644 --- a/obs/debian.nut-common.postinst +++ b/obs/debian.nut-common.postinst.in @@ -33,17 +33,17 @@ case "$1" in chmod 755 /etc/nut/ fi - # make sure that /var/run/nut exists and has the correct ownerships + # make sure that (/var)/run/nut exists and has the correct ownerships # (note that on newer systems, after reboot, the /run/nut is created # by systemd using the tmpfiles configuration snippet) - if [ ! -d /var/run/nut ] ; then - mkdir -p /var/run/nut + if [ ! -d @runbasedir@/nut ] ; then + mkdir -p @runbasedir@/nut fi - if [ -d /var/run/nut ] ; then - chown root:nut /var/run/nut - chmod 770 /var/run/nut + if [ -d @runbasedir@/nut ] ; then + chown root:nut @runbasedir@/nut + chmod 770 @runbasedir@/nut if which restorecon >/dev/null 2>&1; then - restorecon /var/run/nut + restorecon @runbasedir@/nut fi fi diff --git a/obs/debian.nut-common.prerm b/obs/debian.nut-common.prerm.in similarity index 91% rename from obs/debian.nut-common.prerm rename to obs/debian.nut-common.prerm.in index 07b8cfbd92..f77183acd3 100644 --- a/obs/debian.nut-common.prerm +++ b/obs/debian.nut-common.prerm.in @@ -15,7 +15,7 @@ case "$1" in /bin/systemctl disable nut.target fi - [ -d /var/run/nut ] && rm -rf /var/run/nut/ + [ -d @runbasedir@/nut ] && rm -rf @runbasedir@/nut/ ;; upgrade) diff --git a/obs/debian.nut-common.tmpfiles b/obs/debian.nut-common.tmpfiles deleted file mode 100644 index bf195cf142..0000000000 --- a/obs/debian.nut-common.tmpfiles +++ /dev/null @@ -1 +0,0 @@ -d /run/nut 0770 root nut - - diff --git a/obs/debian.nut-common.tmpfiles.in b/obs/debian.nut-common.tmpfiles.in new file mode 100644 index 0000000000..09fce33876 --- /dev/null +++ b/obs/debian.nut-common.tmpfiles.in @@ -0,0 +1 @@ +d @runbasedir@/nut 0770 root nut - - diff --git a/obs/debian.nut-server.init b/obs/debian.nut-server.init.in similarity index 98% rename from obs/debian.nut-server.init rename to obs/debian.nut-server.init.in index c539bd5ebe..701b702e90 100644 --- a/obs/debian.nut-server.init +++ b/obs/debian.nut-server.init.in @@ -18,7 +18,7 @@ PATH=/sbin:/usr/sbin:/bin:/usr/bin:/usr/local/sbin:/usr/local/bin NAME=nut-server DESC="NUT - power devices information server and drivers" CONFIG=/etc/nut/nut.conf -pid_dir=/var/run/nut +pid_dir=@runbasedir@/nut upsd_pid=${pid_dir}/upsd.pid upsd=/sbin/upsd upsdrvctl=/sbin/upsdrvctl @@ -48,7 +48,7 @@ if [ "x$MODE" = "xnone" -o -z "$MODE" ] ; then exit 0 fi -# Check if /var/run/nut exists and has the correct perms +# Check if (/var)/run/nut exists and has the correct perms check_var_directory() { [ ! -d ${pid_dir} ] && mkdir -p ${pid_dir} \ && chown root:nut ${pid_dir} \ diff --git a/obs/debian.nut-server.prerm b/obs/debian.nut-server.prerm.in similarity index 96% rename from obs/debian.nut-server.prerm rename to obs/debian.nut-server.prerm.in index ab4e6de0d3..cb87e3972d 100644 --- a/obs/debian.nut-server.prerm +++ b/obs/debian.nut-server.prerm.in @@ -37,7 +37,7 @@ case "$1" in fi invoke-rc.d nut stop && sleep 1 - [ -d /var/run/nut ] && rm -rf /var/run/nut/ + [ -d @runbasedir@/nut ] && rm -rf @runbasedir@/nut/ ;; upgrade) diff --git a/obs/debian.rules b/obs/debian.rules old mode 100644 new mode 100755 index f197a28637..080ea446f7 --- a/obs/debian.rules +++ b/obs/debian.rules @@ -23,6 +23,9 @@ systemdsystemunitdir := $(shell pkg-config --variable=systemdsystemunitdir syste systemdsystemdutildir := $(shell pkg-config --variable=systemdutildir systemd || echo /lib/systemd) systemdshutdowndir := $(shell pkg-config --variable=systemdshutdowndir systemd || echo /lib/systemd/system-shutdown) +# Newer systems have just /run (and yet newer systemd noisily suggests it) +runbasedir := $(shell test -d /run && echo /run || echo /var/run) + # FIXME: Find a smarter way to set those from main codebase recipes... # Something like `grep 'version-info' **/Makefile.am` ? SO_MAJOR_LIBUPSCLIENT=5 @@ -48,12 +51,12 @@ DEB_CONFIGURE_EXTRA_FLAGS := --libdir=\$${prefix}/lib/$(DEB_HOST_MULTIARCH) \ --with-dmfsnmp-regenerate=no --with-dmfnutscan-regenerate=no --with-dmfsnmp-validate=no --with-dmfnutscan-validate=no \ --with-dev \ --disable-static \ - --with-statepath=/var/run/nut \ - --with-altpidpath=/var/run/nut \ + --with-statepath=$(runbasedir)/nut \ + --with-altpidpath=$(runbasedir)/nut \ --with-drvpath=/lib/nut \ --with-cgipath=/usr/lib/cgi-bin/nut \ --with-htmlpath=/usr/share/nut/www \ - --with-pidpath=/var/run/nut \ + --with-pidpath=$(runbasedir)/nut \ --datadir=/usr/share/nut \ --with-pkgconfig-dir=/usr/lib/$(DEB_HOST_MULTIARCH)/pkgconfig \ --with-user=nut --with-group=nut @@ -88,6 +91,13 @@ pre-build:: debian/compat configure # at the time this recipe was written. Maybe more proper make macros can be # used to rectify paths below and allow better manageable per-distro builds. common-install-arch:: + # prepare debian packaging files + mkdir -p $(CURDIR)/debian + for F in debian.nut-client.init debian.nut-common.postinst debian.nut-common.prerm debian.nut-server.init debian.nut-server.prerm debian.nut-common.tmpfiles ; do \ + echo " SED $F.in => $F" ; \ + sed 's,@runbasedir[@],$(runbasedir),g' < "$(CURDIR)/obs/$$F.in" > $(CURDIR)/debian/"$$F" || exit ; \ + done + # install the bash completion script mkdir -p $(CURDIR)/debian/tmp/usr/share/bash-completion/completions/ cp $(CURDIR)/scripts/misc/nut.bash_completion \ From 6f4debd7121c0a2e8edd3789e33a975c5a6e5e4b Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Fri, 6 Dec 2019 23:45:49 +0100 Subject: [PATCH 467/805] debian.rules : fix away debian. prefix for *.in templates Signed-off-by: Jim Klimov --- obs/debian.rules | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/obs/debian.rules b/obs/debian.rules index 080ea446f7..bd8b3b84bb 100755 --- a/obs/debian.rules +++ b/obs/debian.rules @@ -93,9 +93,9 @@ pre-build:: debian/compat configure common-install-arch:: # prepare debian packaging files mkdir -p $(CURDIR)/debian - for F in debian.nut-client.init debian.nut-common.postinst debian.nut-common.prerm debian.nut-server.init debian.nut-server.prerm debian.nut-common.tmpfiles ; do \ + for F in nut-client.init nut-common.postinst nut-common.prerm nut-server.init nut-server.prerm nut-common.tmpfiles ; do \ echo " SED $F.in => $F" ; \ - sed 's,@runbasedir[@],$(runbasedir),g' < "$(CURDIR)/obs/$$F.in" > $(CURDIR)/debian/"$$F" || exit ; \ + sed 's,@runbasedir[@],$(runbasedir),g' < "$(CURDIR)/obs/debian.$$F.in" > $(CURDIR)/debian/"$$F" || exit ; \ done # install the bash completion script From 36e14be93e0b0836b220cf87897edbf8f4951ac1 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Wed, 20 Jan 2021 10:27:04 +0100 Subject: [PATCH 468/805] FTY OBS packaging: require libsystemd-dev in the build root (to use pkgconfig systemd queries) Signed-off-by: Jim Klimov --- obs/debian.control | 2 +- obs/nut.dsc | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/obs/debian.control b/obs/debian.control index c3a3564535..fd630fac23 100644 --- a/obs/debian.control +++ b/obs/debian.control @@ -7,7 +7,7 @@ Build-Depends: debhelper (>= 8.1.3), cdbs (>= 0.4.122~), autotools-dev, dh-autoreconf, - dh-systemd (>= 1.14), + dh-systemd (>= 1.14), libsystemd-dev, libgd-dev | libgd2-xpm-dev | libgd2-noxpm-dev, libjpeg-dev, libsnmp-dev | libsnmp9-dev, diff --git a/obs/nut.dsc b/obs/nut.dsc index 7008dabf07..9a4f1e8fb3 100644 --- a/obs/nut.dsc +++ b/obs/nut.dsc @@ -10,7 +10,7 @@ Standards-Version: 3.9.6 Vcs-Browser: http://anonscm.debian.org/gitweb/?p=collab-maint/nut.git;a=summary Vcs-Git: git://anonscm.debian.org/collab-maint/nut.git Testsuite: autopkgtest -Build-Depends: debhelper (>= 8.1.3), cdbs (>= 0.4.122~), autotools-dev, dh-autoreconf, dh-systemd (>= 1.14), libjpeg-dev, libgd-dev | libgd2-xpm-dev | libgd2-noxpm-dev, libssl1.0-dev | libssl-dev, libsnmp-dev | libsnmp9-dev, libusb-dev (>= 0.1.8), libneon27-gnutls-dev | libneon27-dev, libpowerman0-dev (>= 2.3.3), libwrap0-dev (>= 7.6), python (>= 2.6.6-3~), libfreeipmi-dev (>= 0.8.5) [!hurd-i386], libipmimonitoring-dev (>= 1.1.5-2) [!hurd-i386], libnss3-dev, libtool, libltdl-dev, liblua5.1-0-dev, lua5.1, pkg-config +Build-Depends: debhelper (>= 8.1.3), cdbs (>= 0.4.122~), autotools-dev, dh-autoreconf, dh-systemd (>= 1.14), libsystemd-dev, libjpeg-dev, libgd-dev | libgd2-xpm-dev | libgd2-noxpm-dev, libssl1.0-dev | libssl-dev, libsnmp-dev | libsnmp9-dev, libusb-dev (>= 0.1.8), libneon27-gnutls-dev | libneon27-dev, libpowerman0-dev (>= 2.3.3), libwrap0-dev (>= 7.6), python (>= 2.6.6-3~), libfreeipmi-dev (>= 0.8.5) [!hurd-i386], libipmimonitoring-dev (>= 1.1.5-2) [!hurd-i386], libnss3-dev, libtool, libltdl-dev, liblua5.1-0-dev, lua5.1, pkg-config #+++ python-pycparser # The pycparser is required to rebuild DMF files, but those pre-built # copies in the git repo/tarball "should" be in sync with original From e4b8f1e9209eeb719baaf23bdd2e99523f35772a Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Thu, 21 Jan 2021 01:21:55 +0100 Subject: [PATCH 469/805] nut.dsc: clarify that any python 2/3 is okay, but we need an interpreter called "python" to be generic Signed-off-by: Jim Klimov --- obs/nut.dsc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/obs/nut.dsc b/obs/nut.dsc index 9a4f1e8fb3..3ffcd87f28 100644 --- a/obs/nut.dsc +++ b/obs/nut.dsc @@ -10,7 +10,7 @@ Standards-Version: 3.9.6 Vcs-Browser: http://anonscm.debian.org/gitweb/?p=collab-maint/nut.git;a=summary Vcs-Git: git://anonscm.debian.org/collab-maint/nut.git Testsuite: autopkgtest -Build-Depends: debhelper (>= 8.1.3), cdbs (>= 0.4.122~), autotools-dev, dh-autoreconf, dh-systemd (>= 1.14), libsystemd-dev, libjpeg-dev, libgd-dev | libgd2-xpm-dev | libgd2-noxpm-dev, libssl1.0-dev | libssl-dev, libsnmp-dev | libsnmp9-dev, libusb-dev (>= 0.1.8), libneon27-gnutls-dev | libneon27-dev, libpowerman0-dev (>= 2.3.3), libwrap0-dev (>= 7.6), python (>= 2.6.6-3~), libfreeipmi-dev (>= 0.8.5) [!hurd-i386], libipmimonitoring-dev (>= 1.1.5-2) [!hurd-i386], libnss3-dev, libtool, libltdl-dev, liblua5.1-0-dev, lua5.1, pkg-config +Build-Depends: debhelper (>= 8.1.3), cdbs (>= 0.4.122~), autotools-dev, dh-autoreconf, dh-systemd (>= 1.14), libsystemd-dev, libjpeg-dev, libgd-dev | libgd2-xpm-dev | libgd2-noxpm-dev, libssl1.0-dev | libssl-dev, libsnmp-dev | libsnmp9-dev, libusb-dev (>= 0.1.8), libneon27-gnutls-dev | libneon27-dev, libpowerman0-dev (>= 2.3.3), libwrap0-dev (>= 7.6), python (>= 2.6.6-3~) | python-is-python2 | python-is-python3, python2 | python3, libfreeipmi-dev (>= 0.8.5) [!hurd-i386], libipmimonitoring-dev (>= 1.1.5-2) [!hurd-i386], libnss3-dev, libtool, libltdl-dev, liblua5.1-0-dev, lua5.1, pkg-config #+++ python-pycparser # The pycparser is required to rebuild DMF files, but those pre-built # copies in the git repo/tarball "should" be in sync with original From 36f40d3b320f12ca77b370e89671dabfcce5aec0 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Thu, 21 Jan 2021 01:35:32 +0100 Subject: [PATCH 470/805] debian.control: clarify that any python 2/3 is okay, but we need an interpreter called "python" to be generic Signed-off-by: Jim Klimov --- obs/debian.control | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/obs/debian.control b/obs/debian.control index fd630fac23..1c849f7811 100644 --- a/obs/debian.control +++ b/obs/debian.control @@ -16,7 +16,7 @@ Build-Depends: debhelper (>= 8.1.3), libneon27-gnutls-dev | libneon27-dev, libpowerman0-dev (>= 2.3.3), libwrap0-dev (>= 7.6), - python (>= 2.6.6-3~), + python (>= 2.6.6-3~) | python-is-python2 | python-is-python3, python2 | python3, libfreeipmi-dev (>= 0.8.5) [!hurd-i386], libipmimonitoring-dev (>= 1.1.5-2) [!hurd-i386], libnss3-dev, libtool, libltdl-dev, From f7e14fe5185403210624439365d56c9e6d45785a Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Thu, 21 Jan 2021 02:03:33 +0100 Subject: [PATCH 471/805] debian.rules: clarify that any python 2/3 is okay, but we need an interpreter called "python" to be generic Signed-off-by: Jim Klimov --- obs/debian.rules | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/obs/debian.rules b/obs/debian.rules index bd8b3b84bb..d9fc14637c 100755 --- a/obs/debian.rules +++ b/obs/debian.rules @@ -178,7 +178,7 @@ common-install-indep:: mkdir -p $(CURDIR)/debian/tmp/usr/share/doc/nut-doc binary-install/nut-monitor:: - dh_python2 -pnut-monitor + dh_python2 -pnut-monitor || dh_python3 -pnut-monitor || dh_python -pnut-monitor DEB_DH_INSTALLINIT_ARGS_nut-server := --init-script=nut-server --restart-after-upgrade DEB_DH_INSTALLINIT_ARGS_nut-client := --init-script=nut-client --restart-after-upgrade From 0e2f25b156057f26d686d4d9b72ec0fed53c531a Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Thu, 21 Jan 2021 02:26:40 +0100 Subject: [PATCH 472/805] debian.rules, nut.dsc: ask for dh_python2 | dh_python3 | dh_pypy Signed-off-by: Jim Klimov --- obs/debian.control | 2 +- obs/nut.dsc | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/obs/debian.control b/obs/debian.control index 1c849f7811..8d2832d5e7 100644 --- a/obs/debian.control +++ b/obs/debian.control @@ -16,7 +16,7 @@ Build-Depends: debhelper (>= 8.1.3), libneon27-gnutls-dev | libneon27-dev, libpowerman0-dev (>= 2.3.3), libwrap0-dev (>= 7.6), - python (>= 2.6.6-3~) | python-is-python2 | python-is-python3, python2 | python3, + python (>= 2.6.6-3~) | python-is-python2 | python-is-python3, python2 | python3, dh_python2 | dh_python3 | dh_pypy, libfreeipmi-dev (>= 0.8.5) [!hurd-i386], libipmimonitoring-dev (>= 1.1.5-2) [!hurd-i386], libnss3-dev, libtool, libltdl-dev, diff --git a/obs/nut.dsc b/obs/nut.dsc index 3ffcd87f28..9ac865f5a7 100644 --- a/obs/nut.dsc +++ b/obs/nut.dsc @@ -10,7 +10,7 @@ Standards-Version: 3.9.6 Vcs-Browser: http://anonscm.debian.org/gitweb/?p=collab-maint/nut.git;a=summary Vcs-Git: git://anonscm.debian.org/collab-maint/nut.git Testsuite: autopkgtest -Build-Depends: debhelper (>= 8.1.3), cdbs (>= 0.4.122~), autotools-dev, dh-autoreconf, dh-systemd (>= 1.14), libsystemd-dev, libjpeg-dev, libgd-dev | libgd2-xpm-dev | libgd2-noxpm-dev, libssl1.0-dev | libssl-dev, libsnmp-dev | libsnmp9-dev, libusb-dev (>= 0.1.8), libneon27-gnutls-dev | libneon27-dev, libpowerman0-dev (>= 2.3.3), libwrap0-dev (>= 7.6), python (>= 2.6.6-3~) | python-is-python2 | python-is-python3, python2 | python3, libfreeipmi-dev (>= 0.8.5) [!hurd-i386], libipmimonitoring-dev (>= 1.1.5-2) [!hurd-i386], libnss3-dev, libtool, libltdl-dev, liblua5.1-0-dev, lua5.1, pkg-config +Build-Depends: debhelper (>= 8.1.3), cdbs (>= 0.4.122~), autotools-dev, dh-autoreconf, dh-systemd (>= 1.14), libsystemd-dev, libjpeg-dev, libgd-dev | libgd2-xpm-dev | libgd2-noxpm-dev, libssl1.0-dev | libssl-dev, libsnmp-dev | libsnmp9-dev, libusb-dev (>= 0.1.8), libneon27-gnutls-dev | libneon27-dev, libpowerman0-dev (>= 2.3.3), libwrap0-dev (>= 7.6), python (>= 2.6.6-3~) | python-is-python2 | python-is-python3, python2 | python3, libfreeipmi-dev (>= 0.8.5) [!hurd-i386], libipmimonitoring-dev (>= 1.1.5-2) [!hurd-i386], libnss3-dev, libtool, libltdl-dev, liblua5.1-0-dev, lua5.1, pkg-config, dh_python2 | dh_python3 | dh_pypy #+++ python-pycparser # The pycparser is required to rebuild DMF files, but those pre-built # copies in the git repo/tarball "should" be in sync with original From 650f0d2814906a92f61b9cd88eb50a4a6b5f15f3 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Thu, 21 Jan 2021 02:30:00 +0100 Subject: [PATCH 473/805] debian.rules, nut.dsc: rather ask for dh-python | dh-python2 | dh-python3 | dh-pypy Signed-off-by: Jim Klimov --- obs/debian.control | 2 +- obs/nut.dsc | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/obs/debian.control b/obs/debian.control index 8d2832d5e7..f86080c4ea 100644 --- a/obs/debian.control +++ b/obs/debian.control @@ -16,7 +16,7 @@ Build-Depends: debhelper (>= 8.1.3), libneon27-gnutls-dev | libneon27-dev, libpowerman0-dev (>= 2.3.3), libwrap0-dev (>= 7.6), - python (>= 2.6.6-3~) | python-is-python2 | python-is-python3, python2 | python3, dh_python2 | dh_python3 | dh_pypy, + python (>= 2.6.6-3~) | python-is-python2 | python-is-python3, python2 | python3, dh-python | dh-python2 | dh-python3 | dh-pypy, libfreeipmi-dev (>= 0.8.5) [!hurd-i386], libipmimonitoring-dev (>= 1.1.5-2) [!hurd-i386], libnss3-dev, libtool, libltdl-dev, diff --git a/obs/nut.dsc b/obs/nut.dsc index 9ac865f5a7..44f629a491 100644 --- a/obs/nut.dsc +++ b/obs/nut.dsc @@ -10,7 +10,7 @@ Standards-Version: 3.9.6 Vcs-Browser: http://anonscm.debian.org/gitweb/?p=collab-maint/nut.git;a=summary Vcs-Git: git://anonscm.debian.org/collab-maint/nut.git Testsuite: autopkgtest -Build-Depends: debhelper (>= 8.1.3), cdbs (>= 0.4.122~), autotools-dev, dh-autoreconf, dh-systemd (>= 1.14), libsystemd-dev, libjpeg-dev, libgd-dev | libgd2-xpm-dev | libgd2-noxpm-dev, libssl1.0-dev | libssl-dev, libsnmp-dev | libsnmp9-dev, libusb-dev (>= 0.1.8), libneon27-gnutls-dev | libneon27-dev, libpowerman0-dev (>= 2.3.3), libwrap0-dev (>= 7.6), python (>= 2.6.6-3~) | python-is-python2 | python-is-python3, python2 | python3, libfreeipmi-dev (>= 0.8.5) [!hurd-i386], libipmimonitoring-dev (>= 1.1.5-2) [!hurd-i386], libnss3-dev, libtool, libltdl-dev, liblua5.1-0-dev, lua5.1, pkg-config, dh_python2 | dh_python3 | dh_pypy +Build-Depends: debhelper (>= 8.1.3), cdbs (>= 0.4.122~), autotools-dev, dh-autoreconf, dh-systemd (>= 1.14), libsystemd-dev, libjpeg-dev, libgd-dev | libgd2-xpm-dev | libgd2-noxpm-dev, libssl1.0-dev | libssl-dev, libsnmp-dev | libsnmp9-dev, libusb-dev (>= 0.1.8), libneon27-gnutls-dev | libneon27-dev, libpowerman0-dev (>= 2.3.3), libwrap0-dev (>= 7.6), python (>= 2.6.6-3~) | python-is-python2 | python-is-python3, python2 | python3, libfreeipmi-dev (>= 0.8.5) [!hurd-i386], libipmimonitoring-dev (>= 1.1.5-2) [!hurd-i386], libnss3-dev, libtool, libltdl-dev, liblua5.1-0-dev, lua5.1, pkg-config, dh-python | dh-python2 | dh-python3 | dh-pypy #+++ python-pycparser # The pycparser is required to rebuild DMF files, but those pre-built # copies in the git repo/tarball "should" be in sync with original From 464f128694e2b5018437239b198944083169368b Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Wed, 10 Feb 2021 22:48:41 +0100 Subject: [PATCH 474/805] obs packaging: avoid warnings from systemd-sysv about legacy init scripts without a service unit Signed-off-by: Jim Klimov --- obs/debian.nut-client.links | 1 + obs/debian.rules | 1 + 2 files changed, 2 insertions(+) diff --git a/obs/debian.nut-client.links b/obs/debian.nut-client.links index c8d27c5584..2248aa2b45 100644 --- a/obs/debian.nut-client.links +++ b/obs/debian.nut-client.links @@ -1 +1,2 @@ +# Legacy compat etc/init.d/nut-client etc/init.d/ups-monitor diff --git a/obs/debian.rules b/obs/debian.rules index d9fc14637c..97bf5f8028 100755 --- a/obs/debian.rules +++ b/obs/debian.rules @@ -151,6 +151,7 @@ common-install-arch:: # Add a symlink to mask the LSB initscript for nut-client: ln -s nut-monitor.service $(CURDIR)/debian/nut-client/$(systemdsystemunitdir)/nut-client.service + ln -s nut-monitor.service $(CURDIR)/debian/nut-client/$(systemdsystemunitdir)/ups-monitor.service # Install tmpfiles config file to create /run/nut directory install -m 644 -D $(CURDIR)/debian/nut-common.tmpfiles \ From 14afb55265fd9abb6a48d01f5c52fb6d414d5a80 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Tue, 4 May 2021 15:36:42 +0200 Subject: [PATCH 475/805] pkgsrc.obs: tell OBS pusher to append gitdate to version Signed-off-by: Jim Klimov --- obs/pkgsrc.obs | 1 + 1 file changed, 1 insertion(+) create mode 100644 obs/pkgsrc.obs diff --git a/obs/pkgsrc.obs b/obs/pkgsrc.obs new file mode 100644 index 0000000000..b920a89b53 --- /dev/null +++ b/obs/pkgsrc.obs @@ -0,0 +1 @@ +USE_GITCOMMIT_VERSION=yes From 2315e164abe1266dd6db47ed5d5e90155bdd9918 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Tue, 4 May 2021 15:44:01 +0200 Subject: [PATCH 476/805] pkgsrc.obs: tell OBS pusher to append gitdate to version (first line must be from a specific range of values) Signed-off-by: Jim Klimov --- obs/pkgsrc.obs | 1 + 1 file changed, 1 insertion(+) diff --git a/obs/pkgsrc.obs b/obs/pkgsrc.obs index b920a89b53..c332d140f8 100644 --- a/obs/pkgsrc.obs +++ b/obs/pkgsrc.obs @@ -1 +1,2 @@ +default USE_GITCOMMIT_VERSION=yes From 655ae4177ee298316d0d7c65c798c00dcf8ebc3a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment?= Date: Mon, 17 May 2021 15:12:06 +0000 Subject: [PATCH 477/805] Add new package for nut client stub Signed-off-by: Jim Klimov --- obs/debian.control | 28 +++++++++++++++++++ obs/debian.libnutclientstub-dev.install | 4 +++ obs/debian.libnutclientstub1.install | 1 + ...debian.libnutclientstub1.lintian-overrides | 1 + 4 files changed, 34 insertions(+) create mode 100644 obs/debian.libnutclientstub-dev.install create mode 100644 obs/debian.libnutclientstub1.install create mode 100644 obs/debian.libnutclientstub1.lintian-overrides diff --git a/obs/debian.control b/obs/debian.control index f86080c4ea..10334901f4 100644 --- a/obs/debian.control +++ b/obs/debian.control @@ -260,6 +260,21 @@ Description: network UPS tools - new client library . This package provides the new shared client library. +Package: libnutclientstub1 +Section: libs +Architecture: any +Depends: ${shlibs:Depends}, ${misc:Depends} +Pre-Depends: ${misc:Pre-Depends} +Multi-Arch: same +Description: network UPS tools - new client library Stub + Network UPS Tools (NUT) is a client/server monitoring system that + allows computers to share uninterruptible power supply (UPS) and + power distribution unit (PDU) hardware. Clients access the hardware + through the server, and are notified whenever the power status + changes. + . + This package provides the new shared client library Stub. + Package: libnutclient-dev Section: libdevel Architecture: any @@ -273,6 +288,19 @@ Description: network UPS tools - development files . This package provides the development files for the new client library. +Package: libnutclientstub-dev +Section: libdevel +Architecture: any +Depends: libnutclientstub1 (= ${binary:Version}), ${shlibs:Depends}, ${misc:Depends} +Description: network UPS tools - development files for stub + Network UPS Tools (NUT) is a client/server monitoring system that + allows computers to share uninterruptible power supply (UPS) and + power distribution unit (PDU) hardware. Clients access the hardware + through the server, and are notified whenever the power status + changes. + . + This package provides the development files for the new client library stub. + Package: python-nut Section: python Architecture: all diff --git a/obs/debian.libnutclientstub-dev.install b/obs/debian.libnutclientstub-dev.install new file mode 100644 index 0000000000..2536e97649 --- /dev/null +++ b/obs/debian.libnutclientstub-dev.install @@ -0,0 +1,4 @@ +usr/lib/*/libnutclientstub.so +usr/lib/*/libnutclientstub.a +usr/lib/*/pkgconfig/libnutclientstub.pc +usr/include/nutclientmem.h diff --git a/obs/debian.libnutclientstub1.install b/obs/debian.libnutclientstub1.install new file mode 100644 index 0000000000..34df3f1b28 --- /dev/null +++ b/obs/debian.libnutclientstub1.install @@ -0,0 +1 @@ +lib/*/libnutclientstub.so.* diff --git a/obs/debian.libnutclientstub1.lintian-overrides b/obs/debian.libnutclientstub1.lintian-overrides new file mode 100644 index 0000000000..2479407fa6 --- /dev/null +++ b/obs/debian.libnutclientstub1.lintian-overrides @@ -0,0 +1 @@ +libnutclientstub1: no-symbols-control-file shlib-missing-in-symbols-control-file From cf219c0f1a5b3f2085ddc7472863dd46e7962292 Mon Sep 17 00:00:00 2001 From: "Clappier, Eric" Date: Tue, 18 May 2021 15:42:34 +0200 Subject: [PATCH 478/805] Fix issue in debian rules for libnutclientstub Signed-off-by: Jim Klimov --- obs/debian.rules | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/obs/debian.rules b/obs/debian.rules index 97bf5f8028..9d988f3d41 100755 --- a/obs/debian.rules +++ b/obs/debian.rules @@ -30,6 +30,7 @@ runbasedir := $(shell test -d /run && echo /run || echo /var/run) # Something like `grep 'version-info' **/Makefile.am` ? SO_MAJOR_LIBUPSCLIENT=5 SO_MAJOR_LIBNUTCLIENT=1 +SO_MAJOR_LIBNUTCLIENTSTUB=1 SO_MAJOR_LIBNUTSCAN=1 # List any files which are not installed @@ -130,6 +131,10 @@ common-install-arch:: test -s $(CURDIR)/debian/tmp/lib/$(DEB_HOST_MULTIARCH)/libnutclient.so.$(SO_MAJOR_LIBNUTCLIENT) && \ ln -s /lib/$(DEB_HOST_MULTIARCH)/libnutclient.so.$(SO_MAJOR_LIBNUTCLIENT) \ $(CURDIR)/debian/tmp/usr/lib/$(DEB_HOST_MULTIARCH)/libnutclient.so + rm -f $(CURDIR)/debian/tmp/lib/$(DEB_HOST_MULTIARCH)/libnutclientstub.so + test -s $(CURDIR)/debian/tmp/lib/$(DEB_HOST_MULTIARCH)/libnutclientstub.so.$(SO_MAJOR_LIBNUTCLIENTSTUB) && \ + ln -s /lib/$(DEB_HOST_MULTIARCH)/libnutclientstub.so.$(SO_MAJOR_LIBNUTCLIENTSTUB) \ + $(CURDIR)/debian/tmp/usr/lib/$(DEB_HOST_MULTIARCH)/libnutclientstub.so rm -f $(CURDIR)/debian/tmp/lib/$(DEB_HOST_MULTIARCH)/libnutscan.so test -s $(CURDIR)/debian/tmp/lib/$(DEB_HOST_MULTIARCH)/libnutscan.so.$(SO_MAJOR_LIBNUTSCAN) && \ ln -s /lib/$(DEB_HOST_MULTIARCH)/libnutscan.so.$(SO_MAJOR_LIBNUTSCAN) \ From 371ac8d83eeec712302d26f0736ce8510bc50ecd Mon Sep 17 00:00:00 2001 From: "Clappier, Eric" Date: Tue, 18 May 2021 16:48:08 +0200 Subject: [PATCH 479/805] Remove lib static for libnutclientstub dev install Signed-off-by: Jim Klimov --- obs/debian.libnutclientstub-dev.install | 1 - 1 file changed, 1 deletion(-) diff --git a/obs/debian.libnutclientstub-dev.install b/obs/debian.libnutclientstub-dev.install index 2536e97649..fc4abb12b1 100644 --- a/obs/debian.libnutclientstub-dev.install +++ b/obs/debian.libnutclientstub-dev.install @@ -1,4 +1,3 @@ usr/lib/*/libnutclientstub.so -usr/lib/*/libnutclientstub.a usr/lib/*/pkgconfig/libnutclientstub.pc usr/include/nutclientmem.h From 39c6dff37ce2a1eacc28563b5db2cc27e50d922f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment?= Date: Thu, 12 Aug 2021 12:40:45 +0200 Subject: [PATCH 480/805] Update debian.control Signed-off-by: Jim Klimov --- obs/debian.control | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/obs/debian.control b/obs/debian.control index 10334901f4..430dfa617f 100644 --- a/obs/debian.control +++ b/obs/debian.control @@ -7,7 +7,7 @@ Build-Depends: debhelper (>= 8.1.3), cdbs (>= 0.4.122~), autotools-dev, dh-autoreconf, - dh-systemd (>= 1.14), libsystemd-dev, + libsystemd-dev, libgd-dev | libgd2-xpm-dev | libgd2-noxpm-dev, libjpeg-dev, libsnmp-dev | libsnmp9-dev, From d7058d6f69e2e5ec73d463eb7eb2fae6e2eb14ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment?= Date: Fri, 13 Aug 2021 06:04:00 +0200 Subject: [PATCH 481/805] Update nut.dsc Signed-off-by: Jim Klimov --- obs/nut.dsc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/obs/nut.dsc b/obs/nut.dsc index 44f629a491..ccd5e4437c 100644 --- a/obs/nut.dsc +++ b/obs/nut.dsc @@ -10,7 +10,7 @@ Standards-Version: 3.9.6 Vcs-Browser: http://anonscm.debian.org/gitweb/?p=collab-maint/nut.git;a=summary Vcs-Git: git://anonscm.debian.org/collab-maint/nut.git Testsuite: autopkgtest -Build-Depends: debhelper (>= 8.1.3), cdbs (>= 0.4.122~), autotools-dev, dh-autoreconf, dh-systemd (>= 1.14), libsystemd-dev, libjpeg-dev, libgd-dev | libgd2-xpm-dev | libgd2-noxpm-dev, libssl1.0-dev | libssl-dev, libsnmp-dev | libsnmp9-dev, libusb-dev (>= 0.1.8), libneon27-gnutls-dev | libneon27-dev, libpowerman0-dev (>= 2.3.3), libwrap0-dev (>= 7.6), python (>= 2.6.6-3~) | python-is-python2 | python-is-python3, python2 | python3, libfreeipmi-dev (>= 0.8.5) [!hurd-i386], libipmimonitoring-dev (>= 1.1.5-2) [!hurd-i386], libnss3-dev, libtool, libltdl-dev, liblua5.1-0-dev, lua5.1, pkg-config, dh-python | dh-python2 | dh-python3 | dh-pypy +Build-Depends: debhelper (>= 8.1.3), cdbs (>= 0.4.122~), autotools-dev, dh-autoreconf, libsystemd-dev, libjpeg-dev, libgd-dev | libgd2-xpm-dev | libgd2-noxpm-dev, libssl1.0-dev | libssl-dev, libsnmp-dev | libsnmp9-dev, libusb-dev (>= 0.1.8), libneon27-gnutls-dev | libneon27-dev, libpowerman0-dev (>= 2.3.3), libwrap0-dev (>= 7.6), python (>= 2.6.6-3~) | python-is-python2 | python-is-python3, python2 | python3, libfreeipmi-dev (>= 0.8.5) [!hurd-i386], libipmimonitoring-dev (>= 1.1.5-2) [!hurd-i386], libnss3-dev, libtool, libltdl-dev, liblua5.1-0-dev, lua5.1, pkg-config, dh-python | dh-python2 | dh-python3 | dh-pypy #+++ python-pycparser # The pycparser is required to rebuild DMF files, but those pre-built # copies in the git repo/tarball "should" be in sync with original From 0069d35d92489ba8abaa1562ad6fe59947dc7bc7 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Wed, 9 Feb 2022 14:01:30 +0100 Subject: [PATCH 482/805] packaging/debian: update for nut-modbus and nut-linux-i2c driver packages Signed-off-by: Jim Klimov --- obs/debian.changelog | 6 ++++++ obs/debian.control | 31 +++++++++++++++++++++++++++++-- obs/debian.nut-server.install | 2 ++ obs/debian.nut-server.manpages | 2 ++ obs/nut-linux-i2c.install | 2 ++ obs/nut-linux-i2c.manpages | 2 ++ obs/nut-modbus.install | 3 +++ obs/nut-modbus.manpages | 3 +++ obs/nut.dsc | 8 +++++--- 9 files changed, 54 insertions(+), 5 deletions(-) create mode 100644 obs/nut-linux-i2c.install create mode 100644 obs/nut-linux-i2c.manpages create mode 100644 obs/nut-modbus.install create mode 100644 obs/nut-modbus.manpages diff --git a/obs/debian.changelog b/obs/debian.changelog index e071d2e0e2..af5c586cb2 100644 --- a/obs/debian.changelog +++ b/obs/debian.changelog @@ -1,3 +1,9 @@ +nut (2.7.4-14) UNRELEASED; urgency=high + + * Ported packaging recipes over upstream NUT, commented away DMF + + -- Jim Klimov Wed, 9 Feb 2022 14:00:00 +0200 + nut (2.7.4-13) UNRELEASED; urgency=high * Base on daisychain+DMF branch from vyskocilm fork @ github diff --git a/obs/debian.control b/obs/debian.control index 430dfa617f..36405a20ff 100644 --- a/obs/debian.control +++ b/obs/debian.control @@ -19,6 +19,8 @@ Build-Depends: debhelper (>= 8.1.3), python (>= 2.6.6-3~) | python-is-python2 | python-is-python3, python2 | python3, dh-python | dh-python2 | dh-python3 | dh-pypy, libfreeipmi-dev (>= 0.8.5) [!hurd-i386], libipmimonitoring-dev (>= 1.1.5-2) [!hurd-i386], + libmodbus-dev (>= 3.1.6), + libi2c-dev (>= 4.0), libnss3-dev, libtool, libltdl-dev, liblua5.1-0-dev, lua5.1, @@ -51,7 +53,7 @@ Description: network UPS tools - metapackage Package: nut-common Architecture: any Depends: ${shlibs:Depends}, ${misc:Depends}, adduser, lsb-base (>= 3.0-6) -Suggests: nut-cgi, nut-snmp, nut-ipmi, nut-xml +Suggests: nut-cgi, nut-snmp, nut-ipmi, nut-modbus, nut-linux-i2c, nut-xml Replaces: nut (<< 2.7.4-11~) Breaks: nut (<< 2.6.1-2~) Description: network UPS tools - core system @@ -66,7 +68,7 @@ Description: network UPS tools - core system Package: nut-server Architecture: any Depends: ${shlibs:Depends}, ${misc:Depends}, adduser, lsb-base (>= 3.0-6), ${udev}, nut-common (= ${binary:Version}) -Suggests: nut-cgi, nut-snmp, nut-ipmi, nut-xml +Suggests: nut-cgi, nut-snmp, nut-ipmi, nut-modbus, nut-linux-i2c, nut-xml Conflicts: nut-hal-drivers Replaces: nut (<< 2.7.4-11~) Breaks: nut (<< 2.6.1-2~) @@ -145,6 +147,31 @@ Description: network UPS tools - IPMI driver popular brands, such as Dell, HP, IBM. It adds an IPMI interface to the core NUT system. +Package: nut-modbus +Architecture: any +Depends: ${shlibs:Depends}, ${misc:Depends}, nut-server (= ${binary:Version}), libmodbus (>= 3.1.6) +Description: network UPS tools - Modbus drivers + Network UPS Tools (NUT) is a client/server monitoring system that + allows computers to share uninterruptible power supply (UPS) and + power distribution unit (PDU) hardware. Clients access the hardware + through the server, and are notified whenever the power status + changes. + . + This package currently provides several drivers that can monitor + modbus devices (phoenixcontact_modbus generic_modbus huawei-ups2000). + +Package: nut-linux-i2c +Architecture: linux-any +Depends: ${shlibs:Depends}, ${misc:Depends}, nut-server (= ${binary:Version}), libi2c0 (>= 4.0) +Description: network UPS tools - Linux I2C drivers + Network UPS Tools (NUT) is a client/server monitoring system that + allows computers to share uninterruptible power supply (UPS) and + power distribution unit (PDU) hardware. Clients access the hardware + through the server, and are notified whenever the power status + changes. + . + This package currently provides asem and pijuice drivers for I2C bus. + Package: nut-xml Architecture: any Depends: ${shlibs:Depends}, ${misc:Depends}, nut-server (= ${binary:Version}) diff --git a/obs/debian.nut-server.install b/obs/debian.nut-server.install index d00e0bad2f..41c92b834b 100644 --- a/obs/debian.nut-server.install +++ b/obs/debian.nut-server.install @@ -58,3 +58,5 @@ debian/tmp/lib/nut/nutdrv_atcl_usb debian/tmp/lib/nut/nutdrv_qx debian/tmp/lib/nut/riello_ser debian/tmp/lib/nut/riello_usb +debian/tmp/lib/nut/microsol-apc +debian/tmp/lib/nut/nutdrv_siemens-sitop diff --git a/obs/debian.nut-server.manpages b/obs/debian.nut-server.manpages index d5cf07ed18..9f69f2c1d1 100644 --- a/obs/debian.nut-server.manpages +++ b/obs/debian.nut-server.manpages @@ -51,3 +51,5 @@ debian/tmp/usr/share/man/man8/nutdrv_atcl_usb.8 debian/tmp/usr/share/man/man8/nutdrv_qx.8 debian/tmp/usr/share/man/man8/riello_ser.8 debian/tmp/usr/share/man/man8/riello_usb.8 +debian/tmp/usr/share/man/man8/microsol-apc.8 +debian/tmp/usr/share/man/man8/nutdrv_siemens-sitop.8 diff --git a/obs/nut-linux-i2c.install b/obs/nut-linux-i2c.install new file mode 100644 index 0000000000..9122412c6f --- /dev/null +++ b/obs/nut-linux-i2c.install @@ -0,0 +1,2 @@ +debian/tmp/lib/nut/asem +debian/tmp/lib/nut/pijuice diff --git a/obs/nut-linux-i2c.manpages b/obs/nut-linux-i2c.manpages new file mode 100644 index 0000000000..9c85e7bb49 --- /dev/null +++ b/obs/nut-linux-i2c.manpages @@ -0,0 +1,2 @@ +debian/tmp/usr/share/man/man8/asem.8 +debian/tmp/usr/share/man/man8/pijuice.8 diff --git a/obs/nut-modbus.install b/obs/nut-modbus.install new file mode 100644 index 0000000000..957282d838 --- /dev/null +++ b/obs/nut-modbus.install @@ -0,0 +1,3 @@ +debian/tmp/lib/nut/phoenixcontact_modbus +debian/tmp/lib/nut/generic_modbus +debian/tmp/lib/nut/huawei-ups2000 \ No newline at end of file diff --git a/obs/nut-modbus.manpages b/obs/nut-modbus.manpages new file mode 100644 index 0000000000..447aac81dc --- /dev/null +++ b/obs/nut-modbus.manpages @@ -0,0 +1,3 @@ +debian/tmp/usr/share/man/man8/phoenixcontact_modbus.8 +debian/tmp/usr/share/man/man8/generic_modbus.8 +debian/tmp/usr/share/man/man8/huawei-ups2000.8 diff --git a/obs/nut.dsc b/obs/nut.dsc index ccd5e4437c..29b6c3ba3f 100644 --- a/obs/nut.dsc +++ b/obs/nut.dsc @@ -1,8 +1,8 @@ Format: 1.0 Source: nut -Binary: nut, nut-server, nut-client, nut-cgi, nut-snmp, nut-ipmi, nut-xml, nut-powerman-pdu, nut-doc, libupsclient4, libupsclient-dev, libnutclient1, libnutclient-dev, python-nut, nut-monitor, libups-nut-perl +Binary: nut, nut-server, nut-client, nut-cgi, nut-snmp, nut-ipmi, nut-modbus, nut-linux-i2c, nut-xml, nut-powerman-pdu, nut-doc, libupsclient4, libupsclient-dev, libnutclient1, libnutclient-dev, python-nut, nut-monitor, libups-nut-perl Architecture: any all -Version: 2.7.4-12 +Version: 2.7.4-14 Maintainer: Arnaud Quette Uploaders: Laurent Bigonville Homepage: http://www.networkupstools.org/ @@ -10,7 +10,7 @@ Standards-Version: 3.9.6 Vcs-Browser: http://anonscm.debian.org/gitweb/?p=collab-maint/nut.git;a=summary Vcs-Git: git://anonscm.debian.org/collab-maint/nut.git Testsuite: autopkgtest -Build-Depends: debhelper (>= 8.1.3), cdbs (>= 0.4.122~), autotools-dev, dh-autoreconf, libsystemd-dev, libjpeg-dev, libgd-dev | libgd2-xpm-dev | libgd2-noxpm-dev, libssl1.0-dev | libssl-dev, libsnmp-dev | libsnmp9-dev, libusb-dev (>= 0.1.8), libneon27-gnutls-dev | libneon27-dev, libpowerman0-dev (>= 2.3.3), libwrap0-dev (>= 7.6), python (>= 2.6.6-3~) | python-is-python2 | python-is-python3, python2 | python3, libfreeipmi-dev (>= 0.8.5) [!hurd-i386], libipmimonitoring-dev (>= 1.1.5-2) [!hurd-i386], libnss3-dev, libtool, libltdl-dev, liblua5.1-0-dev, lua5.1, pkg-config, dh-python | dh-python2 | dh-python3 | dh-pypy +Build-Depends: debhelper (>= 8.1.3), cdbs (>= 0.4.122~), autotools-dev, dh-autoreconf, libsystemd-dev, libjpeg-dev, libgd-dev | libgd2-xpm-dev | libgd2-noxpm-dev, libssl1.0-dev | libssl-dev, libsnmp-dev | libsnmp9-dev, libusb-dev (>= 0.1.8), libneon27-gnutls-dev | libneon27-dev, libpowerman0-dev (>= 2.3.3), libwrap0-dev (>= 7.6), python (>= 2.6.6-3~) | python-is-python2 | python-is-python3, python2 | python3, libfreeipmi-dev (>= 0.8.5) [!hurd-i386], libipmimonitoring-dev (>= 1.1.5-2) [!hurd-i386], libnss3-dev, libtool, libltdl-dev, liblua5.1-0-dev, lua5.1, pkg-config, dh-python | dh-python2 | dh-python3 | dh-pypy, libmodbus-dev, libi2c-dev #+++ python-pycparser # The pycparser is required to rebuild DMF files, but those pre-built # copies in the git repo/tarball "should" be in sync with original @@ -30,6 +30,8 @@ Package-List: nut-client deb admin optional arch=any nut-doc deb doc optional arch=all nut-ipmi deb admin optional arch=linux-any,kfreebsd-any + nut-linux-i2c deb admin optional arch=linux-any + nut-modbus deb admin optional arch=any nut-monitor deb admin optional arch=all nut-powerman-pdu deb admin extra arch=any nut-server deb admin optional arch=any From 21d916c11fc568582c022e6108726c841403e73b Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Thu, 10 Feb 2022 13:19:02 +0100 Subject: [PATCH 483/805] packaging/debian/control: update "libmodbus5" dependency name for Debian 11 Signed-off-by: Jim Klimov --- obs/debian.control | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/obs/debian.control b/obs/debian.control index 36405a20ff..739dc9ac01 100644 --- a/obs/debian.control +++ b/obs/debian.control @@ -149,7 +149,7 @@ Description: network UPS tools - IPMI driver Package: nut-modbus Architecture: any -Depends: ${shlibs:Depends}, ${misc:Depends}, nut-server (= ${binary:Version}), libmodbus (>= 3.1.6) +Depends: ${shlibs:Depends}, ${misc:Depends}, nut-server (= ${binary:Version}), libmodbus5 (>= 3.1.6) Description: network UPS tools - Modbus drivers Network UPS Tools (NUT) is a client/server monitoring system that allows computers to share uninterruptible power supply (UPS) and From d99441e22de432e0e44094bc74e18f1602223cd7 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Thu, 10 Feb 2022 20:34:41 +0100 Subject: [PATCH 484/805] packaging/debian/rules: report PKG_CONFIG_PATH default Signed-off-by: Jim Klimov --- obs/debian.rules | 1 + 1 file changed, 1 insertion(+) diff --git a/obs/debian.rules b/obs/debian.rules index 9d988f3d41..4eddab6022 100755 --- a/obs/debian.rules +++ b/obs/debian.rules @@ -83,6 +83,7 @@ DEB_CONFIGURE_EXTRA_FLAGS+=--with-doc=man=dist-auto configure: configure.ac (cd tools; python nut-snmpinfo.py) sh autogen.sh + echo "PKG_CONFIG_PATH default:" ; pkg-config --variable pc_path pkg-config || true pre-build:: debian/compat configure From d376d207a47960e037dd9b6641246579c86675f3 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Thu, 10 Feb 2022 20:34:29 +0100 Subject: [PATCH 485/805] packaging/debian/rules: define a systemdtmpfilesdir Signed-off-by: Jim Klimov --- obs/debian.rules | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/obs/debian.rules b/obs/debian.rules index 4eddab6022..19b383dfca 100755 --- a/obs/debian.rules +++ b/obs/debian.rules @@ -22,6 +22,7 @@ DEB_HOST_ARCH_OS := $(shell dpkg-architecture -qDEB_HOST_ARCH_OS 2>/dev/null) systemdsystemunitdir := $(shell pkg-config --variable=systemdsystemunitdir systemd || echo /lib/systemd/system) systemdsystemdutildir := $(shell pkg-config --variable=systemdutildir systemd || echo /lib/systemd) systemdshutdowndir := $(shell pkg-config --variable=systemdshutdowndir systemd || echo /lib/systemd/system-shutdown) +systemdtmpfilesdir := $(shell pkg-config --variable=systemdtmpfilesdir systemd || echo /usr/lib/tmpfiles.d) # Newer systems have just /run (and yet newer systemd noisily suggests it) runbasedir := $(shell test -d /run && echo /run || echo /var/run) @@ -68,6 +69,7 @@ ifeq (linux,$(DEB_HOST_ARCH_OS)) ### DEB_CONFIGURE_EXTRA_FLAGS+=--with-systemdsystemunitdir=/lib/systemd/system DEB_CONFIGURE_EXTRA_FLAGS+=--with-systemdsystemunitdir=$(systemdsystemunitdir) DEB_CONFIGURE_EXTRA_FLAGS+=--with-systemdshutdowndir=$(systemdshutdowndir) + DEB_CONFIGURE_EXTRA_FLAGS+=--with-systemdtmpfilesdir=$(systemdtmpfilesdir) endif # only build documentation if asciidoc is installed @@ -161,7 +163,7 @@ common-install-arch:: # Install tmpfiles config file to create /run/nut directory install -m 644 -D $(CURDIR)/debian/nut-common.tmpfiles \ - $(CURDIR)/debian/nut-common/usr/lib/tmpfiles.d/nut-common.conf + $(CURDIR)/debian/nut-common$(systemdtmpfilesdir)/nut-common.conf # Install gen-snmp-subdriver.sh for nut-snmp install -m 755 -D $(CURDIR)/scripts/subdriver/gen-snmp-subdriver.sh \ From 842ccc9222e418ef1a4117450257a1e0e5f224c1 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Wed, 30 Jul 2025 13:16:53 +0200 Subject: [PATCH 486/805] obs/README.adoc, obs/Makefile.am, Makefile.am, configure.ac: document the "obs" directory and cover it with scripting [#1209] Signed-off-by: Jim Klimov --- Makefile.am | 5 +- configure.ac | 1 + obs/Makefile.am | 122 ++++++++++++++++++++++++++++++++++++++++++++++++ obs/README.adoc | 23 +++++++++ 4 files changed, 150 insertions(+), 1 deletion(-) create mode 100644 obs/Makefile.am create mode 100644 obs/README.adoc diff --git a/Makefile.am b/Makefile.am index 0646b54128..22b7ae93f0 100644 --- a/Makefile.am +++ b/Makefile.am @@ -41,7 +41,7 @@ ACLOCAL_AMFLAGS = -I m4 # depend on stuff in "common" or tools being built first! Also "data" depends # (during "dist" time) on scripts in "tools". SUBDIRS = include common clients conf drivers tools data \ - lib scripts server tests docs/man docs + lib obs scripts server tests docs/man docs # Note: not generated from SUBDIRS, because not all are recursive: SUBDIRS_ALL_RECURSIVE = \ @@ -55,6 +55,7 @@ SUBDIRS_ALL_RECURSIVE = \ all/tools/nutconf \ all-recursive/tools \ all/lib \ + all/obs \ all-recursive/scripts \ all/server \ all/tests/NIT \ @@ -275,6 +276,7 @@ all-libs-local/tools/nut-scanner: all-libs-local/drivers all-libs-local/common a all/conf \ all/lib \ +all/obs \ .ChangeLog.adoc-parsed.latest/docs \ ChangeLog.adoc-parsed/docs \ all-recursive/data: @@ -643,6 +645,7 @@ SPELLCHECK_DIRS_MOST = \ spellcheck/conf \ spellcheck/data \ spellcheck/data/htmlcgi \ + spellcheck/obs \ spellcheck/scripts \ spellcheck/scripts/Solaris \ spellcheck/scripts/Windows \ diff --git a/configure.ac b/configure.ac index 96e1757c66..90fde4f7cd 100644 --- a/configure.ac +++ b/configure.ac @@ -6789,6 +6789,7 @@ AC_CONFIG_FILES([ lib/libnutclientstub.pc lib/libnutscan.pc lib/Makefile + obs/Makefile scripts/Aix/nut-aix.spec scripts/RedHat/ups scripts/augeas/Makefile diff --git a/obs/Makefile.am b/obs/Makefile.am new file mode 100644 index 0000000000..f278bce54f --- /dev/null +++ b/obs/Makefile.am @@ -0,0 +1,122 @@ +# Network UPS Tools: obs (root) + +EXTRA_DIST = README.adoc + +# Also EXTRA_DIST the recipe-related files (so OBS can use tarballs if they like) + +# Debian/Ubuntu recipes: +EXTRA_DIST += \ + control \ + debian.Makefile.am \ + debian.NEWS \ + debian.changelog \ + debian.compat \ + debian.control \ + debian.copyright \ + debian.description.subst \ + debian.gbp.conf \ + debian.hotplug \ + debian.libnutclient-dev.install \ + debian.libnutclient-dev.manpages \ + debian.libnutclient1.install \ + debian.libnutclient1.lintian-overrides \ + debian.libnutclientstub-dev.install \ + debian.libnutclientstub1.install \ + debian.libnutclientstub1.lintian-overrides \ + debian.libnutscan-dev.install \ + debian.libnutscan1.install \ + debian.libups-nut-perl.install \ + debian.libupsclient-dev.install \ + debian.libupsclient-dev.manpages \ + debian.libupsclient4.install \ + debian.nut-cgi.README.Debian \ + debian.nut-cgi.docs \ + debian.nut-cgi.install \ + debian.nut-cgi.manpages \ + debian.nut-cgi.postinst \ + debian.nut-cgi.postrm \ + debian.nut-client.init.in \ + debian.nut-client.install \ + debian.nut-client.links \ + debian.nut-client.lintian-overrides \ + debian.nut-client.maintscript \ + debian.nut-client.manpages \ + debian.nut-client.postinst \ + debian.nut-client.preinst \ + debian.nut-client.prerm \ + debian.nut-common.install \ + debian.nut-common.postinst.in \ + debian.nut-common.prerm.in \ + debian.nut-common.tmpfiles.in \ + debian.nut-doc.doc-base.nut-developer-guide \ + debian.nut-doc.doc-base.nut-faq \ + debian.nut-doc.doc-base.nut-packager-guide \ + debian.nut-doc.doc-base.nut-user-manual \ + debian.nut-doc.install \ + debian.nut-ipmi.install \ + debian.nut-ipmi.manpages \ + debian.nut-monitor.install \ + debian.nut-monitor.menu \ + debian.nut-monitor.xpm \ + debian.nut-powerman-pdu.install \ + debian.nut-powerman-pdu.manpages \ + debian.nut-server.dirs \ + debian.nut-server.init.in \ + debian.nut-server.install \ + debian.nut-server.manpages \ + debian.nut-server.postinst \ + debian.nut-server.postrm \ + debian.nut-server.preinst \ + debian.nut-server.prerm.in \ + debian.nut-snmp.docs \ + debian.nut-snmp.install \ + debian.nut-snmp.manpages \ + debian.nut-xml.install \ + debian.nut-xml.manpages \ + debian.nut.README.Debian \ + debian.nut.TODO.Debian \ + debian.nut.docs \ + debian.python-nut.install \ + debian.rules \ + debian.series \ + debian.watch \ + nut-linux-i2c.install \ + nut-linux-i2c.manpages \ + nut-modbus.install \ + nut-modbus.manpages \ + nut.changes \ + nut.dsc + +# RedHAT/Fedora/CentOS/... recipes: +EXTRA_DIST += \ + nut.spec + +# PKGSRC recipes: +EXTRA_DIST += \ + pkgsrc.obs + +SPELLCHECK_SRC = README.adoc + +# NOTE: Due to portability, we do not use a GNU percent-wildcard extension. +# We also have to export some variables that may be tainted by relative +# paths when parsing the other makefile (e.g. MKDIR_P that may be defined +# via expanded $(top_builddir)/install-sh): +#%-spellchecked: % Makefile.am $(top_srcdir)/docs/Makefile.am $(abs_srcdir)/$(NUT_SPELL_DICT) +# +$(MAKE) $(AM_MAKEFLAGS) -s -f $(top_builddir)/docs/Makefile MKDIR_P="$(MKDIR_P)" builddir="$(builddir)" srcdir="$(srcdir)" top_builddir="$(top_builddir)" top_srcdir="$(top_srcdir)" SPELLCHECK_SRC_ONE="$<" SPELLCHECK_SRCDIR="$(srcdir)" SPELLCHECK_BUILDDIR="$(builddir)" $@ + +# NOTE: Portable suffix rules do not allow prerequisites, so we shim them here +# by a wildcard target in case the make implementation can put the two together. +*-spellchecked: Makefile.am $(top_srcdir)/docs/Makefile.am $(abs_srcdir)/$(NUT_SPELL_DICT) + +.sample.sample-spellchecked: + +$(MAKE) $(AM_MAKEFLAGS) -s -f $(top_builddir)/docs/Makefile MKDIR_P="$(MKDIR_P)" builddir="$(builddir)" srcdir="$(srcdir)" top_builddir="$(top_builddir)" top_srcdir="$(top_srcdir)" SPELLCHECK_SRC_ONE="$<" SPELLCHECK_SRCDIR="$(srcdir)" SPELLCHECK_BUILDDIR="$(builddir)" $@ + +.in.in-spellchecked: + +$(MAKE) $(AM_MAKEFLAGS) -s -f $(top_builddir)/docs/Makefile MKDIR_P="$(MKDIR_P)" builddir="$(builddir)" srcdir="$(srcdir)" top_builddir="$(top_builddir)" top_srcdir="$(top_srcdir)" SPELLCHECK_SRC_ONE="$<" SPELLCHECK_SRCDIR="$(srcdir)" SPELLCHECK_BUILDDIR="$(builddir)" $@ + +spellcheck spellcheck-interactive spellcheck-sortdict: + +$(MAKE) $(AM_MAKEFLAGS) -f $(top_builddir)/docs/Makefile MKDIR_P="$(MKDIR_P)" builddir="$(builddir)" srcdir="$(srcdir)" top_builddir="$(top_builddir)" top_srcdir="$(top_srcdir)" SPELLCHECK_SRC="$(SPELLCHECK_SRC)" SPELLCHECK_SRCDIR="$(srcdir)" SPELLCHECK_BUILDDIR="$(builddir)" $@ + +CLEANFILES = *-spellchecked + +MAINTAINERCLEANFILES = Makefile.in .dirstamp diff --git a/obs/README.adoc b/obs/README.adoc new file mode 100644 index 0000000000..defe15c093 --- /dev/null +++ b/obs/README.adoc @@ -0,0 +1,23 @@ += Packaging recipes for OBS + +This directory holds reference NUT packaging recipes for RPM, DEB and +other formats, and is primarily aimed at automation of builds with the +link:https://openbuildservice.org/[Open Build Service (OBS)]. Note that +beside the on-line service, the software is open-source and any project +may install and run their own; back-end scripts may be added to support +more operating systems (even not necessarily Linux). + +NOTE: The layout of files and directories here is dictated by current +expectations of the OBS software (if at some point it has to be a flat +mess with no structure -- so be it). + +The recipe files themselves would likely cross-pollinate with popular +distributions, to allow easier replacement of standard, supported and +stale package builds with those of experimental development iterations. + +This should be in part facilitated by the NUT Semantic Versioning scheme (see +linkdoc:developer-guide[NUT Semantic Versioning,versioning,docs/nut-versioning.adoc]) +which adds version number components to expose the "age" of each such +iteration as a number of commits merged into the common development trunk +since a preceding release, and a number of commits unique to a feature +branch. From 7bd15d755739c2e6c2d138b7e4dc2c39b34a8b33 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Wed, 30 Jul 2025 18:01:52 +0200 Subject: [PATCH 487/805] docs/qa-guide.adoc: mention OBS [#1209] Signed-off-by: Jim Klimov --- docs/qa-guide.adoc | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/docs/qa-guide.adoc b/docs/qa-guide.adoc index 22a657c2a0..43f4494d7f 100644 --- a/docs/qa-guide.adoc +++ b/docs/qa-guide.adoc @@ -520,6 +520,21 @@ gcc and clang, C standards, and requiring to pass builds at least in a mode without warnings (and checking the other cases where any warnings are made fatal). +Open Build Service (OBS) +~~~~~~~~~~~~~~~~~~~~~~~~ +[[NUT_CI_OBS]] + +The SuSE-backed software suite and on-line instance of the Open Build +Service (OBS) allows building packages for a wide range of Linux (and +potentially non-Linux) operating system distributions. + +This can be seen as an additional CI test for multi-platform portability, +but mainly allows NUT users to get recent development builds as "proper" +packages. + +* https://build.opensuse.org/ +* https://openbuildservice.org/ + Continuous Integration (NUT CI farm) build agent preparation ------------------------------------------------------------ [[NUTCI_farm_agents]] From 9221eeefd75729d04e12aa93a104a5b3aff0964c Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Tue, 7 Oct 2025 14:22:49 +0200 Subject: [PATCH 488/805] obs/nut.spec: expand python requirements Signed-off-by: Jim Klimov --- obs/nut.spec | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/obs/nut.spec b/obs/nut.spec index ab28be0f30..50798088ea 100644 --- a/obs/nut.spec +++ b/obs/nut.spec @@ -3,6 +3,7 @@ # # Copyright (c) 2015 SUSE LINUX GmbH, Nuernberg, Germany. # Copyright (c) 2016-2018 Eaton EEIC. +# Copyright (c) 2025 by Jim Klimov # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -68,7 +69,8 @@ BuildRequires: libtool-ltdl-devel BuildRequires: libusb-devel BuildRequires: net-snmp-devel BuildRequires: pkg-config -BuildRequires: python +# Maybe older Pythons are also okay, but were not tested for ages +BuildRequires: (python >= 2.6 or python3 or python2) # LUA 5.1 or 5.2 is known ok for us, both are modern in current distros (201609xx) BuildRequires: lua-devel # TODO: Make sure how this is named to use in CentOS/RHEL (may be not in core but EPEL repos) From dca299ed425453e690811c23681268e3f8b21aef Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Tue, 7 Oct 2025 15:00:58 +0200 Subject: [PATCH 489/805] obs/nut.spec: update heading metadata Signed-off-by: Jim Klimov --- obs/nut.spec | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/obs/nut.spec b/obs/nut.spec index 50798088ea..1071d98e7d 100644 --- a/obs/nut.spec +++ b/obs/nut.spec @@ -39,12 +39,13 @@ %define systemdshutdowndir %(pkg-config --variable=systemdshutdowndir systemd) Name: nut -Version: 2.7.4 -Release: 12 +# NOTE: OBS should rewrite this: +Version: 2.8.4 +Release: 1 Summary: Network UPS Tools Core (Uninterruptible Power Supply Monitoring) License: GPL-2.0+ Group: Hardware/UPS -Url: http://www.networkupstools.org/ +Url: https://www.networkupstools.org/ Source0: %{name}-%{version}.tar.gz Requires: %{_bindir}/fgrep From 4740120bcaf36290b57fa6b5e9bf83c9dfb804de Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Tue, 7 Oct 2025 15:01:10 +0200 Subject: [PATCH 490/805] obs/nut.spec: accept either libusb-0.1 or 1.0 Signed-off-by: Jim Klimov --- obs/nut.spec | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/obs/nut.spec b/obs/nut.spec index 1071d98e7d..4eb18258b0 100644 --- a/obs/nut.spec +++ b/obs/nut.spec @@ -67,7 +67,8 @@ BuildRequires: gcc-c++ BuildRequires: gd-devel BuildRequires: libtool BuildRequires: libtool-ltdl-devel -BuildRequires: libusb-devel +# libusb-0.1 or libusb-1.0: +BuildRequires: (libusb-devel or libusbx-devel) BuildRequires: net-snmp-devel BuildRequires: pkg-config # Maybe older Pythons are also okay, but were not tested for ages From 5041dcb3760a3867c8b27093d3582e231258a698 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Tue, 7 Oct 2025 15:06:53 +0200 Subject: [PATCH 491/805] obs/nut.spec: accept either httpd-devel or apache2-devel Signed-off-by: Jim Klimov --- obs/nut.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/obs/nut.spec b/obs/nut.spec index 4eb18258b0..63f7388a1b 100644 --- a/obs/nut.spec +++ b/obs/nut.spec @@ -101,7 +101,7 @@ BuildRequires: asciidoc %if 0%{?centos_version} BuildRequires: cppunit-devel BuildRequires: dbus-glib-devel -BuildRequires: httpd-devel +BuildRequires: (httpd-devel or apache2-devel) BuildRequires: neon-devel BuildRequires: openssl-devel BuildRequires: tcp_wrappers-devel From c9bf30b4d4e7d913daf8d32ce6d508baf30bee49 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Tue, 7 Oct 2025 15:11:09 +0200 Subject: [PATCH 492/805] obs/nut.spec: make DMF builds and deliveries optional (currently off by default) Signed-off-by: Jim Klimov --- obs/nut.spec | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/obs/nut.spec b/obs/nut.spec index 63f7388a1b..5e4dbe1cd8 100644 --- a/obs/nut.spec +++ b/obs/nut.spec @@ -37,6 +37,7 @@ %define systemdsystemunitdir %(pkg-config --variable=systemdsystemunitdir systemd) %define systemdsystemdutildir %(pkg-config --variable=systemdutildir systemd) %define systemdshutdowndir %(pkg-config --variable=systemdshutdowndir systemd) +%define NUTPKG_WITH_DMF 0 Name: nut # NOTE: OBS should rewrite this: @@ -75,12 +76,15 @@ BuildRequires: pkg-config BuildRequires: (python >= 2.6 or python3 or python2) # LUA 5.1 or 5.2 is known ok for us, both are modern in current distros (201609xx) BuildRequires: lua-devel + +%if 0%{?NUTPKG_WITH_DMF} # TODO: Make sure how this is named to use in CentOS/RHEL (may be not in core but EPEL repos) # The pycparser is required to rebuild DMF files, but those pre-built # copies in the git repo/tarball "should" be in sync with original # C files, so we don't require regeneration for packaging. Also the # Jenkins NUT-master job should have verified this. #BuildRequires: python-pycparser +%endif %if 0%{?suse_version} BuildRequires: apache2-devel @@ -214,7 +218,6 @@ sh autogen.sh --with-usb\ --with-snmp\ --with-neon\ - --with-snmp_dmf_lua\ --with-dev\ --with-ipmi \ --with-powerman=auto\ @@ -229,7 +232,10 @@ sh autogen.sh --enable-option-checking=fatal\ --with-systemdsystemunitdir --with-systemdshutdowndir \ --with-augeas-lenses-dir=/usr/share/augeas/lenses/dist \ +%if 0%{?NUTPKG_WITH_DMF} + --with-snmp_dmf_lua\ --with-dmfsnmp-regenerate=no --with-dmfnutscan-regenerate=no --with-dmfsnmp-validate=no --with-dmfnutscan-validate=no +%endif (cd tools; python nut-snmpinfo.py) @@ -350,9 +356,11 @@ bin/chmod 600 %{CONFPATH}/upsd.conf %{CONFPATH}/upsmon.conf %{CONFPATH}/upsd.use %defattr(-,root,root) %{MODELPATH}/snmp-ups %{MODELPATH}/netxml-ups -%{_bindir}/nut-scanner-reindex-dmfsnmp %{_mandir}/man8/netxml-ups*.* %{_mandir}/man8/snmp-ups*.* +%{_sbindir}/gen-snmp-subdriver.sh +%if 0%{?NUTPKG_WITH_DMF} +%{_bindir}/nut-scanner-reindex-dmfsnmp %dir %{_datadir}/nut/dmfnutscan %dir %{_datadir}/nut/dmfsnmp %{_datadir}/nut/dmfnutscan/*.dmf @@ -363,7 +371,7 @@ bin/chmod 600 %{CONFPATH}/upsd.conf %{CONFPATH}/upsmon.conf %{CONFPATH}/upsd.use %dir %{_datadir}/nut/dmfsnmp.d %{_datadir}/nut/dmfnutscan.d/*.dmf %{_datadir}/nut/dmfsnmp.d/*.dmf -%{_sbindir}/gen-snmp-subdriver.sh +%endif %files -n libupsclient1 %defattr(-,root,root) From 11d1b5d662bf7e80107d50ad19cad9aaf0939663 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Tue, 7 Oct 2025 15:48:41 +0200 Subject: [PATCH 493/805] obs/nut.spec: make IPMI, AVAHI and POWERMAN builds optional (if package seems available to be installed) Signed-off-by: Jim Klimov --- obs/nut.spec | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/obs/nut.spec b/obs/nut.spec index 5e4dbe1cd8..af985175fd 100644 --- a/obs/nut.spec +++ b/obs/nut.spec @@ -37,8 +37,14 @@ %define systemdsystemunitdir %(pkg-config --variable=systemdsystemunitdir systemd) %define systemdsystemdutildir %(pkg-config --variable=systemdutildir systemd) %define systemdshutdowndir %(pkg-config --variable=systemdshutdowndir systemd) + %define NUTPKG_WITH_DMF 0 +# Not all distros have it +%define NUTPKG_WITH_FREEIPMI %( (yum search freeipmi-devel | grep -E '^(lib)?freeipmi-devel\.' && exit ; dnf search freeipmi-devel | grep -E '^(lib)?freeipmi-devel\.' && exit ; zypper search -s freeipmi-devel | grep -E '(lib)?freeipmi-devel' && exit ; urpmq --sources freeipmi-devel && exit ; pkcon search name freeipmi-devel | grep -E '(Available|Installed).*freeipmi-devel' && exit;) >&2 && echo 1 || echo 0) +%define NUTPKG_WITH_POWERMAN %( (yum search powerman-devel | grep -E '^(lib)?powerman-devel\.' && exit ; dnf search powerman-devel | grep -E '^(lib)?powerman-devel\.' && exit ; zypper search -s powerman-devel | grep -E '(lib)?powerman-devel' && exit ; urpmq --sources powerman-devel && exit ; pkcon search name powerman-devel | grep -E '(Available|Installed).*powerman-devel' && exit;) >&2 && echo 1 || echo 0) +%define NUTPKG_WITH_AVAHI %( (yum search avahi-devel | grep -E '^(lib)?avahi-devel\.' && exit ; dnf search avahi-devel | grep -E '^(lib)?avahi-devel\.' && exit ; zypper search -s avahi-devel | grep -E '(lib)?avahi-devel' && exit ; urpmq --sources avahi-devel && exit ; pkcon search name avahi-devel | grep -E '(Available|Installed).*avahi-devel' && exit;) >&2 && echo 1 || echo 0) + Name: nut # NOTE: OBS should rewrite this: Version: 2.8.4 @@ -60,10 +66,17 @@ Requires(post): udev %endif BuildRoot: %{_tmppath}/%{name}-%{version}-build -BuildRequires: avahi-devel # To fix end-of-line encoding: BuildRequires: dos2unix -BuildRequires: freeipmi-devel + +%if 0${?NUTPKG_WITH_AVAHI} +BuildRequires: avahi-devel +%endif + +%if 0${?NUTPKG_WITH_FREEIPMI} +BuildRequires: (libfreeipmi-devel or freeipmi-devel) +%endif + BuildRequires: gcc-c++ BuildRequires: gd-devel BuildRequires: libtool @@ -86,6 +99,10 @@ BuildRequires: lua-devel #BuildRequires: python-pycparser %endif +%if 0${?NUTPKG_WITH_POWERMAN} +BuildRequires: powerman-devel +%endif + %if 0%{?suse_version} BuildRequires: apache2-devel BuildRequires: dbus-1-glib-devel @@ -93,7 +110,6 @@ BuildRequires: libcppunit-devel BuildRequires: libneon-devel BuildRequires: libopenssl-devel BuildRequires: systemd-rpm-macros -BuildRequires: powerman-devel BuildRequires: tcpd-devel # TODO: For doc build: move out of opensuse ###BuildRequires: asciidoc @@ -219,7 +235,7 @@ sh autogen.sh --with-snmp\ --with-neon\ --with-dev\ - --with-ipmi \ + --with-ipmi=auto\ --with-powerman=auto\ --with-doc=man=dist-auto\ --with-htmlpath=%{HTMLPATH}\ From 6bf36379d57d97f3b13c0b6baeb19ab629da05a2 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Tue, 7 Oct 2025 15:49:12 +0200 Subject: [PATCH 494/805] obs/nut.spec: refactor BuildRequires to avoid catering to distro-specific macro names Signed-off-by: Jim Klimov --- obs/nut.spec | 42 ++++++++++++++++++------------------------ 1 file changed, 18 insertions(+), 24 deletions(-) diff --git a/obs/nut.spec b/obs/nut.spec index af985175fd..3b7bb2a45d 100644 --- a/obs/nut.spec +++ b/obs/nut.spec @@ -99,43 +99,37 @@ BuildRequires: lua-devel #BuildRequires: python-pycparser %endif +# Variant names in different distros +# For some may have to fiddle with +# %if 0%{?centos_version} +# %if 0%{?suse_version} +# %if 0%{?rhel_version}>=7 +# and whatnot + +BuildRequires: (httpd-devel or apache2-devel) +BuildRequires: (libcppunit-devel or cppunit-devel) +BuildRequires: (dbus-1-glib-devel or dbus-glib-devel) +BuildRequires: (tcpd-devel or tcp_wrappers-devel) + +# May be plain "neon" and "libusb" in RHEL7 or older? +BuildRequires: (libneon-devel or neon-devel) +BuildRequires: (libopenssl-devel or openssl-devel) + %if 0${?NUTPKG_WITH_POWERMAN} BuildRequires: powerman-devel %endif %if 0%{?suse_version} -BuildRequires: apache2-devel -BuildRequires: dbus-1-glib-devel -BuildRequires: libcppunit-devel -BuildRequires: libneon-devel -BuildRequires: libopenssl-devel BuildRequires: systemd-rpm-macros -BuildRequires: tcpd-devel -# TODO: For doc build: move out of opensuse -###BuildRequires: asciidoc BuildRequires: dblatex -BuildRequires: libxslt-tools %endif -BuildRequires: asciidoc -%if 0%{?centos_version} -BuildRequires: cppunit-devel -BuildRequires: dbus-glib-devel -BuildRequires: (httpd-devel or apache2-devel) -BuildRequires: neon-devel -BuildRequires: openssl-devel -BuildRequires: tcp_wrappers-devel -BuildRequires: libxslt -%endif +BuildRequires: (libxslt-tools or libxslt) +BuildRequires: asciidoc %if 0%{?rhel_version}>=7 -BuildRequires: dbus-glib-devel -BuildRequires: httpd-devel BuildRequires: libusb BuildRequires: neon -BuildRequires: openssl-devel -BuildRequires: tcp_wrappers-devel -BuildRequires: libxslt %endif %if %{defined opensuse_version} From fca2efc822901c94cf4837167f862348ce095480 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Tue, 7 Oct 2025 15:57:10 +0200 Subject: [PATCH 495/805] obs/nut.spec: make TCP_WRAPPERS builds optional (if package seems available to be installed - was obsoleted in many distros) Signed-off-by: Jim Klimov --- obs/nut.spec | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/obs/nut.spec b/obs/nut.spec index 3b7bb2a45d..1f25cf7712 100644 --- a/obs/nut.spec +++ b/obs/nut.spec @@ -44,6 +44,7 @@ %define NUTPKG_WITH_FREEIPMI %( (yum search freeipmi-devel | grep -E '^(lib)?freeipmi-devel\.' && exit ; dnf search freeipmi-devel | grep -E '^(lib)?freeipmi-devel\.' && exit ; zypper search -s freeipmi-devel | grep -E '(lib)?freeipmi-devel' && exit ; urpmq --sources freeipmi-devel && exit ; pkcon search name freeipmi-devel | grep -E '(Available|Installed).*freeipmi-devel' && exit;) >&2 && echo 1 || echo 0) %define NUTPKG_WITH_POWERMAN %( (yum search powerman-devel | grep -E '^(lib)?powerman-devel\.' && exit ; dnf search powerman-devel | grep -E '^(lib)?powerman-devel\.' && exit ; zypper search -s powerman-devel | grep -E '(lib)?powerman-devel' && exit ; urpmq --sources powerman-devel && exit ; pkcon search name powerman-devel | grep -E '(Available|Installed).*powerman-devel' && exit;) >&2 && echo 1 || echo 0) %define NUTPKG_WITH_AVAHI %( (yum search avahi-devel | grep -E '^(lib)?avahi-devel\.' && exit ; dnf search avahi-devel | grep -E '^(lib)?avahi-devel\.' && exit ; zypper search -s avahi-devel | grep -E '(lib)?avahi-devel' && exit ; urpmq --sources avahi-devel && exit ; pkcon search name avahi-devel | grep -E '(Available|Installed).*avahi-devel' && exit;) >&2 && echo 1 || echo 0) +%define NUTPKG_WITH_TCPWRAP %( (yum search tcp_wrappers-devel | grep -E '^(lib)?tcp_wrappers-devel\.' && exit ; dnf search tcp_wrappers-devel | grep -E '^(lib)?tcp_wrappers-devel\.' && exit ; zypper search -s tcp_wrappers-devel | grep -E '(lib)?tcp_wrappers-devel' && exit ; urpmq --sources tcp_wrappers-devel && exit ; pkcon search name tcp_wrappers-devel | grep -E '(Available|Installed).*tcp_wrappers-devel' && exit;) >&2 && echo 1 || echo 0) Name: nut # NOTE: OBS should rewrite this: @@ -109,7 +110,10 @@ BuildRequires: lua-devel BuildRequires: (httpd-devel or apache2-devel) BuildRequires: (libcppunit-devel or cppunit-devel) BuildRequires: (dbus-1-glib-devel or dbus-glib-devel) + +%if 0${?NUTPKG_WITH_TCPWRAP} BuildRequires: (tcpd-devel or tcp_wrappers-devel) +%endif # May be plain "neon" and "libusb" in RHEL7 or older? BuildRequires: (libneon-devel or neon-devel) From 406eb55438da9bfca2d27552ef04137897d0482c Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Tue, 7 Oct 2025 16:02:21 +0200 Subject: [PATCH 496/805] obs/nut.spec: fix typos; make cppunit-devel optional (not in RHEL7) Signed-off-by: Jim Klimov --- obs/nut.spec | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/obs/nut.spec b/obs/nut.spec index 1f25cf7712..3fb1edcf07 100644 --- a/obs/nut.spec +++ b/obs/nut.spec @@ -70,11 +70,11 @@ BuildRoot: %{_tmppath}/%{name}-%{version}-build # To fix end-of-line encoding: BuildRequires: dos2unix -%if 0${?NUTPKG_WITH_AVAHI} +%if 0%{?NUTPKG_WITH_AVAHI} BuildRequires: avahi-devel %endif -%if 0${?NUTPKG_WITH_FREEIPMI} +%if 0%{?NUTPKG_WITH_FREEIPMI} BuildRequires: (libfreeipmi-devel or freeipmi-devel) %endif @@ -108,10 +108,13 @@ BuildRequires: lua-devel # and whatnot BuildRequires: (httpd-devel or apache2-devel) -BuildRequires: (libcppunit-devel or cppunit-devel) BuildRequires: (dbus-1-glib-devel or dbus-glib-devel) -%if 0${?NUTPKG_WITH_TCPWRAP} +%if 0%{?rhel_version}>=8 || ! 0%{?rhel_version} +BuildRequires: (libcppunit-devel or cppunit-devel) +%endif + +%if 0%{?NUTPKG_WITH_TCPWRAP} BuildRequires: (tcpd-devel or tcp_wrappers-devel) %endif @@ -119,7 +122,7 @@ BuildRequires: (tcpd-devel or tcp_wrappers-devel) BuildRequires: (libneon-devel or neon-devel) BuildRequires: (libopenssl-devel or openssl-devel) -%if 0${?NUTPKG_WITH_POWERMAN} +%if 0%{?NUTPKG_WITH_POWERMAN} BuildRequires: powerman-devel %endif From 522a0666c9f71af31e76c32ddac1cd5664de763e Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Tue, 7 Oct 2025 16:06:01 +0200 Subject: [PATCH 497/805] obs/nut.spec: LUA only needed for DMF builds Signed-off-by: Jim Klimov --- obs/nut.spec | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/obs/nut.spec b/obs/nut.spec index 3fb1edcf07..8e528169a0 100644 --- a/obs/nut.spec +++ b/obs/nut.spec @@ -88,10 +88,11 @@ BuildRequires: net-snmp-devel BuildRequires: pkg-config # Maybe older Pythons are also okay, but were not tested for ages BuildRequires: (python >= 2.6 or python3 or python2) + +%if 0%{?NUTPKG_WITH_DMF} # LUA 5.1 or 5.2 is known ok for us, both are modern in current distros (201609xx) BuildRequires: lua-devel -%if 0%{?NUTPKG_WITH_DMF} # TODO: Make sure how this is named to use in CentOS/RHEL (may be not in core but EPEL repos) # The pycparser is required to rebuild DMF files, but those pre-built # copies in the git repo/tarball "should" be in sync with original From f3c2c7e9fb9296b65a58c8d020b619cdbc90a404 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Tue, 7 Oct 2025 16:06:26 +0200 Subject: [PATCH 498/805] obs/nut.spec: revise neon dependency Signed-off-by: Jim Klimov --- obs/nut.spec | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/obs/nut.spec b/obs/nut.spec index 8e528169a0..1b2ad7d771 100644 --- a/obs/nut.spec +++ b/obs/nut.spec @@ -120,8 +120,8 @@ BuildRequires: (tcpd-devel or tcp_wrappers-devel) %endif # May be plain "neon" and "libusb" in RHEL7 or older? -BuildRequires: (libneon-devel or neon-devel) -BuildRequires: (libopenssl-devel or openssl-devel) +BuildRequires: (libneon-devel or neon-devel or neon) +BuildRequires: (libopenssl-devel or openssl-devel or openssl) %if 0%{?NUTPKG_WITH_POWERMAN} BuildRequires: powerman-devel @@ -135,11 +135,6 @@ BuildRequires: dblatex BuildRequires: (libxslt-tools or libxslt) BuildRequires: asciidoc -%if 0%{?rhel_version}>=7 -BuildRequires: libusb -BuildRequires: neon -%endif - %if %{defined opensuse_version} # Package provides driver for USB HID UPSes, but people can live with hal addon: Enhances: %{USBHIDDRIVERS} From e3aed3a575b1912ff521d4d0ae75e958b6d02729 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Tue, 7 Oct 2025 16:06:39 +0200 Subject: [PATCH 499/805] obs/nut.spec: do not call "python" directly Signed-off-by: Jim Klimov --- obs/nut.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/obs/nut.spec b/obs/nut.spec index 1b2ad7d771..5160a43d2c 100644 --- a/obs/nut.spec +++ b/obs/nut.spec @@ -250,7 +250,7 @@ sh autogen.sh --with-dmfsnmp-regenerate=no --with-dmfnutscan-regenerate=no --with-dmfsnmp-validate=no --with-dmfnutscan-validate=no %endif -(cd tools; python nut-snmpinfo.py) +### via Make now ### (cd tools; python nut-snmpinfo.py) make %{?_smp_mflags} PORT=$(sed -n 's/#define PORT //p' config.log) From c4d5942febed49d14c20a0cdb8c55e2674d36f65 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Tue, 7 Oct 2025 16:31:05 +0200 Subject: [PATCH 500/805] obs/nut.spec: explicitly "Prefer" something when OBS sees we "have choice for (X or Y)" Signed-off-by: Jim Klimov --- obs/nut.spec | 3 +++ 1 file changed, 3 insertions(+) diff --git a/obs/nut.spec b/obs/nut.spec index 5160a43d2c..fc76b17b39 100644 --- a/obs/nut.spec +++ b/obs/nut.spec @@ -84,6 +84,7 @@ BuildRequires: libtool BuildRequires: libtool-ltdl-devel # libusb-0.1 or libusb-1.0: BuildRequires: (libusb-devel or libusbx-devel) +#!Prefer: libusbx-devel BuildRequires: net-snmp-devel BuildRequires: pkg-config # Maybe older Pythons are also okay, but were not tested for ages @@ -121,7 +122,9 @@ BuildRequires: (tcpd-devel or tcp_wrappers-devel) # May be plain "neon" and "libusb" in RHEL7 or older? BuildRequires: (libneon-devel or neon-devel or neon) +#!Prefer: (libneon-devel or neon-devel) BuildRequires: (libopenssl-devel or openssl-devel or openssl) +#!Prefer: (libopenssl-devel or openssl-devel) %if 0%{?NUTPKG_WITH_POWERMAN} BuildRequires: powerman-devel From 7c75d84837bc95199d72bb30e5f320fc797abef1 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Tue, 7 Oct 2025 16:46:05 +0200 Subject: [PATCH 501/805] obs/nut.spec: hide dblatex Signed-off-by: Jim Klimov --- obs/nut.spec | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/obs/nut.spec b/obs/nut.spec index fc76b17b39..487fdfd3fe 100644 --- a/obs/nut.spec +++ b/obs/nut.spec @@ -132,7 +132,8 @@ BuildRequires: powerman-devel %if 0%{?suse_version} BuildRequires: systemd-rpm-macros -BuildRequires: dblatex +# Only needed for PDF generation, we do not package that now +#BuildRequires: dblatex %endif BuildRequires: (libxslt-tools or libxslt) From d0548186eb1cfb8517bbee8aca9be5c4d23df3fb Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Tue, 7 Oct 2025 16:49:14 +0200 Subject: [PATCH 502/805] obs/nut.spec: reword comment Signed-off-by: Jim Klimov --- obs/nut.spec | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/obs/nut.spec b/obs/nut.spec index 487fdfd3fe..6fc5c5dc99 100644 --- a/obs/nut.spec +++ b/obs/nut.spec @@ -103,10 +103,10 @@ BuildRequires: lua-devel %endif # Variant names in different distros -# For some may have to fiddle with -# %if 0%{?centos_version} -# %if 0%{?suse_version} -# %if 0%{?rhel_version}>=7 +# For some platforms we may have to fiddle with distro-named macros like +# % if 0 % {?centos_version} +# % if 0 % {?suse_version} +# % if 0 % {?rhel_version}>=7 # and whatnot BuildRequires: (httpd-devel or apache2-devel) From eb5b344830993223eecc64dfe53f2f8ff63833dc Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Tue, 7 Oct 2025 16:49:45 +0200 Subject: [PATCH 503/805] obs/nut.spec: exclude DMF artifacts from main pkg only if NUTPKG_WITH_DMF in the first place Signed-off-by: Jim Klimov --- obs/nut.spec | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/obs/nut.spec b/obs/nut.spec index 6fc5c5dc99..4b98443ecc 100644 --- a/obs/nut.spec +++ b/obs/nut.spec @@ -322,12 +322,16 @@ bin/chmod 600 %{CONFPATH}/upsd.conf %{CONFPATH}/upsmon.conf %{CONFPATH}/upsd.use %{_sysconfdir}/bash_completion.d/* %{_sysconfdir}/logrotate.d/* %{_bindir}/* +%if 0%{?NUTPKG_WITH_DMF} %exclude %{_bindir}/nut-scanner-reindex-dmfsnmp +%endif %{_datadir}/nut +%if 0%{?NUTPKG_WITH_DMF} %exclude %{_datadir}/nut/dmfnutscan %exclude %{_datadir}/nut/dmfsnmp %exclude %{_datadir}/nut/dmfnutscan.d %exclude %{_datadir}/nut/dmfsnmp.d +%endif %{_mandir}/man5/*.* %{_mandir}/man8/*.* %exclude %{_mandir}/man8/netxml-ups*.* From 7cc236b34f1675434b54ec8881e3c4d3c157d3d1 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Tue, 7 Oct 2025 16:52:13 +0200 Subject: [PATCH 504/805] obs/nut.spec: many docs files were renamed to *.adoc Signed-off-by: Jim Klimov --- obs/nut.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/obs/nut.spec b/obs/nut.spec index 4b98443ecc..9708b02e6a 100644 --- a/obs/nut.spec +++ b/obs/nut.spec @@ -317,7 +317,7 @@ bin/chmod 600 %{CONFPATH}/upsd.conf %{CONFPATH}/upsmon.conf %{CONFPATH}/upsd.use %files %defattr(-,root,root) -%doc AUTHORS COPYING ChangeLog MAINTAINERS NEWS README UPGRADING docs/*.txt docs/cables +%doc AUTHORS COPYING LICENSE-DCO LICENSE-GPL2 LICENSE-GPL3 ChangeLog MAINTAINERS NEWS.adoc README.adoc UPGRADING.adoc docs/*.adoc docs/*.txt docs/cables /bin/* %{_sysconfdir}/bash_completion.d/* %{_sysconfdir}/logrotate.d/* From 42ea364f29e03dde502acd627f469d4b724bda19 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Tue, 7 Oct 2025 16:55:28 +0200 Subject: [PATCH 505/805] obs/debian.changelog, obs/nut.dsc: bump formal versioning Signed-off-by: Jim Klimov --- obs/debian.changelog | 6 ++++++ obs/nut.dsc | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/obs/debian.changelog b/obs/debian.changelog index af5c586cb2..092c093c21 100644 --- a/obs/debian.changelog +++ b/obs/debian.changelog @@ -1,3 +1,9 @@ +nut (2.8.4-1) UNRELEASED; urgency=high + + * Revising recipes for OBS builds + + -- Jim Klimov Sun, 5 Oct 2025 14:00:00 +0200 + nut (2.7.4-14) UNRELEASED; urgency=high * Ported packaging recipes over upstream NUT, commented away DMF diff --git a/obs/nut.dsc b/obs/nut.dsc index 29b6c3ba3f..8410468f24 100644 --- a/obs/nut.dsc +++ b/obs/nut.dsc @@ -2,7 +2,7 @@ Format: 1.0 Source: nut Binary: nut, nut-server, nut-client, nut-cgi, nut-snmp, nut-ipmi, nut-modbus, nut-linux-i2c, nut-xml, nut-powerman-pdu, nut-doc, libupsclient4, libupsclient-dev, libnutclient1, libnutclient-dev, python-nut, nut-monitor, libups-nut-perl Architecture: any all -Version: 2.7.4-14 +Version: 2.8.4-1 Maintainer: Arnaud Quette Uploaders: Laurent Bigonville Homepage: http://www.networkupstools.org/ From 56e343e637e5f293194e5c3b4efe0ccb57a6f4c6 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Tue, 7 Oct 2025 16:56:33 +0200 Subject: [PATCH 506/805] obs/debian.rules: do not run python directly anymore Signed-off-by: Jim Klimov --- obs/debian.rules | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/obs/debian.rules b/obs/debian.rules index 19b383dfca..84e0a20b89 100755 --- a/obs/debian.rules +++ b/obs/debian.rules @@ -83,7 +83,7 @@ endif DEB_CONFIGURE_EXTRA_FLAGS+=--with-doc=man=dist-auto configure: configure.ac - (cd tools; python nut-snmpinfo.py) + ###Part of normal build now### (cd tools; python nut-snmpinfo.py) sh autogen.sh echo "PKG_CONFIG_PATH default:" ; pkg-config --variable pc_path pkg-config || true From 5584e0ad7575ceed41e5635f77ba041f4b9787ec Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Tue, 7 Oct 2025 16:58:54 +0200 Subject: [PATCH 507/805] obs/debian.control: support several libusb implementations Signed-off-by: Jim Klimov --- obs/debian.control | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/obs/debian.control b/obs/debian.control index 739dc9ac01..3c94286e09 100644 --- a/obs/debian.control +++ b/obs/debian.control @@ -12,7 +12,7 @@ Build-Depends: debhelper (>= 8.1.3), libjpeg-dev, libsnmp-dev | libsnmp9-dev, libssl1.0-dev | libssl-dev, - libusb-dev (>= 0.1.8), + libusb-1.0-dev | libusb-0.1-dev | libusb-dev (>= 0.1.8), libneon27-gnutls-dev | libneon27-dev, libpowerman0-dev (>= 2.3.3), libwrap0-dev (>= 7.6), From e7fae7e096816d1ae1f54c33452a2c1506850c8f Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Tue, 7 Oct 2025 17:12:23 +0200 Subject: [PATCH 508/805] obs/nut.spec: deliver files that are built and installed but were not listed Signed-off-by: Jim Klimov --- obs/nut.spec | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/obs/nut.spec b/obs/nut.spec index 9708b02e6a..554635f4e0 100644 --- a/obs/nut.spec +++ b/obs/nut.spec @@ -35,6 +35,8 @@ %define USBHIDDRIVERS %(zcat %{SOURCE0} | tr a-z A-Z | fgrep -a -A1 USBHID-UPS | sed -n 's/.*ATTR{IDVENDOR}==%{QUOTE}%{BACKSLASH}%{LBRACE}[^%{QUOTE}]*%{BACKSLASH}%{RBRACE}%{QUOTE}, ATTR{IDPRODUCT}==%{QUOTE}%{BACKSLASH}%{LBRACE}[^%{QUOTE}]*%{BACKSLASH}%{RBRACE}%{QUOTE}, MODE=.*/modalias%{LBRACE}usb:v%{BACKSLASH}1p%{BACKSLASH}2d*dc*dsc*dp*ic*isc*ip*%{RBRACE}/p' | tr '%{BACKSLASH}n' ' ') %define USBNONHIDDRIVERS %(zcat %{SOURCE0} | tr a-z A-Z | fgrep -a -A1 _USB | sed -n 's/.*ATTR{IDVENDOR}==%{QUOTE}%{BACKSLASH}%{LBRACE}[^%{QUOTE}]*%{BACKSLASH}%{RBRACE}%{QUOTE}, ATTR{IDPRODUCT}==%{QUOTE}%{BACKSLASH}%{LBRACE}[^%{QUOTE}]*%{BACKSLASH}%{RBRACE}%{QUOTE}, MODE=.*/modalias%{LBRACE}usb:v%{BACKSLASH}1p%{BACKSLASH}2d*dc*dsc*dp*ic*isc*ip*%{RBRACE}/p' | tr '%{BACKSLASH}n' ' ') %define systemdsystemunitdir %(pkg-config --variable=systemdsystemunitdir systemd) +%define systemdsystempresetdir %(pkg-config --variable=systemdsystempresetdir systemd || pkg-config --variable=systemdsystempresetdir libsystemd) +%define systemdtmpfilesdir %(pkg-config --variable=systemdtmpfilesdir systemd || pkg-config --variable=systemdtmpfilesdir libsystemd) %define systemdsystemdutildir %(pkg-config --variable=systemdutildir systemd) %define systemdshutdowndir %(pkg-config --variable=systemdshutdowndir systemd) @@ -200,6 +202,22 @@ interface for monitoring and administering UPS hardware. Detailed information about supported hardware can be found in %{_docdir}/nut. +%package gui +Summary: Network UPS Tools Web Server Support (GUI client) +Group: Hardware/UPS +Requires: %{name} = %{version} +BuildRequires: (python >= 2.6 or python3 or python2) + +%description gui +Graphical user interface client for the Network UPS Tools, +written in Python. + +Network UPS Tools is a collection of programs which provide a common +interface for monitoring and administering UPS hardware. + +Detailed information about supported hardware can be found in +%{_docdir}/nut. + %package devel Summary: Network UPS Tools (Uninterruptible Power Supply Monitoring) Group: Development/Libraries/C and C++ @@ -333,6 +351,7 @@ bin/chmod 600 %{CONFPATH}/upsd.conf %{CONFPATH}/upsmon.conf %{CONFPATH}/upsd.use %exclude %{_datadir}/nut/dmfsnmp.d %endif %{_mandir}/man5/*.* +%{_mandir}/man7/*.* %{_mandir}/man8/*.* %exclude %{_mandir}/man8/netxml-ups*.* %exclude %{_mandir}/man8/snmp-ups*.* @@ -357,6 +376,8 @@ bin/chmod 600 %{CONFPATH}/upsd.conf %{CONFPATH}/upsmon.conf %{CONFPATH}/upsd.use %exclude %{_sbindir}/gen-snmp-subdriver.sh %attr(700,%{USER},%{GROUP}) %{STATEPATH} %{systemdsystemunitdir}/* +%{systemdsystempresetdir}/* +%{systemdtmpfilesdir}/* %{systemdshutdowndir}/nutshutdown %{_datadir}/augeas/lenses/dist/nuthostsconf.aug %{_datadir}/augeas/lenses/dist/nutnutconf.aug @@ -405,11 +426,18 @@ bin/chmod 600 %{CONFPATH}/upsd.conf %{CONFPATH}/upsmon.conf %{CONFPATH}/upsd.use %config(noreplace) %{CONFPATH}/upsstats-single.html %config(noreplace) %{CONFPATH}/upsstats.html +%files gui +%defattr(-,root,root) +# TODO: NUT-Monitor where available +# TODO: Detect path from chosen interpreter or NUT build config files? +/usr/lib/python*/*-packages/* + %files devel %defattr(-,root,root) %{_includedir}/*.h %{_libdir}/*.so %{_libdir}/pkgconfig/*.pc %{_mandir}/man3/*.* +%{_libexecdir}/sockdebug %changelog From 5ebb08890fb592a1fb35d320d80ffadc748df798 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Tue, 7 Oct 2025 17:21:51 +0200 Subject: [PATCH 509/805] obs/nut.spec: rename "GROUP" which tends to pull in package type string Signed-off-by: Jim Klimov --- obs/nut.spec | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/obs/nut.spec b/obs/nut.spec index 554635f4e0..4c5523e59e 100644 --- a/obs/nut.spec +++ b/obs/nut.spec @@ -25,8 +25,8 @@ %define STATEPATH %{_localstatedir}/lib/ups %define CONFPATH %{_sysconfdir}/ups ### Note: this is /etc/nut in Debian version -%define USER upsd -%define GROUP daemon +%define NUT_USER upsd +%define NUT_GROUP daemon %define LBRACE ( %define RBRACE ) %define QUOTE " @@ -261,8 +261,8 @@ sh autogen.sh --with-cgipath=%{CGIPATH}\ --with-statepath=%{STATEPATH}\ --with-drvpath=%{MODELPATH}\ - --with-user=%{USER}\ - --with-group=%{GROUP} \ + --with-user=%{NUT_USER}\ + --with-group=%{NUT_GROUP} \ --with-udev-dir=%{_sysconfdir}/udev \ --enable-option-checking=fatal\ --with-systemdsystemunitdir --with-systemdshutdowndir \ @@ -301,17 +301,17 @@ install -m0644 scripts/misc/nut.bash_completion %{buildroot}%{_sysconfdir}/bash_ install -m0755 scripts/subdriver/gen-snmp-subdriver.sh %{buildroot}%{_sbindir}/ %pre -usr/sbin/useradd -r -g %{GROUP} -s /bin/false \ - -c "UPS daemon" -d /sbin %{USER} 2>/dev/null || : +usr/sbin/useradd -r -g %{NUT_GROUP} -s /bin/false \ + -c "UPS daemon" -d /sbin %{NUT_USER} 2>/dev/null || : %if %{defined opensuse_version} %service_add_pre nut-driver@.service nut-server.service nut-monitor.service nut-driver.target nut.target %endif %post # Be sure that all files are owned by a dedicated user. -bin/chown -R %{USER}:%{GROUP} %{STATEPATH} +bin/chown -R %{NUT_USER}:%{NUT_GROUP} %{STATEPATH} # Be sure that all files are owned by a dedicated user. -bin/chown %{USER}:root %{CONFPATH}/upsd.conf %{CONFPATH}/upsmon.conf %{CONFPATH}/upsd.users +bin/chown %{NUT_USER}:root %{CONFPATH}/upsd.conf %{CONFPATH}/upsmon.conf %{CONFPATH}/upsd.users bin/chmod 600 %{CONFPATH}/upsd.conf %{CONFPATH}/upsmon.conf %{CONFPATH}/upsd.users # And finally trigger udev to set permissions according to newly installed rules files. /sbin/udevadm trigger --subsystem-match=usb --property-match=DEVTYPE=usb_device @@ -361,9 +361,9 @@ bin/chmod 600 %{CONFPATH}/upsd.conf %{CONFPATH}/upsmon.conf %{CONFPATH}/upsd.use %dir %{_sysconfdir}/udev/rules.d %config(noreplace) %{_sysconfdir}/udev/rules.d/*.rules %config(noreplace) %{CONFPATH}/hosts.conf -%config(noreplace) %attr(600,%{USER},root) %{CONFPATH}/upsd.conf -%config(noreplace) %attr(600,%{USER},root) %{CONFPATH}/upsd.users -%config(noreplace) %attr(600,%{USER},root) %{CONFPATH}/upsmon.conf +%config(noreplace) %attr(600,%{NUT_USER},root) %{CONFPATH}/upsd.conf +%config(noreplace) %attr(600,%{NUT_USER},root) %{CONFPATH}/upsd.users +%config(noreplace) %attr(600,%{NUT_USER},root) %{CONFPATH}/upsmon.conf %dir %{CONFPATH} %config(noreplace) %{CONFPATH}/nut.conf %config(noreplace) %{CONFPATH}/ups.conf @@ -374,7 +374,7 @@ bin/chmod 600 %{CONFPATH}/upsd.conf %{CONFPATH}/upsmon.conf %{CONFPATH}/upsd.use %exclude %{MODELPATH}/snmp-ups %exclude %{MODELPATH}/netxml-ups %exclude %{_sbindir}/gen-snmp-subdriver.sh -%attr(700,%{USER},%{GROUP}) %{STATEPATH} +%attr(700,%{NUT_USER},%{NUT_GROUP}) %{STATEPATH} %{systemdsystemunitdir}/* %{systemdsystempresetdir}/* %{systemdtmpfilesdir}/* From d59d6f1e0b2a2eddb616bc50f13e2c45b8da2551 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Tue, 7 Oct 2025 17:23:17 +0200 Subject: [PATCH 510/805] obs/nut.spec: only run udevadm where available Signed-off-by: Jim Klimov --- obs/nut.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/obs/nut.spec b/obs/nut.spec index 4c5523e59e..aac653e5cc 100644 --- a/obs/nut.spec +++ b/obs/nut.spec @@ -314,7 +314,7 @@ bin/chown -R %{NUT_USER}:%{NUT_GROUP} %{STATEPATH} bin/chown %{NUT_USER}:root %{CONFPATH}/upsd.conf %{CONFPATH}/upsmon.conf %{CONFPATH}/upsd.users bin/chmod 600 %{CONFPATH}/upsd.conf %{CONFPATH}/upsmon.conf %{CONFPATH}/upsd.users # And finally trigger udev to set permissions according to newly installed rules files. -/sbin/udevadm trigger --subsystem-match=usb --property-match=DEVTYPE=usb_device +if [ -x /sbin/udevadm ] ; then /sbin/udevadm trigger --subsystem-match=usb --property-match=DEVTYPE=usb_device ; fi %if %{defined opensuse_version} %service_add_post nut-driver@.service nut-server.service nut-monitor.service nut-driver-enumerator.service nut-driver.target nut.target %endif From 96c81647b9d0f72331ec17a8620a92964ed2db3c Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Tue, 7 Oct 2025 17:31:48 +0200 Subject: [PATCH 511/805] obs/debian.nut.docs: update file name lists Signed-off-by: Jim Klimov --- obs/debian.nut.docs | 34 +++++++++++++++++++++++++++++++--- 1 file changed, 31 insertions(+), 3 deletions(-) diff --git a/obs/debian.nut.docs b/obs/debian.nut.docs index d0026f76e3..e16c35721b 100644 --- a/obs/debian.nut.docs +++ b/obs/debian.nut.docs @@ -1,18 +1,46 @@ AUTHORS MAINTAINERS -README -UPGRADING +README.adoc +NEWS.adoc +UPGRADING.adoc +docs/FAQ.txt docs/acknowledgements.txt +docs/asciidoc.txt +docs/cables.txt +docs/ci-farm-do-setup.adoc +docs/ci-farm-lxc-setup.txt docs/config-notes.txt +docs/config-prereqs.txt +docs/configure.txt +docs/contact-closure.txt +docs/daisychain.txt +docs/design.txt +docs/developer-guide.txt +docs/developers.txt docs/documentation.txt docs/download.txt -docs/FAQ.txt docs/features.txt +docs/hid-subdrivers.txt docs/history.txt +docs/macros.txt +docs/maintainer-guide.txt +docs/net-protocol.txt +docs/new-clients.txt +docs/new-drivers.txt docs/nut-names.txt +docs/nut-qa.txt +docs/nut-versioning.adoc +docs/nutdrv_qx-subdrivers.txt docs/outlets.txt docs/packager-guide.txt +docs/qa-guide.adoc +docs/release-notes.txt docs/scheduling.txt docs/security.txt +docs/sms-brazil-protocol.txt +docs/snmp-subdrivers.txt +docs/snmp.txt +docs/sock-protocol.txt +docs/solaris-usb.txt docs/support.txt docs/user-manual.txt From 4a3f701ff1cb530dab0e5d49a05f49280b6bcc77 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Tue, 7 Oct 2025 17:36:47 +0200 Subject: [PATCH 512/805] obs/nut.spec: avoid "chown USER:GROUP" syntax Signed-off-by: Jim Klimov --- obs/nut.spec | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/obs/nut.spec b/obs/nut.spec index aac653e5cc..71153cb4f6 100644 --- a/obs/nut.spec +++ b/obs/nut.spec @@ -309,9 +309,12 @@ usr/sbin/useradd -r -g %{NUT_GROUP} -s /bin/false \ %post # Be sure that all files are owned by a dedicated user. -bin/chown -R %{NUT_USER}:%{NUT_GROUP} %{STATEPATH} +# Some systems struggle with "chown USER:GROUP" so we separate them here: +bin/chown -R %{NUT_USER} %{STATEPATH} +bin/chgrp -R %{NUT_GROUP} %{STATEPATH} # Be sure that all files are owned by a dedicated user. -bin/chown %{NUT_USER}:root %{CONFPATH}/upsd.conf %{CONFPATH}/upsmon.conf %{CONFPATH}/upsd.users +bin/chown %{NUT_USER} %{CONFPATH}/upsd.conf %{CONFPATH}/upsmon.conf %{CONFPATH}/upsd.users +bin/chgrp root %{CONFPATH}/upsd.conf %{CONFPATH}/upsmon.conf %{CONFPATH}/upsd.users bin/chmod 600 %{CONFPATH}/upsd.conf %{CONFPATH}/upsmon.conf %{CONFPATH}/upsd.users # And finally trigger udev to set permissions according to newly installed rules files. if [ -x /sbin/udevadm ] ; then /sbin/udevadm trigger --subsystem-match=usb --property-match=DEVTYPE=usb_device ; fi From be4f5fd9ea98bfc3057db2cecde61eeafd34eda5 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Tue, 7 Oct 2025 17:38:48 +0200 Subject: [PATCH 513/805] obs/debian.nut-monitor.install: GUI glade files have moved Signed-off-by: Jim Klimov --- obs/debian.nut-monitor.install | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/obs/debian.nut-monitor.install b/obs/debian.nut-monitor.install index f92d0850ee..8c2975fd06 100644 --- a/obs/debian.nut-monitor.install +++ b/obs/debian.nut-monitor.install @@ -1,6 +1,6 @@ scripts/python/app/NUT-Monitor usr/bin/ scripts/python/app/nut-monitor.desktop usr/share/applications/ -scripts/python/app/gui-*.glade usr/share/nut-monitor/ +scripts/python/app/ui/gui-*.glade usr/share/nut-monitor/ scripts/python/app/locale/ usr/share/ scripts/python/app/icons/48x48/nut-monitor.png usr/share/pixmaps/ scripts/python/app/pixmaps usr/share/nut-monitor/ From 64cf028a08479e666791931aa774b123b166da3d Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Tue, 7 Oct 2025 17:39:36 +0200 Subject: [PATCH 514/805] obs/nut.spec: fix sub-package name for NUT-Monitor (GUI) Signed-off-by: Jim Klimov --- obs/nut.spec | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/obs/nut.spec b/obs/nut.spec index 71153cb4f6..92eee2d4dc 100644 --- a/obs/nut.spec +++ b/obs/nut.spec @@ -202,13 +202,13 @@ interface for monitoring and administering UPS hardware. Detailed information about supported hardware can be found in %{_docdir}/nut. -%package gui +%package monitor Summary: Network UPS Tools Web Server Support (GUI client) Group: Hardware/UPS Requires: %{name} = %{version} BuildRequires: (python >= 2.6 or python3 or python2) -%description gui +%description monitor Graphical user interface client for the Network UPS Tools, written in Python. @@ -429,7 +429,7 @@ if [ -x /sbin/udevadm ] ; then /sbin/udevadm trigger --subsystem-match=usb --pro %config(noreplace) %{CONFPATH}/upsstats-single.html %config(noreplace) %{CONFPATH}/upsstats.html -%files gui +%files monitor %defattr(-,root,root) # TODO: NUT-Monitor where available # TODO: Detect path from chosen interpreter or NUT build config files? From ea3633cba145e9dc587e3a142fc118d07f99a02f Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Wed, 8 Oct 2025 13:45:24 +0200 Subject: [PATCH 515/805] obs/nut.spec: only use apache_serverroot if we can detect it; otherwise dump NUT CGI artifacts under our _libexecdir and _datadir Signed-off-by: Jim Klimov --- obs/nut.spec | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/obs/nut.spec b/obs/nut.spec index 92eee2d4dc..e66068a5e8 100644 --- a/obs/nut.spec +++ b/obs/nut.spec @@ -17,10 +17,18 @@ # Please submit bugfixes or comments via http://bugs.opensuse.org/ # - +# Requires httpd(-devel?) or apache2(-devel?) to be present in this distro: %define apache_serverroot %(%{_sbindir}/apxs2 -q datadir 2>/dev/null || %{_sbindir}/apxs -q PREFIX) -%define CGIPATH %{apache_serverroot}/cgi-bin -%define HTMLPATH %{apache_serverroot}/htdocs +%if 0%{?apache_serverroot:1} +# Rename web pages location to not conflict with apache2-example-pages +# or user home page: +%define CGIPATH %{apache_serverroot}/cgi-bin/nut +%define HTMLPATH %{apache_serverroot}/htdocs/nut +%else +%define CGIPATH %{_libexecdir}/ups/cgi-bin +%define HTMLPATH %{_datadir}/nut/htdocs +%endif + %define MODELPATH %{_libexecdir}/ups/driver %define STATEPATH %{_localstatedir}/lib/ups %define CONFPATH %{_sysconfdir}/ups @@ -291,10 +299,6 @@ mkdir -p %{buildroot}%{STATEPATH} rename .sample "" %{buildroot}%{_sysconfdir}/ups/*.sample mkdir -p %{buildroot}/bin mv %{buildroot}%{_bindir}/upssched-cmd %{buildroot}/bin/upssched-cmd -# Rename web pages to not conflict with apache2-example-pages or user home page: -mkdir -p %{buildroot}%{HTMLPATH}/nut %{buildroot}%{CGIPATH}/nut -mv %{buildroot}%{HTMLPATH}/*.{html,png} %{buildroot}%{HTMLPATH}/nut/ -mv %{buildroot}%{CGIPATH}/*.cgi %{buildroot}%{CGIPATH}/nut find %{buildroot} -type f -name "*.la" -delete -print mkdir -p %{buildroot}%{_sysconfdir}/bash_completion.d install -m0644 scripts/misc/nut.bash_completion %{buildroot}%{_sysconfdir}/bash_completion.d/ @@ -424,8 +428,8 @@ if [ -x /sbin/udevadm ] ; then /sbin/udevadm trigger --subsystem-match=usb --pro %files cgi %defattr(-,root,root) -%{CGIPATH}/nut -%{HTMLPATH}/nut +%{CGIPATH} +%{HTMLPATH} %config(noreplace) %{CONFPATH}/upsstats-single.html %config(noreplace) %{CONFPATH}/upsstats.html From ce3f487cdcb5fde60540f78a3a857ba9c0dd0e7f Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Wed, 8 Oct 2025 13:46:28 +0200 Subject: [PATCH 516/805] obs/nut.spec: actually detect ability to build NUTPKG_WITH_DMF (sources available or not in this branch) Signed-off-by: Jim Klimov --- obs/nut.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/obs/nut.spec b/obs/nut.spec index e66068a5e8..1e76bbec0d 100644 --- a/obs/nut.spec +++ b/obs/nut.spec @@ -42,13 +42,16 @@ # Collect all devices listed in ups-nut-device.fdi: %define USBHIDDRIVERS %(zcat %{SOURCE0} | tr a-z A-Z | fgrep -a -A1 USBHID-UPS | sed -n 's/.*ATTR{IDVENDOR}==%{QUOTE}%{BACKSLASH}%{LBRACE}[^%{QUOTE}]*%{BACKSLASH}%{RBRACE}%{QUOTE}, ATTR{IDPRODUCT}==%{QUOTE}%{BACKSLASH}%{LBRACE}[^%{QUOTE}]*%{BACKSLASH}%{RBRACE}%{QUOTE}, MODE=.*/modalias%{LBRACE}usb:v%{BACKSLASH}1p%{BACKSLASH}2d*dc*dsc*dp*ic*isc*ip*%{RBRACE}/p' | tr '%{BACKSLASH}n' ' ') %define USBNONHIDDRIVERS %(zcat %{SOURCE0} | tr a-z A-Z | fgrep -a -A1 _USB | sed -n 's/.*ATTR{IDVENDOR}==%{QUOTE}%{BACKSLASH}%{LBRACE}[^%{QUOTE}]*%{BACKSLASH}%{RBRACE}%{QUOTE}, ATTR{IDPRODUCT}==%{QUOTE}%{BACKSLASH}%{LBRACE}[^%{QUOTE}]*%{BACKSLASH}%{RBRACE}%{QUOTE}, MODE=.*/modalias%{LBRACE}usb:v%{BACKSLASH}1p%{BACKSLASH}2d*dc*dsc*dp*ic*isc*ip*%{RBRACE}/p' | tr '%{BACKSLASH}n' ' ') + +# Collect systemd related paths so we can package files there: %define systemdsystemunitdir %(pkg-config --variable=systemdsystemunitdir systemd) %define systemdsystempresetdir %(pkg-config --variable=systemdsystempresetdir systemd || pkg-config --variable=systemdsystempresetdir libsystemd) %define systemdtmpfilesdir %(pkg-config --variable=systemdtmpfilesdir systemd || pkg-config --variable=systemdtmpfilesdir libsystemd) %define systemdsystemdutildir %(pkg-config --variable=systemdutildir systemd) %define systemdshutdowndir %(pkg-config --variable=systemdshutdowndir systemd) -%define NUTPKG_WITH_DMF 0 +# Does this NUT branch have DMF feature code? +%define NUTPKG_WITH_DMF %( test -d scripts/DMF && echo 1 || echo 0 ) # Not all distros have it %define NUTPKG_WITH_FREEIPMI %( (yum search freeipmi-devel | grep -E '^(lib)?freeipmi-devel\.' && exit ; dnf search freeipmi-devel | grep -E '^(lib)?freeipmi-devel\.' && exit ; zypper search -s freeipmi-devel | grep -E '(lib)?freeipmi-devel' && exit ; urpmq --sources freeipmi-devel && exit ; pkcon search name freeipmi-devel | grep -E '(Available|Installed).*freeipmi-devel' && exit;) >&2 && echo 1 || echo 0) From e754ded634a4ca1518ec60ee0043cdc03fa0c97e Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Wed, 8 Oct 2025 13:49:03 +0200 Subject: [PATCH 517/805] obs/nut.spec: update comments Signed-off-by: Jim Klimov --- obs/nut.spec | 3 +++ 1 file changed, 3 insertions(+) diff --git a/obs/nut.spec b/obs/nut.spec index 1e76bbec0d..5480a7c9c3 100644 --- a/obs/nut.spec +++ b/obs/nut.spec @@ -129,11 +129,14 @@ BuildRequires: (dbus-1-glib-devel or dbus-glib-devel) BuildRequires: (libcppunit-devel or cppunit-devel) %endif +# Obsoleted/away in newer distros %if 0%{?NUTPKG_WITH_TCPWRAP} BuildRequires: (tcpd-devel or tcp_wrappers-devel) %endif # May be plain "neon" and "libusb" in RHEL7 or older? +# OBS: This may need `osc meta prjconf` to `Prefer:` one +# certain variant in case several hits happen on a builder: BuildRequires: (libneon-devel or neon-devel or neon) #!Prefer: (libneon-devel or neon-devel) BuildRequires: (libopenssl-devel or openssl-devel or openssl) From 8fd10a4ec23ff80178b53da73d5aa0b9489e9a18 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Wed, 8 Oct 2025 13:54:04 +0200 Subject: [PATCH 518/805] obs/nut.spec: post: neuter faults of chown/chgrp/chmod (some rpmbuilds fail self-check due to lack of accounts) Signed-off-by: Jim Klimov --- obs/nut.spec | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/obs/nut.spec b/obs/nut.spec index 5480a7c9c3..64b5484dd2 100644 --- a/obs/nut.spec +++ b/obs/nut.spec @@ -319,13 +319,16 @@ usr/sbin/useradd -r -g %{NUT_GROUP} -s /bin/false \ %post # Be sure that all files are owned by a dedicated user. -# Some systems struggle with "chown USER:GROUP" so we separate them here: -bin/chown -R %{NUT_USER} %{STATEPATH} -bin/chgrp -R %{NUT_GROUP} %{STATEPATH} +# Some systems do not have the users or groups during rpmbuild +# pre/port tests, so we neuter faults with a warning echo. +# Some systems struggle with "chown USER:GROUP" so we separate +# them into two commands here: +bin/chown -R %{NUT_USER} %{STATEPATH} || echo "WARNING: Could not secure state path '%{STATEPATH}'" >&2 +bin/chgrp -R %{NUT_GROUP} %{STATEPATH} || echo "WARNING: Could not secure state path '%{STATEPATH}'" >&2 # Be sure that all files are owned by a dedicated user. -bin/chown %{NUT_USER} %{CONFPATH}/upsd.conf %{CONFPATH}/upsmon.conf %{CONFPATH}/upsd.users -bin/chgrp root %{CONFPATH}/upsd.conf %{CONFPATH}/upsmon.conf %{CONFPATH}/upsd.users -bin/chmod 600 %{CONFPATH}/upsd.conf %{CONFPATH}/upsmon.conf %{CONFPATH}/upsd.users +bin/chown %{NUT_USER} %{CONFPATH}/upsd.conf %{CONFPATH}/upsmon.conf %{CONFPATH}/upsd.users || echo "WARNING: Could not secure config files in path '%{CONFPATH}'" >&2 +bin/chgrp root %{CONFPATH}/upsd.conf %{CONFPATH}/upsmon.conf %{CONFPATH}/upsd.users || echo "WARNING: Could not secure config files in path '%{CONFPATH}'" >&2 +bin/chmod 600 %{CONFPATH}/upsd.conf %{CONFPATH}/upsmon.conf %{CONFPATH}/upsd.users || echo "WARNING: Could not secure config files in path '%{CONFPATH}'" >&2 # And finally trigger udev to set permissions according to newly installed rules files. if [ -x /sbin/udevadm ] ; then /sbin/udevadm trigger --subsystem-match=usb --property-match=DEVTYPE=usb_device ; fi %if %{defined opensuse_version} From 28363625dce23f76a18eff531935878565f756d5 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Wed, 8 Oct 2025 14:18:06 +0200 Subject: [PATCH 519/805] obs/nut.spec: exclude in root package whatever we put into sub-packages (rpmbuild seems to duplicate this) Signed-off-by: Jim Klimov --- obs/nut.spec | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/obs/nut.spec b/obs/nut.spec index 64b5484dd2..65a46261b6 100644 --- a/obs/nut.spec +++ b/obs/nut.spec @@ -409,6 +409,25 @@ if [ -x /sbin/udevadm ] ; then /sbin/udevadm trigger --subsystem-match=usb --pro %dir %{_datadir}/augeas/lenses/dist %dir %{_datadir}/augeas/lenses/dist/tests %{_libexecdir}/nut-driver-enumerator.sh +# Exclude whatever other packages bring, some rpmbuild versions seem to dump +# everything into the base package and then complain about duplicates/conflicts: +### libupsclient1 +%exclude %{_libdir}/*.so.* +### nut-cgi +%exclude %{CGIPATH} +%exclude %{HTMLPATH} +%exclude %{CONFPATH}/*.html +### nut-monitor +# TODO: Actually package NUT-Monitor app and scripts where available +# TODO: Detect path from chosen interpreter or NUT build config files? +%exclude /usr/lib/python*/*-packages/* +### nut-devel +%exclude %{_includedir}/*.h +%exclude %{_libdir}/*.so +%exclude %{_libdir}/pkgconfig/*.pc +%exclude %{_mandir}/man3/*.* +%exclude %{_libexecdir}/sockdebug + %files drivers-net %defattr(-,root,root) @@ -432,6 +451,7 @@ if [ -x /sbin/udevadm ] ; then /sbin/udevadm trigger --subsystem-match=usb --pro %endif %files -n libupsclient1 +# TODO: Separate or rename for other nut-libs (nut-scanner, nutconf C++)? %defattr(-,root,root) %{_libdir}/*.so.* @@ -444,7 +464,7 @@ if [ -x /sbin/udevadm ] ; then /sbin/udevadm trigger --subsystem-match=usb --pro %files monitor %defattr(-,root,root) -# TODO: NUT-Monitor where available +# TODO: Actually package NUT-Monitor app and scripts where available # TODO: Detect path from chosen interpreter or NUT build config files? /usr/lib/python*/*-packages/* From 0920996a14076c8c82e5d7e18811fa7f1709e34c Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Wed, 8 Oct 2025 14:18:29 +0200 Subject: [PATCH 520/805] obs/nut.spec: try another way of checking that apache_serverroot is defined and not empty Signed-off-by: Jim Klimov --- obs/nut.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/obs/nut.spec b/obs/nut.spec index 65a46261b6..7d343bd4ca 100644 --- a/obs/nut.spec +++ b/obs/nut.spec @@ -19,7 +19,7 @@ # Requires httpd(-devel?) or apache2(-devel?) to be present in this distro: %define apache_serverroot %(%{_sbindir}/apxs2 -q datadir 2>/dev/null || %{_sbindir}/apxs -q PREFIX) -%if 0%{?apache_serverroot:1} +%if %{?apache_serverroot} # Rename web pages location to not conflict with apache2-example-pages # or user home page: %define CGIPATH %{apache_serverroot}/cgi-bin/nut From f08798177089e9d3562795f511eb40f6ee7602d4 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Wed, 8 Oct 2025 14:24:05 +0200 Subject: [PATCH 521/805] obs/debian.rules: fix a shell/make typo Signed-off-by: Jim Klimov --- obs/debian.rules | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/obs/debian.rules b/obs/debian.rules index 84e0a20b89..9d1a581c1c 100755 --- a/obs/debian.rules +++ b/obs/debian.rules @@ -98,7 +98,7 @@ common-install-arch:: # prepare debian packaging files mkdir -p $(CURDIR)/debian for F in nut-client.init nut-common.postinst nut-common.prerm nut-server.init nut-server.prerm nut-common.tmpfiles ; do \ - echo " SED $F.in => $F" ; \ + echo " SED $$F.in => $$F" ; \ sed 's,@runbasedir[@],$(runbasedir),g' < "$(CURDIR)/obs/debian.$$F.in" > $(CURDIR)/debian/"$$F" || exit ; \ done From 6b70c5486f72630c125e041c1cd568b41f26dad4 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Wed, 8 Oct 2025 14:24:27 +0200 Subject: [PATCH 522/805] obs/debian.rules: binary-install/nut-monitor: use dh_python* more clearly Signed-off-by: Jim Klimov --- obs/debian.rules | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/obs/debian.rules b/obs/debian.rules index 9d1a581c1c..6383590446 100755 --- a/obs/debian.rules +++ b/obs/debian.rules @@ -187,7 +187,14 @@ common-install-indep:: mkdir -p $(CURDIR)/debian/tmp/usr/share/doc/nut-doc binary-install/nut-monitor:: - dh_python2 -pnut-monitor || dh_python3 -pnut-monitor || dh_python -pnut-monitor + if (command -v dh_python2) ; then \ + dh_python2 -pnut-monitor ; \ + else if (command -v dh_python3) ; then \ + dh_python3 -pnut-monitor ; \ + else if (command -v dh_python) ; then \ + dh_python -pnut-monitor ; \ + else echo "$@: no implementation of dh_python was found!" >&2 ; exit 1 ; \ + fi; fi; fi DEB_DH_INSTALLINIT_ARGS_nut-server := --init-script=nut-server --restart-after-upgrade DEB_DH_INSTALLINIT_ARGS_nut-client := --init-script=nut-client --restart-after-upgrade From c85197ea516f0ae2c420bc32dc102e4020fc0675 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Wed, 8 Oct 2025 14:50:05 +0200 Subject: [PATCH 523/805] obs/nut.spec: comment about %(cmd) definitions Signed-off-by: Jim Klimov --- obs/nut.spec | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/obs/nut.spec b/obs/nut.spec index 7d343bd4ca..2f9eadcdf3 100644 --- a/obs/nut.spec +++ b/obs/nut.spec @@ -17,16 +17,25 @@ # Please submit bugfixes or comments via http://bugs.opensuse.org/ # +# NOTE: Evaluations in percent-round-parentheses below happen in the +# build area already populated with packages according to "Required:" +# lines. We can test for OS feature availability here if needed (e.g. +# to decide if we deliver a sub-package with certain dependencies), +# but can not decide that we can/must install something and then we +# would have the needed OS capability. + # Requires httpd(-devel?) or apache2(-devel?) to be present in this distro: -%define apache_serverroot %(%{_sbindir}/apxs2 -q datadir 2>/dev/null || %{_sbindir}/apxs -q PREFIX) -%if %{?apache_serverroot} +%define apache_serverroot %(%{_sbindir}/apxs2 -q datadir || %{_sbindir}/apxs -q PREFIX || true) +%if 0%{?apache_serverroot} == 0 +# Dump nut-cgi artifacts under our own locations, so end-users can +# integrate them later. +%define CGIPATH %{_libexecdir}/ups/cgi-bin +%define HTMLPATH %{_datadir}/nut/htdocs +%else # Rename web pages location to not conflict with apache2-example-pages # or user home page: %define CGIPATH %{apache_serverroot}/cgi-bin/nut %define HTMLPATH %{apache_serverroot}/htdocs/nut -%else -%define CGIPATH %{_libexecdir}/ups/cgi-bin -%define HTMLPATH %{_datadir}/nut/htdocs %endif %define MODELPATH %{_libexecdir}/ups/driver @@ -54,6 +63,9 @@ %define NUTPKG_WITH_DMF %( test -d scripts/DMF && echo 1 || echo 0 ) # Not all distros have it +# FIXME: No use searching remote repos; can use rpm queries based on whatever +# did get installed according to Requires lines below, to decide whether we +# deliver certain sub-packages though. %define NUTPKG_WITH_FREEIPMI %( (yum search freeipmi-devel | grep -E '^(lib)?freeipmi-devel\.' && exit ; dnf search freeipmi-devel | grep -E '^(lib)?freeipmi-devel\.' && exit ; zypper search -s freeipmi-devel | grep -E '(lib)?freeipmi-devel' && exit ; urpmq --sources freeipmi-devel && exit ; pkcon search name freeipmi-devel | grep -E '(Available|Installed).*freeipmi-devel' && exit;) >&2 && echo 1 || echo 0) %define NUTPKG_WITH_POWERMAN %( (yum search powerman-devel | grep -E '^(lib)?powerman-devel\.' && exit ; dnf search powerman-devel | grep -E '^(lib)?powerman-devel\.' && exit ; zypper search -s powerman-devel | grep -E '(lib)?powerman-devel' && exit ; urpmq --sources powerman-devel && exit ; pkcon search name powerman-devel | grep -E '(Available|Installed).*powerman-devel' && exit;) >&2 && echo 1 || echo 0) %define NUTPKG_WITH_AVAHI %( (yum search avahi-devel | grep -E '^(lib)?avahi-devel\.' && exit ; dnf search avahi-devel | grep -E '^(lib)?avahi-devel\.' && exit ; zypper search -s avahi-devel | grep -E '(lib)?avahi-devel' && exit ; urpmq --sources avahi-devel && exit ; pkcon search name avahi-devel | grep -E '(Available|Installed).*avahi-devel' && exit;) >&2 && echo 1 || echo 0) From 59e4634595d1a4d94efb2d34b1626867545f5321 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Wed, 8 Oct 2025 14:56:46 +0200 Subject: [PATCH 524/805] obs/debian.rules: bump SO_MAJOR_LIB* vars and add libnutconf installation Signed-off-by: Jim Klimov --- obs/debian.rules | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/obs/debian.rules b/obs/debian.rules index 6383590446..51a3db430c 100755 --- a/obs/debian.rules +++ b/obs/debian.rules @@ -28,11 +28,12 @@ systemdtmpfilesdir := $(shell pkg-config --variable=systemdtmpfilesdir systemd | runbasedir := $(shell test -d /run && echo /run || echo /var/run) # FIXME: Find a smarter way to set those from main codebase recipes... -# Something like `grep 'version-info' **/Makefile.am` ? -SO_MAJOR_LIBUPSCLIENT=5 -SO_MAJOR_LIBNUTCLIENT=1 +# Something like `git grep 'version-info' '*.am'` ? +SO_MAJOR_LIBUPSCLIENT=7 +SO_MAJOR_LIBNUTCLIENT=2 SO_MAJOR_LIBNUTCLIENTSTUB=1 -SO_MAJOR_LIBNUTSCAN=1 +SO_MAJOR_LIBNUTSCAN=4 +SO_MAJOR_LIBNUTCONF=0 # List any files which are not installed include /usr/share/cdbs/1/rules/utils.mk @@ -51,7 +52,7 @@ DEB_CONFIGURE_EXTRA_FLAGS := --libdir=\$${prefix}/lib/$(DEB_HOST_MULTIARCH) \ --with-serial --with-usb --with-snmp --with-neon --with-ipmi \ --with-snmp_dmf_lua=yes \ --with-dmfsnmp-regenerate=no --with-dmfnutscan-regenerate=no --with-dmfsnmp-validate=no --with-dmfnutscan-validate=no \ - --with-dev \ + --with-dev --with-dev-libnutconf \ --disable-static \ --with-statepath=$(runbasedir)/nut \ --with-altpidpath=$(runbasedir)/nut \ @@ -142,6 +143,10 @@ common-install-arch:: test -s $(CURDIR)/debian/tmp/lib/$(DEB_HOST_MULTIARCH)/libnutscan.so.$(SO_MAJOR_LIBNUTSCAN) && \ ln -s /lib/$(DEB_HOST_MULTIARCH)/libnutscan.so.$(SO_MAJOR_LIBNUTSCAN) \ $(CURDIR)/debian/tmp/usr/lib/$(DEB_HOST_MULTIARCH)/libnutscan.so + rm -f $(CURDIR)/debian/tmp/lib/$(DEB_HOST_MULTIARCH)/libnutconf.so + test -s $(CURDIR)/debian/tmp/lib/$(DEB_HOST_MULTIARCH)/libnutconf.so.$(SO_MAJOR_LIBNUTCONF) && \ + ln -s /lib/$(DEB_HOST_MULTIARCH)/libnutconf.so.$(SO_MAJOR_LIBNUTCONF) \ + $(CURDIR)/debian/tmp/usr/lib/$(DEB_HOST_MULTIARCH)/libnutconf.so # Install systemd files only on systems where it's supported ### Package files for nut-client: From 6f1a4b5406964d71a13e51fbe413a28039b19978 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Wed, 8 Oct 2025 15:05:28 +0200 Subject: [PATCH 525/805] obs/nut.spec: try another way of checking that apache_serverroot is defined and not empty Signed-off-by: Jim Klimov --- obs/nut.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/obs/nut.spec b/obs/nut.spec index 2f9eadcdf3..01cbcdeac1 100644 --- a/obs/nut.spec +++ b/obs/nut.spec @@ -26,7 +26,7 @@ # Requires httpd(-devel?) or apache2(-devel?) to be present in this distro: %define apache_serverroot %(%{_sbindir}/apxs2 -q datadir || %{_sbindir}/apxs -q PREFIX || true) -%if 0%{?apache_serverroot} == 0 +%if "0%{?apache_serverroot}" == "0" # Dump nut-cgi artifacts under our own locations, so end-users can # integrate them later. %define CGIPATH %{_libexecdir}/ups/cgi-bin From ff1a824a2e2b099b2304a4e392f16f35d5ae9950 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Wed, 8 Oct 2025 17:23:58 +0200 Subject: [PATCH 526/805] obs/nut.spec: require basic tooling used in rpmlint checks Signed-off-by: Jim Klimov --- obs/nut.spec | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/obs/nut.spec b/obs/nut.spec index 01cbcdeac1..65428b04f0 100644 --- a/obs/nut.spec +++ b/obs/nut.spec @@ -81,6 +81,13 @@ Group: Hardware/UPS Url: https://www.networkupstools.org/ Source0: %{name}-%{version}.tar.gz +Requires: %{_bindir}/bash +Requires: %{_bindir}/sh +Requires: %{_sbindir}/sh +Requires: %{_bindir}/chown +Requires: %{_bindir}/chgrp +Requires: %{_bindir}/chmod +Requires: %{_bindir}/rm Requires: %{_bindir}/fgrep Requires: %{_bindir}/grep Requires: %{_bindir}/pgrep From c44bbca2f22c002d35f967f94c073167ec800091 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Wed, 8 Oct 2025 17:48:29 +0200 Subject: [PATCH 527/805] obs/README.adoc, docs/nut.dict: update info about OBS recipes [#1209] Signed-off-by: Jim Klimov --- docs/nut.dict | 1 + obs/README.adoc | 15 +++++++++++---- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/docs/nut.dict b/docs/nut.dict index dcc4f726da..c2e59d1df1 100644 --- a/docs/nut.dict +++ b/docs/nut.dict @@ -2764,6 +2764,7 @@ optimizations optiups oq os +osc ostream other's otheruser diff --git a/obs/README.adoc b/obs/README.adoc index defe15c093..fdf8d8259f 100644 --- a/obs/README.adoc +++ b/obs/README.adoc @@ -2,15 +2,22 @@ This directory holds reference NUT packaging recipes for RPM, DEB and other formats, and is primarily aimed at automation of builds with the -link:https://openbuildservice.org/[Open Build Service (OBS)]. Note that -beside the on-line service, the software is open-source and any project -may install and run their own; back-end scripts may be added to support -more operating systems (even not necessarily Linux). +link:https://openbuildservice.org/[Open Build Service (OBS)]. + +Note that beside the on-line service, the software is open-source and +any project may install and run their own server instance. The `osc build` +command can also be used on a workstation to iterate recipe nuances for +different distributions. In theory, back-end scripts may be added to +support more operating systems over time (even not necessarily Linux). NOTE: The layout of files and directories here is dictated by current expectations of the OBS software (if at some point it has to be a flat mess with no structure -- so be it). +For some practical details see: + +* https://github.com/networkupstools/nut/issues/1209 + The recipe files themselves would likely cross-pollinate with popular distributions, to allow easier replacement of standard, supported and stale package builds with those of experimental development iterations. From b77d47ba2378600e43e42537f162d500ab8be5f3 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Wed, 8 Oct 2025 17:58:17 +0200 Subject: [PATCH 528/805] obs/debian.nut-cgi.docs: README renamed to *.adoc Signed-off-by: Jim Klimov --- obs/debian.nut-cgi.docs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/obs/debian.nut-cgi.docs b/obs/debian.nut-cgi.docs index 80796c9b00..0caede9ebc 100644 --- a/obs/debian.nut-cgi.docs +++ b/obs/debian.nut-cgi.docs @@ -1 +1 @@ -data/html/README +data/html/README.adoc From 00174b88843c8cc74afcba1bc324ce85acbee883 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Wed, 8 Oct 2025 18:10:55 +0200 Subject: [PATCH 529/805] obs/debian.rules: make NUTPKG_WITH_DMF optional (based on the branch we build) Signed-off-by: Jim Klimov --- obs/debian.rules | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/obs/debian.rules b/obs/debian.rules index 51a3db430c..bb0c3f8a12 100755 --- a/obs/debian.rules +++ b/obs/debian.rules @@ -24,6 +24,9 @@ systemdsystemdutildir := $(shell pkg-config --variable=systemdutildir systemd || systemdshutdowndir := $(shell pkg-config --variable=systemdshutdowndir systemd || echo /lib/systemd/system-shutdown) systemdtmpfilesdir := $(shell pkg-config --variable=systemdtmpfilesdir systemd || echo /usr/lib/tmpfiles.d) +# Does this NUT branch have DMF feature code? +NUTPKG_WITH_DMF := $(test -d scripts/DMF && echo 1 || echo 0) + # Newer systems have just /run (and yet newer systemd noisily suggests it) runbasedir := $(shell test -d /run && echo /run || echo /var/run) @@ -50,8 +53,6 @@ DEB_CONFIGURE_EXTRA_FLAGS := --libdir=\$${prefix}/lib/$(DEB_HOST_MULTIARCH) \ --with-ssl --with-openssl --with-libltdl=yes \ --with-cgi=auto --with-powerman=auto \ --with-serial --with-usb --with-snmp --with-neon --with-ipmi \ - --with-snmp_dmf_lua=yes \ - --with-dmfsnmp-regenerate=no --with-dmfnutscan-regenerate=no --with-dmfsnmp-validate=no --with-dmfnutscan-validate=no \ --with-dev --with-dev-libnutconf \ --disable-static \ --with-statepath=$(runbasedir)/nut \ @@ -64,6 +65,12 @@ DEB_CONFIGURE_EXTRA_FLAGS := --libdir=\$${prefix}/lib/$(DEB_HOST_MULTIARCH) \ --with-pkgconfig-dir=/usr/lib/$(DEB_HOST_MULTIARCH)/pkgconfig \ --with-user=nut --with-group=nut +ifeq (1,$(NUTPKG_WITH_DMF)) +DEB_CONFIGURE_EXTRA_FLAGS += \ + --with-snmp_dmf_lua=yes \ + --with-dmfsnmp-regenerate=no --with-dmfnutscan-regenerate=no --with-dmfsnmp-validate=no --with-dmfnutscan-validate=no +endif + ifeq (linux,$(DEB_HOST_ARCH_OS)) DEB_CONFIGURE_EXTRA_FLAGS+=--with-udev-dir=/lib/udev ### DEB_CONFIGURE_EXTRA_FLAGS+=--with-systemdsystemunitdir @@ -88,7 +95,17 @@ configure: configure.ac sh autogen.sh echo "PKG_CONFIG_PATH default:" ; pkg-config --variable pc_path pkg-config || true -pre-build:: debian/compat configure +ifeq (0,$(NUTPKG_WITH_DMF)) +# hide +patch-recipe-dmf: + sed 's,^([^#].*dmf.*)$$,#\1,' -i debian.*.install +else +# expose +patch-recipe-dmf: + sed 's,^#(.*dmf.*)$$,\1,' -i debian.*.install +endif + +pre-build:: patch-recipe-dmf debian/compat configure # FIXME : The recipe below is a crime scene regarding hardcoded paths that # are more or less relevant for a particular OS distribution and version, From bea96979160e312a1f20cde8eabf50c08cc89a2b Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Wed, 8 Oct 2025 18:18:39 +0200 Subject: [PATCH 530/805] obs/nut.spec: %pre: try to groupadd to be sure Signed-off-by: Jim Klimov --- obs/nut.spec | 1 + 1 file changed, 1 insertion(+) diff --git a/obs/nut.spec b/obs/nut.spec index 65428b04f0..066275b183 100644 --- a/obs/nut.spec +++ b/obs/nut.spec @@ -330,6 +330,7 @@ install -m0644 scripts/misc/nut.bash_completion %{buildroot}%{_sysconfdir}/bash_ install -m0755 scripts/subdriver/gen-snmp-subdriver.sh %{buildroot}%{_sbindir}/ %pre +usr/sbin/groupadd -r -g %{NUT_GROUP} 2>/dev/null || : usr/sbin/useradd -r -g %{NUT_GROUP} -s /bin/false \ -c "UPS daemon" -d /sbin %{NUT_USER} 2>/dev/null || : %if %{defined opensuse_version} From ebdb0504d38a8feee57a9945528d929bfc8f1dff Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Wed, 8 Oct 2025 19:41:00 +0200 Subject: [PATCH 531/805] obs/nut.spec: address some concerns from rpmlint Signed-off-by: Jim Klimov --- obs/nut.spec | 84 ++++++++++++++++++++++++++++++++++++++++------------ 1 file changed, 65 insertions(+), 19 deletions(-) diff --git a/obs/nut.spec b/obs/nut.spec index 066275b183..ea8ff6fbd5 100644 --- a/obs/nut.spec +++ b/obs/nut.spec @@ -41,6 +41,17 @@ %define MODELPATH %{_libexecdir}/ups/driver %define STATEPATH %{_localstatedir}/lib/ups %define CONFPATH %{_sysconfdir}/ups + +### FIXME: Detect properly? +# W: suse-filelist-forbidden-udev-userdirs /etc/udev/rules.d/62-nut-usbups.rules is not allowed in SUSE +# This directory is for user files, use /usr/lib/udev/rules.d +%define UDEVRULEPATH %(test -d /usr/lib/udev && echo /usr/lib/udev || echo "%{_sysconfdir}/udev") + +### FIXME: Detect properly? +# W: suse-filelist-forbidden-bashcomp-userdirs /etc/bash_completion.d/nut.bash_completion is not allowed in SUSE +# This directory is for user files, use /usr/share/bash-completion/completions/ +%define BASHCOMPLETIONPATH %(test -d /usr/share/bash-completion/completions && echo /usr/share/bash-completion/completions || echo "%{_sysconfdir}/bash_completion.d") + ### Note: this is /etc/nut in Debian version %define NUT_USER upsd %define NUT_GROUP daemon @@ -59,6 +70,10 @@ %define systemdsystemdutildir %(pkg-config --variable=systemdutildir systemd) %define systemdshutdowndir %(pkg-config --variable=systemdshutdowndir systemd) +%define NUT_SYSTEMD_UNITS_SERVICE_TARGET %(cd scripts/systemd && ls -1 *.{service,target}{,.in} | sed 's,.in$,,' | sort | uniq) +%define NUT_SYSTEMD_UNITS_OTHER %(cd scripts/systemd && ls -1 *.{path,timer}{,.in} | sed 's,.in$,,' | sort | uniq) +%define NUT_SYSTEMD_UNITS_PRESET %(cd scripts/systemd && ls -1 *.preset{,.in} | sed 's,.in$,,' | sort | uniq) + # Does this NUT branch have DMF feature code? %define NUTPKG_WITH_DMF %( test -d scripts/DMF && echo 1 || echo 0 ) @@ -296,7 +311,7 @@ sh autogen.sh --with-drvpath=%{MODELPATH}\ --with-user=%{NUT_USER}\ --with-group=%{NUT_GROUP} \ - --with-udev-dir=%{_sysconfdir}/udev \ + --with-udev-dir=%{UDEVRULEPATH} \ --enable-option-checking=fatal\ --with-systemdsystemunitdir --with-systemdshutdowndir \ --with-augeas-lenses-dir=/usr/share/augeas/lenses/dist \ @@ -315,26 +330,51 @@ fi %install make DESTDIR=%{buildroot} install %{?_smp_mflags} -mkdir -p %{buildroot}%{STATEPATH} +mkdir -p %{buildroot}%{STATEPATH}/upssched # SuSE rc mkdir -p %{buildroot}%{_sbindir} mkdir -p %{buildroot}%{_sysconfdir}/logrotate.d -install -m 644 scripts/logrotate/nutlogd %{buildroot}%{_sysconfdir}/logrotate.d/ -mkdir -p %{buildroot}%{STATEPATH} +# Avoid W: incoherent-logrotate-file /etc/logrotate.d/nutlogd +install -m 644 scripts/logrotate/nutlogd %{buildroot}%{_sysconfdir}/logrotate.d/nut rename .sample "" %{buildroot}%{_sysconfdir}/ups/*.sample mkdir -p %{buildroot}/bin mv %{buildroot}%{_bindir}/upssched-cmd %{buildroot}/bin/upssched-cmd find %{buildroot} -type f -name "*.la" -delete -print -mkdir -p %{buildroot}%{_sysconfdir}/bash_completion.d -install -m0644 scripts/misc/nut.bash_completion %{buildroot}%{_sysconfdir}/bash_completion.d/ +mkdir -p %{buildroot}%{BASHCOMPLETIONPATH} +install -m0644 scripts/misc/nut.bash_completion %{buildroot}%{BASHCOMPLETIONPATH}/ install -m0755 scripts/subdriver/gen-snmp-subdriver.sh %{buildroot}%{_sbindir}/ +# TODO: Detect path from chosen interpreter or NUT build config files? +# Avoid W: non-executable-script /usr/lib/python3.6/site-packages/PyNUT.py 644 /usr/bin/python... +# Not really relevant for the module (not directly runnable, but has the shebang just in case) +chmod +x %{buildroot}/usr/lib/python*/*-packages/*.py +if [ x"%{systemdtmpfilesdir}" != x ]; then + # Deliver these dirs by packaging: + sed 's,^(. %{STATEPATH}(/upssched)*( .*)*)$,#PACKAGED#\1,' -i %{buildroot}%{systemdtmpfilesdir}/nut-common-tmpfiles.conf +fi +find %{buildroot} -type f -name '*.sh' -o -name '*.py' -o -name '*.pl' | \ +# Use deterministic script interpreters: +while read F ; do + if head -1 "$F" | grep bin/env >/dev/null ; then + F_SHEBANG="`head -1 "$F"`" + + F_SHELL_SHORT="`echo "$F_SHEBANG" | sed -e 's,^.*bin/env *,,'`" -e 's, .*$,,' \ + && [ -n "$F_SHELL_SHORT" ] \ + || { echo "WARNING: Failed to extract an interpreter from shebang '${F_SHEBANG}'" >&2 ; continue ; } + + F_SHELL_PATH="`command -v "$F_SHELL_SHORT"`" \ + && [ -n "$F_SHELL_PATH" ] && [ -x "$F_SHELL_PATH" ] \ + || { echo "WARNING: Failed to find executable path to interpreter '${F_SHELL_SHORT}' from shebang '${F_SHEBANG}'" >&2 ; continue; } + + sed '1 s,^.*$,#!'"${F_SHELL_PATH}," -i "$F" + fi +done %pre usr/sbin/groupadd -r -g %{NUT_GROUP} 2>/dev/null || : usr/sbin/useradd -r -g %{NUT_GROUP} -s /bin/false \ -c "UPS daemon" -d /sbin %{NUT_USER} 2>/dev/null || : %if %{defined opensuse_version} -%service_add_pre nut-driver@.service nut-server.service nut-monitor.service nut-driver.target nut.target +%service_add_pre %{NUT_SYSTEMD_UNITS_SERVICE_TARGET} %endif %post @@ -351,19 +391,24 @@ bin/chgrp root %{CONFPATH}/upsd.conf %{CONFPATH}/upsmon.conf %{CONFPATH}/upsd.us bin/chmod 600 %{CONFPATH}/upsd.conf %{CONFPATH}/upsmon.conf %{CONFPATH}/upsd.users || echo "WARNING: Could not secure config files in path '%{CONFPATH}'" >&2 # And finally trigger udev to set permissions according to newly installed rules files. if [ -x /sbin/udevadm ] ; then /sbin/udevadm trigger --subsystem-match=usb --property-match=DEVTYPE=usb_device ; fi -%if %{defined opensuse_version} -%service_add_post nut-driver@.service nut-server.service nut-monitor.service nut-driver-enumerator.service nut-driver.target nut.target +%if "x%{systemdtmpfilesdir}" != "x" +%tmpfiles_create nut-common-tmpfiles.conf +%endif +%if "x%{systemdsystemunitdir}" != "x" +%service_add_post %{NUT_SYSTEMD_UNITS_SERVICE_TARGET} %endif %preun -%if %{defined opensuse_version} -%service_del_preun nut-driver@.service nut-server.service nut-monitor.service nut-driver-enumerator.service nut-driver.target nut.target +%if "x%{systemdsystemunitdir}" != "x" +%service_del_preun %{NUT_SYSTEMD_UNITS_SERVICE_TARGET} %endif +: %postun -%if %{defined opensuse_version} -%service_del_postun nut-driver@.service nut-server.service nut-monitor.service nut-driver-enumerator.service nut-driver.target nut.target +%if "x%{systemdsystemunitdir}" != "x" +%service_del_postun %{NUT_SYSTEMD_UNITS_SERVICE_TARGET} %endif +: %post -n libupsclient1 -p /sbin/ldconfig @@ -373,8 +418,8 @@ if [ -x /sbin/udevadm ] ; then /sbin/udevadm trigger --subsystem-match=usb --pro %defattr(-,root,root) %doc AUTHORS COPYING LICENSE-DCO LICENSE-GPL2 LICENSE-GPL3 ChangeLog MAINTAINERS NEWS.adoc README.adoc UPGRADING.adoc docs/*.adoc docs/*.txt docs/cables /bin/* -%{_sysconfdir}/bash_completion.d/* -%{_sysconfdir}/logrotate.d/* +%{BASHCOMPLETIONPATH}/* +%config(noreplace) %{_sysconfdir}/logrotate.d/* %{_bindir}/* %if 0%{?NUTPKG_WITH_DMF} %exclude %{_bindir}/nut-scanner-reindex-dmfsnmp @@ -393,9 +438,9 @@ if [ -x /sbin/udevadm ] ; then /sbin/udevadm trigger --subsystem-match=usb --pro %exclude %{_mandir}/man8/snmp-ups*.* %dir %{_libexecdir}/ups %{_sbindir}/* -%dir %{_sysconfdir}/udev -%dir %{_sysconfdir}/udev/rules.d -%config(noreplace) %{_sysconfdir}/udev/rules.d/*.rules +%dir %{UDEVRULEPATH} +%dir %{UDEVRULEPATH}/rules.d +%config(noreplace) %{UDEVRULEPATH}/rules.d/*.rules %config(noreplace) %{CONFPATH}/hosts.conf %config(noreplace) %attr(600,%{NUT_USER},root) %{CONFPATH}/upsd.conf %config(noreplace) %attr(600,%{NUT_USER},root) %{CONFPATH}/upsd.users @@ -410,7 +455,8 @@ if [ -x /sbin/udevadm ] ; then /sbin/udevadm trigger --subsystem-match=usb --pro %exclude %{MODELPATH}/snmp-ups %exclude %{MODELPATH}/netxml-ups %exclude %{_sbindir}/gen-snmp-subdriver.sh -%attr(700,%{NUT_USER},%{NUT_GROUP}) %{STATEPATH} +%attr(770,%{NUT_USER},%{NUT_GROUP}) %{STATEPATH} +%attr(770,%{NUT_USER},%{NUT_GROUP}) %{STATEPATH}/upssched %{systemdsystemunitdir}/* %{systemdsystempresetdir}/* %{systemdtmpfilesdir}/* From 5b1f94af9f008cf8f71b311f953f3825ca091143 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Wed, 8 Oct 2025 19:43:00 +0200 Subject: [PATCH 532/805] obs/nut.spec: only package docs/cables/*.txt, not the whole builddir Signed-off-by: Jim Klimov --- obs/nut.spec | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/obs/nut.spec b/obs/nut.spec index ea8ff6fbd5..dd55627995 100644 --- a/obs/nut.spec +++ b/obs/nut.spec @@ -349,7 +349,7 @@ install -m0755 scripts/subdriver/gen-snmp-subdriver.sh %{buildroot}%{_sbindir}/ chmod +x %{buildroot}/usr/lib/python*/*-packages/*.py if [ x"%{systemdtmpfilesdir}" != x ]; then # Deliver these dirs by packaging: - sed 's,^(. %{STATEPATH}(/upssched)*( .*)*)$,#PACKAGED#\1,' -i %{buildroot}%{systemdtmpfilesdir}/nut-common-tmpfiles.conf + sed 's,^\(. %{STATEPATH}\(/upssched\)*\( .*\)*\)$,#PACKAGED#\1,' -i %{buildroot}%{systemdtmpfilesdir}/nut-common-tmpfiles.conf fi find %{buildroot} -type f -name '*.sh' -o -name '*.py' -o -name '*.pl' | \ # Use deterministic script interpreters: @@ -416,7 +416,7 @@ if [ -x /sbin/udevadm ] ; then /sbin/udevadm trigger --subsystem-match=usb --pro %files %defattr(-,root,root) -%doc AUTHORS COPYING LICENSE-DCO LICENSE-GPL2 LICENSE-GPL3 ChangeLog MAINTAINERS NEWS.adoc README.adoc UPGRADING.adoc docs/*.adoc docs/*.txt docs/cables +%doc AUTHORS COPYING LICENSE-DCO LICENSE-GPL2 LICENSE-GPL3 ChangeLog MAINTAINERS NEWS.adoc README.adoc UPGRADING.adoc docs/*.adoc docs/*.txt docs/cables/*.txt /bin/* %{BASHCOMPLETIONPATH}/* %config(noreplace) %{_sysconfdir}/logrotate.d/* From fd640663f6b5c8984a4f07f23bfa3d458029f287 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Wed, 8 Oct 2025 19:45:56 +0200 Subject: [PATCH 533/805] obs/debian.rules: fix sed with parentheses Signed-off-by: Jim Klimov --- obs/debian.rules | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/obs/debian.rules b/obs/debian.rules index bb0c3f8a12..3f4ce7df7e 100755 --- a/obs/debian.rules +++ b/obs/debian.rules @@ -98,11 +98,11 @@ configure: configure.ac ifeq (0,$(NUTPKG_WITH_DMF)) # hide patch-recipe-dmf: - sed 's,^([^#].*dmf.*)$$,#\1,' -i debian.*.install + for F in debian.*.install ; do sed 's,^\([^#].*dmf.*\)$$,#\1,' -i "$$F" || exit ; done else # expose patch-recipe-dmf: - sed 's,^#(.*dmf.*)$$,\1,' -i debian.*.install + for F in debian.*.install ; do sed 's,^#\(.*dmf.*\)$$,\1,' -i "$$F" || exit ; done endif pre-build:: patch-recipe-dmf debian/compat configure From ef249628075b229c82bf5fbfa90b9bf292bf34bd Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Wed, 8 Oct 2025 20:35:01 +0200 Subject: [PATCH 534/805] obs/nut.spec: fix rpm-var expansion for conditionals Signed-off-by: Jim Klimov --- obs/nut.spec | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/obs/nut.spec b/obs/nut.spec index dd55627995..ec5e7242ca 100644 --- a/obs/nut.spec +++ b/obs/nut.spec @@ -391,21 +391,21 @@ bin/chgrp root %{CONFPATH}/upsd.conf %{CONFPATH}/upsmon.conf %{CONFPATH}/upsd.us bin/chmod 600 %{CONFPATH}/upsd.conf %{CONFPATH}/upsmon.conf %{CONFPATH}/upsd.users || echo "WARNING: Could not secure config files in path '%{CONFPATH}'" >&2 # And finally trigger udev to set permissions according to newly installed rules files. if [ -x /sbin/udevadm ] ; then /sbin/udevadm trigger --subsystem-match=usb --property-match=DEVTYPE=usb_device ; fi -%if "x%{systemdtmpfilesdir}" != "x" +%if "x%{?systemdtmpfilesdir}" != "x" %tmpfiles_create nut-common-tmpfiles.conf %endif -%if "x%{systemdsystemunitdir}" != "x" +%if "x%{?systemdsystemunitdir}" != "x" %service_add_post %{NUT_SYSTEMD_UNITS_SERVICE_TARGET} %endif %preun -%if "x%{systemdsystemunitdir}" != "x" +%if "x%{?systemdsystemunitdir}" != "x" %service_del_preun %{NUT_SYSTEMD_UNITS_SERVICE_TARGET} %endif : %postun -%if "x%{systemdsystemunitdir}" != "x" +%if "x%{?systemdsystemunitdir}" != "x" %service_del_postun %{NUT_SYSTEMD_UNITS_SERVICE_TARGET} %endif : From 74dae363aa1d7997d4b49be1ae550885be9da29b Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Wed, 8 Oct 2025 20:35:31 +0200 Subject: [PATCH 535/805] obs/nut.spec: udev rules no longer under /etc - not a %config (hopefully) Signed-off-by: Jim Klimov --- obs/nut.spec | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/obs/nut.spec b/obs/nut.spec index ec5e7242ca..b43ac72748 100644 --- a/obs/nut.spec +++ b/obs/nut.spec @@ -440,7 +440,8 @@ if [ -x /sbin/udevadm ] ; then /sbin/udevadm trigger --subsystem-match=usb --pro %{_sbindir}/* %dir %{UDEVRULEPATH} %dir %{UDEVRULEPATH}/rules.d -%config(noreplace) %{UDEVRULEPATH}/rules.d/*.rules +### FIXME: if under /etc ### %config(noreplace) %{UDEVRULEPATH}/rules.d/*.rules +%{UDEVRULEPATH}/rules.d/*.rules %config(noreplace) %{CONFPATH}/hosts.conf %config(noreplace) %attr(600,%{NUT_USER},root) %{CONFPATH}/upsd.conf %config(noreplace) %attr(600,%{NUT_USER},root) %{CONFPATH}/upsd.users From ebd578d3f27260ae0ad4f1fcd0f5a582582bddc9 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Wed, 8 Oct 2025 20:46:54 +0200 Subject: [PATCH 536/805] obs/debian.rules: search for systemd configs also in libsystemd Signed-off-by: Jim Klimov --- obs/debian.rules | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/obs/debian.rules b/obs/debian.rules index 3f4ce7df7e..ce8f763262 100755 --- a/obs/debian.rules +++ b/obs/debian.rules @@ -19,10 +19,10 @@ DEB_DH_AUTORECONF_ARGS = --as-needed DEB_HOST_ARCH_OS := $(shell dpkg-architecture -qDEB_HOST_ARCH_OS 2>/dev/null) # echoed fallbacks are for Ubuntu primarily -systemdsystemunitdir := $(shell pkg-config --variable=systemdsystemunitdir systemd || echo /lib/systemd/system) -systemdsystemdutildir := $(shell pkg-config --variable=systemdutildir systemd || echo /lib/systemd) -systemdshutdowndir := $(shell pkg-config --variable=systemdshutdowndir systemd || echo /lib/systemd/system-shutdown) -systemdtmpfilesdir := $(shell pkg-config --variable=systemdtmpfilesdir systemd || echo /usr/lib/tmpfiles.d) +systemdsystemunitdir := $(shell pkg-config --variable=systemdsystemunitdir libsystemd || pkg-config --variable=systemdsystemunitdir systemd || echo /lib/systemd/system) +systemdsystemdutildir := $(shell pkg-config --variable=systemdutildir libsystemd || shell pkg-config --variable=systemdutildir systemd || echo /lib/systemd) +systemdshutdowndir := $(shell pkg-config --variable=systemdshutdowndir libsystemd || shell pkg-config --variable=systemdshutdowndir systemd || echo /lib/systemd/system-shutdown) +systemdtmpfilesdir := $(shell pkg-config --variable=systemdtmpfilesdir libsystemd || shell pkg-config --variable=systemdtmpfilesdir systemd || echo /usr/lib/tmpfiles.d) # Does this NUT branch have DMF feature code? NUTPKG_WITH_DMF := $(test -d scripts/DMF && echo 1 || echo 0) From d2a06532ef7c21af6c41411efc9ec348e13b5d56 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Wed, 8 Oct 2025 20:47:11 +0200 Subject: [PATCH 537/805] obs/debian.rules: fix check for NUTPKG_WITH_DMF Signed-off-by: Jim Klimov --- obs/debian.rules | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/obs/debian.rules b/obs/debian.rules index ce8f763262..162e2feb02 100755 --- a/obs/debian.rules +++ b/obs/debian.rules @@ -25,7 +25,7 @@ systemdshutdowndir := $(shell pkg-config --variable=systemdshutdowndir libsystem systemdtmpfilesdir := $(shell pkg-config --variable=systemdtmpfilesdir libsystemd || shell pkg-config --variable=systemdtmpfilesdir systemd || echo /usr/lib/tmpfiles.d) # Does this NUT branch have DMF feature code? -NUTPKG_WITH_DMF := $(test -d scripts/DMF && echo 1 || echo 0) +NUTPKG_WITH_DMF := $(shell test -d scripts/DMF && echo 1 || echo 0) # Newer systems have just /run (and yet newer systemd noisily suggests it) runbasedir := $(shell test -d /run && echo /run || echo /var/run) From 9e445d9ab5ec09669d131307da6b62603dbc24ff Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Wed, 8 Oct 2025 20:47:30 +0200 Subject: [PATCH 538/805] obs/debian.rules: fix iteration for debian *.install fixup (DMF) Signed-off-by: Jim Klimov --- obs/debian.rules | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/obs/debian.rules b/obs/debian.rules index 162e2feb02..85c8bd8bf3 100755 --- a/obs/debian.rules +++ b/obs/debian.rules @@ -98,11 +98,11 @@ configure: configure.ac ifeq (0,$(NUTPKG_WITH_DMF)) # hide patch-recipe-dmf: - for F in debian.*.install ; do sed 's,^\([^#].*dmf.*\)$$,#\1,' -i "$$F" || exit ; done + for F in debian.*.install debian/*.install ; do [ -s "$$F" ] || continue ; sed 's,^\([^#].*dmf.*\)$$,#\1,' -i "$$F" || exit ; done else # expose patch-recipe-dmf: - for F in debian.*.install ; do sed 's,^#\(.*dmf.*\)$$,\1,' -i "$$F" || exit ; done + for F in debian.*.install debian/*.install ; do [ -s "$$F" ] || continue ; sed 's,^#\(.*dmf.*\)$$,\1,' -i "$$F" || exit ; done endif pre-build:: patch-recipe-dmf debian/compat configure From 7610aabc806818608d1f385dc6fdafd32601bd87 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Wed, 8 Oct 2025 21:01:28 +0200 Subject: [PATCH 539/805] obs/debian.rules: fix pkg-config search for systemd vars Signed-off-by: Jim Klimov --- obs/debian.rules | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/obs/debian.rules b/obs/debian.rules index 85c8bd8bf3..da35916750 100755 --- a/obs/debian.rules +++ b/obs/debian.rules @@ -19,10 +19,10 @@ DEB_DH_AUTORECONF_ARGS = --as-needed DEB_HOST_ARCH_OS := $(shell dpkg-architecture -qDEB_HOST_ARCH_OS 2>/dev/null) # echoed fallbacks are for Ubuntu primarily -systemdsystemunitdir := $(shell pkg-config --variable=systemdsystemunitdir libsystemd || pkg-config --variable=systemdsystemunitdir systemd || echo /lib/systemd/system) -systemdsystemdutildir := $(shell pkg-config --variable=systemdutildir libsystemd || shell pkg-config --variable=systemdutildir systemd || echo /lib/systemd) -systemdshutdowndir := $(shell pkg-config --variable=systemdshutdowndir libsystemd || shell pkg-config --variable=systemdshutdowndir systemd || echo /lib/systemd/system-shutdown) -systemdtmpfilesdir := $(shell pkg-config --variable=systemdtmpfilesdir libsystemd || shell pkg-config --variable=systemdtmpfilesdir systemd || echo /usr/lib/tmpfiles.d) +systemdsystemunitdir := $(shell OUT="`pkg-config --variable=systemdsystemunitdir libsystemd`" && [ -n "$$OUT" ] && { echo "$$OUT" ; exit; } || OUT="`pkg-config --variable=systemdsystemunitdir systemd`" && [ -n "$$OUT" ] && { echo "$$OUT" ; exit; } || echo /lib/systemd/system) +systemdsystemdutildir := $(shell OUT="`pkg-config --variable=systemdutildir libsystemd`" && [ -n "$$OUT" ] && { echo "$$OUT" ; exit; } || OUT="`pkg-config --variable=systemdutildir systemd`" && [ -n "$$OUT" ] && { echo "$$OUT" ; exit; } || echo /lib/systemd) +systemdshutdowndir := $(shell OUT="`pkg-config --variable=systemdshutdowndir libsystemd`" && [ -n "$$OUT" ] && { echo "$$OUT" ; exit; } || OUT="`pkg-config --variable=systemdshutdowndir systemd`" && [ -n "$$OUT" ] && { echo "$$OUT" ; exit; } || echo /lib/systemd/system-shutdown) +systemdtmpfilesdir := $(shell OUT="`pkg-config --variable=systemdtmpfilesdir libsystemd`" && [ -n "$$OUT" ] && { echo "$$OUT" ; exit; } || OUT="`pkg-config --variable=systemdtmpfilesdir systemd`" && [ -n "$$OUT" ] && { echo "$$OUT" ; exit; } || echo /usr/lib/tmpfiles.d) # Does this NUT branch have DMF feature code? NUTPKG_WITH_DMF := $(shell test -d scripts/DMF && echo 1 || echo 0) From 79157c80152bb726e977c4a0d504bd2b441775d7 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Wed, 8 Oct 2025 21:05:27 +0200 Subject: [PATCH 540/805] obs/nut.spec: reshuffle NUT_SYSTEMD_UNITS_SERVICE_TARGET definition Signed-off-by: Jim Klimov --- obs/nut.spec | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/obs/nut.spec b/obs/nut.spec index b43ac72748..8821cc5171 100644 --- a/obs/nut.spec +++ b/obs/nut.spec @@ -70,7 +70,9 @@ %define systemdsystemdutildir %(pkg-config --variable=systemdutildir systemd) %define systemdshutdowndir %(pkg-config --variable=systemdshutdowndir systemd) -%define NUT_SYSTEMD_UNITS_SERVICE_TARGET %(cd scripts/systemd && ls -1 *.{service,target}{,.in} | sed 's,.in$,,' | sort | uniq) +#%define NUT_SYSTEMD_UNITS_SERVICE_TARGET %(cd scripts/systemd && ls -1 *.{service,target}{,.in} | sed 's,.in$,,' | sort | uniq) +%define NUT_SYSTEMD_UNITS_SERVICE_TARGET nut-driver-enumerator.service nut-driver.target nut-driver@.service nut-logger.service nut-monitor.service nut-server.service nut-sleep.service nut-udev-settle.service nut.target + %define NUT_SYSTEMD_UNITS_OTHER %(cd scripts/systemd && ls -1 *.{path,timer}{,.in} | sed 's,.in$,,' | sort | uniq) %define NUT_SYSTEMD_UNITS_PRESET %(cd scripts/systemd && ls -1 *.preset{,.in} | sed 's,.in$,,' | sort | uniq) From 19c70294c80fe4934b28fe0191ff671b269e2cde Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Thu, 9 Oct 2025 00:44:42 +0000 Subject: [PATCH 541/805] obs/nut.dsc, obs/debian.control: do not require "python-is-..." which confuses cdbs Signed-off-by: Jim Klimov --- obs/debian.control | 3 ++- obs/nut.dsc | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/obs/debian.control b/obs/debian.control index 3c94286e09..e14a9b93a3 100644 --- a/obs/debian.control +++ b/obs/debian.control @@ -16,7 +16,7 @@ Build-Depends: debhelper (>= 8.1.3), libneon27-gnutls-dev | libneon27-dev, libpowerman0-dev (>= 2.3.3), libwrap0-dev (>= 7.6), - python (>= 2.6.6-3~) | python-is-python2 | python-is-python3, python2 | python3, dh-python | dh-python2 | dh-python3 | dh-pypy, + python2 | python3, dh-python | dh-python2 | dh-python3 | dh-pypy, libfreeipmi-dev (>= 0.8.5) [!hurd-i386], libipmimonitoring-dev (>= 1.1.5-2) [!hurd-i386], libmodbus-dev (>= 3.1.6), @@ -25,6 +25,7 @@ Build-Depends: debhelper (>= 8.1.3), liblua5.1-0-dev, lua5.1, pkg-config +#python (>= 2.6.6-3~) | python-is-python2 | python-is-python3, Build-Depends-Indep: asciidoc (>= 8.6.3), docbook-xsl, dblatex (>= 0.2.5), diff --git a/obs/nut.dsc b/obs/nut.dsc index 8410468f24..8c910131a3 100644 --- a/obs/nut.dsc +++ b/obs/nut.dsc @@ -10,7 +10,8 @@ Standards-Version: 3.9.6 Vcs-Browser: http://anonscm.debian.org/gitweb/?p=collab-maint/nut.git;a=summary Vcs-Git: git://anonscm.debian.org/collab-maint/nut.git Testsuite: autopkgtest -Build-Depends: debhelper (>= 8.1.3), cdbs (>= 0.4.122~), autotools-dev, dh-autoreconf, libsystemd-dev, libjpeg-dev, libgd-dev | libgd2-xpm-dev | libgd2-noxpm-dev, libssl1.0-dev | libssl-dev, libsnmp-dev | libsnmp9-dev, libusb-dev (>= 0.1.8), libneon27-gnutls-dev | libneon27-dev, libpowerman0-dev (>= 2.3.3), libwrap0-dev (>= 7.6), python (>= 2.6.6-3~) | python-is-python2 | python-is-python3, python2 | python3, libfreeipmi-dev (>= 0.8.5) [!hurd-i386], libipmimonitoring-dev (>= 1.1.5-2) [!hurd-i386], libnss3-dev, libtool, libltdl-dev, liblua5.1-0-dev, lua5.1, pkg-config, dh-python | dh-python2 | dh-python3 | dh-pypy, libmodbus-dev, libi2c-dev +Build-Depends: debhelper (>= 8.1.3), cdbs (>= 0.4.122~), autotools-dev, dh-autoreconf, libsystemd-dev, libjpeg-dev, libgd-dev | libgd2-xpm-dev | libgd2-noxpm-dev, libssl1.0-dev | libssl-dev, libsnmp-dev | libsnmp9-dev, libusb-dev (>= 0.1.8), libneon27-gnutls-dev | libneon27-dev, libpowerman0-dev (>= 2.3.3), libwrap0-dev (>= 7.6), python2 | python3, libfreeipmi-dev (>= 0.8.5) [!hurd-i386], libipmimonitoring-dev (>= 1.1.5-2) [!hurd-i386], libnss3-dev, libtool, libltdl-dev, liblua5.1-0-dev, lua5.1, pkg-config, dh-python | dh-python2 | dh-python3 | dh-pypy, libmodbus-dev, libi2c-dev +# , python (>= 2.6.6-3~) | python-is-python2 | python-is-python3 #+++ python-pycparser # The pycparser is required to rebuild DMF files, but those pre-built # copies in the git repo/tarball "should" be in sync with original From e60ed00d66de6dadf8ad76e2a4858c3c2e270ec0 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Thu, 9 Oct 2025 01:40:59 +0000 Subject: [PATCH 542/805] obs/debian.rules: convince cdbs about dh_python3 when it is the only viable option Signed-off-by: Jim Klimov --- obs/debian.rules | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/obs/debian.rules b/obs/debian.rules index da35916750..97b85eb61f 100755 --- a/obs/debian.rules +++ b/obs/debian.rules @@ -6,6 +6,16 @@ include /usr/share/cdbs/1/class/python-module.mk include /usr/share/cdbs/1/rules/autoreconf.mk +# CDBS has some issues detecting something other than dh_python2 +# which is absent on Debian 12+ and Ubuntu 25.04 for example. +ifeq (,$(shell command -v dh_python2)) +ifneq (,$(shell command -v dh_python3)) +ifneq (,$(shell command -v python3)) +cdbs_curpythonsystems := python3 +endif +endif +endif + export DH_OPTIONS # This is the debhelper compatibility version to use. From 304babb71342274edb5e39e82ff07426b11bd455 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Thu, 9 Oct 2025 02:15:12 +0000 Subject: [PATCH 543/805] ci_build.sh: wrap pkg-rpm and pkg-deb (PoC) Signed-off-by: Jim Klimov --- ci_build.sh | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/ci_build.sh b/ci_build.sh index adec0daa92..77b33e7bc5 100755 --- a/ci_build.sh +++ b/ci_build.sh @@ -1478,6 +1478,8 @@ if [ -z "$BUILD_TYPE" ] ; then win|windows|cross-windows-mingw) BUILD_TYPE="cross-windows-mingw" ; shift ;; + pkg*) BUILD_TYPE="$1" ; shift ;; + spellcheck|spellcheck-interactive|spellcheck-quick|spellcheck-interactive-quick) # Note: this is a little hack to reduce typing # and scrolling in (docs) developer iterations. @@ -2869,6 +2871,28 @@ cross-windows-mingw*) ./build-mingw-nut.sh $cmd ;; +pkg-rpm|pkg-spec) + rm -f nut.spec + cp -f obs/nut.spec . + sed -e 's,^(Version:).*$,\1 '"`NUT_VERSION_QUERY=VER50 ./tools/gitlog2version.sh`," \ + -i nut.spec + rpmbuild -ba + ;; + +pkg-deb|pkg-dsc) + rm -rf debian + mkdir -p debian + cd obs || exit + for F in debian.* nut*.install nut*.manpages ; do + ln -s "../obs/$"F "../debian/`echo "$F" | sed 's/debian.//'`" + done + rm -f nut.dsc + cp -f obs/nut.dsc . + sed -e 's,^(Version:).*$,\1 '"`NUT_VERSION_QUERY=VER50 ./tools/gitlog2version.sh`," \ + -i nut.dsc + debuild -y + ;; + *) pushd "./builds/${BUILD_TYPE}" && REPO_DIR="$(dirs -l +1)" ./ci_build.sh ;; From 3ec158f8d18291b5778bead2ee318363f7e8feb4 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Thu, 9 Oct 2025 02:24:11 +0000 Subject: [PATCH 544/805] obs.*, ci_build.sh: rename debiam recipe files to standard pattern Signed-off-by: Jim Klimov --- ci_build.sh | 2 +- obs/Makefile.am | 10 +++++----- ...-linux-i2c.install => debian.nut-linux-i2c.install} | 0 ...inux-i2c.manpages => debian.nut-linux-i2c.manpages} | 0 obs/{nut-modbus.install => debian.nut-modbus.install} | 0 ...{nut-modbus.manpages => debian.nut-modbus.manpages} | 0 obs/{nut.changes => debian.nut.changes} | 0 7 files changed, 6 insertions(+), 6 deletions(-) rename obs/{nut-linux-i2c.install => debian.nut-linux-i2c.install} (100%) rename obs/{nut-linux-i2c.manpages => debian.nut-linux-i2c.manpages} (100%) rename obs/{nut-modbus.install => debian.nut-modbus.install} (100%) rename obs/{nut-modbus.manpages => debian.nut-modbus.manpages} (100%) rename obs/{nut.changes => debian.nut.changes} (100%) diff --git a/ci_build.sh b/ci_build.sh index 77b33e7bc5..d62535293d 100755 --- a/ci_build.sh +++ b/ci_build.sh @@ -2883,7 +2883,7 @@ pkg-deb|pkg-dsc) rm -rf debian mkdir -p debian cd obs || exit - for F in debian.* nut*.install nut*.manpages ; do + for F in debian.* ; do ln -s "../obs/$"F "../debian/`echo "$F" | sed 's/debian.//'`" done rm -f nut.dsc diff --git a/obs/Makefile.am b/obs/Makefile.am index f278bce54f..e16077f1c3 100644 --- a/obs/Makefile.am +++ b/obs/Makefile.am @@ -29,6 +29,7 @@ EXTRA_DIST += \ debian.libupsclient-dev.install \ debian.libupsclient-dev.manpages \ debian.libupsclient4.install \ + debian.nut.changes \ debian.nut-cgi.README.Debian \ debian.nut-cgi.docs \ debian.nut-cgi.install \ @@ -55,6 +56,10 @@ EXTRA_DIST += \ debian.nut-doc.install \ debian.nut-ipmi.install \ debian.nut-ipmi.manpages \ + debian.nut-linux-i2c.install \ + debian.nut-linux-i2c.manpages \ + debian.nut-modbus.install \ + debian.nut-modbus.manpages \ debian.nut-monitor.install \ debian.nut-monitor.menu \ debian.nut-monitor.xpm \ @@ -80,11 +85,6 @@ EXTRA_DIST += \ debian.rules \ debian.series \ debian.watch \ - nut-linux-i2c.install \ - nut-linux-i2c.manpages \ - nut-modbus.install \ - nut-modbus.manpages \ - nut.changes \ nut.dsc # RedHAT/Fedora/CentOS/... recipes: diff --git a/obs/nut-linux-i2c.install b/obs/debian.nut-linux-i2c.install similarity index 100% rename from obs/nut-linux-i2c.install rename to obs/debian.nut-linux-i2c.install diff --git a/obs/nut-linux-i2c.manpages b/obs/debian.nut-linux-i2c.manpages similarity index 100% rename from obs/nut-linux-i2c.manpages rename to obs/debian.nut-linux-i2c.manpages diff --git a/obs/nut-modbus.install b/obs/debian.nut-modbus.install similarity index 100% rename from obs/nut-modbus.install rename to obs/debian.nut-modbus.install diff --git a/obs/nut-modbus.manpages b/obs/debian.nut-modbus.manpages similarity index 100% rename from obs/nut-modbus.manpages rename to obs/debian.nut-modbus.manpages diff --git a/obs/nut.changes b/obs/debian.nut.changes similarity index 100% rename from obs/nut.changes rename to obs/debian.nut.changes From f306cad61f924fba7d8a17a28b1676c409a86ebf Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Thu, 9 Oct 2025 02:25:08 +0000 Subject: [PATCH 545/805] obs/*: drop "control" symlink Signed-off-by: Jim Klimov --- obs/Makefile.am | 1 - obs/control | 1 - 2 files changed, 2 deletions(-) delete mode 120000 obs/control diff --git a/obs/Makefile.am b/obs/Makefile.am index e16077f1c3..006149e736 100644 --- a/obs/Makefile.am +++ b/obs/Makefile.am @@ -6,7 +6,6 @@ EXTRA_DIST = README.adoc # Debian/Ubuntu recipes: EXTRA_DIST += \ - control \ debian.Makefile.am \ debian.NEWS \ debian.changelog \ diff --git a/obs/control b/obs/control deleted file mode 120000 index 467d6decea..0000000000 --- a/obs/control +++ /dev/null @@ -1 +0,0 @@ -debian.control \ No newline at end of file From 0f2f74367143d6d79897040c2f5365bffd176bc2 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Thu, 9 Oct 2025 02:28:03 +0000 Subject: [PATCH 546/805] ci_build.sh: pkg-deb: fix shell and sed syntax Signed-off-by: Jim Klimov --- ci_build.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ci_build.sh b/ci_build.sh index d62535293d..7fe001a8cc 100755 --- a/ci_build.sh +++ b/ci_build.sh @@ -2882,13 +2882,13 @@ pkg-rpm|pkg-spec) pkg-deb|pkg-dsc) rm -rf debian mkdir -p debian - cd obs || exit + (cd obs || exit for F in debian.* ; do - ln -s "../obs/$"F "../debian/`echo "$F" | sed 's/debian.//'`" - done + ln -s "../obs/$F" "../debian/`echo "$F" | sed 's/debian.//'`" || exit + done) || exit rm -f nut.dsc cp -f obs/nut.dsc . - sed -e 's,^(Version:).*$,\1 '"`NUT_VERSION_QUERY=VER50 ./tools/gitlog2version.sh`," \ + sed -e 's,^\(Version:\).*$,\1 '"`NUT_VERSION_QUERY=VER50 ./tools/gitlog2version.sh`," \ -i nut.dsc debuild -y ;; From c2b17e61d24cef613620c7594748c860294d554d Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Thu, 9 Oct 2025 02:33:48 +0000 Subject: [PATCH 547/805] ci_build.sh: pkg-deb: force debuikd differently Signed-off-by: Jim Klimov --- ci_build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci_build.sh b/ci_build.sh index 7fe001a8cc..558bc9cc1f 100755 --- a/ci_build.sh +++ b/ci_build.sh @@ -2890,7 +2890,7 @@ pkg-deb|pkg-dsc) cp -f obs/nut.dsc . sed -e 's,^\(Version:\).*$,\1 '"`NUT_VERSION_QUERY=VER50 ./tools/gitlog2version.sh`," \ -i nut.dsc - debuild -y + yes | debuild ;; *) From b56453cc85519a1b36db2d9c55bb7647acff7828 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Thu, 9 Oct 2025 02:36:01 +0000 Subject: [PATCH 548/805] ci_build.sh: pkg-deb: install prereqs (TBD;: optional?) Signed-off-by: Jim Klimov --- ci_build.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/ci_build.sh b/ci_build.sh index 558bc9cc1f..6517944ad5 100755 --- a/ci_build.sh +++ b/ci_build.sh @@ -2890,6 +2890,7 @@ pkg-deb|pkg-dsc) cp -f obs/nut.dsc . sed -e 's,^\(Version:\).*$,\1 '"`NUT_VERSION_QUERY=VER50 ./tools/gitlog2version.sh`," \ -i nut.dsc + dpkg-checkbuilddeps || sudo mk-build-debs -i yes | debuild ;; From adaff5d0ecc40d28f6d25b72182fe8e7f7893c56 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Thu, 9 Oct 2025 02:38:34 +0000 Subject: [PATCH 549/805] ci_build.sh: pkg-deb: clean away cdbs temp leftovers Signed-off-by: Jim Klimov --- ci_build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci_build.sh b/ci_build.sh index 6517944ad5..3757119070 100755 --- a/ci_build.sh +++ b/ci_build.sh @@ -2880,7 +2880,7 @@ pkg-rpm|pkg-spec) ;; pkg-deb|pkg-dsc) - rm -rf debian + rm -rf debian config.*cdbs* mkdir -p debian (cd obs || exit for F in debian.* ; do From 8a8831137f619da6611fb6c3ac3313075ab647d3 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Thu, 9 Oct 2025 02:51:35 +0000 Subject: [PATCH 550/805] ci_build.sh: pkg*: pre-cleanup more Signed-off-by: Jim Klimov --- ci_build.sh | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/ci_build.sh b/ci_build.sh index 3757119070..af8c60f3bd 100755 --- a/ci_build.sh +++ b/ci_build.sh @@ -2872,26 +2872,29 @@ cross-windows-mingw*) ;; pkg-rpm|pkg-spec) - rm -f nut.spec + rm -f nut.spec || true + git clean -fdX || true cp -f obs/nut.spec . sed -e 's,^(Version:).*$,\1 '"`NUT_VERSION_QUERY=VER50 ./tools/gitlog2version.sh`," \ -i nut.spec - rpmbuild -ba + rpmbuild -ba \ + && find . -name '*rpm' ;; pkg-deb|pkg-dsc) - rm -rf debian config.*cdbs* + rm -rf debian config.*cdbs* nut.dsc || true + git clean -fdX || true mkdir -p debian (cd obs || exit for F in debian.* ; do ln -s "../obs/$F" "../debian/`echo "$F" | sed 's/debian.//'`" || exit done) || exit - rm -f nut.dsc cp -f obs/nut.dsc . sed -e 's,^\(Version:\).*$,\1 '"`NUT_VERSION_QUERY=VER50 ./tools/gitlog2version.sh`," \ -i nut.dsc dpkg-checkbuilddeps || sudo mk-build-debs -i - yes | debuild + yes | debuild \ + && find . -name '*deb' ;; *) From 16d3aacd4faa02ab96a5c019bf5a69cf2c913880 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Thu, 9 Oct 2025 03:48:11 +0000 Subject: [PATCH 551/805] obs/debian.rules: try harder to detect python2/3 helper Signed-off-by: Jim Klimov --- obs/debian.rules | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/obs/debian.rules b/obs/debian.rules index 97b85eb61f..166baf3baf 100755 --- a/obs/debian.rules +++ b/obs/debian.rules @@ -8,9 +8,9 @@ include /usr/share/cdbs/1/rules/autoreconf.mk # CDBS has some issues detecting something other than dh_python2 # which is absent on Debian 12+ and Ubuntu 25.04 for example. -ifeq (,$(shell command -v dh_python2)) -ifneq (,$(shell command -v dh_python3)) -ifneq (,$(shell command -v python3)) +ifeq (,$(shell command -v dh_python2 || which dh_python2 || dh_python2 --help)) +ifneq (,$(shell command -v dh_python3 || which dh_python3 || dh_python3 --help)) +ifneq (,$(shell command -v python3 || which python3 || python3 --help)) cdbs_curpythonsystems := python3 endif endif From ffb4b2aa8cc3203336fa70977b8ad981afb2795e Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Thu, 9 Oct 2025 10:18:41 +0200 Subject: [PATCH 552/805] obs/nut.spec: avoid what looks like spec-var expansion in comments Signed-off-by: Jim Klimov --- obs/nut.spec | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/obs/nut.spec b/obs/nut.spec index 8821cc5171..bbdb99520a 100644 --- a/obs/nut.spec +++ b/obs/nut.spec @@ -70,7 +70,7 @@ %define systemdsystemdutildir %(pkg-config --variable=systemdutildir systemd) %define systemdshutdowndir %(pkg-config --variable=systemdshutdowndir systemd) -#%define NUT_SYSTEMD_UNITS_SERVICE_TARGET %(cd scripts/systemd && ls -1 *.{service,target}{,.in} | sed 's,.in$,,' | sort | uniq) +# % define NUT_SYSTEMD_UNITS_SERVICE_TARGET % (cd scripts/systemd && ls -1 *.{service,target}{,.in} | sed 's,.in$,,' | sort | uniq) %define NUT_SYSTEMD_UNITS_SERVICE_TARGET nut-driver-enumerator.service nut-driver.target nut-driver@.service nut-logger.service nut-monitor.service nut-server.service nut-sleep.service nut-udev-settle.service nut.target %define NUT_SYSTEMD_UNITS_OTHER %(cd scripts/systemd && ls -1 *.{path,timer}{,.in} | sed 's,.in$,,' | sort | uniq) @@ -442,7 +442,7 @@ if [ -x /sbin/udevadm ] ; then /sbin/udevadm trigger --subsystem-match=usb --pro %{_sbindir}/* %dir %{UDEVRULEPATH} %dir %{UDEVRULEPATH}/rules.d -### FIXME: if under /etc ### %config(noreplace) %{UDEVRULEPATH}/rules.d/*.rules +### FIXME: if under /etc ### % config(noreplace) % {UDEVRULEPATH}/rules.d/*.rules %{UDEVRULEPATH}/rules.d/*.rules %config(noreplace) %{CONFPATH}/hosts.conf %config(noreplace) %attr(600,%{NUT_USER},root) %{CONFPATH}/upsd.conf From 8b309010cd0d82a99a80df13ed17698d1b8a80c4 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Thu, 9 Oct 2025 10:39:24 +0200 Subject: [PATCH 553/805] obs/nut.spec: do not dump sockdebug and NDE script into /usr/libexec directly Signed-off-by: Jim Klimov --- obs/nut.spec | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/obs/nut.spec b/obs/nut.spec index bbdb99520a..c6a7d9bf32 100644 --- a/obs/nut.spec +++ b/obs/nut.spec @@ -293,7 +293,7 @@ sh autogen.sh --bindir=%{_bindir}\ --sbindir=%{_sbindir}\ --libdir=%{_libdir}\ - --libexecdir=%{_libexecdir}\ + --libexecdir=%{_libexecdir}/ups\ --sysconfdir=%{CONFPATH}\ --datadir=%{_datadir}/nut\ --with-ssl --with-openssl\ @@ -477,7 +477,7 @@ if [ -x /sbin/udevadm ] ; then /sbin/udevadm trigger --subsystem-match=usb --pro %dir %{_datadir}/augeas/lenses %dir %{_datadir}/augeas/lenses/dist %dir %{_datadir}/augeas/lenses/dist/tests -%{_libexecdir}/nut-driver-enumerator.sh +%{_libexecdir}/ups/nut-driver-enumerator.sh # Exclude whatever other packages bring, some rpmbuild versions seem to dump # everything into the base package and then complain about duplicates/conflicts: ### libupsclient1 @@ -495,7 +495,7 @@ if [ -x /sbin/udevadm ] ; then /sbin/udevadm trigger --subsystem-match=usb --pro %exclude %{_libdir}/*.so %exclude %{_libdir}/pkgconfig/*.pc %exclude %{_mandir}/man3/*.* -%exclude %{_libexecdir}/sockdebug +%exclude %{_libexecdir}/ups/sockdebug %files drivers-net @@ -543,6 +543,6 @@ if [ -x /sbin/udevadm ] ; then /sbin/udevadm trigger --subsystem-match=usb --pro %{_libdir}/*.so %{_libdir}/pkgconfig/*.pc %{_mandir}/man3/*.* -%{_libexecdir}/sockdebug +%{_libexecdir}/ups/sockdebug %changelog From b4d9b56af45a2991718cc0968a7c8c714d2cae85 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Thu, 9 Oct 2025 10:39:48 +0200 Subject: [PATCH 554/805] obs/nut.spec: specify system locations we use via %dir Signed-off-by: Jim Klimov --- obs/nut.spec | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/obs/nut.spec b/obs/nut.spec index c6a7d9bf32..8154353003 100644 --- a/obs/nut.spec +++ b/obs/nut.spec @@ -419,6 +419,25 @@ if [ -x /sbin/udevadm ] ; then /sbin/udevadm trigger --subsystem-match=usb --pro %files %defattr(-,root,root) %doc AUTHORS COPYING LICENSE-DCO LICENSE-GPL2 LICENSE-GPL3 ChangeLog MAINTAINERS NEWS.adoc README.adoc UPGRADING.adoc docs/*.adoc docs/*.txt docs/cables/*.txt +# List the (system) dirs we impact but do not own for the package +%dir /bin +%dir %{BASHCOMPLETIONPATH} +%dir %{_sysconfdir}/logrotate.d +%dir %{_bindir} +%dir %{_sbindir} +%dir %{_datadir} +%dir %{_docdir} +%dir %{_mandir}/man1 +%dir %{_mandir}/man3 +%dir %{_mandir}/man5 +%dir %{_mandir}/man7 +%dir %{_mandir}/man8 +%dir %{_libexecdir} +%dir %{systemdsystemunitdir} +%dir %{systemdsystempresetdir} +%dir %{systemdtmpfilesdir} +%dir %{systemdshutdowndir} +# List the file patterns to install from proto area /bin/* %{BASHCOMPLETIONPATH}/* %config(noreplace) %{_sysconfdir}/logrotate.d/* From 872320cf06dafcc35084dd8322dec8749b022cc8 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Thu, 9 Oct 2025 10:40:06 +0200 Subject: [PATCH 555/805] obs/nut.spec: comment about alias man pages seen as duplicate files in package Signed-off-by: Jim Klimov --- obs/nut.spec | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/obs/nut.spec b/obs/nut.spec index 8154353003..ddb82949d3 100644 --- a/obs/nut.spec +++ b/obs/nut.spec @@ -561,6 +561,12 @@ if [ -x /sbin/udevadm ] ; then /sbin/udevadm trigger --subsystem-match=usb --pro %{_includedir}/*.h %{_libdir}/*.so %{_libdir}/pkgconfig/*.pc +# FIXME: Alias man page files... use symlinks or what? +# [ 139s] nut-devel.x86_64: W: files-duplicate /usr/share/man/man3/nutclient_execute_device_command.3.gz /usr/share/man/man3/nutclient_get_device_command_description.3.gz:/usr/share/man/man3/nutclient_get_device_commands.3.gz:/usr/share/man/man3/nutclient_has_device_command.3.gz +# [ 139s] nut-devel.x86_64: W: files-duplicate /usr/share/man/man3/nutclient_get_device_num_logins.3.gz /usr/share/man/man3/nutclient_authenticate.3.gz:/usr/share/man/man3/nutclient_device_forced_shutdown.3.gz:/usr/share/man/man3/nutclient_device_login.3.gz:/usr/share/man/man3/nutclient_device_master.3.gz:/usr/share/man/man3/nutclient_logout.3.gz +# [ 139s] nut-devel.x86_64: W: files-duplicate /usr/share/man/man3/nutclient_get_devices.3.gz /usr/share/man/man3/nutclient_get_device_description.3.gz:/usr/share/man/man3/nutclient_has_device.3.gz +# [ 139s] nut-devel.x86_64: W: files-duplicate /usr/share/man/man3/nutclient_set_device_variable_value.3.gz /usr/share/man/man3/nutclient_get_device_rw_variables.3.gz:/usr/share/man/man3/nutclient_get_device_variable_description.3.gz:/usr/share/man/man3/nutclient_get_device_variable_values.3.gz:/usr/share/man/man3/nutclient_get_device_variables.3.gz:/usr/share/man/man3/nutclient_has_device_variable.3.gz:/usr/share/man/man3/nutclient_set_device_variable_values.3.gz +# [ 139s] nut-devel.x86_64: W: files-duplicate /usr/share/man/man3/nutclient_tcp_get_timeout.3.gz /usr/share/man/man3/nutclient_tcp_create_client.3.gz:/usr/share/man/man3/nutclient_tcp_disconnect.3.gz:/usr/share/man/man3/nutclient_tcp_is_connected.3.gz:/usr/share/man/man3/nutclient_tcp_reconnect.3.gz:/usr/share/man/man3/nutclient_tcp_set_timeout.3.gz %{_mandir}/man3/*.* %{_libexecdir}/ups/sockdebug From 0a7ff40bc7a0a4edcdc92086c7d67a06270440f2 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Thu, 9 Oct 2025 10:45:02 +0200 Subject: [PATCH 556/805] obs/nut.spec: seems there is no "%if X != Y" syntax Signed-off-by: Jim Klimov --- obs/nut.spec | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/obs/nut.spec b/obs/nut.spec index ddb82949d3..f7b0737780 100644 --- a/obs/nut.spec +++ b/obs/nut.spec @@ -393,21 +393,25 @@ bin/chgrp root %{CONFPATH}/upsd.conf %{CONFPATH}/upsmon.conf %{CONFPATH}/upsd.us bin/chmod 600 %{CONFPATH}/upsd.conf %{CONFPATH}/upsmon.conf %{CONFPATH}/upsd.users || echo "WARNING: Could not secure config files in path '%{CONFPATH}'" >&2 # And finally trigger udev to set permissions according to newly installed rules files. if [ -x /sbin/udevadm ] ; then /sbin/udevadm trigger --subsystem-match=usb --property-match=DEVTYPE=usb_device ; fi -%if "x%{?systemdtmpfilesdir}" != "x" +%if "x%{?systemdtmpfilesdir}" == "x" +%else %tmpfiles_create nut-common-tmpfiles.conf %endif -%if "x%{?systemdsystemunitdir}" != "x" +%if "x%{?systemdsystemunitdir}" == "x" +%else %service_add_post %{NUT_SYSTEMD_UNITS_SERVICE_TARGET} %endif %preun -%if "x%{?systemdsystemunitdir}" != "x" +%if "x%{?systemdsystemunitdir}" == "x" +%else %service_del_preun %{NUT_SYSTEMD_UNITS_SERVICE_TARGET} %endif : %postun -%if "x%{?systemdsystemunitdir}" != "x" +%if "x%{?systemdsystemunitdir}" == "x" +%else %service_del_postun %{NUT_SYSTEMD_UNITS_SERVICE_TARGET} %endif : From 8a6cc349241ba87e8a86624db434abeab9af0e19 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Thu, 9 Oct 2025 10:48:49 +0200 Subject: [PATCH 557/805] obs/nut.spec: announce where and how we rewrite shebangs Signed-off-by: Jim Klimov --- obs/nut.spec | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/obs/nut.spec b/obs/nut.spec index f7b0737780..7fd2d98aab 100644 --- a/obs/nut.spec +++ b/obs/nut.spec @@ -353,8 +353,8 @@ if [ x"%{systemdtmpfilesdir}" != x ]; then # Deliver these dirs by packaging: sed 's,^\(. %{STATEPATH}\(/upssched\)*\( .*\)*\)$,#PACKAGED#\1,' -i %{buildroot}%{systemdtmpfilesdir}/nut-common-tmpfiles.conf fi -find %{buildroot} -type f -name '*.sh' -o -name '*.py' -o -name '*.pl' | \ # Use deterministic script interpreters: +find %{buildroot} -type f -name '*.sh' -o -name '*.py' -o -name '*.pl' | \ while read F ; do if head -1 "$F" | grep bin/env >/dev/null ; then F_SHEBANG="`head -1 "$F"`" @@ -367,6 +367,7 @@ while read F ; do && [ -n "$F_SHELL_PATH" ] && [ -x "$F_SHELL_PATH" ] \ || { echo "WARNING: Failed to find executable path to interpreter '${F_SHELL_SHORT}' from shebang '${F_SHEBANG}'" >&2 ; continue; } + echo "REWRITING shebang from '$F_SHEBANG' to '#!${F_SHELL_PATH}' in '$F'" >&2 sed '1 s,^.*$,#!'"${F_SHELL_PATH}," -i "$F" fi done From d4caf7a465c826599c089fbf98664546837d11f4 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Thu, 9 Oct 2025 11:15:08 +0200 Subject: [PATCH 558/805] obs/nut.spec: reject found apache_serverroot that is under /usr/share Signed-off-by: Jim Klimov --- obs/nut.spec | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/obs/nut.spec b/obs/nut.spec index 7fd2d98aab..a792b84319 100644 --- a/obs/nut.spec +++ b/obs/nut.spec @@ -26,7 +26,9 @@ # Requires httpd(-devel?) or apache2(-devel?) to be present in this distro: %define apache_serverroot %(%{_sbindir}/apxs2 -q datadir || %{_sbindir}/apxs -q PREFIX || true) -%if "0%{?apache_serverroot}" == "0" +%if "0%{?apache_serverroot}" == "0" || 0%(echo '%{apache_serverroot}' | grep -E '^%{_datadir}' >/dev/null && echo 1 || echo 0) > 0 +# Spec-var is undefined or empty, or matches the pattern triggering +# E: arch-dependent-file-in-usr-share (Badness: 590) # Dump nut-cgi artifacts under our own locations, so end-users can # integrate them later. %define CGIPATH %{_libexecdir}/ups/cgi-bin From fff0a7db5ecdf83604c9e7ef21d7d84d593590ff Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Thu, 9 Oct 2025 11:16:14 +0200 Subject: [PATCH 559/805] obs/nut.spec: abstract the LIBEXECPATH as a spec-var Signed-off-by: Jim Klimov --- obs/nut.spec | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/obs/nut.spec b/obs/nut.spec index a792b84319..90a8c55b3f 100644 --- a/obs/nut.spec +++ b/obs/nut.spec @@ -24,6 +24,8 @@ # but can not decide that we can/must install something and then we # would have the needed OS capability. +%define LIBEXECPATH %{_libexecdir}/ups + # Requires httpd(-devel?) or apache2(-devel?) to be present in this distro: %define apache_serverroot %(%{_sbindir}/apxs2 -q datadir || %{_sbindir}/apxs -q PREFIX || true) %if "0%{?apache_serverroot}" == "0" || 0%(echo '%{apache_serverroot}' | grep -E '^%{_datadir}' >/dev/null && echo 1 || echo 0) > 0 @@ -31,7 +33,7 @@ # E: arch-dependent-file-in-usr-share (Badness: 590) # Dump nut-cgi artifacts under our own locations, so end-users can # integrate them later. -%define CGIPATH %{_libexecdir}/ups/cgi-bin +%define CGIPATH %{LIBEXECPATH}/cgi-bin %define HTMLPATH %{_datadir}/nut/htdocs %else # Rename web pages location to not conflict with apache2-example-pages @@ -40,7 +42,7 @@ %define HTMLPATH %{apache_serverroot}/htdocs/nut %endif -%define MODELPATH %{_libexecdir}/ups/driver +%define MODELPATH %{LIBEXECPATH}/driver %define STATEPATH %{_localstatedir}/lib/ups %define CONFPATH %{_sysconfdir}/ups @@ -295,7 +297,7 @@ sh autogen.sh --bindir=%{_bindir}\ --sbindir=%{_sbindir}\ --libdir=%{_libdir}\ - --libexecdir=%{_libexecdir}/ups\ + --libexecdir=%{LIBEXECPATH}\ --sysconfdir=%{CONFPATH}\ --datadir=%{_datadir}/nut\ --with-ssl --with-openssl\ @@ -464,7 +466,7 @@ if [ -x /sbin/udevadm ] ; then /sbin/udevadm trigger --subsystem-match=usb --pro %{_mandir}/man8/*.* %exclude %{_mandir}/man8/netxml-ups*.* %exclude %{_mandir}/man8/snmp-ups*.* -%dir %{_libexecdir}/ups +%dir %{LIBEXECPATH} %{_sbindir}/* %dir %{UDEVRULEPATH} %dir %{UDEVRULEPATH}/rules.d @@ -503,7 +505,7 @@ if [ -x /sbin/udevadm ] ; then /sbin/udevadm trigger --subsystem-match=usb --pro %dir %{_datadir}/augeas/lenses %dir %{_datadir}/augeas/lenses/dist %dir %{_datadir}/augeas/lenses/dist/tests -%{_libexecdir}/ups/nut-driver-enumerator.sh +%{LIBEXECPATH}/nut-driver-enumerator.sh # Exclude whatever other packages bring, some rpmbuild versions seem to dump # everything into the base package and then complain about duplicates/conflicts: ### libupsclient1 @@ -521,7 +523,7 @@ if [ -x /sbin/udevadm ] ; then /sbin/udevadm trigger --subsystem-match=usb --pro %exclude %{_libdir}/*.so %exclude %{_libdir}/pkgconfig/*.pc %exclude %{_mandir}/man3/*.* -%exclude %{_libexecdir}/ups/sockdebug +%exclude %{LIBEXECPATH}/sockdebug %files drivers-net @@ -575,6 +577,6 @@ if [ -x /sbin/udevadm ] ; then /sbin/udevadm trigger --subsystem-match=usb --pro # [ 139s] nut-devel.x86_64: W: files-duplicate /usr/share/man/man3/nutclient_set_device_variable_value.3.gz /usr/share/man/man3/nutclient_get_device_rw_variables.3.gz:/usr/share/man/man3/nutclient_get_device_variable_description.3.gz:/usr/share/man/man3/nutclient_get_device_variable_values.3.gz:/usr/share/man/man3/nutclient_get_device_variables.3.gz:/usr/share/man/man3/nutclient_has_device_variable.3.gz:/usr/share/man/man3/nutclient_set_device_variable_values.3.gz # [ 139s] nut-devel.x86_64: W: files-duplicate /usr/share/man/man3/nutclient_tcp_get_timeout.3.gz /usr/share/man/man3/nutclient_tcp_create_client.3.gz:/usr/share/man/man3/nutclient_tcp_disconnect.3.gz:/usr/share/man/man3/nutclient_tcp_is_connected.3.gz:/usr/share/man/man3/nutclient_tcp_reconnect.3.gz:/usr/share/man/man3/nutclient_tcp_set_timeout.3.gz %{_mandir}/man3/*.* -%{_libexecdir}/ups/sockdebug +%{LIBEXECPATH}/sockdebug %changelog From 996e0c700a787682bbda5b3bdc6a6deac3040274 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Thu, 9 Oct 2025 11:26:35 +0200 Subject: [PATCH 560/805] obs/nut.spec: do not mention man1 Signed-off-by: Jim Klimov --- obs/nut.spec | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/obs/nut.spec b/obs/nut.spec index 90a8c55b3f..cdab368066 100644 --- a/obs/nut.spec +++ b/obs/nut.spec @@ -436,7 +436,9 @@ if [ -x /sbin/udevadm ] ; then /sbin/udevadm trigger --subsystem-match=usb --pro %dir %{_sbindir} %dir %{_datadir} %dir %{_docdir} -%dir %{_mandir}/man1 +# NOTE: Currently this only delivers libupsclient-config.1 +# and only if not building with pkg-config available: +#% dir % {_mandir}/man1 %dir %{_mandir}/man3 %dir %{_mandir}/man5 %dir %{_mandir}/man7 From 24c12b76d3dd9224013bb46be36898bb9d578809 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Thu, 9 Oct 2025 11:33:32 +0200 Subject: [PATCH 561/805] obs/nut.spec: abstract the DOCPATH as a spec-var Signed-off-by: Jim Klimov --- obs/nut.spec | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/obs/nut.spec b/obs/nut.spec index cdab368066..dd1fef0f2b 100644 --- a/obs/nut.spec +++ b/obs/nut.spec @@ -45,6 +45,9 @@ %define MODELPATH %{LIBEXECPATH}/driver %define STATEPATH %{_localstatedir}/lib/ups %define CONFPATH %{_sysconfdir}/ups +# RPM on OpenSUSE goes: +# DOCDIR=/home/abuild/rpmbuild/BUILD/nut-2.8.4.428-build/BUILDROOT/usr/share/doc/packages/nut +%define DOCPATH %{_docdir}/nut ### FIXME: Detect properly? # W: suse-filelist-forbidden-udev-userdirs /etc/udev/rules.d/62-nut-usbups.rules is not allowed in SUSE @@ -300,6 +303,7 @@ sh autogen.sh --libexecdir=%{LIBEXECPATH}\ --sysconfdir=%{CONFPATH}\ --datadir=%{_datadir}/nut\ + --docdir=%{DOCPATH}\ --with-ssl --with-openssl\ --with-libltdl=yes\ --with-cgi=auto\ @@ -436,6 +440,7 @@ if [ -x /sbin/udevadm ] ; then /sbin/udevadm trigger --subsystem-match=usb --pro %dir %{_sbindir} %dir %{_datadir} %dir %{_docdir} +%dir %{DOCPATH} # NOTE: Currently this only delivers libupsclient-config.1 # and only if not building with pkg-config available: #% dir % {_mandir}/man1 From f0647e828f9fe5f46c603466ef0d7ce03c819ad8 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Thu, 9 Oct 2025 11:34:25 +0200 Subject: [PATCH 562/805] obs/nut.spec: shebangs: fix shell and sed syntax Signed-off-by: Jim Klimov --- obs/nut.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/obs/nut.spec b/obs/nut.spec index dd1fef0f2b..6ac7ce5ae5 100644 --- a/obs/nut.spec +++ b/obs/nut.spec @@ -367,7 +367,7 @@ while read F ; do if head -1 "$F" | grep bin/env >/dev/null ; then F_SHEBANG="`head -1 "$F"`" - F_SHELL_SHORT="`echo "$F_SHEBANG" | sed -e 's,^.*bin/env *,,'`" -e 's, .*$,,' \ + F_SHELL_SHORT="`echo "$F_SHEBANG" | sed -e 's,^.*bin/env *,,' -e 's, .*$,,'`" \ && [ -n "$F_SHELL_SHORT" ] \ || { echo "WARNING: Failed to extract an interpreter from shebang '${F_SHEBANG}'" >&2 ; continue ; } From 42288f3746fed6f5a2a860960eed1a57997c6242 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Thu, 9 Oct 2025 12:22:22 +0200 Subject: [PATCH 563/805] Move obs/ to scripts/obs/ for consistency with other helper code Signed-off-by: Jim Klimov --- Makefile.am | 6 ++---- ci_build.sh | 8 ++++---- configure.ac | 2 +- scripts/Makefile.am | 4 ++-- {obs => scripts/obs}/Makefile.am | 0 {obs => scripts/obs}/README.adoc | 0 {obs => scripts/obs}/debian.Makefile.am | 0 {obs => scripts/obs}/debian.NEWS | 0 {obs => scripts/obs}/debian.changelog | 0 {obs => scripts/obs}/debian.compat | 0 {obs => scripts/obs}/debian.control | 0 {obs => scripts/obs}/debian.copyright | 0 {obs => scripts/obs}/debian.description.subst | 0 {obs => scripts/obs}/debian.gbp.conf | 0 {obs => scripts/obs}/debian.hotplug | 0 {obs => scripts/obs}/debian.libnutclient-dev.install | 0 {obs => scripts/obs}/debian.libnutclient-dev.manpages | 0 {obs => scripts/obs}/debian.libnutclient1.install | 0 .../obs}/debian.libnutclient1.lintian-overrides | 0 {obs => scripts/obs}/debian.libnutclientstub-dev.install | 0 {obs => scripts/obs}/debian.libnutclientstub1.install | 0 .../obs}/debian.libnutclientstub1.lintian-overrides | 0 {obs => scripts/obs}/debian.libnutscan-dev.install | 0 {obs => scripts/obs}/debian.libnutscan1.install | 0 {obs => scripts/obs}/debian.libups-nut-perl.install | 0 {obs => scripts/obs}/debian.libupsclient-dev.install | 0 {obs => scripts/obs}/debian.libupsclient-dev.manpages | 0 {obs => scripts/obs}/debian.libupsclient4.install | 0 {obs => scripts/obs}/debian.nut-cgi.README.Debian | 0 {obs => scripts/obs}/debian.nut-cgi.docs | 0 {obs => scripts/obs}/debian.nut-cgi.install | 0 {obs => scripts/obs}/debian.nut-cgi.manpages | 0 {obs => scripts/obs}/debian.nut-cgi.postinst | 0 {obs => scripts/obs}/debian.nut-cgi.postrm | 0 {obs => scripts/obs}/debian.nut-client.init.in | 0 {obs => scripts/obs}/debian.nut-client.install | 0 {obs => scripts/obs}/debian.nut-client.links | 0 {obs => scripts/obs}/debian.nut-client.lintian-overrides | 0 {obs => scripts/obs}/debian.nut-client.maintscript | 0 {obs => scripts/obs}/debian.nut-client.manpages | 0 {obs => scripts/obs}/debian.nut-client.postinst | 0 {obs => scripts/obs}/debian.nut-client.preinst | 0 {obs => scripts/obs}/debian.nut-client.prerm | 0 {obs => scripts/obs}/debian.nut-common.install | 0 {obs => scripts/obs}/debian.nut-common.postinst.in | 0 {obs => scripts/obs}/debian.nut-common.prerm.in | 0 {obs => scripts/obs}/debian.nut-common.tmpfiles.in | 0 .../obs}/debian.nut-doc.doc-base.nut-developer-guide | 0 {obs => scripts/obs}/debian.nut-doc.doc-base.nut-faq | 0 .../obs}/debian.nut-doc.doc-base.nut-packager-guide | 0 .../obs}/debian.nut-doc.doc-base.nut-user-manual | 0 {obs => scripts/obs}/debian.nut-doc.install | 0 {obs => scripts/obs}/debian.nut-ipmi.install | 0 {obs => scripts/obs}/debian.nut-ipmi.manpages | 0 {obs => scripts/obs}/debian.nut-linux-i2c.install | 0 {obs => scripts/obs}/debian.nut-linux-i2c.manpages | 0 {obs => scripts/obs}/debian.nut-modbus.install | 0 {obs => scripts/obs}/debian.nut-modbus.manpages | 0 {obs => scripts/obs}/debian.nut-monitor.install | 0 {obs => scripts/obs}/debian.nut-monitor.menu | 0 {obs => scripts/obs}/debian.nut-monitor.xpm | 0 {obs => scripts/obs}/debian.nut-powerman-pdu.install | 0 {obs => scripts/obs}/debian.nut-powerman-pdu.manpages | 0 {obs => scripts/obs}/debian.nut-server.dirs | 0 {obs => scripts/obs}/debian.nut-server.init.in | 0 {obs => scripts/obs}/debian.nut-server.install | 0 {obs => scripts/obs}/debian.nut-server.manpages | 0 {obs => scripts/obs}/debian.nut-server.postinst | 0 {obs => scripts/obs}/debian.nut-server.postrm | 0 {obs => scripts/obs}/debian.nut-server.preinst | 0 {obs => scripts/obs}/debian.nut-server.prerm.in | 0 {obs => scripts/obs}/debian.nut-snmp.docs | 0 {obs => scripts/obs}/debian.nut-snmp.install | 0 {obs => scripts/obs}/debian.nut-snmp.manpages | 0 {obs => scripts/obs}/debian.nut-xml.install | 0 {obs => scripts/obs}/debian.nut-xml.manpages | 0 {obs => scripts/obs}/debian.nut.README.Debian | 0 {obs => scripts/obs}/debian.nut.TODO.Debian | 0 {obs => scripts/obs}/debian.nut.changes | 0 {obs => scripts/obs}/debian.nut.docs | 0 {obs => scripts/obs}/debian.python-nut.install | 0 {obs => scripts/obs}/debian.rules | 2 +- {obs => scripts/obs}/debian.series | 0 {obs => scripts/obs}/debian.watch | 0 {obs => scripts/obs}/nut.dsc | 0 {obs => scripts/obs}/nut.spec | 0 {obs => scripts/obs}/pkgsrc.obs | 0 87 files changed, 10 insertions(+), 12 deletions(-) rename {obs => scripts/obs}/Makefile.am (100%) rename {obs => scripts/obs}/README.adoc (100%) rename {obs => scripts/obs}/debian.Makefile.am (100%) rename {obs => scripts/obs}/debian.NEWS (100%) rename {obs => scripts/obs}/debian.changelog (100%) rename {obs => scripts/obs}/debian.compat (100%) rename {obs => scripts/obs}/debian.control (100%) rename {obs => scripts/obs}/debian.copyright (100%) rename {obs => scripts/obs}/debian.description.subst (100%) rename {obs => scripts/obs}/debian.gbp.conf (100%) rename {obs => scripts/obs}/debian.hotplug (100%) rename {obs => scripts/obs}/debian.libnutclient-dev.install (100%) rename {obs => scripts/obs}/debian.libnutclient-dev.manpages (100%) rename {obs => scripts/obs}/debian.libnutclient1.install (100%) rename {obs => scripts/obs}/debian.libnutclient1.lintian-overrides (100%) rename {obs => scripts/obs}/debian.libnutclientstub-dev.install (100%) rename {obs => scripts/obs}/debian.libnutclientstub1.install (100%) rename {obs => scripts/obs}/debian.libnutclientstub1.lintian-overrides (100%) rename {obs => scripts/obs}/debian.libnutscan-dev.install (100%) rename {obs => scripts/obs}/debian.libnutscan1.install (100%) rename {obs => scripts/obs}/debian.libups-nut-perl.install (100%) rename {obs => scripts/obs}/debian.libupsclient-dev.install (100%) rename {obs => scripts/obs}/debian.libupsclient-dev.manpages (100%) rename {obs => scripts/obs}/debian.libupsclient4.install (100%) rename {obs => scripts/obs}/debian.nut-cgi.README.Debian (100%) rename {obs => scripts/obs}/debian.nut-cgi.docs (100%) rename {obs => scripts/obs}/debian.nut-cgi.install (100%) rename {obs => scripts/obs}/debian.nut-cgi.manpages (100%) rename {obs => scripts/obs}/debian.nut-cgi.postinst (100%) rename {obs => scripts/obs}/debian.nut-cgi.postrm (100%) rename {obs => scripts/obs}/debian.nut-client.init.in (100%) rename {obs => scripts/obs}/debian.nut-client.install (100%) rename {obs => scripts/obs}/debian.nut-client.links (100%) rename {obs => scripts/obs}/debian.nut-client.lintian-overrides (100%) rename {obs => scripts/obs}/debian.nut-client.maintscript (100%) rename {obs => scripts/obs}/debian.nut-client.manpages (100%) rename {obs => scripts/obs}/debian.nut-client.postinst (100%) rename {obs => scripts/obs}/debian.nut-client.preinst (100%) rename {obs => scripts/obs}/debian.nut-client.prerm (100%) rename {obs => scripts/obs}/debian.nut-common.install (100%) rename {obs => scripts/obs}/debian.nut-common.postinst.in (100%) rename {obs => scripts/obs}/debian.nut-common.prerm.in (100%) rename {obs => scripts/obs}/debian.nut-common.tmpfiles.in (100%) rename {obs => scripts/obs}/debian.nut-doc.doc-base.nut-developer-guide (100%) rename {obs => scripts/obs}/debian.nut-doc.doc-base.nut-faq (100%) rename {obs => scripts/obs}/debian.nut-doc.doc-base.nut-packager-guide (100%) rename {obs => scripts/obs}/debian.nut-doc.doc-base.nut-user-manual (100%) rename {obs => scripts/obs}/debian.nut-doc.install (100%) rename {obs => scripts/obs}/debian.nut-ipmi.install (100%) rename {obs => scripts/obs}/debian.nut-ipmi.manpages (100%) rename {obs => scripts/obs}/debian.nut-linux-i2c.install (100%) rename {obs => scripts/obs}/debian.nut-linux-i2c.manpages (100%) rename {obs => scripts/obs}/debian.nut-modbus.install (100%) rename {obs => scripts/obs}/debian.nut-modbus.manpages (100%) rename {obs => scripts/obs}/debian.nut-monitor.install (100%) rename {obs => scripts/obs}/debian.nut-monitor.menu (100%) rename {obs => scripts/obs}/debian.nut-monitor.xpm (100%) rename {obs => scripts/obs}/debian.nut-powerman-pdu.install (100%) rename {obs => scripts/obs}/debian.nut-powerman-pdu.manpages (100%) rename {obs => scripts/obs}/debian.nut-server.dirs (100%) rename {obs => scripts/obs}/debian.nut-server.init.in (100%) rename {obs => scripts/obs}/debian.nut-server.install (100%) rename {obs => scripts/obs}/debian.nut-server.manpages (100%) rename {obs => scripts/obs}/debian.nut-server.postinst (100%) rename {obs => scripts/obs}/debian.nut-server.postrm (100%) rename {obs => scripts/obs}/debian.nut-server.preinst (100%) rename {obs => scripts/obs}/debian.nut-server.prerm.in (100%) rename {obs => scripts/obs}/debian.nut-snmp.docs (100%) rename {obs => scripts/obs}/debian.nut-snmp.install (100%) rename {obs => scripts/obs}/debian.nut-snmp.manpages (100%) rename {obs => scripts/obs}/debian.nut-xml.install (100%) rename {obs => scripts/obs}/debian.nut-xml.manpages (100%) rename {obs => scripts/obs}/debian.nut.README.Debian (100%) rename {obs => scripts/obs}/debian.nut.TODO.Debian (100%) rename {obs => scripts/obs}/debian.nut.changes (100%) rename {obs => scripts/obs}/debian.nut.docs (100%) rename {obs => scripts/obs}/debian.python-nut.install (100%) rename {obs => scripts/obs}/debian.rules (98%) rename {obs => scripts/obs}/debian.series (100%) rename {obs => scripts/obs}/debian.watch (100%) rename {obs => scripts/obs}/nut.dsc (100%) rename {obs => scripts/obs}/nut.spec (100%) rename {obs => scripts/obs}/pkgsrc.obs (100%) diff --git a/Makefile.am b/Makefile.am index 22b7ae93f0..8fc1436077 100644 --- a/Makefile.am +++ b/Makefile.am @@ -41,7 +41,7 @@ ACLOCAL_AMFLAGS = -I m4 # depend on stuff in "common" or tools being built first! Also "data" depends # (during "dist" time) on scripts in "tools". SUBDIRS = include common clients conf drivers tools data \ - lib obs scripts server tests docs/man docs + lib scripts server tests docs/man docs # Note: not generated from SUBDIRS, because not all are recursive: SUBDIRS_ALL_RECURSIVE = \ @@ -55,7 +55,6 @@ SUBDIRS_ALL_RECURSIVE = \ all/tools/nutconf \ all-recursive/tools \ all/lib \ - all/obs \ all-recursive/scripts \ all/server \ all/tests/NIT \ @@ -276,7 +275,6 @@ all-libs-local/tools/nut-scanner: all-libs-local/drivers all-libs-local/common a all/conf \ all/lib \ -all/obs \ .ChangeLog.adoc-parsed.latest/docs \ ChangeLog.adoc-parsed/docs \ all-recursive/data: @@ -645,7 +643,6 @@ SPELLCHECK_DIRS_MOST = \ spellcheck/conf \ spellcheck/data \ spellcheck/data/htmlcgi \ - spellcheck/obs \ spellcheck/scripts \ spellcheck/scripts/Solaris \ spellcheck/scripts/Windows \ @@ -653,6 +650,7 @@ SPELLCHECK_DIRS_MOST = \ spellcheck/scripts/external_apis \ spellcheck/scripts/hotplug \ spellcheck/scripts/installer \ + spellcheck/scripts/obs \ spellcheck/scripts/python \ spellcheck/scripts/systemd \ spellcheck/scripts/udev \ diff --git a/ci_build.sh b/ci_build.sh index af8c60f3bd..69a5a73231 100755 --- a/ci_build.sh +++ b/ci_build.sh @@ -2874,7 +2874,7 @@ cross-windows-mingw*) pkg-rpm|pkg-spec) rm -f nut.spec || true git clean -fdX || true - cp -f obs/nut.spec . + cp -f scripts/obs/nut.spec . sed -e 's,^(Version:).*$,\1 '"`NUT_VERSION_QUERY=VER50 ./tools/gitlog2version.sh`," \ -i nut.spec rpmbuild -ba \ @@ -2885,11 +2885,11 @@ pkg-deb|pkg-dsc) rm -rf debian config.*cdbs* nut.dsc || true git clean -fdX || true mkdir -p debian - (cd obs || exit + (cd scripts/obs || exit for F in debian.* ; do - ln -s "../obs/$F" "../debian/`echo "$F" | sed 's/debian.//'`" || exit + ln -s "../scripts/obs/$F" "../../debian/`echo "$F" | sed 's/debian.//'`" || exit done) || exit - cp -f obs/nut.dsc . + cp -f scripts/obs/nut.dsc . sed -e 's,^\(Version:\).*$,\1 '"`NUT_VERSION_QUERY=VER50 ./tools/gitlog2version.sh`," \ -i nut.dsc dpkg-checkbuilddeps || sudo mk-build-debs -i diff --git a/configure.ac b/configure.ac index 90fde4f7cd..d06c73f83f 100644 --- a/configure.ac +++ b/configure.ac @@ -6789,7 +6789,6 @@ AC_CONFIG_FILES([ lib/libnutclientstub.pc lib/libnutscan.pc lib/Makefile - obs/Makefile scripts/Aix/nut-aix.spec scripts/RedHat/ups scripts/augeas/Makefile @@ -6809,6 +6808,7 @@ AC_CONFIG_FILES([ scripts/HP-UX/nut.psf scripts/installer/Makefile scripts/misc/nut.bash_completion + scripts/obs/Makefile scripts/python/Makefile scripts/python/module/Makefile scripts/python/module/PyNUT.py diff --git a/scripts/Makefile.am b/scripts/Makefile.am index 748aff54cb..0c60ce9a77 100644 --- a/scripts/Makefile.am +++ b/scripts/Makefile.am @@ -30,9 +30,9 @@ EXTRA_DIST = \ valgrind/valgrind.sh.in \ Windows/halt.c -SUBDIRS = augeas devd hotplug installer python systemd udev ufw Solaris Windows upsdrvsvcctl external_apis +SUBDIRS = augeas devd hotplug installer obs python systemd udev ufw Solaris Windows upsdrvsvcctl external_apis -SPELLCHECK_SRC = README.adoc RedHat/README.adoc usb_resetter/README.adoc valgrind/README.adoc +SPELLCHECK_SRC = README.adoc RedHat/README.adoc usb_resetter/README.adoc valgrind/README.adoc obs/README.adoc # NOTE: Due to portability, we do not use a GNU percent-wildcard extension. # We also have to export some variables that may be tainted by relative diff --git a/obs/Makefile.am b/scripts/obs/Makefile.am similarity index 100% rename from obs/Makefile.am rename to scripts/obs/Makefile.am diff --git a/obs/README.adoc b/scripts/obs/README.adoc similarity index 100% rename from obs/README.adoc rename to scripts/obs/README.adoc diff --git a/obs/debian.Makefile.am b/scripts/obs/debian.Makefile.am similarity index 100% rename from obs/debian.Makefile.am rename to scripts/obs/debian.Makefile.am diff --git a/obs/debian.NEWS b/scripts/obs/debian.NEWS similarity index 100% rename from obs/debian.NEWS rename to scripts/obs/debian.NEWS diff --git a/obs/debian.changelog b/scripts/obs/debian.changelog similarity index 100% rename from obs/debian.changelog rename to scripts/obs/debian.changelog diff --git a/obs/debian.compat b/scripts/obs/debian.compat similarity index 100% rename from obs/debian.compat rename to scripts/obs/debian.compat diff --git a/obs/debian.control b/scripts/obs/debian.control similarity index 100% rename from obs/debian.control rename to scripts/obs/debian.control diff --git a/obs/debian.copyright b/scripts/obs/debian.copyright similarity index 100% rename from obs/debian.copyright rename to scripts/obs/debian.copyright diff --git a/obs/debian.description.subst b/scripts/obs/debian.description.subst similarity index 100% rename from obs/debian.description.subst rename to scripts/obs/debian.description.subst diff --git a/obs/debian.gbp.conf b/scripts/obs/debian.gbp.conf similarity index 100% rename from obs/debian.gbp.conf rename to scripts/obs/debian.gbp.conf diff --git a/obs/debian.hotplug b/scripts/obs/debian.hotplug similarity index 100% rename from obs/debian.hotplug rename to scripts/obs/debian.hotplug diff --git a/obs/debian.libnutclient-dev.install b/scripts/obs/debian.libnutclient-dev.install similarity index 100% rename from obs/debian.libnutclient-dev.install rename to scripts/obs/debian.libnutclient-dev.install diff --git a/obs/debian.libnutclient-dev.manpages b/scripts/obs/debian.libnutclient-dev.manpages similarity index 100% rename from obs/debian.libnutclient-dev.manpages rename to scripts/obs/debian.libnutclient-dev.manpages diff --git a/obs/debian.libnutclient1.install b/scripts/obs/debian.libnutclient1.install similarity index 100% rename from obs/debian.libnutclient1.install rename to scripts/obs/debian.libnutclient1.install diff --git a/obs/debian.libnutclient1.lintian-overrides b/scripts/obs/debian.libnutclient1.lintian-overrides similarity index 100% rename from obs/debian.libnutclient1.lintian-overrides rename to scripts/obs/debian.libnutclient1.lintian-overrides diff --git a/obs/debian.libnutclientstub-dev.install b/scripts/obs/debian.libnutclientstub-dev.install similarity index 100% rename from obs/debian.libnutclientstub-dev.install rename to scripts/obs/debian.libnutclientstub-dev.install diff --git a/obs/debian.libnutclientstub1.install b/scripts/obs/debian.libnutclientstub1.install similarity index 100% rename from obs/debian.libnutclientstub1.install rename to scripts/obs/debian.libnutclientstub1.install diff --git a/obs/debian.libnutclientstub1.lintian-overrides b/scripts/obs/debian.libnutclientstub1.lintian-overrides similarity index 100% rename from obs/debian.libnutclientstub1.lintian-overrides rename to scripts/obs/debian.libnutclientstub1.lintian-overrides diff --git a/obs/debian.libnutscan-dev.install b/scripts/obs/debian.libnutscan-dev.install similarity index 100% rename from obs/debian.libnutscan-dev.install rename to scripts/obs/debian.libnutscan-dev.install diff --git a/obs/debian.libnutscan1.install b/scripts/obs/debian.libnutscan1.install similarity index 100% rename from obs/debian.libnutscan1.install rename to scripts/obs/debian.libnutscan1.install diff --git a/obs/debian.libups-nut-perl.install b/scripts/obs/debian.libups-nut-perl.install similarity index 100% rename from obs/debian.libups-nut-perl.install rename to scripts/obs/debian.libups-nut-perl.install diff --git a/obs/debian.libupsclient-dev.install b/scripts/obs/debian.libupsclient-dev.install similarity index 100% rename from obs/debian.libupsclient-dev.install rename to scripts/obs/debian.libupsclient-dev.install diff --git a/obs/debian.libupsclient-dev.manpages b/scripts/obs/debian.libupsclient-dev.manpages similarity index 100% rename from obs/debian.libupsclient-dev.manpages rename to scripts/obs/debian.libupsclient-dev.manpages diff --git a/obs/debian.libupsclient4.install b/scripts/obs/debian.libupsclient4.install similarity index 100% rename from obs/debian.libupsclient4.install rename to scripts/obs/debian.libupsclient4.install diff --git a/obs/debian.nut-cgi.README.Debian b/scripts/obs/debian.nut-cgi.README.Debian similarity index 100% rename from obs/debian.nut-cgi.README.Debian rename to scripts/obs/debian.nut-cgi.README.Debian diff --git a/obs/debian.nut-cgi.docs b/scripts/obs/debian.nut-cgi.docs similarity index 100% rename from obs/debian.nut-cgi.docs rename to scripts/obs/debian.nut-cgi.docs diff --git a/obs/debian.nut-cgi.install b/scripts/obs/debian.nut-cgi.install similarity index 100% rename from obs/debian.nut-cgi.install rename to scripts/obs/debian.nut-cgi.install diff --git a/obs/debian.nut-cgi.manpages b/scripts/obs/debian.nut-cgi.manpages similarity index 100% rename from obs/debian.nut-cgi.manpages rename to scripts/obs/debian.nut-cgi.manpages diff --git a/obs/debian.nut-cgi.postinst b/scripts/obs/debian.nut-cgi.postinst similarity index 100% rename from obs/debian.nut-cgi.postinst rename to scripts/obs/debian.nut-cgi.postinst diff --git a/obs/debian.nut-cgi.postrm b/scripts/obs/debian.nut-cgi.postrm similarity index 100% rename from obs/debian.nut-cgi.postrm rename to scripts/obs/debian.nut-cgi.postrm diff --git a/obs/debian.nut-client.init.in b/scripts/obs/debian.nut-client.init.in similarity index 100% rename from obs/debian.nut-client.init.in rename to scripts/obs/debian.nut-client.init.in diff --git a/obs/debian.nut-client.install b/scripts/obs/debian.nut-client.install similarity index 100% rename from obs/debian.nut-client.install rename to scripts/obs/debian.nut-client.install diff --git a/obs/debian.nut-client.links b/scripts/obs/debian.nut-client.links similarity index 100% rename from obs/debian.nut-client.links rename to scripts/obs/debian.nut-client.links diff --git a/obs/debian.nut-client.lintian-overrides b/scripts/obs/debian.nut-client.lintian-overrides similarity index 100% rename from obs/debian.nut-client.lintian-overrides rename to scripts/obs/debian.nut-client.lintian-overrides diff --git a/obs/debian.nut-client.maintscript b/scripts/obs/debian.nut-client.maintscript similarity index 100% rename from obs/debian.nut-client.maintscript rename to scripts/obs/debian.nut-client.maintscript diff --git a/obs/debian.nut-client.manpages b/scripts/obs/debian.nut-client.manpages similarity index 100% rename from obs/debian.nut-client.manpages rename to scripts/obs/debian.nut-client.manpages diff --git a/obs/debian.nut-client.postinst b/scripts/obs/debian.nut-client.postinst similarity index 100% rename from obs/debian.nut-client.postinst rename to scripts/obs/debian.nut-client.postinst diff --git a/obs/debian.nut-client.preinst b/scripts/obs/debian.nut-client.preinst similarity index 100% rename from obs/debian.nut-client.preinst rename to scripts/obs/debian.nut-client.preinst diff --git a/obs/debian.nut-client.prerm b/scripts/obs/debian.nut-client.prerm similarity index 100% rename from obs/debian.nut-client.prerm rename to scripts/obs/debian.nut-client.prerm diff --git a/obs/debian.nut-common.install b/scripts/obs/debian.nut-common.install similarity index 100% rename from obs/debian.nut-common.install rename to scripts/obs/debian.nut-common.install diff --git a/obs/debian.nut-common.postinst.in b/scripts/obs/debian.nut-common.postinst.in similarity index 100% rename from obs/debian.nut-common.postinst.in rename to scripts/obs/debian.nut-common.postinst.in diff --git a/obs/debian.nut-common.prerm.in b/scripts/obs/debian.nut-common.prerm.in similarity index 100% rename from obs/debian.nut-common.prerm.in rename to scripts/obs/debian.nut-common.prerm.in diff --git a/obs/debian.nut-common.tmpfiles.in b/scripts/obs/debian.nut-common.tmpfiles.in similarity index 100% rename from obs/debian.nut-common.tmpfiles.in rename to scripts/obs/debian.nut-common.tmpfiles.in diff --git a/obs/debian.nut-doc.doc-base.nut-developer-guide b/scripts/obs/debian.nut-doc.doc-base.nut-developer-guide similarity index 100% rename from obs/debian.nut-doc.doc-base.nut-developer-guide rename to scripts/obs/debian.nut-doc.doc-base.nut-developer-guide diff --git a/obs/debian.nut-doc.doc-base.nut-faq b/scripts/obs/debian.nut-doc.doc-base.nut-faq similarity index 100% rename from obs/debian.nut-doc.doc-base.nut-faq rename to scripts/obs/debian.nut-doc.doc-base.nut-faq diff --git a/obs/debian.nut-doc.doc-base.nut-packager-guide b/scripts/obs/debian.nut-doc.doc-base.nut-packager-guide similarity index 100% rename from obs/debian.nut-doc.doc-base.nut-packager-guide rename to scripts/obs/debian.nut-doc.doc-base.nut-packager-guide diff --git a/obs/debian.nut-doc.doc-base.nut-user-manual b/scripts/obs/debian.nut-doc.doc-base.nut-user-manual similarity index 100% rename from obs/debian.nut-doc.doc-base.nut-user-manual rename to scripts/obs/debian.nut-doc.doc-base.nut-user-manual diff --git a/obs/debian.nut-doc.install b/scripts/obs/debian.nut-doc.install similarity index 100% rename from obs/debian.nut-doc.install rename to scripts/obs/debian.nut-doc.install diff --git a/obs/debian.nut-ipmi.install b/scripts/obs/debian.nut-ipmi.install similarity index 100% rename from obs/debian.nut-ipmi.install rename to scripts/obs/debian.nut-ipmi.install diff --git a/obs/debian.nut-ipmi.manpages b/scripts/obs/debian.nut-ipmi.manpages similarity index 100% rename from obs/debian.nut-ipmi.manpages rename to scripts/obs/debian.nut-ipmi.manpages diff --git a/obs/debian.nut-linux-i2c.install b/scripts/obs/debian.nut-linux-i2c.install similarity index 100% rename from obs/debian.nut-linux-i2c.install rename to scripts/obs/debian.nut-linux-i2c.install diff --git a/obs/debian.nut-linux-i2c.manpages b/scripts/obs/debian.nut-linux-i2c.manpages similarity index 100% rename from obs/debian.nut-linux-i2c.manpages rename to scripts/obs/debian.nut-linux-i2c.manpages diff --git a/obs/debian.nut-modbus.install b/scripts/obs/debian.nut-modbus.install similarity index 100% rename from obs/debian.nut-modbus.install rename to scripts/obs/debian.nut-modbus.install diff --git a/obs/debian.nut-modbus.manpages b/scripts/obs/debian.nut-modbus.manpages similarity index 100% rename from obs/debian.nut-modbus.manpages rename to scripts/obs/debian.nut-modbus.manpages diff --git a/obs/debian.nut-monitor.install b/scripts/obs/debian.nut-monitor.install similarity index 100% rename from obs/debian.nut-monitor.install rename to scripts/obs/debian.nut-monitor.install diff --git a/obs/debian.nut-monitor.menu b/scripts/obs/debian.nut-monitor.menu similarity index 100% rename from obs/debian.nut-monitor.menu rename to scripts/obs/debian.nut-monitor.menu diff --git a/obs/debian.nut-monitor.xpm b/scripts/obs/debian.nut-monitor.xpm similarity index 100% rename from obs/debian.nut-monitor.xpm rename to scripts/obs/debian.nut-monitor.xpm diff --git a/obs/debian.nut-powerman-pdu.install b/scripts/obs/debian.nut-powerman-pdu.install similarity index 100% rename from obs/debian.nut-powerman-pdu.install rename to scripts/obs/debian.nut-powerman-pdu.install diff --git a/obs/debian.nut-powerman-pdu.manpages b/scripts/obs/debian.nut-powerman-pdu.manpages similarity index 100% rename from obs/debian.nut-powerman-pdu.manpages rename to scripts/obs/debian.nut-powerman-pdu.manpages diff --git a/obs/debian.nut-server.dirs b/scripts/obs/debian.nut-server.dirs similarity index 100% rename from obs/debian.nut-server.dirs rename to scripts/obs/debian.nut-server.dirs diff --git a/obs/debian.nut-server.init.in b/scripts/obs/debian.nut-server.init.in similarity index 100% rename from obs/debian.nut-server.init.in rename to scripts/obs/debian.nut-server.init.in diff --git a/obs/debian.nut-server.install b/scripts/obs/debian.nut-server.install similarity index 100% rename from obs/debian.nut-server.install rename to scripts/obs/debian.nut-server.install diff --git a/obs/debian.nut-server.manpages b/scripts/obs/debian.nut-server.manpages similarity index 100% rename from obs/debian.nut-server.manpages rename to scripts/obs/debian.nut-server.manpages diff --git a/obs/debian.nut-server.postinst b/scripts/obs/debian.nut-server.postinst similarity index 100% rename from obs/debian.nut-server.postinst rename to scripts/obs/debian.nut-server.postinst diff --git a/obs/debian.nut-server.postrm b/scripts/obs/debian.nut-server.postrm similarity index 100% rename from obs/debian.nut-server.postrm rename to scripts/obs/debian.nut-server.postrm diff --git a/obs/debian.nut-server.preinst b/scripts/obs/debian.nut-server.preinst similarity index 100% rename from obs/debian.nut-server.preinst rename to scripts/obs/debian.nut-server.preinst diff --git a/obs/debian.nut-server.prerm.in b/scripts/obs/debian.nut-server.prerm.in similarity index 100% rename from obs/debian.nut-server.prerm.in rename to scripts/obs/debian.nut-server.prerm.in diff --git a/obs/debian.nut-snmp.docs b/scripts/obs/debian.nut-snmp.docs similarity index 100% rename from obs/debian.nut-snmp.docs rename to scripts/obs/debian.nut-snmp.docs diff --git a/obs/debian.nut-snmp.install b/scripts/obs/debian.nut-snmp.install similarity index 100% rename from obs/debian.nut-snmp.install rename to scripts/obs/debian.nut-snmp.install diff --git a/obs/debian.nut-snmp.manpages b/scripts/obs/debian.nut-snmp.manpages similarity index 100% rename from obs/debian.nut-snmp.manpages rename to scripts/obs/debian.nut-snmp.manpages diff --git a/obs/debian.nut-xml.install b/scripts/obs/debian.nut-xml.install similarity index 100% rename from obs/debian.nut-xml.install rename to scripts/obs/debian.nut-xml.install diff --git a/obs/debian.nut-xml.manpages b/scripts/obs/debian.nut-xml.manpages similarity index 100% rename from obs/debian.nut-xml.manpages rename to scripts/obs/debian.nut-xml.manpages diff --git a/obs/debian.nut.README.Debian b/scripts/obs/debian.nut.README.Debian similarity index 100% rename from obs/debian.nut.README.Debian rename to scripts/obs/debian.nut.README.Debian diff --git a/obs/debian.nut.TODO.Debian b/scripts/obs/debian.nut.TODO.Debian similarity index 100% rename from obs/debian.nut.TODO.Debian rename to scripts/obs/debian.nut.TODO.Debian diff --git a/obs/debian.nut.changes b/scripts/obs/debian.nut.changes similarity index 100% rename from obs/debian.nut.changes rename to scripts/obs/debian.nut.changes diff --git a/obs/debian.nut.docs b/scripts/obs/debian.nut.docs similarity index 100% rename from obs/debian.nut.docs rename to scripts/obs/debian.nut.docs diff --git a/obs/debian.python-nut.install b/scripts/obs/debian.python-nut.install similarity index 100% rename from obs/debian.python-nut.install rename to scripts/obs/debian.python-nut.install diff --git a/obs/debian.rules b/scripts/obs/debian.rules similarity index 98% rename from obs/debian.rules rename to scripts/obs/debian.rules index 166baf3baf..c144d21036 100755 --- a/obs/debian.rules +++ b/scripts/obs/debian.rules @@ -127,7 +127,7 @@ common-install-arch:: mkdir -p $(CURDIR)/debian for F in nut-client.init nut-common.postinst nut-common.prerm nut-server.init nut-server.prerm nut-common.tmpfiles ; do \ echo " SED $$F.in => $$F" ; \ - sed 's,@runbasedir[@],$(runbasedir),g' < "$(CURDIR)/obs/debian.$$F.in" > $(CURDIR)/debian/"$$F" || exit ; \ + sed 's,@runbasedir[@],$(runbasedir),g' < "$(CURDIR)/scripts/obs/debian.$$F.in" > $(CURDIR)/debian/"$$F" || exit ; \ done # install the bash completion script diff --git a/obs/debian.series b/scripts/obs/debian.series similarity index 100% rename from obs/debian.series rename to scripts/obs/debian.series diff --git a/obs/debian.watch b/scripts/obs/debian.watch similarity index 100% rename from obs/debian.watch rename to scripts/obs/debian.watch diff --git a/obs/nut.dsc b/scripts/obs/nut.dsc similarity index 100% rename from obs/nut.dsc rename to scripts/obs/nut.dsc diff --git a/obs/nut.spec b/scripts/obs/nut.spec similarity index 100% rename from obs/nut.spec rename to scripts/obs/nut.spec diff --git a/obs/pkgsrc.obs b/scripts/obs/pkgsrc.obs similarity index 100% rename from obs/pkgsrc.obs rename to scripts/obs/pkgsrc.obs From 72ad4738be137f2ebfc829516881f596e61f7b84 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Thu, 9 Oct 2025 12:34:09 +0200 Subject: [PATCH 564/805] scripts/obs/_service: add a copy of working OBS recipe Signed-off-by: Jim Klimov --- scripts/obs/Makefile.am | 2 +- scripts/obs/_service | 59 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 60 insertions(+), 1 deletion(-) create mode 100644 scripts/obs/_service diff --git a/scripts/obs/Makefile.am b/scripts/obs/Makefile.am index 006149e736..e6e3c79dd8 100644 --- a/scripts/obs/Makefile.am +++ b/scripts/obs/Makefile.am @@ -1,6 +1,6 @@ # Network UPS Tools: obs (root) -EXTRA_DIST = README.adoc +EXTRA_DIST = README.adoc _service # Also EXTRA_DIST the recipe-related files (so OBS can use tarballs if they like) diff --git a/scripts/obs/_service b/scripts/obs/_service new file mode 100644 index 0000000000..2cb090a9a4 --- /dev/null +++ b/scripts/obs/_service @@ -0,0 +1,59 @@ + + + https://github.com/jimklimov/nut.git + git + FTY-obs + + + + @PARENT_TAG@.@TAG_OFFSET@ + v(.*) + .git + nut + + scripts/obs/nut.dsc + scripts/obs/nut.spec + scripts/obs/pkgsrc.* + + enable + + + + + + + + + + *.tar + */scripts/obs/debian.* + + + + + nut + + + + *.tar + gz + + \ No newline at end of file From 47e279ddd01d8f7d3bc4e566fe7f7caeaafcb179 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Thu, 9 Oct 2025 12:34:41 +0200 Subject: [PATCH 565/805] scripts/obs/README.adoc: update with Practical setup and Other notes Signed-off-by: Jim Klimov --- docs/nut.dict | 4 +++- scripts/obs/README.adoc | 34 +++++++++++++++++++++++++++++++++- 2 files changed, 36 insertions(+), 2 deletions(-) diff --git a/docs/nut.dict b/docs/nut.dict index c2e59d1df1..0f175ab8d5 100644 --- a/docs/nut.dict +++ b/docs/nut.dict @@ -1,4 +1,4 @@ -personal_ws-1.1 en 3566 utf-8 +personal_ws-1.1 en 3575 utf-8 AAC AAS ABI @@ -148,6 +148,7 @@ Breiland Brownell Bs BuildBot +BuildRequires Buildbot Bxx ByPass @@ -2877,6 +2878,7 @@ prio priv privPassword privProtocol +prjconf problemMatcher probu proc diff --git a/scripts/obs/README.adoc b/scripts/obs/README.adoc index fdf8d8259f..938a6b5f7d 100644 --- a/scripts/obs/README.adoc +++ b/scripts/obs/README.adoc @@ -1,5 +1,7 @@ = Packaging recipes for OBS +== Overview + This directory holds reference NUT packaging recipes for RPM, DEB and other formats, and is primarily aimed at automation of builds with the link:https://openbuildservice.org/[Open Build Service (OBS)]. @@ -14,10 +16,36 @@ NOTE: The layout of files and directories here is dictated by current expectations of the OBS software (if at some point it has to be a flat mess with no structure -- so be it). -For some practical details see: +== Practical setup + +The copy of `_service` file represents the directly maintained OBS recipe +in an OBS packaging project, and is the only file needed there (triggering +service runs updates the temporary tarball from git). + +Beside that, `osc meta prjconf --edit` can be used to specify unambiguous +preferences for certain packages, when a distro actually offers a choice +via conditional `BuildRequires` statements, e.g.: + +---- +Prefer: libusbx-devel +Prefer: libusb-1.0-dev +Prefer: neon-devel +---- + +A parent project must be used to define OBS Repositories we build for, which +should usually include a layer with `openSUSE:Tools` to have the OBS helper +scripts needed for package and tarball transformations in the build area, +for example: https://build.opensuse.org/projects/home:jimklimov/meta + +The list of known distros and repositories massaged with these tools can be +seen at https://build.opensuse.org/repositories/openSUSE:Tools + +For some historical and/or practical details see: * https://github.com/networkupstools/nut/issues/1209 +== Other notes + The recipe files themselves would likely cross-pollinate with popular distributions, to allow easier replacement of standard, supported and stale package builds with those of experimental development iterations. @@ -28,3 +56,7 @@ which adds version number components to expose the "age" of each such iteration as a number of commits merged into the common development trunk since a preceding release, and a number of commits unique to a feature branch. + +Maybe some way of pre-making a dist tarball (with `VERSION_DEFAULT`, man +pages pre-built, etc.) and using that would be better, to be explored +(ideally if we can do this within OBS). From 84d82f3f02630c50b32c9fbc15ad4daa08432a4f Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Thu, 9 Oct 2025 12:37:03 +0200 Subject: [PATCH 566/805] ci_build.sh: add failsafes into pkg* build types Signed-off-by: Jim Klimov --- ci_build.sh | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/ci_build.sh b/ci_build.sh index 69a5a73231..c78f2b7acc 100755 --- a/ci_build.sh +++ b/ci_build.sh @@ -2872,6 +2872,11 @@ cross-windows-mingw*) ;; pkg-rpm|pkg-spec) + echo "WARNING: package build recipes manipulate directly your current workspace" >&2 + echo " and would remove any git-ignored files, might leave trash afterwards!" >&2 + echo " Press Ctrl+C to abort if this is a problem" >&2 + sleep 5 + rm -f nut.spec || true git clean -fdX || true cp -f scripts/obs/nut.spec . @@ -2882,6 +2887,11 @@ pkg-rpm|pkg-spec) ;; pkg-deb|pkg-dsc) + echo "WARNING: package build recipes manipulate directly your current workspace" >&2 + echo " and would remove any git-ignored files, might leave trash afterwards!" >&2 + echo " Press Ctrl+C to abort if this is a problem" >&2 + sleep 5 + rm -rf debian config.*cdbs* nut.dsc || true git clean -fdX || true mkdir -p debian From d8de298a8674c1d9dfee9a009c0999caa24c0ab7 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Thu, 9 Oct 2025 12:45:36 +0200 Subject: [PATCH 567/805] scripts/obs/nut.spec: let the SPEC version reflect in NUT self-identification Signed-off-by: Jim Klimov --- scripts/obs/nut.spec | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/scripts/obs/nut.spec b/scripts/obs/nut.spec index 6ac7ce5ae5..fee5a8c0a4 100644 --- a/scripts/obs/nut.spec +++ b/scripts/obs/nut.spec @@ -294,6 +294,12 @@ Detailed information about supported hardware can be found in # Note: NOT configure macro, due to override of --sysconfdir and --datadir # values just for the recipe part but not for whole specfile %build +# May be pre-populated if building from tarball, or derived from git +# Otherwise let the SPEC version reflect in NUT self-identification +if [ ! -s VERSION_DEFAULT ] && [ ! -e .git ] && [ -n '%{version}' ] ; then + echo NUT_VERSION_DEFAULT='%{version}' > VERSION_DEFAULT +fi + sh autogen.sh ./configure --disable-static --with-pic \ --prefix=%{_prefix}\ From f0448b4e0761c327bb170fc78ad69c4c8548296e Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Thu, 9 Oct 2025 14:53:57 +0200 Subject: [PATCH 568/805] scripts/obs/nut.spec: refactor how we get HTMLPATH and CGIPATH, they may be different in APXS output Signed-off-by: Jim Klimov --- scripts/obs/nut.spec | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/scripts/obs/nut.spec b/scripts/obs/nut.spec index fee5a8c0a4..797526a692 100644 --- a/scripts/obs/nut.spec +++ b/scripts/obs/nut.spec @@ -27,19 +27,26 @@ %define LIBEXECPATH %{_libexecdir}/ups # Requires httpd(-devel?) or apache2(-devel?) to be present in this distro: -%define apache_serverroot %(%{_sbindir}/apxs2 -q datadir || %{_sbindir}/apxs -q PREFIX || true) -%if "0%{?apache_serverroot}" == "0" || 0%(echo '%{apache_serverroot}' | grep -E '^%{_datadir}' >/dev/null && echo 1 || echo 0) > 0 +%define apache_serverroot_data %(%{_sbindir}/apxs2 -q datadir || %{_sbindir}/apxs -q PREFIX || true) +# FIXME: is naming correct for both versions? +%define apache_serverroot_cgi %(%{_sbindir}/apxs2 -q cgidir || %{_sbindir}/apxs -q cgidir || true) + +%if "0%{?apache_serverroot_cgi}" == "0" || 0%(echo '%{apache_serverroot_cgi}' | grep -E '^%{_datadir}' >/dev/null && echo 1 || echo 0) > 0 # Spec-var is undefined or empty, or matches the pattern triggering # E: arch-dependent-file-in-usr-share (Badness: 590) # Dump nut-cgi artifacts under our own locations, so end-users can # integrate them later. %define CGIPATH %{LIBEXECPATH}/cgi-bin +%else +%define CGIPATH %{apache_serverroot_cgi}/cgi-bin/nut +%endif + +%if "0%{?apache_serverroot_data}" == "0" %define HTMLPATH %{_datadir}/nut/htdocs %else # Rename web pages location to not conflict with apache2-example-pages # or user home page: -%define CGIPATH %{apache_serverroot}/cgi-bin/nut -%define HTMLPATH %{apache_serverroot}/htdocs/nut +%define HTMLPATH %{apache_serverroot_data}/htdocs/nut %endif %define MODELPATH %{LIBEXECPATH}/driver From 24fff584ea4de3b5bacc575862541e24444226f2 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Thu, 9 Oct 2025 15:15:13 +0200 Subject: [PATCH 569/805] scripts/obs/nut.spec: require user/group for post-install script context Signed-off-by: Jim Klimov --- scripts/obs/nut.spec | 3 +++ 1 file changed, 3 insertions(+) diff --git a/scripts/obs/nut.spec b/scripts/obs/nut.spec index 797526a692..7172f88464 100644 --- a/scripts/obs/nut.spec +++ b/scripts/obs/nut.spec @@ -128,6 +128,9 @@ Requires: usbutils %if 0%{?suse_version} Requires(post): udev %endif +Requires(post): group(%{NUT_GROUP}) +Requires(post): user(%{NUT_USER}) + BuildRoot: %{_tmppath}/%{name}-%{version}-build # To fix end-of-line encoding: From 4b07052ad43385f134ad5d1bb64f9a97ddca9457 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Thu, 9 Oct 2025 15:17:54 +0200 Subject: [PATCH 570/805] scripts/obs/nut.spec: require more tools for SUSE platform tests on OBS Signed-off-by: Jim Klimov --- scripts/obs/nut.spec | 2 ++ 1 file changed, 2 insertions(+) diff --git a/scripts/obs/nut.spec b/scripts/obs/nut.spec index 7172f88464..d816279d03 100644 --- a/scripts/obs/nut.spec +++ b/scripts/obs/nut.spec @@ -118,6 +118,7 @@ Requires: %{_sbindir}/sh Requires: %{_bindir}/chown Requires: %{_bindir}/chgrp Requires: %{_bindir}/chmod +BuildRequires: %{_sbindir}/chroot Requires: %{_bindir}/rm Requires: %{_bindir}/fgrep Requires: %{_bindir}/grep @@ -130,6 +131,7 @@ Requires(post): udev %endif Requires(post): group(%{NUT_GROUP}) Requires(post): user(%{NUT_USER}) +Requires(postun): %{_bindir}/sh BuildRoot: %{_tmppath}/%{name}-%{version}-build From b287635a3e14b8a954e734e2048330f0240e9883 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Thu, 9 Oct 2025 15:22:12 +0200 Subject: [PATCH 571/805] scripts/obs/nut.spec: do not package directly-named "/bin" objects Signed-off-by: Jim Klimov --- scripts/obs/nut.spec | 2 -- 1 file changed, 2 deletions(-) diff --git a/scripts/obs/nut.spec b/scripts/obs/nut.spec index d816279d03..f4f4042ba5 100644 --- a/scripts/obs/nut.spec +++ b/scripts/obs/nut.spec @@ -451,7 +451,6 @@ if [ -x /sbin/udevadm ] ; then /sbin/udevadm trigger --subsystem-match=usb --pro %defattr(-,root,root) %doc AUTHORS COPYING LICENSE-DCO LICENSE-GPL2 LICENSE-GPL3 ChangeLog MAINTAINERS NEWS.adoc README.adoc UPGRADING.adoc docs/*.adoc docs/*.txt docs/cables/*.txt # List the (system) dirs we impact but do not own for the package -%dir /bin %dir %{BASHCOMPLETIONPATH} %dir %{_sysconfdir}/logrotate.d %dir %{_bindir} @@ -472,7 +471,6 @@ if [ -x /sbin/udevadm ] ; then /sbin/udevadm trigger --subsystem-match=usb --pro %dir %{systemdtmpfilesdir} %dir %{systemdshutdowndir} # List the file patterns to install from proto area -/bin/* %{BASHCOMPLETIONPATH}/* %config(noreplace) %{_sysconfdir}/logrotate.d/* %{_bindir}/* From 4b0abe252345ea7a3fd3f5fcb7b42152acbfd880 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Thu, 9 Oct 2025 15:26:20 +0200 Subject: [PATCH 572/805] scripts/obs/nut.spec: dep on chroot does not work like this Signed-off-by: Jim Klimov --- scripts/obs/nut.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/obs/nut.spec b/scripts/obs/nut.spec index f4f4042ba5..d1d7515262 100644 --- a/scripts/obs/nut.spec +++ b/scripts/obs/nut.spec @@ -118,7 +118,7 @@ Requires: %{_sbindir}/sh Requires: %{_bindir}/chown Requires: %{_bindir}/chgrp Requires: %{_bindir}/chmod -BuildRequires: %{_sbindir}/chroot +###BuildRequires: % {_sbindir}/chroot Requires: %{_bindir}/rm Requires: %{_bindir}/fgrep Requires: %{_bindir}/grep From ecc517c87f647b06d4a7980b4c62842846ac8f83 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Thu, 9 Oct 2025 15:35:18 +0200 Subject: [PATCH 573/805] scripts/obs/nut.spec: dep on accounts for pkg self-test does not work like this Signed-off-by: Jim Klimov --- scripts/obs/nut.spec | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/obs/nut.spec b/scripts/obs/nut.spec index d1d7515262..1380fa81fa 100644 --- a/scripts/obs/nut.spec +++ b/scripts/obs/nut.spec @@ -129,8 +129,8 @@ Requires: usbutils %if 0%{?suse_version} Requires(post): udev %endif -Requires(post): group(%{NUT_GROUP}) -Requires(post): user(%{NUT_USER}) +#Requires(post): group(% {NUT_GROUP}) +#Requires(post): user(% {NUT_USER}) Requires(postun): %{_bindir}/sh BuildRoot: %{_tmppath}/%{name}-%{version}-build From a29b650f05b6ce950b110d06f7c21b4f676d4053 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Thu, 9 Oct 2025 15:38:23 +0200 Subject: [PATCH 574/805] scripts/obs/nut.spec: BuildRequires: libxml2-devel Signed-off-by: Jim Klimov --- scripts/obs/nut.spec | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/obs/nut.spec b/scripts/obs/nut.spec index 1380fa81fa..3d71a557c4 100644 --- a/scripts/obs/nut.spec +++ b/scripts/obs/nut.spec @@ -154,6 +154,7 @@ BuildRequires: libtool-ltdl-devel BuildRequires: (libusb-devel or libusbx-devel) #!Prefer: libusbx-devel BuildRequires: net-snmp-devel +BuildRequires: libxml2-devel BuildRequires: pkg-config # Maybe older Pythons are also okay, but were not tested for ages BuildRequires: (python >= 2.6 or python3 or python2) From a18738944766baebdbef450fa5a63e7e3e7d7bec Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Thu, 9 Oct 2025 15:56:29 +0200 Subject: [PATCH 575/805] scripts/obs/nut.spec: fix systemdtmpfilesdir determination Signed-off-by: Jim Klimov --- scripts/obs/nut.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/obs/nut.spec b/scripts/obs/nut.spec index 3d71a557c4..4f36f62b48 100644 --- a/scripts/obs/nut.spec +++ b/scripts/obs/nut.spec @@ -80,7 +80,7 @@ # Collect systemd related paths so we can package files there: %define systemdsystemunitdir %(pkg-config --variable=systemdsystemunitdir systemd) %define systemdsystempresetdir %(pkg-config --variable=systemdsystempresetdir systemd || pkg-config --variable=systemdsystempresetdir libsystemd) -%define systemdtmpfilesdir %(pkg-config --variable=systemdtmpfilesdir systemd || pkg-config --variable=systemdtmpfilesdir libsystemd) +%define systemdtmpfilesdir %(pkg-config --variable=tmpfilesdir systemd || pkg-config --variable=tmpfilesdir libsystemd) %define systemdsystemdutildir %(pkg-config --variable=systemdutildir systemd) %define systemdshutdowndir %(pkg-config --variable=systemdshutdowndir systemd) From 9692a9766fe3699ceb479db23c71b328ddb2b6fd Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Thu, 9 Oct 2025 16:00:23 +0200 Subject: [PATCH 576/805] scripts/obs/nut.spec: fence delivery of systemd files (check if we could resolve the the paths involved) Signed-off-by: Jim Klimov --- scripts/obs/nut.spec | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/scripts/obs/nut.spec b/scripts/obs/nut.spec index 4f36f62b48..185ccc34c6 100644 --- a/scripts/obs/nut.spec +++ b/scripts/obs/nut.spec @@ -467,10 +467,22 @@ if [ -x /sbin/udevadm ] ; then /sbin/udevadm trigger --subsystem-match=usb --pro %dir %{_mandir}/man7 %dir %{_mandir}/man8 %dir %{_libexecdir} +%if "x%{?systemdsystemunitdir}" == "x" +%else %dir %{systemdsystemunitdir} +%endif +%if "x%{?systemdsystempresetdir}" == "x" +%else %dir %{systemdsystempresetdir} +%endif +%if "x%{?systemdtmpfilesdir}" == "x" +%else %dir %{systemdtmpfilesdir} +%endif +%if "x%{?systemdshutdowndir}" == "x" +%else %dir %{systemdshutdowndir} +%endif # List the file patterns to install from proto area %{BASHCOMPLETIONPATH}/* %config(noreplace) %{_sysconfdir}/logrotate.d/* @@ -512,10 +524,22 @@ if [ -x /sbin/udevadm ] ; then /sbin/udevadm trigger --subsystem-match=usb --pro %exclude %{_sbindir}/gen-snmp-subdriver.sh %attr(770,%{NUT_USER},%{NUT_GROUP}) %{STATEPATH} %attr(770,%{NUT_USER},%{NUT_GROUP}) %{STATEPATH}/upssched +%if "x%{?systemdsystemunitdir}" == "x" +%else %{systemdsystemunitdir}/* +%endif +%if "x%{?systemdsystempresetdir}" == "x" +%else %{systemdsystempresetdir}/* +%endif +%if "x%{?systemdtmpfilesdir}" == "x" +%else %{systemdtmpfilesdir}/* +%endif +%if "x%{?systemdshutdowndir}" == "x" +%else %{systemdshutdowndir}/nutshutdown +%endif %{_datadir}/augeas/lenses/dist/nuthostsconf.aug %{_datadir}/augeas/lenses/dist/nutnutconf.aug %{_datadir}/augeas/lenses/dist/nutupsconf.aug From 2378cbe46101d8cd4f9332357e551248d419ac49 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Thu, 9 Oct 2025 16:06:42 +0200 Subject: [PATCH 577/805] scripts/obs/nut.spec: do not relocate upssched-cmd to hard-coded /bin Signed-off-by: Jim Klimov --- scripts/obs/nut.spec | 2 -- 1 file changed, 2 deletions(-) diff --git a/scripts/obs/nut.spec b/scripts/obs/nut.spec index 185ccc34c6..823a430f1e 100644 --- a/scripts/obs/nut.spec +++ b/scripts/obs/nut.spec @@ -366,8 +366,6 @@ mkdir -p %{buildroot}%{_sysconfdir}/logrotate.d # Avoid W: incoherent-logrotate-file /etc/logrotate.d/nutlogd install -m 644 scripts/logrotate/nutlogd %{buildroot}%{_sysconfdir}/logrotate.d/nut rename .sample "" %{buildroot}%{_sysconfdir}/ups/*.sample -mkdir -p %{buildroot}/bin -mv %{buildroot}%{_bindir}/upssched-cmd %{buildroot}/bin/upssched-cmd find %{buildroot} -type f -name "*.la" -delete -print mkdir -p %{buildroot}%{BASHCOMPLETIONPATH} install -m0644 scripts/misc/nut.bash_completion %{buildroot}%{BASHCOMPLETIONPATH}/ From 8eaa33c506433ab56bbbc8b819637ce0134922ed Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Thu, 9 Oct 2025 16:52:21 +0200 Subject: [PATCH 578/805] scripts/obs/nut.spec: revise pre/port-in/un snippets Signed-off-by: Jim Klimov --- scripts/obs/nut.spec | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/scripts/obs/nut.spec b/scripts/obs/nut.spec index 823a430f1e..6bf48a04ed 100644 --- a/scripts/obs/nut.spec +++ b/scripts/obs/nut.spec @@ -401,7 +401,8 @@ done usr/sbin/groupadd -r -g %{NUT_GROUP} 2>/dev/null || : usr/sbin/useradd -r -g %{NUT_GROUP} -s /bin/false \ -c "UPS daemon" -d /sbin %{NUT_USER} 2>/dev/null || : -%if %{defined opensuse_version} +%if "x%{?systemdsystemunitdir}" == "x" +%else %service_add_pre %{NUT_SYSTEMD_UNITS_SERVICE_TARGET} %endif @@ -430,17 +431,17 @@ if [ -x /sbin/udevadm ] ; then /sbin/udevadm trigger --subsystem-match=usb --pro %preun %if "x%{?systemdsystemunitdir}" == "x" +: %else %service_del_preun %{NUT_SYSTEMD_UNITS_SERVICE_TARGET} %endif -: %postun %if "x%{?systemdsystemunitdir}" == "x" +: %else %service_del_postun %{NUT_SYSTEMD_UNITS_SERVICE_TARGET} %endif -: %post -n libupsclient1 -p /sbin/ldconfig From 0e9d7aa0cf64a193860c8e9be102f4a89c166823 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Thu, 9 Oct 2025 16:52:46 +0200 Subject: [PATCH 579/805] scripts/obs/nut.spec: comment away "%dir" and "%exclude" hacks that felt superfluous and probably are Signed-off-by: Jim Klimov --- scripts/obs/nut.spec | 42 +++++++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/scripts/obs/nut.spec b/scripts/obs/nut.spec index 6bf48a04ed..1591e3e04c 100644 --- a/scripts/obs/nut.spec +++ b/scripts/obs/nut.spec @@ -451,21 +451,21 @@ if [ -x /sbin/udevadm ] ; then /sbin/udevadm trigger --subsystem-match=usb --pro %defattr(-,root,root) %doc AUTHORS COPYING LICENSE-DCO LICENSE-GPL2 LICENSE-GPL3 ChangeLog MAINTAINERS NEWS.adoc README.adoc UPGRADING.adoc docs/*.adoc docs/*.txt docs/cables/*.txt # List the (system) dirs we impact but do not own for the package -%dir %{BASHCOMPLETIONPATH} -%dir %{_sysconfdir}/logrotate.d -%dir %{_bindir} -%dir %{_sbindir} -%dir %{_datadir} -%dir %{_docdir} -%dir %{DOCPATH} +#% dir % {BASHCOMPLETIONPATH} +#% dir % {_sysconfdir}/logrotate.d +#% dir % {_bindir} +#% dir % {_sbindir} +#% dir % {_datadir} +#% dir % {_docdir} +#% dir % {DOCPATH} # NOTE: Currently this only delivers libupsclient-config.1 # and only if not building with pkg-config available: #% dir % {_mandir}/man1 -%dir %{_mandir}/man3 -%dir %{_mandir}/man5 -%dir %{_mandir}/man7 -%dir %{_mandir}/man8 -%dir %{_libexecdir} +#% dir % {_mandir}/man3 +#% dir % {_mandir}/man5 +#% dir % {_mandir}/man7 +#% dir % {_mandir}/man8 +#% dir % {_libexecdir} %if "x%{?systemdsystemunitdir}" == "x" %else %dir %{systemdsystemunitdir} @@ -556,21 +556,21 @@ if [ -x /sbin/udevadm ] ; then /sbin/udevadm trigger --subsystem-match=usb --pro # Exclude whatever other packages bring, some rpmbuild versions seem to dump # everything into the base package and then complain about duplicates/conflicts: ### libupsclient1 -%exclude %{_libdir}/*.so.* +#% exclude % {_libdir}/*.so.* ### nut-cgi -%exclude %{CGIPATH} -%exclude %{HTMLPATH} -%exclude %{CONFPATH}/*.html +#% exclude % {CGIPATH} +#% exclude % {HTMLPATH} +#% exclude % {CONFPATH}/*.html ### nut-monitor # TODO: Actually package NUT-Monitor app and scripts where available # TODO: Detect path from chosen interpreter or NUT build config files? %exclude /usr/lib/python*/*-packages/* ### nut-devel -%exclude %{_includedir}/*.h -%exclude %{_libdir}/*.so -%exclude %{_libdir}/pkgconfig/*.pc -%exclude %{_mandir}/man3/*.* -%exclude %{LIBEXECPATH}/sockdebug +#% exclude % {_includedir}/*.h +#% exclude % {_libdir}/*.so +#% exclude % {_libdir}/pkgconfig/*.pc +#% exclude % {_mandir}/man3/*.* +#% exclude % {LIBEXECPATH}/sockdebug %files drivers-net From 41eaa764b51a6a4a14288187b60d329fce2fa873 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Thu, 9 Oct 2025 17:11:45 +0200 Subject: [PATCH 580/805] scripts/obs/nut.spec: deliver libs each in its ABI-version-named package Signed-off-by: Jim Klimov --- scripts/obs/nut.spec | 126 +++++++++++++++++++++++++++++++++++++++---- 1 file changed, 117 insertions(+), 9 deletions(-) diff --git a/scripts/obs/nut.spec b/scripts/obs/nut.spec index 1591e3e04c..9c7903cc9f 100644 --- a/scripts/obs/nut.spec +++ b/scripts/obs/nut.spec @@ -102,6 +102,17 @@ %define NUTPKG_WITH_AVAHI %( (yum search avahi-devel | grep -E '^(lib)?avahi-devel\.' && exit ; dnf search avahi-devel | grep -E '^(lib)?avahi-devel\.' && exit ; zypper search -s avahi-devel | grep -E '(lib)?avahi-devel' && exit ; urpmq --sources avahi-devel && exit ; pkcon search name avahi-devel | grep -E '(Available|Installed).*avahi-devel' && exit;) >&2 && echo 1 || echo 0) %define NUTPKG_WITH_TCPWRAP %( (yum search tcp_wrappers-devel | grep -E '^(lib)?tcp_wrappers-devel\.' && exit ; dnf search tcp_wrappers-devel | grep -E '^(lib)?tcp_wrappers-devel\.' && exit ; zypper search -s tcp_wrappers-devel | grep -E '(lib)?tcp_wrappers-devel' && exit ; urpmq --sources tcp_wrappers-devel && exit ; pkcon search name tcp_wrappers-devel | grep -E '(Available|Installed).*tcp_wrappers-devel' && exit;) >&2 && echo 1 || echo 0) +# FIXME: Find a smarter way to set those from main codebase recipes... +# Something like `git grep 'version-info' '*.am'` ? +%define SO_MAJOR_LIBUPSCLIENT 7 +%define SO_MAJOR_LIBNUTCLIENT 2 +%define SO_MAJOR_LIBNUTCLIENTSTUB 1 +%define SO_MAJOR_LIBNUTSCAN 4 +%define SO_MAJOR_LIBNUTCONF 0 + +# If not published, nutconf is built with a statically linked library variant +%define NUTPKG_WITH_LIBNUTCONF 0 + Name: nut # NOTE: OBS should rewrite this: Version: 2.8.4 @@ -243,12 +254,53 @@ interface for monitoring and administering UPS hardware. Detailed information about supported hardware can be found in %{_docdir}/nut. -%package -n libupsclient1 +%package -n libupsclient%{SO_MAJOR_LIBUPSCLIENT} +Summary: Network UPS Tools Library (Uninterruptible Power Supply Monitoring) +Group: System/Libraries + +%description -n libupsclient%{SO_MAJOR_LIBUPSCLIENT} +Shared library for the Network UPS Tools, used by its and third-party C clients. + +Network UPS Tools is a collection of programs which provide a common +interface for monitoring and administering UPS hardware. + +Detailed information about supported hardware can be found in +%{_docdir}/nut. + +%package -n libnutclient%{SO_MAJOR_LIBNUTCLIENT} +Summary: Network UPS Tools Library (Uninterruptible Power Supply Monitoring) +Group: System/Libraries + +%description -n libnutclient%{SO_MAJOR_LIBNUTCLIENT} +Shared library for the Network UPS Tools, used by its and third-party C++ clients. + +Network UPS Tools is a collection of programs which provide a common +interface for monitoring and administering UPS hardware. + +Detailed information about supported hardware can be found in +%{_docdir}/nut. + +%package -n libnutclientstub%{SO_MAJOR_LIBNUTCLIENTSTUB} +Summary: Network UPS Tools Library (Uninterruptible Power Supply Monitoring) +Group: System/Libraries + +%description -n libnutclientstub%{SO_MAJOR_LIBNUTCLIENTSTUB} +Shared stub library for the Network UPS Tools with memory-backed configurations, +primarily used by tests and mocks with its and third-party C++ clients. + +Network UPS Tools is a collection of programs which provide a common +interface for monitoring and administering UPS hardware. + +Detailed information about supported hardware can be found in +%{_docdir}/nut. + +%package -n libnutscan%{SO_MAJOR_LIBNUTSCAN} Summary: Network UPS Tools Library (Uninterruptible Power Supply Monitoring) Group: System/Libraries -%description -n libupsclient1 -Shared library for the Network UPS Tools. +%description -n libnutscan%{SO_MAJOR_LIBNUTSCAN} +Shared library for the Network UPS Tools, used by its nut-scanner and nutconf tools, +and possibly third-party C clients, integrations or tools. Network UPS Tools is a collection of programs which provide a common interface for monitoring and administering UPS hardware. @@ -256,6 +308,23 @@ interface for monitoring and administering UPS hardware. Detailed information about supported hardware can be found in %{_docdir}/nut. +%if 0%{?NUTPKG_WITH_LIBNUTCONF} > 0 +# If not published, nutconf is built with a statically linked library variant +%package -n libnutconf%{SO_MAJOR_LIBNUTCONF} +Summary: Network UPS Tools Library (Uninterruptible Power Supply Monitoring) +Group: System/Libraries + +%description -n libnutconf%{SO_MAJOR_LIBNUTCONF} +Shared library for the Network UPS Tools, used by its nutconf tool, +and possibly third-party C++ clients, integrations or tools. + +Network UPS Tools is a collection of programs which provide a common +interface for monitoring and administering UPS hardware. + +Detailed information about supported hardware can be found in +%{_docdir}/nut. +%endif + %package cgi Summary: Network UPS Tools Web Server Support (UPS Status Pages) Group: Hardware/UPS @@ -344,6 +413,9 @@ sh autogen.sh --enable-option-checking=fatal\ --with-systemdsystemunitdir --with-systemdshutdowndir \ --with-augeas-lenses-dir=/usr/share/augeas/lenses/dist \ +%if 0%{?NUTPKG_WITH_LIBNUTCONF} > 0 + --with-dev-libnutconf\ +%endif %if 0%{?NUTPKG_WITH_DMF} --with-snmp_dmf_lua\ --with-dmfsnmp-regenerate=no --with-dmfnutscan-regenerate=no --with-dmfsnmp-validate=no --with-dmfnutscan-validate=no @@ -443,9 +515,28 @@ if [ -x /sbin/udevadm ] ; then /sbin/udevadm trigger --subsystem-match=usb --pro %service_del_postun %{NUT_SYSTEMD_UNITS_SERVICE_TARGET} %endif -%post -n libupsclient1 -p /sbin/ldconfig +%post -n libupsclient%{SO_MAJOR_LIBUPSCLIENT} -p /sbin/ldconfig + +%postun -n libupsclient%{SO_MAJOR_LIBUPSCLIENT} -p /sbin/ldconfig + +%post -n libnutclient%{SO_MAJOR_LIBNUTCLIENT} -p /sbin/ldconfig + +%postun -n libnutclient%{SO_MAJOR_LIBNUTCLIENT} -p /sbin/ldconfig + +%post -n libnutclientstub%{SO_MAJOR_LIBNUTCLIENTSTUB} -p /sbin/ldconfig -%postun -n libupsclient1 -p /sbin/ldconfig +%postun -n libnutclientstub%{SO_MAJOR_LIBNUTCLIENTSTUB} -p /sbin/ldconfig + +%post -n libnutscan%{SO_MAJOR_LIBNUTSCAN} -p /sbin/ldconfig + +%postun -n libnutscan%{SO_MAJOR_LIBNUTSCAN} -p /sbin/ldconfig + +%if 0%{?NUTPKG_WITH_LIBNUTCONF} > 0 +%post -n libnutconf%{SO_MAJOR_LIBNUTCONF} -p /sbin/ldconfig + +%postun -n libnutconf%{SO_MAJOR_LIBNUTCONF} -p /sbin/ldconfig + +%endif %files %defattr(-,root,root) @@ -555,7 +646,7 @@ if [ -x /sbin/udevadm ] ; then /sbin/udevadm trigger --subsystem-match=usb --pro %{LIBEXECPATH}/nut-driver-enumerator.sh # Exclude whatever other packages bring, some rpmbuild versions seem to dump # everything into the base package and then complain about duplicates/conflicts: -### libupsclient1 +### libupsclient7 etc #% exclude % {_libdir}/*.so.* ### nut-cgi #% exclude % {CGIPATH} @@ -594,10 +685,27 @@ if [ -x /sbin/udevadm ] ; then /sbin/udevadm trigger --subsystem-match=usb --pro %{_datadir}/nut/dmfsnmp.d/*.dmf %endif -%files -n libupsclient1 -# TODO: Separate or rename for other nut-libs (nut-scanner, nutconf C++)? +%files -n libupsclient%{SO_MAJOR_LIBUPSCLIENT} +%defattr(-,root,root) +%{_libdir}/libupsclient.so.* + +%files -n libnutclient%{SO_MAJOR_LIBNUTCLIENT} %defattr(-,root,root) -%{_libdir}/*.so.* +%{_libdir}/libnutclient.so.* + +%files -n libnutclientstub%{SO_MAJOR_LIBNUTCLIENTSTUB} +%defattr(-,root,root) +%{_libdir}/libnutclientstub.so.* + +%files -n libnutscan%{SO_MAJOR_LIBNUTSCAN} +%defattr(-,root,root) +%{_libdir}/libnutscan.so.* + +%if 0%{?NUTPKG_WITH_LIBNUTCONF} > 0 +%files -n libnutconf%{SO_MAJOR_LIBNUTCONF} +%defattr(-,root,root) +%{_libdir}/libnutconf.so.* +%endif %files cgi %defattr(-,root,root) From e55839dd82b034fba8e4509e4299c32a82272461 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Thu, 9 Oct 2025 17:17:47 +0200 Subject: [PATCH 581/805] scripts/obs/nut.spec: address SUSE rpmlint issues with logrotate Signed-off-by: Jim Klimov --- scripts/obs/nut.spec | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/scripts/obs/nut.spec b/scripts/obs/nut.spec index 9c7903cc9f..c197b519e8 100644 --- a/scripts/obs/nut.spec +++ b/scripts/obs/nut.spec @@ -146,6 +146,8 @@ Requires(postun): %{_bindir}/sh BuildRoot: %{_tmppath}/%{name}-%{version}-build +Recommends: logrotate + # To fix end-of-line encoding: BuildRequires: dos2unix @@ -437,6 +439,8 @@ mkdir -p %{buildroot}%{_sbindir} mkdir -p %{buildroot}%{_sysconfdir}/logrotate.d # Avoid W: incoherent-logrotate-file /etc/logrotate.d/nutlogd install -m 644 scripts/logrotate/nutlogd %{buildroot}%{_sysconfdir}/logrotate.d/nut +# As (currently) hard-coded in that file above +mkdir -p %{buildroot}/var/log rename .sample "" %{buildroot}%{_sysconfdir}/ups/*.sample find %{buildroot} -type f -name "*.la" -delete -print mkdir -p %{buildroot}%{BASHCOMPLETIONPATH} @@ -557,6 +561,8 @@ if [ -x /sbin/udevadm ] ; then /sbin/udevadm trigger --subsystem-match=usb --pro #% dir % {_mandir}/man7 #% dir % {_mandir}/man8 #% dir % {_libexecdir} +# FIXME: Detect from logrotate properties (or our scriptlet file)? +%dir /var/log %if "x%{?systemdsystemunitdir}" == "x" %else %dir %{systemdsystemunitdir} From fad2db0b3cf4001abb0e66bbf4f4052f213dc488 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Thu, 9 Oct 2025 17:18:04 +0200 Subject: [PATCH 582/805] scripts/obs/nut.spec: address SUSE rpmlint issues with scripted-only NUT-Monitor package Signed-off-by: Jim Klimov --- scripts/obs/nut.spec | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/obs/nut.spec b/scripts/obs/nut.spec index c197b519e8..cfcafb2cf9 100644 --- a/scripts/obs/nut.spec +++ b/scripts/obs/nut.spec @@ -348,6 +348,7 @@ Summary: Network UPS Tools Web Server Support (GUI client) Group: Hardware/UPS Requires: %{name} = %{version} BuildRequires: (python >= 2.6 or python3 or python2) +BuildArch: noarch %description monitor Graphical user interface client for the Network UPS Tools, From 5c4a9700193f52cdd2406607fad112e75621f472 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Thu, 9 Oct 2025 17:18:18 +0200 Subject: [PATCH 583/805] scripts/obs/nut.spec: address SUSE rpmlint issues with "make check" section Signed-off-by: Jim Klimov --- scripts/obs/nut.spec | 3 +++ 1 file changed, 3 insertions(+) diff --git a/scripts/obs/nut.spec b/scripts/obs/nut.spec index cfcafb2cf9..ea9d917f4b 100644 --- a/scripts/obs/nut.spec +++ b/scripts/obs/nut.spec @@ -432,6 +432,9 @@ if test "$PORT" = 3493 ; then PORT=nut fi +%check +make %{?_smp_mflags} check + %install make DESTDIR=%{buildroot} install %{?_smp_mflags} mkdir -p %{buildroot}%{STATEPATH}/upssched From 16e36d3af9dfbe1d3565a390d094bc3e6705c5e5 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Thu, 9 Oct 2025 18:04:03 +0200 Subject: [PATCH 584/805] scripts/obs/nut.spec: revise delivery of CGI artifacts as %dir Signed-off-by: Jim Klimov --- scripts/obs/nut.spec | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/scripts/obs/nut.spec b/scripts/obs/nut.spec index ea9d917f4b..5b18987277 100644 --- a/scripts/obs/nut.spec +++ b/scripts/obs/nut.spec @@ -719,8 +719,10 @@ if [ -x /sbin/udevadm ] ; then /sbin/udevadm trigger --subsystem-match=usb --pro %files cgi %defattr(-,root,root) -%{CGIPATH} -%{HTMLPATH} +%dir %{CGIPATH} +%dir %{HTMLPATH} +%{CGIPATH}/* +%{HTMLPATH}/* %config(noreplace) %{CONFPATH}/upsstats-single.html %config(noreplace) %{CONFPATH}/upsstats.html From c5af3ede0e81a7fd16ffce36e87cc919795f02df Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Thu, 9 Oct 2025 20:49:09 +0200 Subject: [PATCH 585/805] scripts/obs/nut.spec: keep excluding from main package stuff that should be in others Signed-off-by: Jim Klimov --- scripts/obs/nut.spec | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/scripts/obs/nut.spec b/scripts/obs/nut.spec index 5b18987277..852dcbc15f 100644 --- a/scripts/obs/nut.spec +++ b/scripts/obs/nut.spec @@ -657,21 +657,21 @@ if [ -x /sbin/udevadm ] ; then /sbin/udevadm trigger --subsystem-match=usb --pro # Exclude whatever other packages bring, some rpmbuild versions seem to dump # everything into the base package and then complain about duplicates/conflicts: ### libupsclient7 etc -#% exclude % {_libdir}/*.so.* +%exclude %{_libdir}/*.so.* ### nut-cgi -#% exclude % {CGIPATH} -#% exclude % {HTMLPATH} -#% exclude % {CONFPATH}/*.html +%exclude %{CGIPATH} +%exclude %{HTMLPATH} +%exclude %{CONFPATH}/*.html ### nut-monitor # TODO: Actually package NUT-Monitor app and scripts where available # TODO: Detect path from chosen interpreter or NUT build config files? %exclude /usr/lib/python*/*-packages/* ### nut-devel -#% exclude % {_includedir}/*.h -#% exclude % {_libdir}/*.so -#% exclude % {_libdir}/pkgconfig/*.pc -#% exclude % {_mandir}/man3/*.* -#% exclude % {LIBEXECPATH}/sockdebug +%exclude %{_includedir}/*.h +%exclude %{_libdir}/*.so +%exclude %{_libdir}/pkgconfig/*.pc +%exclude %{_mandir}/man3/*.* +%exclude %{LIBEXECPATH}/sockdebug %files drivers-net From d4e826c637fda38e4f988a4735c9b5ada598040a Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Thu, 9 Oct 2025 21:41:13 +0200 Subject: [PATCH 586/805] scripts/obs/nut.spec: anticipate something like /usr/lib64/python2.7/site-packages/ too Signed-off-by: Jim Klimov --- scripts/obs/nut.spec | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/obs/nut.spec b/scripts/obs/nut.spec index 852dcbc15f..8c3dfa7533 100644 --- a/scripts/obs/nut.spec +++ b/scripts/obs/nut.spec @@ -453,7 +453,7 @@ install -m0755 scripts/subdriver/gen-snmp-subdriver.sh %{buildroot}%{_sbindir}/ # TODO: Detect path from chosen interpreter or NUT build config files? # Avoid W: non-executable-script /usr/lib/python3.6/site-packages/PyNUT.py 644 /usr/bin/python... # Not really relevant for the module (not directly runnable, but has the shebang just in case) -chmod +x %{buildroot}/usr/lib/python*/*-packages/*.py +chmod +x %{buildroot}/usr/lib*/python*/*-packages/*.py if [ x"%{systemdtmpfilesdir}" != x ]; then # Deliver these dirs by packaging: sed 's,^\(. %{STATEPATH}\(/upssched\)*\( .*\)*\)$,#PACKAGED#\1,' -i %{buildroot}%{systemdtmpfilesdir}/nut-common-tmpfiles.conf @@ -665,7 +665,7 @@ if [ -x /sbin/udevadm ] ; then /sbin/udevadm trigger --subsystem-match=usb --pro ### nut-monitor # TODO: Actually package NUT-Monitor app and scripts where available # TODO: Detect path from chosen interpreter or NUT build config files? -%exclude /usr/lib/python*/*-packages/* +%exclude /usr/lib*/python*/*-packages/* ### nut-devel %exclude %{_includedir}/*.h %exclude %{_libdir}/*.so @@ -730,7 +730,7 @@ if [ -x /sbin/udevadm ] ; then /sbin/udevadm trigger --subsystem-match=usb --pro %defattr(-,root,root) # TODO: Actually package NUT-Monitor app and scripts where available # TODO: Detect path from chosen interpreter or NUT build config files? -/usr/lib/python*/*-packages/* +/usr/lib*/python*/*-packages/* %files devel %defattr(-,root,root) From 416aa5e4f481f918ed46c5a672451f83611f0c6c Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Thu, 9 Oct 2025 21:41:47 +0200 Subject: [PATCH 587/805] scripts/obs/nut.spec: reduce layering of CGIPATH under apache_serverroot_cgi Signed-off-by: Jim Klimov --- scripts/obs/nut.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/obs/nut.spec b/scripts/obs/nut.spec index 8c3dfa7533..eb3c81e5fb 100644 --- a/scripts/obs/nut.spec +++ b/scripts/obs/nut.spec @@ -38,7 +38,7 @@ # integrate them later. %define CGIPATH %{LIBEXECPATH}/cgi-bin %else -%define CGIPATH %{apache_serverroot_cgi}/cgi-bin/nut +%define CGIPATH %{apache_serverroot_cgi}/nut %endif %if "0%{?apache_serverroot_data}" == "0" From ef60cd02afc37b3c11e6652abbe4ca7d293cbd69 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Thu, 9 Oct 2025 21:43:39 +0200 Subject: [PATCH 588/805] scripts/obs/nut.spec: reduce layering of HTMLPATH under apache_serverroot_data Signed-off-by: Jim Klimov --- scripts/obs/nut.spec | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/obs/nut.spec b/scripts/obs/nut.spec index eb3c81e5fb..85309cf53b 100644 --- a/scripts/obs/nut.spec +++ b/scripts/obs/nut.spec @@ -41,12 +41,12 @@ %define CGIPATH %{apache_serverroot_cgi}/nut %endif -%if "0%{?apache_serverroot_data}" == "0" +%if "0%{?apache_serverroot_data}" == "0" || 0%(test x'%{apache_serverroot_data}' = x'^%{_datadir}' && echo 1 || echo 0) > 0 %define HTMLPATH %{_datadir}/nut/htdocs %else # Rename web pages location to not conflict with apache2-example-pages # or user home page: -%define HTMLPATH %{apache_serverroot_data}/htdocs/nut +%define HTMLPATH %{apache_serverroot_data}/nut %endif %define MODELPATH %{LIBEXECPATH}/driver From 31949e2592d6d5ebe59d31a61c067e270a27b115 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Thu, 9 Oct 2025 22:00:17 +0200 Subject: [PATCH 589/805] scripts/obs/nut.spec: deduplicate man page files with symlinks Signed-off-by: Jim Klimov --- scripts/obs/nut.spec | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/scripts/obs/nut.spec b/scripts/obs/nut.spec index 85309cf53b..5ae049c5e3 100644 --- a/scripts/obs/nut.spec +++ b/scripts/obs/nut.spec @@ -151,6 +151,10 @@ Recommends: logrotate # To fix end-of-line encoding: BuildRequires: dos2unix +# For man page aliases +# https://en.opensuse.org/openSUSE:Packaging_Conventions_RPM_Macros#fdupes +BuildRequires: fdupes + %if 0%{?NUTPKG_WITH_AVAHI} BuildRequires: avahi-devel %endif @@ -476,6 +480,11 @@ while read F ; do sed '1 s,^.*$,#!'"${F_SHELL_PATH}," -i "$F" fi done +# create symlinks for man pages; skip man1 (not used with pkgconfig +# capable builds), and man7 (one page there): +%fdupes -s %{buildroot}/%{_mandir}/man3 +%fdupes -s %{buildroot}/%{_mandir}/man5 +%fdupes -s %{buildroot}/%{_mandir}/man8 %pre usr/sbin/groupadd -r -g %{NUT_GROUP} 2>/dev/null || : From c71f0693fdccc5f468af93b002698d07226c574d Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Thu, 9 Oct 2025 22:02:58 +0200 Subject: [PATCH 590/805] scripts/obs/nut.spec, scripts/obs/debian.rules: enable storing build configuration and checking the build with NUT Integration Tests suite, and strip binaries of debug symbols Signed-off-by: Jim Klimov --- scripts/obs/debian.rules | 4 +++- scripts/obs/nut.spec | 5 ++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/scripts/obs/debian.rules b/scripts/obs/debian.rules index c144d21036..d3de4c2030 100755 --- a/scripts/obs/debian.rules +++ b/scripts/obs/debian.rules @@ -73,7 +73,9 @@ DEB_CONFIGURE_EXTRA_FLAGS := --libdir=\$${prefix}/lib/$(DEB_HOST_MULTIARCH) \ --with-pidpath=$(runbasedir)/nut \ --datadir=/usr/share/nut \ --with-pkgconfig-dir=/usr/lib/$(DEB_HOST_MULTIARCH)/pkgconfig \ - --with-user=nut --with-group=nut + --with-user=nut --with-group=nut\ + --enable-strip\ + --enable-keep_nut_report_feature --enable-check-NIT ifeq (1,$(NUTPKG_WITH_DMF)) DEB_CONFIGURE_EXTRA_FLAGS += \ diff --git a/scripts/obs/nut.spec b/scripts/obs/nut.spec index 5ae049c5e3..047bc1c652 100644 --- a/scripts/obs/nut.spec +++ b/scripts/obs/nut.spec @@ -425,8 +425,11 @@ sh autogen.sh %endif %if 0%{?NUTPKG_WITH_DMF} --with-snmp_dmf_lua\ - --with-dmfsnmp-regenerate=no --with-dmfnutscan-regenerate=no --with-dmfsnmp-validate=no --with-dmfnutscan-validate=no + --with-dmfsnmp-regenerate=no --with-dmfnutscan-regenerate=no --with-dmfsnmp-validate=no --with-dmfnutscan-validate=no\ %endif + --enable-keep_nut_report_feature\ + --enable-strip\ + --enable-check-NIT ### via Make now ### (cd tools; python nut-snmpinfo.py) From d261d7b74b92391c8788e93baa426327ee7db5ed Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Thu, 9 Oct 2025 22:14:27 +0200 Subject: [PATCH 591/805] scripts/obs/nut.spec: register other service units (enablement is via presets after all) Signed-off-by: Jim Klimov --- scripts/obs/nut.spec | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/scripts/obs/nut.spec b/scripts/obs/nut.spec index 047bc1c652..658dcf4096 100644 --- a/scripts/obs/nut.spec +++ b/scripts/obs/nut.spec @@ -84,10 +84,11 @@ %define systemdsystemdutildir %(pkg-config --variable=systemdutildir systemd) %define systemdshutdowndir %(pkg-config --variable=systemdshutdowndir systemd) -# % define NUT_SYSTEMD_UNITS_SERVICE_TARGET % (cd scripts/systemd && ls -1 *.{service,target}{,.in} | sed 's,.in$,,' | sort | uniq) -%define NUT_SYSTEMD_UNITS_SERVICE_TARGET nut-driver-enumerator.service nut-driver.target nut-driver@.service nut-logger.service nut-monitor.service nut-server.service nut-sleep.service nut-udev-settle.service nut.target +# % define NUT_SYSTEMD_UNITS_SERVICE_TARGET % (cd scripts/systemd && ls -1 *.{service,target,path,timer}{,.in} | sed 's,.in$,,' | sort | uniq) +%define NUT_SYSTEMD_UNITS_SERVICE_TARGET nut-driver-enumerator.service nut-driver.target nut-driver@.service nut-logger.service nut-monitor.service nut-server.service nut-sleep.service nut-udev-settle.service nut.target nut-driver-enumerator.path +# Most deployments do not want these by default: +%define NUT_SYSTEMD_UNITS_UNCOMMON_NDE nut-driver-enumerator-daemon-activator.path nut-driver-enumerator-daemon-activator.service nut-driver-enumerator-daemon.service -%define NUT_SYSTEMD_UNITS_OTHER %(cd scripts/systemd && ls -1 *.{path,timer}{,.in} | sed 's,.in$,,' | sort | uniq) %define NUT_SYSTEMD_UNITS_PRESET %(cd scripts/systemd && ls -1 *.preset{,.in} | sed 's,.in$,,' | sort | uniq) # Does this NUT branch have DMF feature code? @@ -495,7 +496,7 @@ usr/sbin/useradd -r -g %{NUT_GROUP} -s /bin/false \ -c "UPS daemon" -d /sbin %{NUT_USER} 2>/dev/null || : %if "x%{?systemdsystemunitdir}" == "x" %else -%service_add_pre %{NUT_SYSTEMD_UNITS_SERVICE_TARGET} +%service_add_pre %{NUT_SYSTEMD_UNITS_SERVICE_TARGET} %{NUT_SYSTEMD_UNITS_UNCOMMON_NDE} %endif %post @@ -518,21 +519,21 @@ if [ -x /sbin/udevadm ] ; then /sbin/udevadm trigger --subsystem-match=usb --pro %endif %if "x%{?systemdsystemunitdir}" == "x" %else -%service_add_post %{NUT_SYSTEMD_UNITS_SERVICE_TARGET} +%service_add_post %{NUT_SYSTEMD_UNITS_SERVICE_TARGET} %{NUT_SYSTEMD_UNITS_UNCOMMON_NDE} %endif %preun %if "x%{?systemdsystemunitdir}" == "x" : %else -%service_del_preun %{NUT_SYSTEMD_UNITS_SERVICE_TARGET} +%service_del_preun %{NUT_SYSTEMD_UNITS_SERVICE_TARGET} %{NUT_SYSTEMD_UNITS_UNCOMMON_NDE} %endif %postun %if "x%{?systemdsystemunitdir}" == "x" : %else -%service_del_postun %{NUT_SYSTEMD_UNITS_SERVICE_TARGET} +%service_del_postun %{NUT_SYSTEMD_UNITS_SERVICE_TARGET} %{NUT_SYSTEMD_UNITS_UNCOMMON_NDE} %endif %post -n libupsclient%{SO_MAJOR_LIBUPSCLIENT} -p /sbin/ldconfig From dd3cb40e0bee8fcbf2a2b2aebe643fc9d1f2a8e9 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Fri, 10 Oct 2025 13:20:46 +0200 Subject: [PATCH 592/805] scripts/obs/README.adoc: update notes on OBS prjconf Signed-off-by: Jim Klimov --- scripts/obs/README.adoc | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/scripts/obs/README.adoc b/scripts/obs/README.adoc index 938a6b5f7d..c43a66ab61 100644 --- a/scripts/obs/README.adoc +++ b/scripts/obs/README.adoc @@ -22,9 +22,10 @@ The copy of `_service` file represents the directly maintained OBS recipe in an OBS packaging project, and is the only file needed there (triggering service runs updates the temporary tarball from git). -Beside that, `osc meta prjconf --edit` can be used to specify unambiguous -preferences for certain packages, when a distro actually offers a choice -via conditional `BuildRequires` statements, e.g.: +Beside that, a `_config` file in the OBS project repository or live settings +in `osc meta prjconf --edit` can be used to specify unambiguous preferences +for certain packages, when a distro actually offers a choice via conditional +`BuildRequires` statements (and other options), e.g.: ---- Prefer: libusbx-devel @@ -32,6 +33,9 @@ Prefer: libusb-1.0-dev Prefer: neon-devel ---- +* For more details on this, see + https://openbuildservice.org/help/manuals/obs-user-guide/cha-obs-prjconfig + A parent project must be used to define OBS Repositories we build for, which should usually include a layer with `openSUSE:Tools` to have the OBS helper scripts needed for package and tarball transformations in the build area, From bc3f1cde0b927f1771fb226c48d8a4390e435016 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Fri, 10 Oct 2025 13:30:47 +0200 Subject: [PATCH 593/805] scripts/obs/_config: track a copy of prjconf data Signed-off-by: Jim Klimov --- scripts/obs/_config | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 scripts/obs/_config diff --git a/scripts/obs/_config b/scripts/obs/_config new file mode 100644 index 0000000000..c53e0ce56c --- /dev/null +++ b/scripts/obs/_config @@ -0,0 +1,16 @@ +# OBS prjconf for NUT builds +# See https://openbuildservice.org/help/manuals/obs-user-guide/cha-obs-prjconfig + +# Unambiguous preference if "Requires: (A or B)" offered both hits: +Prefer: libusbx-devel +Prefer: libusb-1.0-dev +Prefer: neon-devel + +%if "x%{_repository}" == "xRaspbian_11" +%else +# Use ccache or sccache (let OBS pick its preference) for faster (re-)builds: +BuildFlags: useccache:nut +%endif + +# Embed GIT URL into package metadata: +BuildFlags: setvcs From 439afe51021661188707e3631eb5c4de6691794c Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Fri, 10 Oct 2025 13:57:35 +0200 Subject: [PATCH 594/805] scripts/obs/nut.spec: nut-monitor requires python-base Signed-off-by: Jim Klimov --- scripts/obs/nut.spec | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/obs/nut.spec b/scripts/obs/nut.spec index 658dcf4096..739b169e59 100644 --- a/scripts/obs/nut.spec +++ b/scripts/obs/nut.spec @@ -352,6 +352,7 @@ Detailed information about supported hardware can be found in Summary: Network UPS Tools Web Server Support (GUI client) Group: Hardware/UPS Requires: %{name} = %{version} +Requires: python-base BuildRequires: (python >= 2.6 or python3 or python2) BuildArch: noarch From db2576867830f7742a4b748da4a00fb16d3cfe85 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Fri, 10 Oct 2025 13:58:54 +0200 Subject: [PATCH 595/805] scripts/obs/nut.spec: hide %dir /var/log (we do not own it), suffice to mkdir it in build area to match our logrotate configuration Signed-off-by: Jim Klimov --- scripts/obs/nut.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/obs/nut.spec b/scripts/obs/nut.spec index 739b169e59..68ecfe2243 100644 --- a/scripts/obs/nut.spec +++ b/scripts/obs/nut.spec @@ -580,7 +580,7 @@ if [ -x /sbin/udevadm ] ; then /sbin/udevadm trigger --subsystem-match=usb --pro #% dir % {_mandir}/man8 #% dir % {_libexecdir} # FIXME: Detect from logrotate properties (or our scriptlet file)? -%dir /var/log +#% dir /var/log %if "x%{?systemdsystemunitdir}" == "x" %else %dir %{systemdsystemunitdir} From 6f31e24645ec231f4fb997d118b4827e1d143f37 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Fri, 10 Oct 2025 15:56:11 +0200 Subject: [PATCH 596/805] scripts/obs/nut.spec: update comment about python locations Signed-off-by: Jim Klimov --- scripts/obs/nut.spec | 3 +++ 1 file changed, 3 insertions(+) diff --git a/scripts/obs/nut.spec b/scripts/obs/nut.spec index 68ecfe2243..9d718e3d11 100644 --- a/scripts/obs/nut.spec +++ b/scripts/obs/nut.spec @@ -744,6 +744,9 @@ if [ -x /sbin/udevadm ] ; then /sbin/udevadm trigger --subsystem-match=usb --pro %defattr(-,root,root) # TODO: Actually package NUT-Monitor app and scripts where available # TODO: Detect path from chosen interpreter or NUT build config files? +# Maybe specify python version and location using RPM macros, see e.g. +# https://docs.redhat.com/en/documentation/red_hat_enterprise_linux/9/html/installing_and_using_dynamic_programming_languages/assembly_packaging-python-3-rpms_installing-and-using-dynamic-programming-languages +# Note we MAY be dual-packaging for several python versions and locations. /usr/lib*/python*/*-packages/* %files devel From 7147327ea40621b5073761f339ff8919e1f9feab Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Mon, 13 Oct 2025 02:22:34 +0200 Subject: [PATCH 597/805] scripts/obs/debian.rules: update for bleeding-edge CDBS that lacks many scripts Signed-off-by: Jim Klimov --- scripts/obs/debian.rules | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/scripts/obs/debian.rules b/scripts/obs/debian.rules index d3de4c2030..9ffeebbb9a 100755 --- a/scripts/obs/debian.rules +++ b/scripts/obs/debian.rules @@ -2,12 +2,15 @@ include /usr/share/cdbs/1/rules/debhelper.mk include /usr/share/cdbs/1/class/autotools.mk -include /usr/share/cdbs/1/class/python-module.mk +-include /usr/share/cdbs/1/class/python-module.mk -include /usr/share/cdbs/1/rules/autoreconf.mk +-include /usr/share/cdbs/1/rules/autoreconf.mk # CDBS has some issues detecting something other than dh_python2 # which is absent on Debian 12+ and Ubuntu 25.04 for example. +# This hack is broken for Debian Next in Oct 2025, as CDBS sheds +# a lot of older scripts and the helpers seem to get implemented +# somehow differently. ifeq (,$(shell command -v dh_python2 || which dh_python2 || dh_python2 --help)) ifneq (,$(shell command -v dh_python3 || which dh_python3 || dh_python3 --help)) ifneq (,$(shell command -v python3 || which python3 || python3 --help)) @@ -49,7 +52,7 @@ SO_MAJOR_LIBNUTSCAN=4 SO_MAJOR_LIBNUTCONF=0 # List any files which are not installed -include /usr/share/cdbs/1/rules/utils.mk +-include /usr/share/cdbs/1/rules/utils.mk common-binary-post-install-arch:: list-missing DEB_LDFLAGS_MAINT_APPEND=-Wl,-z,defs -Wl,-O1 -Wl,--as-needed From 0768fdf38bbeccce81a99e82b97b00ada39592ae Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Mon, 13 Oct 2025 03:16:24 +0200 Subject: [PATCH 598/805] scripts/obs/debian.rules: do not mislead about lack of dh_python2 due to our own tests Signed-off-by: Jim Klimov --- scripts/obs/debian.rules | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/obs/debian.rules b/scripts/obs/debian.rules index 9ffeebbb9a..ef8a2287c9 100755 --- a/scripts/obs/debian.rules +++ b/scripts/obs/debian.rules @@ -11,9 +11,9 @@ include /usr/share/cdbs/1/class/autotools.mk # This hack is broken for Debian Next in Oct 2025, as CDBS sheds # a lot of older scripts and the helpers seem to get implemented # somehow differently. -ifeq (,$(shell command -v dh_python2 || which dh_python2 || dh_python2 --help)) -ifneq (,$(shell command -v dh_python3 || which dh_python3 || dh_python3 --help)) -ifneq (,$(shell command -v python3 || which python3 || python3 --help)) +ifeq (,$(shell command -v dh_python2 || which dh_python2 || dh_python2 --help 2>/dev/null)) +ifneq (,$(shell command -v dh_python3 || which dh_python3 || dh_python3 --help 2>/dev/null)) +ifneq (,$(shell command -v python3 || which python3 || python3 --help 2>/dev/null)) cdbs_curpythonsystems := python3 endif endif From 7d2c99ef0729f4c065b4a121563b656d23091c63 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Mon, 13 Oct 2025 03:20:47 +0200 Subject: [PATCH 599/805] scripts/obs/debian.rules: make list-missing optional (absent in new cdbs) Signed-off-by: Jim Klimov --- scripts/obs/debian.rules | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/scripts/obs/debian.rules b/scripts/obs/debian.rules index ef8a2287c9..21b43e3613 100755 --- a/scripts/obs/debian.rules +++ b/scripts/obs/debian.rules @@ -51,9 +51,11 @@ SO_MAJOR_LIBNUTCLIENTSTUB=1 SO_MAJOR_LIBNUTSCAN=4 SO_MAJOR_LIBNUTCONF=0 +ifneq (,$(shell ls -1 /usr/share/cdbs/1/rules/utils.mk 2>/dev/null)) # List any files which are not installed --include /usr/share/cdbs/1/rules/utils.mk +include /usr/share/cdbs/1/rules/utils.mk common-binary-post-install-arch:: list-missing +endif DEB_LDFLAGS_MAINT_APPEND=-Wl,-z,defs -Wl,-O1 -Wl,--as-needed include /usr/share/dpkg/buildflags.mk From 28d1cdf239ea93ef6ed852ad0918b2199d86c875 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Tue, 14 Oct 2025 09:54:14 +0200 Subject: [PATCH 600/805] scripts/obs/nut.changes: isn't it a placeholder for RPM changelog? Signed-off-by: Jim Klimov --- ci_build.sh | 4 ++-- scripts/obs/_service | 2 +- scripts/obs/{debian.nut.changes => nut.changes} | 0 3 files changed, 3 insertions(+), 3 deletions(-) rename scripts/obs/{debian.nut.changes => nut.changes} (100%) diff --git a/ci_build.sh b/ci_build.sh index c78f2b7acc..5a19fd022b 100755 --- a/ci_build.sh +++ b/ci_build.sh @@ -2877,9 +2877,9 @@ pkg-rpm|pkg-spec) echo " Press Ctrl+C to abort if this is a problem" >&2 sleep 5 - rm -f nut.spec || true + rm -f nut.spec nut.changes || true git clean -fdX || true - cp -f scripts/obs/nut.spec . + cp -f scripts/obs/nut.spec scripts/obs/nut.changes . sed -e 's,^(Version:).*$,\1 '"`NUT_VERSION_QUERY=VER50 ./tools/gitlog2version.sh`," \ -i nut.spec rpmbuild -ba \ diff --git a/scripts/obs/_service b/scripts/obs/_service index 2cb090a9a4..81a37d0ecf 100644 --- a/scripts/obs/_service +++ b/scripts/obs/_service @@ -33,11 +33,11 @@ *.tar */scripts/obs/debian.* - + diff --git a/docs/man/asciidoc.conf.in b/docs/man/asciidoc.conf.in index e693fc0a5e..2365e84c65 100644 --- a/docs/man/asciidoc.conf.in +++ b/docs/man/asciidoc.conf.in @@ -88,4 +88,17 @@ Last updated {docdate} {doctime} -- Network UPS Tools {nutversion} // @license-end --> +# Match color of headers, that is included into final pages +# from the asciidoc distro, seek there for a file with e.g. +# "Shared CSS for AsciiDoc xhtml11 and html5 backends": + endif::backend-xhtml11[] From 5d3d5eb7069c04ef6032333e9686823f8729b144 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Fri, 21 Nov 2025 12:50:49 +0100 Subject: [PATCH 757/805] docs/man/nut.txt: update sentence markup; expand on built-in vs configurable use of user/group accounts at run-time Signed-off-by: Jim Klimov --- docs/man/nut.txt | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/docs/man/nut.txt b/docs/man/nut.txt index 2a48ad0f42..e420389382 100644 --- a/docs/man/nut.txt +++ b/docs/man/nut.txt @@ -32,13 +32,14 @@ release v2.8.3, it remains not 100% complete) so it is possible to run the whole server and client stack as native Windows programs. Most operating systems deliver NUT as packages built from a certain release, -which for the project is just a better-tested snapshot of on-going development. +which for the project is just a better-tested snapshot of on-going development +with an opinionated choice of build and run-time system configuration options. Some OS distribution maintainers pick fixes from later releases to update their software packages while nominally remaining on the same base line version that the distribution's major release originally went with. This allows to balance delivering stable programs with well-known qualities and minimal downsides for a long stretch of time, but misses out on new -capabilities, features (and yes, new bugs) which the on-going development +capabilities, features (and yes, new bugs), which the on-going development regularly adds to the current code base du-jour. As such, NUT community support for releases (or any other non-current code) @@ -247,12 +248,20 @@ User/Group Accounts ^^^^^^^^^^^^^^^^^^^ Generally NUT daemon programs avoid running as a highly-privileged `root` -account (on POSIX platforms), and drop privileges to run as the configured +account (on POSIX platforms), although they anticipate being started as such +(most system services are) and drop privileges to run as the configured user and group accounts such as `nut:nut`. * One notable exception is the linkman:upsmon[8] daemon which splits into a `root`-owned process which may trigger the OS shutdown routine, and an unprivileged process which does everything else. +* Default user and group accounts are built-in, selected as options for the + `configure` script when it prepares the build of NUT. Those settings can + be overridden by configuration file or command-line options of respective + NUT daemons, whether to run as a different unprivileged user account (it + may be possible to constrain each NUT service to run in their dedicated + accounts), or to remain capable of everything as `root` (rarely, drivers + are configured this way temporarily to troubleshoot local device access). File system permissions ^^^^^^^^^^^^^^^^^^^^^^^ @@ -268,7 +277,7 @@ for volatile implementations). Note that there are several run-time locations for data and socket files of NUT's privileged and unprivileged programs, and for configuration files. Access to these directories and individual files should be secured according -to NUT documentation; NUT daemons will warn about lax permissions in their +to NUT documentation. NUT daemons will warn about lax permissions in their syslog or console messages. Generally, `root:nut` and `0640` permissions are correct for most of the files (so the run-time NUT programs may only read them but can not rewrite them, not even if there happens to be an @@ -343,8 +352,8 @@ linkman:hosts.conf[5] and linkman:upsset.conf[5] for configuration, and `upsstats-single.html` and `upsstats.html` for HTML UI templates. Other clients, whether delivered by NUT project (linkman:NUT-Monitor[8] -GUI) or co-located (link:https://github.com/networkupstools/wmnut[WMNut]) -or third-party (see https://networkupstools.org/projects.html) would +GUI), or co-located (link:https://github.com/networkupstools/wmnut[WMNut]), +or third-party (see https://networkupstools.org/projects.html), would probably support saving their settings or "favorites". Do not forget to secure access to those files and their copies as well. From 5a966dc5fce9773abc61aaa6a3278345d2ce2c05 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Sat, 22 Nov 2025 20:35:56 +0100 Subject: [PATCH 758/805] scripts/upsdrvsvcctl/nut-driver-enumerator.sh.in, NEWS.adoc: revise message logging in the script [#3194] Signed-off-by: Jim Klimov --- NEWS.adoc | 4 + .../upsdrvsvcctl/nut-driver-enumerator.sh.in | 280 ++++++++++-------- 2 files changed, 168 insertions(+), 116 deletions(-) diff --git a/NEWS.adoc b/NEWS.adoc index b1649ed3e5..1652766201 100644 --- a/NEWS.adoc +++ b/NEWS.adoc @@ -238,6 +238,10 @@ several `FSD` notifications into one executed action. [PR #3097] from `upsmon` which calls `upssched`) as an environment variable into the ultimately executed `CMDSCRIPT` processes. [#3105] + - The `nut-driver-enumerator.sh` script (NDE) updates: + * Revised info/error/warning/debug message emission so they go to `stderr` + and have a consistent look. Revised some typos along the way. [issue #3194] + - `configure` script options: * For ages, most recipes for building NUT had customized the `sysconfdir` to be `/etc/nut`, which is not exactly the *system* configuration directory. diff --git a/scripts/upsdrvsvcctl/nut-driver-enumerator.sh.in b/scripts/upsdrvsvcctl/nut-driver-enumerator.sh.in index a6caff44c0..82e24cc21b 100644 --- a/scripts/upsdrvsvcctl/nut-driver-enumerator.sh.in +++ b/scripts/upsdrvsvcctl/nut-driver-enumerator.sh.in @@ -91,19 +91,55 @@ prefix="@prefix@" # during package build. But everyone has it the same from systemd defaults: [ -n "${SYSTEMD_CONFPATH-}" ] || SYSTEMD_CONFPATH="/etc/systemd/system" +# NOTE: We log whatever info traces to stderr, because many modes expect +# user/program consumable outputs on stdout. +shouldDebug() { + [ -n "$DEBUG" ] || [ "${NUT_DEBUG_LEVEL}" -gt 0 ] 2>/dev/null +} + +log_debug() { + # TODO: Provide an equivalent of upsdebugx and verbosity levels?.. + if shouldDebug ; then + echo "`TZ=UTC LANG=C date` [DEBUG] $@" >&2 + fi + return 0 +} + +log_info() { + echo "`TZ=UTC LANG=C date` [INFO] $@" >&2 +} + +log_warn() { + echo "`TZ=UTC LANG=C date` [WARNING] $@" >&2 +} + +log_error() { + echo "`TZ=UTC LANG=C date` [ERROR] $@" >&2 +} + +log_fatal() { + EXITCODE="$1" + if [ "${EXITCODE}" -ge 0 ] 2>/dev/null ; then + shift 1 + else + EXITCODE=1 + fi + echo "`TZ=UTC LANG=C date` [FATAL] $@" >&2 + exit $EXITCODE +} + if [ -n "$ZSH_VERSION" ]; then ### Problem: loops like `for UPS in $UPSLIST` do not separate ### the UPSLIST into many tokens but use it as one string. - echo "FATAL: zsh is not supported in this script" >&2 - exit 1 + log_fatal 1 "zsh is not supported in this script" +# FIXME: Try some more checks/solutions like these? # setopt noglob # setopt +F # IFS="`printf ' \t\r\n'`" ; export IFS fi if set | $EGREP '^(shell|version|t?csh)' | $EGREP 't?csh' >/dev/null ; then - echo "FATAL: csh or tcsh is not supported in this script" >&2 - exit 1 + log_fatal 1 "csh or tcsh is not supported in this script" fi # Third-party services to depend on (can be overridden by config file) @@ -151,8 +187,8 @@ SVCNAME_SMF="svc:/system/power/nut-driver" NUT_DRIVER_ENUMERATOR_CONF="${NUT_CONFPATH}/nut-driver-enumerator.conf" [ -s "${NUT_DRIVER_ENUMERATOR_CONF}" ] && \ - echo "Sourcing config file: ${NUT_DRIVER_ENUMERATOR_CONF}" && \ - . "${NUT_DRIVER_ENUMERATOR_CONF}" + log_info "Sourcing config file: ${NUT_DRIVER_ENUMERATOR_CONF}" && \ + . "${NUT_DRIVER_ENUMERATOR_CONF}" >&2 [ -z "${UPSCONF-}" ] && \ UPSCONF="${NUT_CONFPATH}/ups.conf" @@ -275,17 +311,15 @@ case "${SERVICE_FRAMEWORK-}" in hook_restart_drv="selftest_NOOP" ;; "") - echo "Error detecting the service-management framework on this OS" >&2 - exit 1 + log_fatal 1 "Error detecting the service-management framework on this OS" ;; *) - echo "Error: User provided an unknown service-management framework '$SERVICE_FRAMEWORK'" >&2 - exit 1 + log_fatal 1 "Error: User provided an unknown service-management framework '$SERVICE_FRAMEWORK'" ;; esac selftest_NOOP() { - echo "NO-OP: Self-testing context does not do systems configuration" >&2 + log_warn "NO-OP: Self-testing context does not do systems configuration" return 0 } @@ -504,7 +538,7 @@ $LINE" echo "$SECTION_CONTENT" fi - [ "$RES" = 0 ] || echo "ERROR: Section [$1] was not found in the '$UPSCONF' file" >&2 + [ "$RES" = 0 ] || log_error "Section [$1] was not found in the '$UPSCONF' file" return $RES } @@ -555,13 +589,13 @@ upsconf_getValue() { && VALUE="$(echo "$LINE" | sed -e "s,^$1=,," -e 's,^\"\(.*\)\"$,\1,' -e "s,^'\(.*\)'\$,\1,")" \ || RES_L=$? - [ "$RES_L" = 0 ] || { RES="$RES_L" ; echo "ERROR: Section [$CURR_SECTION] or key '$1' in it was not found in the '$UPSCONF' file" >&2 ; } + [ "$RES_L" = 0 ] || { RES="$RES_L" ; log_error "Section [$CURR_SECTION] or key '$1' in it was not found in the '$UPSCONF' file" ; } echo "$VALUE" shift done - [ "$RES" = 0 ] || echo "ERROR: Section [$CURR_SECTION] or key(s) '$KEYS' in it was not found in the '$UPSCONF' file" >&2 + [ "$RES" = 0 ] || log_error "ERROR: Section [$CURR_SECTION] or key(s) '$KEYS' in it was not found in the '$UPSCONF' file" return $RES } @@ -676,7 +710,7 @@ upsconf_list_dev_drv_socket_checksum() { # NOTE: Output column order matters, it is parsed e.g. to check # for driver-on-driver dependencies when adding services upslist_readFile_once && [ "${#UPSLIST_FILE}" != 0 ] \ - || { echo "No devices detected in '$UPSCONF'" >&2 ; return 1 ; } + || { log_warn "No devices detected in '$UPSCONF'" ; return 1 ; } # Use the section-driver-port subset if [ x"${AVOID_REPARSE}" != xyes ] ; then upslist_normalizeFile_once || return # Propagate errors upwards @@ -694,6 +728,8 @@ upsconf_debug() { _MED="`upsconf_getMedia "$1"`" _MD5="`upsconf_getSection_MD5 "$1"`" NAME_MD5="`calc_md5 "$1"`" + # Not public, not in usage() + # Used by tests, echo as formatted here to stdout echo "INST: ${NAME_MD5}~[$1]: DRV='${_DRV}' PORT='${_PRT}' MEDIA='${_MED}' SECTIONMD5='${_MD5}'" } @@ -744,7 +780,7 @@ smf_registerInstance() { smf_unregisterInstance "$SVCINST" fi /usr/sbin/svccfg -s nut-driver add "$SVCINST" || return ; } - echo "Added instance: 'nut-driver:$SVCINST' for NUT configuration section '$DEVICE'" >&2 + log_info "Added instance: 'nut-driver:$SVCINST' for NUT configuration section '$DEVICE'" DEPSVC="" DEPREQ="" @@ -763,12 +799,13 @@ smf_registerInstance() { drivers=*) ;; # Handled just below '') ;; # FIXME: modbus? sysfs like INA219? GPIO? Other local devices? - *) echo "WARNING: Unexpected NUT media type ignored: '${_MED}'" >&2 ;; + *) log_warn "WARNING: Unexpected NUT media type ignored: '${_MED}'" ;; esac case "${_MED}" in drivers=*|*,drivers=*) OTHERLIST="`upsconf_list_dev_drv_socket_checksum`" || OTHERLIST="" + # Not double-quoting here to iterate the string tokens: for DEPDRV in `echo "${_MED}" | sed -e 's/^\(.*,d\|d\)rivers=//' -e 's/,/ /g'` ; do case "${DEPDRV}" in *-*) # May be "drivername-upsname", where either sub-string @@ -782,7 +819,7 @@ smf_registerInstance() { case "${DEPDRV}" in *-"${OTHERDEV}") OTHERDRV="'`echo "${OTHERLIST}" | awk '($1 == "'"${OTHERDEV}"'") { print $2 }'`'" || OTHERDRV="" - echo "WARNING: Device ${DEVICE} depends on another as '${DEPDRV}', but the other possible device '${OTHERDEV}' uses an unexpected driver: ${OTHERDRV}" >&2 + log_warn "Device ${DEVICE} depends on another as '${DEPDRV}', but the other possible device '${OTHERDEV}' uses an unexpected driver: ${OTHERDRV}" ;; esac done @@ -795,7 +832,7 @@ smf_registerInstance() { if [ x"${OTHERDEV}" != x ] && (echo "$OTHERLIST" | $EGREP "^${OTHERDEV}\t") >/dev/null ; then DEPSVC="$DEPSVC ${SVCNAME_SMF}${SVCNAMESEP_SMF}`smf_validInstanceName ${OTHERDEV}`" else - echo "WARNING: Device ${DEVICE} depends on another ${DEPDRV} but we did not find a config section for it" >&2 + log_warn "Device ${DEVICE} depends on another ${DEPDRV} but we did not find a config section for it" fi done if [ x"`echo "$DEPSVC" | tr -d ' '`" != x ] ; then DEPREQ="$DEPREQ_DRV_FULL_SMF" ; fi @@ -805,7 +842,7 @@ smf_registerInstance() { TARGET_FMRI="nut-driver:$SVCINST" if [ -n "$DEPSVC" ]; then [ -n "$DEPREQ" ] || DEPREQ="optional_all" - echo "Adding '$DEPREQ' dependency for '$SVCINST' on '$DEPSVC'..." + log_info "Adding '$DEPREQ' dependency for '$SVCINST' on '$DEPSVC'..." # NOTE: it seems (at least as of Solaris 11) that the fmri: definition # below (especially when there are many dependency FMRI's) must be a @@ -817,7 +854,7 @@ smf_registerInstance() { /usr/sbin/svccfg -s "$TARGET_FMRI" setprop "$DEPPG"/restart_on = astring: "$RESTARTON" && \ /usr/sbin/svccfg -s "$TARGET_FMRI" setprop "$DEPPG"/type = astring: service && \ /usr/sbin/svccfg -s "$TARGET_FMRI" setprop "$DEPPG"/entities = fmri: "(" $DEPSVC ")" && \ - echo "OK" || echo "FAILED to define the dependency" >&2 + log_info "OK: Defined the '$DEPREQ' dependency for '$SVCINST' on '$DEPSVC'" || log_error "FAILED to define the '$DEPREQ' dependency for '$SVCINST' on '$DEPSVC'" fi smf_setSavedMD5 "$SVCINST" "`upsconf_getSection_MD5 "$DEVICE"`" @@ -829,11 +866,11 @@ smf_registerInstance() { if [ "$AUTO_START" = yes ] ; then /usr/sbin/svcadm clear "${TARGET_FMRI}" 2>/dev/null || true /usr/sbin/svcadm enable "${TARGET_FMRI}" || return - echo "Started instance: 'nut-driver:$SVCINST' for NUT configuration section '$DEVICE'" >&2 + log_info "Started instance: 'nut-driver:$SVCINST' for NUT configuration section '$DEVICE'" fi } smf_unregisterInstance() { - echo "Removing instance: 'nut-driver:$1' ..." >&2 + log_info "Removing instance: 'nut-driver:$1' ..." /usr/sbin/svcadm disable -ts 'nut-driver:'"$1" || false /usr/sbin/svccfg -s nut-driver delete "$1" } @@ -906,11 +943,11 @@ smf_setSavedUniq() { *) __TYPE="${__TYPE}:" ;; esac __VAL="$5" - echo "Stashing service property '${__PG}/${__PROP}' of '${__TARGET_FMRI}'..." + log_info "Stashing service property '${__PG}/${__PROP}' of '${__TARGET_FMRI}'..." /usr/sbin/svccfg -s "${__TARGET_FMRI}" delprop "${__PG}" 2>/dev/null || true /usr/sbin/svccfg -s "${__TARGET_FMRI}" addpg "${__PG}" application && \ /usr/sbin/svccfg -s "${__TARGET_FMRI}" setprop "${__PG}/${__PROP}" = "${__TYPE}" "${__VAL}" - [ $? = 0 ] && echo "OK" || { echo "FAILED to stash the service property ${__PG}/${__PROP}">&2 ; return 1 ; } + [ $? = 0 ] && log_info "OK: Stashed the service property ${__PG}/${__PROP}" || { log_error "FAILED to stash the service property ${__PG}/${__PROP}" ; return 1 ; } case "${__TARGET_FMRI}" in svc:/*:*) ;; # A service instance by full FMRI, refresh @@ -958,34 +995,36 @@ smf_setDocLink() { #tm_man_nwamd8/title astring nwamd __PG="tm_doc_${__DRV}_Page" - echo "Stashing service property group '${__PG}' of '${__TARGET_FMRI}' for online docs..." + log_info "Stashing service property group '${__PG}' for '${__TARGET_FMRI}' for online docs..." /usr/sbin/svccfg -s "${__TARGET_FMRI}" delprop "${__PG}" 2>/dev/null || true /usr/sbin/svccfg -s "${__TARGET_FMRI}" addpg "${__PG}" template && \ /usr/sbin/svccfg -s "${__TARGET_FMRI}" setprop "${__PG}/name" = "astring:" "\"${__DRV} online\"" && \ /usr/sbin/svccfg -s "${__TARGET_FMRI}" setprop "${__PG}/uri" = "astring:" "${NUT_WEBSITE_BASE}/docs/man/${__DRV}.html" - [ $? = 0 ] && echo "OK" || { echo "FAILED to stash the service property group '${__PG}' for online docs">&2 ; return 1 ; } + [ $? = 0 ] && log_info "OK: Stashed the service property group '${__PG}' for '${__TARGET_FMRI}' for online docs" \ + || { log_error "FAILED to stash the service property group '${__PG}' for '${__TARGET_FMRI}' for online docs" ; return 1 ; } __PG="tm_man_${__DRV}@MAN_SECTION_CMD_SYS@" - echo "Stashing service property group '${__PG}' for '${__TARGET_FMRI}' for local docs..." + log_info "Stashing service property group '${__PG}' for '${__TARGET_FMRI}' for local docs..." /usr/sbin/svccfg -s "${__TARGET_FMRI}" delprop "${__PG}" 2>/dev/null || true /usr/sbin/svccfg -s "${__TARGET_FMRI}" addpg "${__PG}" template && \ /usr/sbin/svccfg -s "${__TARGET_FMRI}" setprop "${__PG}/manpath" = "astring:" "@NUT_MANDIR@" && \ /usr/sbin/svccfg -s "${__TARGET_FMRI}" setprop "${__PG}/section" = "astring:" "@MAN_SECTION_CMD_SYS@" && \ /usr/sbin/svccfg -s "${__TARGET_FMRI}" setprop "${__PG}/title" = "astring:" "${__DRV}" - [ $? = 0 ] && echo "OK" || { echo "FAILED to stash the service property group '${__PG}' for local docs">&2 ; return 1 ; } + [ $? = 0 ] && log_info "OK: Stashed the service property group '${__PG}' for '${__TARGET_FMRI}' for local docs" \ + || { log_error "FAILED to stash the service property group '${__PG}' for '${__TARGET_FMRI}' for local docs" ; return 1 ; } unset __DRV __PG __TARGET_FMRI - [ $? = 0 ] || { echo "FAILED to stash the device doc links">&2 ; return 1 ; } + [ $? = 0 ] || { log_error "FAILED to stash the device doc links" ; return 1 ; } } smf_restart_upsd() { - echo "Reloading or restarting NUT data server to make sure it knows new configuration..." + log_info "Reloading or restarting NUT data server to make sure it knows new configuration..." /usr/sbin/svcadm enable "nut-server" 2>/dev/null /usr/sbin/svcadm clear "nut-server" 2>/dev/null /usr/sbin/svcadm refresh "nut-server" || \ /usr/sbin/svcadm restart "nut-server" } smf_restart_drv() { - echo "Reloading or restarting NUT driver instance '$1' to make sure it knows new configuration..." + log_info "Reloading or restarting NUT driver instance '$1' to make sure it knows new configuration..." /usr/sbin/svcadm enable "nut-driver:$1" 2>/dev/null /usr/sbin/svcadm clear "nut-driver:$1" 2>/dev/null /usr/sbin/svcadm refresh "nut-driver:$1" || \ @@ -1011,21 +1050,21 @@ systemd_registerInstance() { SVCINST="$1" /bin/systemctl enable 'nut-driver@'"$DEVICE".service || \ { if /bin/systemctl list-unit-files | awk '$2 == "masked" {print $1}' | $EGREP "^nut-driver@${DEVICE}.service$"; then - echo "SKIP: Unit 'nut-driver@${DEVICE}.service' seems deliberately masked" >&2 + log_warn "SKIP: Unit 'nut-driver@${DEVICE}.service' seems deliberately masked" return 0 fi - echo "RETRY with validInstanceName of '$1'" >&2 + log_warn "RETRY with validInstanceName of '$1'" SVCINST="`systemd_validInstanceName "$1"`" && \ /bin/systemctl enable 'nut-driver@'"$SVCINST".service || { RES=$? if /bin/systemctl list-unit-files | awk '$2 == "masked" {print $1}' | $EGREP "^nut-driver@${SVCINST}.service$"; then - echo "SKIP: Unit 'nut-driver@${SVCINST}.service' seems deliberately masked" >&2 + log_warn "SKIP: Unit 'nut-driver@${SVCINST}.service' seems deliberately masked" return 0 fi return $RES } } - echo "Enabled instance: 'nut-driver@$SVCINST' for NUT configuration section '$DEVICE'" >&2 + log_info "Enabled instance: 'nut-driver@$SVCINST' for NUT configuration section '$DEVICE'" DEPSVC="" DEPREQ="" @@ -1046,12 +1085,13 @@ systemd_registerInstance() { drivers=*) ;; # Handled just below '') ;; # FIXME: modbus? sysfs like INA219? GPIO? Other local devices? - *) echo "WARNING: Unexpected NUT media type ignored: '${_MED}'" >&2 ;; + *) log_warn "Unexpected NUT media type ignored: '${_MED}'" ;; esac case "${_MED}" in drivers=*|*,drivers=*) OTHERLIST="`upsconf_list_dev_drv_socket_checksum`" || OTHERLIST="" + # Not double-quoting here to iterate the string tokens: for DEPDRV in `echo "${_MED}" | sed -e 's/^\(.*,d\|d\)rivers=//' -e 's/,/ /g'` ; do case "${DEPDRV}" in *-*) # May be "drivername-upsname", where either sub-string @@ -1065,7 +1105,7 @@ systemd_registerInstance() { case "${DEPDRV}" in *-"${OTHERDEV}") OTHERDRV="'`echo "${OTHERLIST}" | awk '($1 == "'"${OTHERDEV}"'") { print $2 }'`'" || OTHERDRV="" - echo "WARNING: Device ${DEVICE} depends on another as '${DEPDRV}', but the other possible device '${OTHERDEV}' uses an unexpected driver: ${OTHERDRV}" >&2 + log_warn "Device ${DEVICE} depends on another as '${DEPDRV}', but the other possible device '${OTHERDEV}' uses an unexpected driver: ${OTHERDRV}" ;; esac done @@ -1078,7 +1118,7 @@ systemd_registerInstance() { if [ x"${OTHERDEV}" != x ] && (echo "$OTHERLIST" | $EGREP "^${OTHERDEV}\t") >/dev/null ; then DEPSVC="$DEPSVC ${SVCNAME_SYSTEMD}${SVCNAMESEP_SYSTEMD}`systemd_validInstanceName ${OTHERDEV}`" else - echo "WARNING: Device ${DEVICE} depends on another ${DEPDRV} but we did not find a config section for it" >&2 + log_warn "Device ${DEVICE} depends on another ${DEPDRV} but we did not find a config section for it" fi done if [ x"`echo "$DEPSVC" | tr -d ' '`" != x ] ; then DEPREQ="$DEPREQ_DRV_FULL_SYSTEMD" ; fi @@ -1087,7 +1127,7 @@ systemd_registerInstance() { if [ -n "$DEPSVC" ]; then [ -n "$DEPREQ" ] || DEPREQ="#Wants" - echo "Adding '$DEPREQ'+After dependency for '$SVCINST' on '$DEPSVC'..." + log_info "Adding '$DEPREQ'+After dependency for '$SVCINST' on '$DEPSVC'..." mkdir -p "${SYSTEMD_CONFPATH}/nut-driver@$SVCINST.service.d" && \ cat > "${SYSTEMD_CONFPATH}/nut-driver@$SVCINST.service.d/nut-driver-enumerator-generated.conf" <&2 + [ $? = 0 ] && log_info "OK: Defined the '$DEPREQ'+After dependency for '$SVCINST' on '$DEPSVC'" || log_error "FAILED to define the '$DEPREQ'+After dependency for '$SVCINST' on '$DEPSVC'" fi systemd_setSavedMD5 "$SVCINST" "`upsconf_getSection_MD5 "$DEVICE"`" @@ -1105,13 +1145,13 @@ EOF systemd_setDocLink "$SVCINST" "$DEVICE" if [ "$AUTO_START" = yes ] ; then - systemd_refreshSupervizor || echo "WARNING: Somehow managed to fail systemd_refreshSupervizor()" >&2 + systemd_refreshSupervizor || log_warn "Somehow managed to fail systemd_refreshSupervizor()" $TIMEOUT_CMD $TIMEOUT_ARGS /bin/systemctl start --no-block 'nut-driver@'"$SVCINST".service || return - echo "Started instance: 'nut-driver@$SVCINST' for NUT configuration section '$DEVICE'" >&2 + log_info "Started instance: 'nut-driver@$SVCINST' for NUT configuration section '$DEVICE'" fi } systemd_unregisterInstance() { - echo "Removing instance: 'nut-driver@$1' ..." >&2 + log_info "Removing instance: 'nut-driver@$1' ..." $TIMEOUT_CMD $TIMEOUT_ARGS /bin/systemctl stop 'nut-driver@'"$1".service || \ $TIMEOUT_CMD $TIMEOUT_ARGS /bin/systemctl stop 'nut-driver@'"$1".service || \ $TIMEOUT_CMD $TIMEOUT_ARGS /bin/systemctl stop 'nut-driver@'"$1".service || false @@ -1136,7 +1176,7 @@ systemd_getSavedMD5() { PROPFILE="${SYSTEMD_CONFPATH}/nut-driver@$1.service.d/nut-driver-enumerator-generated-checksum.conf" [ -s "${PROPFILE}" ] \ && $GREP "Environment='$PROP=" "${PROPFILE}" | sed -e "s,^Environment='$PROP=,," -e "s,'\$,," \ - || { echo "Did not find '${PROPFILE}' with a $PROP" ; return 1; } + || { log_warn "Did not find '${PROPFILE}' with a $PROP" ; return 1; } } systemd_findSavedDeviceName() { # Returns long service instance name which has DEVICE=="$1" @@ -1160,25 +1200,26 @@ systemd_getSavedDeviceName() { PROPFILE="${SYSTEMD_CONFPATH}/nut-driver@$1.service.d/nut-driver-enumerator-generated-devicename.conf" [ -s "${PROPFILE}" ] \ && $GREP "Environment='$PROP=" "${PROPFILE}" | sed -e "s,^Environment='$PROP=,," -e "s,'\$,," -e 's,^"\(.*\)"$,\1,' \ - || { echo "Did not find '${PROPFILE}' with a $PROP" ; return 1; } + || { log_warn "Did not find '${PROPFILE}' with a $PROP" ; return 1; } } systemd_setSavedDeviceName() { # Save device (config section) name $2 into service instance $1 [ -n "$1" ] || return # No-op for global section - echo "Saving device (config section) name $2 into service instance $...1" + log_info "Saving device (config section) name $2 into service instance $1..." PROPFILE="${SYSTEMD_CONFPATH}/nut-driver@$1.service.d/nut-driver-enumerator-generated-devicename.conf" mkdir -p "${SYSTEMD_CONFPATH}/nut-driver@$1.service.d" && \ cat > "${PROPFILE}" << EOF [Service] Environment='DEVICE="$2"' EOF - [ $? = 0 ] && echo "OK" || { echo "FAILED to stash the device name">&2 ; return 1 ; } + [ $? = 0 ] && log_info "OK: Stashed the device name" \ + || { log_error "FAILED to stash the device name" ; return 1 ; } } systemd_setDocLink() { # Save documentation links for driver of device (config section) named $2 # into service instance $1 [ -n "$1" ] || return # No-op for global section - echo "Saving documentation links for driver of device (config section) named $2 into service instance $1..." + log_info "Saving documentation links for driver of device (config section) named $2 into service instance $1..." PROPFILE="${SYSTEMD_CONFPATH}/nut-driver@$1.service.d/nut-driver-enumerator-generated-doclink.conf" mkdir -p "${SYSTEMD_CONFPATH}/nut-driver@$1.service.d" && \ __DRV="`upsconf_getDriver "$2"`" @@ -1188,30 +1229,32 @@ Documentation=man:${__DRV}(@MAN_SECTION_CMD_SYS@) Documentation=${NUT_WEBSITE_BASE}/docs/man/${__DRV}.html EOF unset __DRV - [ $? = 0 ] && echo "OK" || { echo "FAILED to stash the device name">&2 ; return 1 ; } + [ $? = 0 ] && log_info "OK: Saved documentation links for driver of device (config section) named $2 into service instance $1" \ + || { log_error "FAILED to save the documentation links" ; return 1 ; } } systemd_setSavedMD5() { # Save checksum value $2 into service instance $1 PROP="SECTION_CHECKSUM" [ -n "$1" ] || PROP="SECTION_CHECKSUM_GLOBAL" - echo "Saving checksum value $2 into service instance $1..." + log_info "Saving checksum value $2 into service instance $1..." PROPFILE="${SYSTEMD_CONFPATH}/nut-driver@$1.service.d/nut-driver-enumerator-generated-checksum.conf" mkdir -p "${SYSTEMD_CONFPATH}/nut-driver@$1.service.d" && \ cat > "${PROPFILE}" << EOF [Service] Environment='$PROP=$2' EOF - [ $? = 0 ] && echo "OK" || { echo "FAILED to stash the checksum">&2 ; return 1 ; } + [ $? = 0 ] && log_info "OK: Stashed the checksum" \ + || { log_error "FAILED to stash the checksum" ; return 1 ; } } systemd_restart_upsd() { # Do not restart/reload if not already running case "`/bin/systemctl is-active "nut-server"`" in active|unknown) ;; # unknown meant "starting" in our testing... - failed) echo "Note: nut-server unit was 'failed' - not disabled by user, so (re)starting it (probably had no config initially)" >&2 ;; + failed) log_warn "Note: nut-server unit was 'failed' - not disabled by user, so (re)starting it (probably had no config initially)" ;; *) return 0 ;; esac - echo "Reloading or restarting NUT data server to make sure it knows new configuration..." + log_info "Reloading or restarting NUT data server to make sure it knows new configuration..." # Note: reload is a better way to go about this, so the # data service is not interrupted by re-initialization # of the daemon. But systemd/systemctl sometimes stalls... @@ -1227,7 +1270,7 @@ systemd_restart_drv() { *) return 0 ;; esac - echo "Reloading or restarting NUT driver instance '$1' to make sure it knows new configuration..." + log_info "Reloading or restarting NUT driver instance '$1' to make sure it knows new configuration..." # Full restart, e.g. in case we changed the user= in configs # however let "reload" try, in case we changed something that @@ -1272,11 +1315,12 @@ upslist_normalizeFile() { UPSCONF_DATA_SDP="" if [ -n "$UPSCONF" ] && [ -f "$UPSCONF" ] && [ -r "$UPSCONF" ]; then [ ! -s "$UPSCONF" ] \ - && echo "WARNING: The '$UPSCONF' file exists but is empty" >&2 \ + && log_warn "The '$UPSCONF' file exists but is empty" \ && return 0 # Ok to continue - we may end up removing all instances else - echo "FATAL: The '$UPSCONF' file does not exist or is not readable" >&2 + # TOTHINK: log_fatal() right away? + log_error "The '$UPSCONF' file does not exist or is not readable" return 2 fi @@ -1288,7 +1332,7 @@ upslist_normalizeFile() { && UPSCONF_DATA_SDP="`$EGREP '^(\[.*\]|driver=|port=)' << EOF $UPSCONF_DATA EOF`" \ - || { echo "Error reading the '$UPSCONF' file or it does not declare any device configurations: nothing left after normalization" >&2 + || { log_error "Could not read the '$UPSCONF' file or it does not declare any device configurations: nothing left after normalization" UPSCONF_DATA="" UPSCONF_DATA_SDP="" } @@ -1319,7 +1363,7 @@ upslist_readFile() { UPSLIST_FILE="$(echo "$UPSCONF_DATA_SDP" | $EGREP '^\[[^'"$TABCHAR"'\ ]*\]$' | sed 's,^\[\(.*\)\]$,\1,' | sort -k1n -k1)" \ || UPSLIST_FILE="" if [ "${#UPSLIST_FILE}" = 0 ] ; then - echo "Error reading the '$UPSCONF' file or it does not declare any device configurations: no section declarations in parsed normalized contents" >&2 + log_error "Could not read the '$UPSCONF' file or it does not declare any device configurations: no section declarations in parsed normalized contents" fi fi # Ok to continue with empty results - we may end up removing all instances @@ -1338,7 +1382,7 @@ upslist_readSvcs() { if [ "${#UPSLIST_SVCS}" = 0 ] && [ "$1" != "-" ] ; then EXPLAIN="" [ -z "$1" ] || EXPLAIN=" - $1" - echo "Error reading the list of ${SERVICE_FRAMEWORK-} service instances for UPS drivers, or none are defined${EXPLAIN}" >&2 + log_error "Could not read the list of ${SERVICE_FRAMEWORK-} service instances for UPS drivers, or none are defined${EXPLAIN}" # Ok to continue - we may end up defining new instances fi } @@ -1359,7 +1403,7 @@ upslist_addSvcs() { if common_isRegistered "$UPSF" ; then true else - echo "Adding new ${SERVICE_FRAMEWORK} service instance for power device [${UPSF}]..." >&2 + log_info "Adding new ${SERVICE_FRAMEWORK} service instance for power device [${UPSF}]..." $hook_registerInstance "$UPSF" fi done @@ -1370,7 +1414,7 @@ upslist_delSvcs() { if common_isFiled "$UPSS" ; then true else - echo "Dropping old ${SERVICE_FRAMEWORK} service instance for power device [${UPSS}] which is no longer in config file..." >&2 + log_info "Dropping old ${SERVICE_FRAMEWORK} service instance for power device [${UPSS}] which is no longer in config file..." $hook_unregisterInstance "$UPSS" fi done @@ -1393,14 +1437,14 @@ RECONFIGURATION_SIGNALS="1" TERMINATE_ASAP=false trap_handle_interruption_exit() { # Handle SIGINT, SIGQUIT, SIGTERM with a message - echo "`date -u` : Received an interruption signal, terminating the script now" >&2 - exit 0 + log_fatal 0 "Received an interruption signal, terminating the script now" } trap_handle_interruption() { # Handle SIGINT, SIGQUIT, SIGTERM gracefully - tell the main # iteration to complete and just then abort - echo "`date -u` : Received an interruption signal, will terminate the script after ending the main routine. Repeat the signal if urgent!" >&2 + # Sub-shell "log_fatal" to get a standard message but not exit right now: + log_fatal 0 "Received an interruption signal, will terminate the script after ending the main routine. Repeat the signal if urgent!" || true TERMINATE_ASAP=true trap 'trap_handle_interruption_exit' $TERMINATION_SIGNALS } @@ -1422,7 +1466,7 @@ nut_driver_enumerator_main() { # device sections yet) we do not want to spend time and log storage to # parse again and complain again. RESTART_ALL=no - AVOID_REPARSE=yes upssvcconf_checksum_unchanged "" || { echo "`date -u` : Detected changes in global section of '$UPSCONF', will restart all drivers"; RESTART_ALL=yes; } + AVOID_REPARSE=yes upssvcconf_checksum_unchanged "" || { log_info "Detected changes in global section of '$UPSCONF', will restart all drivers"; RESTART_ALL=yes; } # Quickly exit if there's nothing to do (both lists empty or equal); note # the lists are pre-sorted. Otherwise a non-zero exit will be done below. @@ -1439,7 +1483,7 @@ nut_driver_enumerator_main() { && upslist_equals "$UPSLIST_FILE" "$UPSLIST_SVCS" ; \ } ; } \ && if [ -z "$DAEMON_SLEEP" -o "${VERBOSE_LOOP}" = yes ] ; then \ - echo "`date -u` : OK: No changes to reconcile between ${SERVICE_FRAMEWORK} service instances and device configurations in '$UPSCONF'" ; \ + log_info "OK: No changes to reconcile between ${SERVICE_FRAMEWORK} service instances and device configurations in '$UPSCONF'" ; \ fi \ && [ "$RESTART_ALL" = no ] && return 0 @@ -1447,11 +1491,11 @@ nut_driver_enumerator_main() { # compared to older runs (stashed in service instance configurations). if [ "${#NEW_CHECKSUM}" = 0 ]; then if [ "${VERBOSE_LOOP}" = yes ] ; then - echo "`date -u` : No changes to reconcile between *contents* of ${SERVICE_FRAMEWORK} service instances and device configurations in '$UPSCONF', but the *list* of instances vs. devices seems to have changed" + log_info "No changes to reconcile between *contents* of ${SERVICE_FRAMEWORK} service instances and device configurations in '$UPSCONF', but the *list* of instances vs. devices seems to have changed" fi else if [ "${VERBOSE_LOOP}" = yes ] ; then - echo "`date -u` : Got some changes to reconcile between ${SERVICE_FRAMEWORK} service instances and device configurations in '$UPSCONF', content checksums changed for: `echo ${NEW_CHECKSUM} | tr '\n' ' '`" + log_info "Got some changes to reconcile between ${SERVICE_FRAMEWORK} service instances and device configurations in '$UPSCONF', content checksums changed for: `echo ${NEW_CHECKSUM} | tr '\n' ' '`" fi for UPSS in $NEW_CHECKSUM ; do # NOTE: Pedantically, UPSS is a service instance name, @@ -1466,18 +1510,18 @@ nut_driver_enumerator_main() { # we are OK to proceed without re-defining # and restarting the driver service instance. if [ "${VERBOSE_LOOP}" = yes ] ; then - echo "`date -u` : Reloading ${SERVICE_FRAMEWORK} service instance '${UPSS}' whose section '${CURR_DEV}' in config file has changed: calling driver program '${CURR_DRV}' for the low-level work..." >&2 + log_info "Reloading ${SERVICE_FRAMEWORK} service instance '${UPSS}' whose section '${CURR_DEV}' in config file has changed: calling driver program '${CURR_DRV}' for the low-level work..." fi "@DRVPATH@/$CURR_DRV" -a "${CURR_DEV}" -c reload-or-error >/dev/null 2>/dev/null \ || { if [ "${VERBOSE_LOOP}" = yes ] ; then sleep 1; "@DRVPATH@/$CURR_DRV" -a "${CURR_DEV}" -c reload-or-error >&2 ; fi; } \ && DO_UNREGISTER=no fi if [ "$DO_UNREGISTER" = yes ] ; then - echo "Dropping old ${SERVICE_FRAMEWORK} service instance '${UPSS}' whose section '${CURR_DEV}' in config file has changed..." >&2 + log_info "Dropping old ${SERVICE_FRAMEWORK} service instance '${UPSS}' whose section '${CURR_DEV}' in config file has changed..." $hook_unregisterInstance "$UPSS" # Re-registration to reconcile below should set the "saved" values else - echo "Keeping ${SERVICE_FRAMEWORK} service instance '${UPSS}' whose section '${CURR_DEV}' in config file has changed: live reload sufficed. Saving updated info into service properties." >&2 + log_info "Keeping ${SERVICE_FRAMEWORK} service instance '${UPSS}' whose section '${CURR_DEV}' in config file has changed: live reload sufficed. Saving updated info into service properties." $hook_setSavedMD5 "$UPSS" "`upsconf_getSection_MD5 "${CURR_DEV}"`" # TOTHINK: This is already there, else we redefine units for bigger discrepancies? # $hook_setSavedDeviceName "$UPSS" "${CURR_DEV}" @@ -1511,14 +1555,14 @@ nut_driver_enumerator_main() { upslist_readSvcs if [ "${#UPSLIST_SVCS}" != 0 ] ; then - echo "=== The currently defined service instances are:" + log_info "The currently defined service instances are:" echo "$UPSLIST_SVCS" - fi + fi >&2 if [ "${#UPSLIST_FILE}" != 0 ] ; then - echo "=== The currently defined configurations in '$UPSCONF' are:" + log_info "The currently defined configurations in '$UPSCONF' are:" echo "$UPSLIST_FILE" - fi + fi >&2 # We had some changes to the config file; upsd must be made aware if [ "$AUTO_START" = yes ] ; then @@ -1540,7 +1584,7 @@ nut_driver_enumerator_main() { # NOTE: even if daemonized, the sleep between iterations # can be configured into an uncomfortably long lag, so # we should re-sync the system config in any case. - echo "`date -u` : '$UPSCONF' changed while $0 $* was processing its older contents; re-running the script to pick up the late-coming changes" + log_info "'$UPSCONF' changed while $0 $* was processing its older contents; re-running the script to pick up the late-coming changes" # Make sure the cycle does not repeat itself due to diffs # from an ages-old state of the file from when we started. UPSCONF_CHECKSUM_START="$UPSCONF_CHECKSUM_END" @@ -1550,7 +1594,7 @@ nut_driver_enumerator_main() { fi if [ "$UPSLIST_EQ_RES" = 0 ] ; then - echo "`date -u` : OK: No more changes to reconcile between ${SERVICE_FRAMEWORK} service instances and device configurations in '$UPSCONF'" + log_info "OK: No more changes to reconcile between ${SERVICE_FRAMEWORK} service instances and device configurations in '$UPSCONF'" [ "${REPORT_RESTART_42-}" = no ] && return 0 || return 42 fi return 13 @@ -1565,7 +1609,7 @@ nut_driver_enumerator_full_reconfigure() { if [ "${#UPSLIST_SVCS}" != 0 ]; then for UPSS in $UPSLIST_SVCS ; do - echo "Dropping old ${SERVICE_FRAMEWORK} service instance for power device [${UPSS}] to reconfigure the service unit..." >&2 + log_info "Dropping old ${SERVICE_FRAMEWORK} service instance for power device [${UPSS}] to reconfigure the service unit..." $hook_unregisterInstance "$UPSS" done upslist_readSvcs "after dropping" @@ -1583,14 +1627,14 @@ nut_driver_enumerator_full_reconfigure() { $hook_refreshSupervizor if [ "${#UPSLIST_SVCS}" != 0 ] ; then - echo "=== The currently defined service instances are:" + log_info "The currently defined service instances are:" echo "$UPSLIST_SVCS" - fi + fi >&2 if [ "${#UPSLIST_FILE}" != 0 ] ; then - echo "=== The currently defined configurations in '$UPSCONF' are:" + log_info "The currently defined configurations in '$UPSCONF' are:" echo "$UPSLIST_FILE" - fi + fi >&2 # We had some changes to the config file; upsd must be made aware if [ "$AUTO_START" = yes ] ; then @@ -1609,13 +1653,13 @@ nut_driver_enumerator_full_reconfigure() { # at just the wrong moment. UPSCONF_CHECKSUM_END="`calc_md5_file "$UPSCONF"`" || true if [ "$UPSCONF_CHECKSUM_END" != "$UPSCONF_CHECKSUM_START" ] ; then - echo "`date -u` : '$UPSCONF' changed while $0 $* was processing its older contents; re-running the script to pick up and reconcile the late-coming changes" + log_info "'$UPSCONF' changed while $0 $* was processing its older contents; re-running the script to pick up and reconcile the late-coming changes" nut_driver_enumerator_main ; return $? # The "main" routine will do REPORT_RESTART_42 logic too fi if [ "$UPSLIST_EQ_RES" = 0 ] ; then - echo "`date -u` : OK: No more changes to reconcile between ${SERVICE_FRAMEWORK} service instances and device configurations in '$UPSCONF'" + log_info "OK: No more changes to reconcile between ${SERVICE_FRAMEWORK} service instances and device configurations in '$UPSCONF'" [ "${REPORT_RESTART_42-}" = no ] && return 0 || return 42 fi @@ -1625,11 +1669,11 @@ nut_driver_enumerator_full_reconfigure() { list_services_for_devices() { FINAL_RES=0 upslist_readFile_once && [ "${#UPSLIST_FILE}" != 0 ] \ - || { echo "No devices detected in '$UPSCONF'" >&2 ; return 1 ; } + || { log_warn "No devices detected in '$UPSCONF'" ; return 1 ; } upslist_readSvcs "by user request" && [ "${#UPSLIST_SVCS}" != 0 ] \ - || { echo "No service instances detected" >&2 ; return 1; } + || { log_warn "No service instances detected" ; return 1; } UPSLIST_SVCS_RAW="`$hook_listInstances_raw`" && [ "${#UPSLIST_SVCS_RAW}" != 0 ] \ - || { echo "No service units detected" >&2 ; return 1; } + || { log_warn "No service units detected" ; return 1; } for DEV in $UPSLIST_FILE ; do vINST="`$hook_validInstanceName "$DEV"`" vUNITD="`$hook_validFullUnitName "$DEV"`" @@ -1655,7 +1699,7 @@ list_services_for_devices() { done fi done - echo "WARNING: no service instances detected that match device '$DEV'" >&2 + log_warn "No service instances detected that match device '$DEV'" FINAL_RES=1 done return $FINAL_RES @@ -1676,11 +1720,11 @@ list_services_for_devices_once() { } get_device_for_service() { - [ -z "$1" ] && echo "Service (instance) name argument required" >&2 && return 1 + [ -z "$1" ] && { log_error "Service (instance) name argument required"; return 1; } # Instance name can be a hash or "native" NUT section name SVC="`$hook_validInstanceSuffixName "$1"`" && [ -n "$SVC" ] \ - || { echo "Error getting SVC name from the inputs" >&2 ; return 1; } + || { log_error "Error getting SVC name from the inputs"; return 1; } # Reading the config is too expensive to do for every # driver management attempt when there are many devices @@ -1709,13 +1753,13 @@ get_device_for_service() { [ "${_SVC}" = "${SVC}" ] && echo "${_DEV}" && exit 0 done ; exit 1 ) && return 0 fi - echo "No service instance '$1' was detected that matches a NUT device" >&2 + log_warn "No service instance '$1' was detected that matches a NUT device" return 1 } get_service_for_device() { DEV="$1" - [ -z "$DEV" ] && echo "Device name argument required" >&2 && return 1 + [ -z "$DEV" ] && { log_error "Device name argument required"; return 1; } # Cheap check in service instance metadata, if saved # (NOTE: saved value is assumed to be valid if present) @@ -1727,9 +1771,9 @@ get_service_for_device() { # Trawl all the data we have... # TODO: Reorder to avoid extra parsing if we have an early hit? upslist_readSvcs "by user request" && [ "${#UPSLIST_SVCS}" != 0 ] \ - || { echo "No service instances detected" >&2 ; return 1; } + || { log_warn "No service instances detected" ; return 1; } UPSLIST_SVCS_RAW="`$hook_listInstances_raw`" && [ "${#UPSLIST_SVCS_RAW}" != 0 ] \ - || { echo "No service units detected" >&2 ; return 1; } + || { log_warn "No service units detected" ; return 1; } vINST="`$hook_validInstanceName "$DEV"`" vUNITD="`$hook_validFullUnitName "$DEV"`" vUNITI="`$hook_validFullUnitName "$vINST"`" @@ -1756,7 +1800,7 @@ get_service_for_device() { done fi done - echo "No service instances detected that match device '$DEV'" >&2 + log_warn "No service instances detected that match device '$DEV'" return 1 } @@ -1783,8 +1827,8 @@ update_upslist_savednames_find_missing() { _MISSING_RES=0 for SVCINST in $SVCINSTS_NO_DEVICE ; do _DEV="`printf '%s\n' "$SVCS_DEVS_LIST" | awk '( \$1 == "'"${SVCINST}"'" ) {print \$NF}'`" - echo "Service instance '$SVCINST' did not have a device recorded into properties, setting to '${_DEV}'" - [ -n "${_DEV}" ] || { echo "The device name value for '$SVCINST' is empty, skipping" >&2 ; _MISSING_RES=1 ; continue ; } + log_warn "Service instance '$SVCINST' did not have a device recorded into properties, setting to '${_DEV}'" + [ -n "${_DEV}" ] || { log_warn "The device name value for '$SVCINST' is empty, skipping" ; _MISSING_RES=1 ; continue ; } $hook_setSavedDeviceName "`$hook_validInstanceSuffixName "$SVCINST"`" "${_DEV}" || _MISSING_RES=$? done return ${_MISSING_RES} @@ -1792,7 +1836,7 @@ update_upslist_savednames_find_missing() { RECONFIGURE_ASAP=false trap_handle_hup_main() { - echo "`date -u` : Received a HUP during processing, scheduling reconfiguration to repeat ASAP (after the current iteration is done)" >&2 + log_info "Received a HUP during processing, scheduling reconfiguration to repeat ASAP (after the current iteration is done)" # Note: in the worst case the reconfig would run twice; # we do not update UPSCONF_CHECKSUM_START in this case # to avoid corrupting decisions of the currently running @@ -1801,7 +1845,7 @@ trap_handle_hup_main() { } trap_handle_hup_sleep() { - echo "`date -u` : Received a HUP in my sleep, reprocessing configs right now!" >&2 + log_info "Received a HUP in my sleep, reprocessing configs right now!" # Avoid re-parsing main twice, though don't recalculate # checksums needlessly on every loop cycle, either... UPSCONF_CHECKSUM_START="`calc_md5_file "$UPSCONF"`" || true @@ -1815,7 +1859,7 @@ trap_handle_hup_sleep() { daemonize() { # Note: do not further sub-shell this routine, so systemd # is not confused whom to signal. - echo "`date -u` : Daemonizing $0 with config re-evaluation frequency $DAEMON_SLEEP" >&2 + log_info "Daemonizing $0 with config re-evaluation frequency $DAEMON_SLEEP" # Support (SIG)HUP == signal code 1 to quickly reconfigure, # e.g. to request it while the sleep is happening or while @@ -1838,12 +1882,12 @@ daemonize() { while nut_driver_enumerator_main ; do trap 'trap_handle_interruption_exit' $TERMINATION_SIGNALS if $TERMINATE_ASAP ; then - echo "`date -u` : Trapped a SIGTERM/SIGINT/SIGQUIT during last run of nut_driver_enumerator_main, terminating gracefully now" >&2 + log_info "Trapped a SIGTERM/SIGINT/SIGQUIT during last run of nut_driver_enumerator_main, terminating gracefully now" exit 0 fi if $RECONFIGURE_ASAP ; then - echo "`date -u` : Trapped a SIGHUP during last run of nut_driver_enumerator_main, repeating reconfiguration quickly" >&2 + log_info "Trapped a SIGHUP during last run of nut_driver_enumerator_main, repeating reconfiguration quickly" else sleep $DAEMON_SLEEP & trap "trap_handle_hup_sleep $!" $RECONFIGURATION_SIGNALS @@ -1952,31 +1996,34 @@ while [ $# -gt 0 ]; do --list-devices) upslist_readFile_once && \ if [ "${#UPSLIST_FILE}" != 0 ] ; then - echo "=== The currently defined configurations in '$UPSCONF' are:" >&2 + log_info "The currently defined configurations in '$UPSCONF' are:" + # echo this to stdout: echo "$UPSLIST_FILE" exit 0 fi - echo "No devices detected in '$UPSCONF'" >&2 + log_warn "No devices detected in '$UPSCONF'" exit 1 ;; --list-services) UPSLIST_SVCS_RAW="`$hook_listInstances_raw`" && \ if [ "${#UPSLIST_SVCS_RAW}" != 0 ] ; then - echo "=== The currently defined service units are:" >&2 + log_info "The currently defined service units are:" + # echo this to stdout: echo "$UPSLIST_SVCS_RAW" exit 0 fi - echo "No service units detected" >&2 + log_warn "No service units detected" exit 1 ;; --list-instances) upslist_readSvcs "by user request" && \ if [ "${#UPSLIST_SVCS}" != 0 ] ; then - echo "=== The currently defined service instances are:" >&2 + log_info "The currently defined service instances are:" + # echo this to stdout: echo "$UPSLIST_SVCS" exit 0 fi - echo "No service instances detected" >&2 + log_warn "No service instances detected" exit 1 ;; --get-service-for-device) @@ -1997,28 +2044,29 @@ while [ $# -gt 0 ]; do --show-configs|--show-device-configs|--show-all-configs|--show-all-device-configs) RES=0 upslist_readFile_once || RES=$? - [ "$RES" != 0 ] && { echo "ERROR: upslist_readFile_once () failed with code $RES" >&2; exit $RES; } + [ "$RES" != 0 ] && log_fatal $RES "upslist_readFile_once() failed with code $RES" [ "${#UPSLIST_FILE}" != 0 ] \ - || { echo "WARNING: No devices detected in '$UPSCONF'" >&2 ; RES=1 ; } + || { log_warn "No devices detected in '$UPSCONF'" ; RES=1 ; } + # echo this to stdout: echo "$UPSCONF_DATA" exit $RES ;; --show-config|--show-device-config) - [ -z "$2" ] && echo "WARNING: Device name argument empty, will show global config" >&2 + [ -z "$2" ] && log_warn "Device name argument empty, will show global config" DEV="$2" upsconf_getSection "$DEV" exit $? ;; --show-config-value|--show-device-config-value) - [ -z "$3" ] && echo "At least one configuration key name argument is required" >&2 && exit 1 - [ -z "$2" ] && echo "WARNING: Device name argument empty, will show global config" >&2 + [ -z "$3" ] && log_fatal 1 "At least one configuration key name argument is required" + [ -z "$2" ] && log_warn "Device name argument empty, will show global config" DEV="$2" shift 2 upsconf_getValue "$DEV" "$@" exit $? ;; upsconf_debug) # Not public, not in usage() - [ -z "$2" ] && echo "Device name argument required" >&2 && exit 1 + [ -z "$2" ] && log_fatal 1 "Device name argument required" upsconf_debug "$2" exit $? ;; @@ -2041,7 +2089,7 @@ while [ $# -gt 0 ]; do ;; hook_findSavedDeviceName) shift ; $hook_findSavedDeviceName "$@" ; exit $? ;; hook_getSavedDeviceName) shift ; $hook_getSavedDeviceName "$@" ; exit $? ;; - *) echo "Unrecognized argument: $1" >&2 ; exit 1 ;; + *) log_fatal 1 "Unrecognized argument: $1" ;; esac shift done From 8d4839f8e21f57e70b9dec5da6690a3fc617f6a2 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Sat, 22 Nov 2025 20:41:11 +0100 Subject: [PATCH 759/805] Makefile.am: shellcheck-nde: be sure to test freshly generated script text Signed-off-by: Jim Klimov --- Makefile.am | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Makefile.am b/Makefile.am index afe95090e8..d1c8f7e3e1 100644 --- a/Makefile.am +++ b/Makefile.am @@ -869,7 +869,10 @@ shellcheck-disclaimer: # Note: currently not part of shellcheck target, because the script below # can test the logic with numerous SHELL_PROGS in a CI setting, and because # check-scripts-syntax probably has checked the basic syntax above already. -shellcheck-nde: +nut-driver-enumerator.sh/scripts/upsdrvsvcctl: + +@$(SUBDIR_TGT_RULE) + +shellcheck-nde: nut-driver-enumerator.sh/scripts/upsdrvsvcctl GREP="$(GREP)"; EGREP="$(EGREP)"; export GREP; export EGREP; \ cd $(srcdir)/tests && SERVICE_FRAMEWORK="selftest" ./nut-driver-enumerator-test.sh From 7a078244a9ede692e63ad41f759abc7b4d497336 Mon Sep 17 00:00:00 2001 From: Atanas Vladimirov Date: Sun, 23 Nov 2025 21:48:36 +0200 Subject: [PATCH 760/805] nutdrv_qx: Hides QX_FLAG_NONUT variables from syslog. One can see them by raising the debug level. Tested on A1000 Signed-off-by: Atanas Vladimirov --- NEWS.adoc | 2 ++ drivers/nutdrv_qx.c | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/NEWS.adoc b/NEWS.adoc index 1652766201..fa8bc0a4ba 100644 --- a/NEWS.adoc +++ b/NEWS.adoc @@ -116,6 +116,8 @@ https://github.com/networkupstools/nut/milestone/12 `battery.ageing.factor` (Battery ageing factor in promille) and `battery.calibration.factor` (Battery calibration factor in percent). Tested on A1000 and A2000 units. [#3181] + * Hides QX_FLAG_NONUT variables from syslog unless the debug level + is raised. [issue #3190, PR #XXXX] - `powerp-bin` and `powerp-txt` driver updates: * Their `upsdrv_initinfo()` methods did not explicitly reference the diff --git a/drivers/nutdrv_qx.c b/drivers/nutdrv_qx.c index e2a08201c0..a7bd3905b0 100644 --- a/drivers/nutdrv_qx.c +++ b/drivers/nutdrv_qx.c @@ -4784,7 +4784,8 @@ int ups_infoval_set(item_t *item) } if (item->qxflags & QX_FLAG_NONUT) { - upslogx(LOG_INFO, "%s: %s", item->info_type, value); + /* Hides QX_FLAG_NONUT variables from syslog unless the debug level is raised */ + upsdebugx(2, "%s: %s", item->info_type, value); return 1; } From ae05ecd68ca2cb6f4a304ca64f57cf2eb13c456c Mon Sep 17 00:00:00 2001 From: Atanas Vladimirov Date: Sun, 23 Nov 2025 21:56:09 +0200 Subject: [PATCH 761/805] NEWS.adoc: Update the PR number. Signed-off-by: Atanas Vladimirov --- NEWS.adoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/NEWS.adoc b/NEWS.adoc index fa8bc0a4ba..5de181c213 100644 --- a/NEWS.adoc +++ b/NEWS.adoc @@ -117,7 +117,7 @@ https://github.com/networkupstools/nut/milestone/12 `battery.calibration.factor` (Battery calibration factor in percent). Tested on A1000 and A2000 units. [#3181] * Hides QX_FLAG_NONUT variables from syslog unless the debug level - is raised. [issue #3190, PR #XXXX] + is raised. [issue #3190, PR #3198] - `powerp-bin` and `powerp-txt` driver updates: * Their `upsdrv_initinfo()` methods did not explicitly reference the From 3d2f00266f2dfbac69e08e8b389c7fdebd084ddb Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Sun, 23 Nov 2025 19:23:12 +0000 Subject: [PATCH 762/805] tests/nut-driver-enumerator-test.sh: see now backticks and doublequotes play together in different shells [#3196] Signed-off-by: Jim Klimov --- tests/nut-driver-enumerator-test.sh | 76 ++++++++++++++++++++++++----- 1 file changed, 65 insertions(+), 11 deletions(-) diff --git a/tests/nut-driver-enumerator-test.sh b/tests/nut-driver-enumerator-test.sh index 7205d0faa2..ca3dea142f 100755 --- a/tests/nut-driver-enumerator-test.sh +++ b/tests/nut-driver-enumerator-test.sh @@ -68,24 +68,30 @@ fi FAIL_COUNT=0 GOOD_COUNT=0 -callNDE() { +callSHELL() { + # Calls shell as-is, pass the script name (or stdin) to execute some logic case "$DEBUG" in - yes) time $USE_SHELL $NDE "$@" ;; - trace) time $USE_SHELL -x $NDE "$@" ;; - *) $USE_SHELL $NDE "$@" 2>/dev/null ;; + yes) time $USE_SHELL "$@" ;; + trace) time $USE_SHELL -x "$@" ;; + *) $USE_SHELL "$@" 2>/dev/null ;; esac } -run_testcase() { - # First 3 args are required as defined below; the rest are +callNDE() { + callSHELL $NDE "$@" +} + +run_testcase_generic() { + # First 4 args are required as defined below; the rest are # CLI arg(s) to nut-driver-enumerator.sh - CASE_DESCR="$1" - EXPECT_CODE="$2" - EXPECT_TEXT="$3" - shift 3 + CASE_CMD="$1" + CASE_DESCR="$2" + EXPECT_CODE="$3" + EXPECT_TEXT="$4" + shift 4 printf "Testing : SHELL='%s'\tCASE='%s'\t" "$USE_SHELL" "$CASE_DESCR" - OUT="`callNDE "$@"`" ; RESCODE=$? + OUT="`$CASE_CMD "$@"`" ; RESCODE=$? printf "Got : RESCODE='%s'\t" "$RESCODE" RES=0 @@ -123,6 +129,11 @@ run_testcase() { return $RES } +run_testcase() { + # Main call for NDE test suites: + run_testcase_generic callNDE "$@" +} + ################################################################## # Note: expectations in test cases below are tightly connected # # to both the current code in the script and content of the test # @@ -298,6 +309,47 @@ globalflag" \ --show-config-value '' nosuchflag } +# This one is not about NDE as such, but piggy-backs on our ability to test +# multiple shells at once, with a test relevant for how we write scripts +# (with backticks to remain compatible with older Bourne-like shells). +# In particular, we have a problem with KSH on Solaris, treating double +# quotes inside backticked text which is wrapped in more double quotes +# (so some command execution would be a single token) as an end of a +# double-quoted token and so abortion of a command mid-way; other shells +# were not seen to work this way: +testcase_backticks_cmd_natural() { + callSHELL << 'EOF' + nut_with_python=yes; nut_with_python2=no; nut_with_python3=auto-prio=3; PYTHON=python; PYTHON2=auto-py; PYTHON3=python3 + RES=0 + FOUND_PYTHONS="`( echo "${nut_with_python}|${PYTHON}"; echo "${nut_with_python2}|${PYTHON2}"; echo "${nut_with_python3}|${PYTHON3}" ) | ${EGREP} -v '\|\(no\)*$' | ${EGREP} -v '^no\|'`" || RES=$? + echo "${FOUND_PYTHONS}" + exit $RES +EOF +} + +testcase_backticks_cmd_escaped() { + callSHELL << 'EOF' + nut_with_python=yes; nut_with_python2=no; nut_with_python3=auto-prio=3; PYTHON=python; PYTHON2=auto-py; PYTHON3=python3 + RES=0 + # Escape the quotes, following examples at + # https://stackoverflow.com/a/33301370/4715872 + FOUND_PYTHONS="`( echo \"${nut_with_python}|${PYTHON}\"; echo \"${nut_with_python2}|${PYTHON2}\"; echo \"${nut_with_python3}|${PYTHON3}\" ) | ${EGREP} -v '\|\(no\)*$' | ${EGREP} -v '^no\|'`" || RES=$? + echo "${FOUND_PYTHONS}" + exit $RES +EOF +} + +testcase_backticks() { + run_testcase_generic testcase_backticks_cmd_natural \ + "Backticks wrapped in doublequotes, with doublequoted text inside" 0 \ +"yes|python +auto-prio=3|python3" + + run_testcase_generic testcase_backticks_cmd_escaped \ + "Backticks wrapped in doublequotes, with escaped-doublequoted text inside" 0 \ +"yes|python +auto-prio=3|python3" +} # Combine the cases above into a stack testsuite() { @@ -308,6 +360,8 @@ testsuite() { testcase_globalSection # This one can take a while, put it last testcase_upslist_debug + # Something very different + testcase_backticks } # If no args... From 53a706c55583b600bceea52c57c1af5c40566218 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Mon, 24 Nov 2025 10:37:41 +0000 Subject: [PATCH 763/805] tests/nut-driver-enumerator-test.sh: report if the failure could be due to unsupported or not-found shell interpreter [#3196] Signed-off-by: Jim Klimov --- tests/nut-driver-enumerator-test.sh | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/tests/nut-driver-enumerator-test.sh b/tests/nut-driver-enumerator-test.sh index ca3dea142f..0fe43cc978 100755 --- a/tests/nut-driver-enumerator-test.sh +++ b/tests/nut-driver-enumerator-test.sh @@ -375,4 +375,26 @@ done echo "Test suite for nut-driver-enumerator has completed with $FAIL_COUNT failed cases and $GOOD_COUNT good cases" >&2 -[ "$FAIL_COUNT" = 0 ] || { echo "As a developer, you may want to export DEBUG=trace or export DEBUG=yes and re-run the test; also make sure you meant the nut-driver-enumerator.sh implementation as NDE='$NDE'" >&2 ; exit 1; } +[ "$FAIL_COUNT" = 0 ] || { + echo "As a developer, you may want to export DEBUG=trace or export DEBUG=yes and re-run the test; also make sure you meant the nut-driver-enumerator.sh implementation as NDE='$NDE'" + for USE_SHELL in $SHELL_PROGS ; do + case "$USE_SHELL" in + */*) test -x "`echo $USE_SHELL | awk '{print $1}'`" ;; + busybox|busybox_sh|"busybox sh") command -v busybox ;; + *) command -v $USE_SHELL ;; + esac || echo "WARNING: Could not resolve shell interpreter '$USE_SHELL' in PATH='$PATH'" + + case "$USE_SHELL" in + */sh|sh) + echo "WARNING: This test was executed with a system default shell interpreter '$USE_SHELL'; depends on implementation whether it supports the (legacy) POSIX syntax our scripts are written for or not" ;; + */ksh*|ksh*|*/ast-ksh*|ast-ksh*|*/oksh*|oksh*) + echo "INFO: We have reports that shell interpreter '$USE_SHELL' should support the (legacy) POSIX syntax our scripts are written for, but beware double-quotes inside and outside backticks" ;; + busybox|busybox_sh|"busybox sh"|*/busybox|*/bash|bash|*/dash|dash) + echo "INFO: We have reports that shell interpreter '$USE_SHELL' should support the (legacy) POSIX syntax our scripts are written for" ;; + */zsh|zsh|*/csh|*/tcsh) + echo "WARNING: Sadly, we have reports that shell interpreter '$USE_SHELL' does not support the (legacy) POSIX syntax our scripts are written for" ;; + *) echo "WARNING: We do not have confirmation whether shell interpreter '$USE_SHELL' supports the (legacy) POSIX syntax our scripts are written for or not" ;; + esac + done + exit 1 +} >&2 From 31d8f0d74f559c1b9bdd0ed6b3a882af4ae768f5 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Mon, 24 Nov 2025 13:41:34 +0000 Subject: [PATCH 764/805] tests/nut-driver-enumerator-test.sh: support passing-or-failing tests (for syntax not supported by all of ksh implementations) [#3196] Signed-off-by: Jim Klimov --- tests/nut-driver-enumerator-test.sh | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/tests/nut-driver-enumerator-test.sh b/tests/nut-driver-enumerator-test.sh index 0fe43cc978..9ecb36f9a3 100755 --- a/tests/nut-driver-enumerator-test.sh +++ b/tests/nut-driver-enumerator-test.sh @@ -1,6 +1,8 @@ #!/bin/sh -# Copyright (C) 2018 Eaton +# Copyright (C) +# 2018 Eaton +# 2020-2025 Jim Klimov # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -86,7 +88,7 @@ run_testcase_generic() { # CLI arg(s) to nut-driver-enumerator.sh CASE_CMD="$1" CASE_DESCR="$2" - EXPECT_CODE="$3" + EXPECT_CODE="$3" # Can be '*' to ignore errors EXPECT_TEXT="$4" shift 4 @@ -95,7 +97,7 @@ run_testcase_generic() { printf "Got : RESCODE='%s'\t" "$RESCODE" RES=0 - if [ "$RESCODE" = "$EXPECT_CODE" ]; then + if [ "$RESCODE" = "$EXPECT_CODE" ] || [ x'*' = x"$EXPECT_CODE" ]; then printf "STATUS_CODE='MATCHED'\t" GOOD_COUNT="`expr $GOOD_COUNT + 1`" else @@ -122,8 +124,12 @@ run_testcase_generic() { fi } ; ) 2>/dev/null || true rm -f "/tmp/.nde.text.expected.$$" "/tmp/.nde.text.actual.$$" - FAIL_COUNT="`expr $FAIL_COUNT + 1`" - RES="`expr $RES + 2`" + if [ x'*' = x"$EXPECT_CODE" ] ; then + echo 'MISMATCH IGNORED because EXPECT_CODE=*' >&2 + else + FAIL_COUNT="`expr $FAIL_COUNT + 1`" + RES="`expr $RES + 2`" + fi fi if [ "$RES" != 0 ] || [ -n "$DEBUG" ] ; then echo "" ; fi return $RES @@ -318,6 +324,7 @@ globalflag" \ # double-quoted token and so abortion of a command mid-way; other shells # were not seen to work this way: testcase_backticks_cmd_natural() { + #DEBUG=yes \ callSHELL << 'EOF' nut_with_python=yes; nut_with_python2=no; nut_with_python3=auto-prio=3; PYTHON=python; PYTHON2=auto-py; PYTHON3=python3 RES=0 @@ -341,7 +348,7 @@ EOF testcase_backticks() { run_testcase_generic testcase_backticks_cmd_natural \ - "Backticks wrapped in doublequotes, with doublequoted text inside" 0 \ + "Backticks wrapped in doublequotes, with doublequoted text inside (can fail on some interpreters)" '*' \ "yes|python auto-prio=3|python3" From a0602820f3f5dae203d2b34576d161db8981d0b7 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Mon, 24 Nov 2025 14:58:12 +0000 Subject: [PATCH 765/805] tests/nut-driver-enumerator-test.sh: double-quote $0 name inspection, safely for shell script syntax with backticks and double-quotes [#3196] Signed-off-by: Jim Klimov --- tests/nut-driver-enumerator-test.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/nut-driver-enumerator-test.sh b/tests/nut-driver-enumerator-test.sh index 9ecb36f9a3..b0c0ebea88 100755 --- a/tests/nut-driver-enumerator-test.sh +++ b/tests/nut-driver-enumerator-test.sh @@ -38,8 +38,8 @@ export LANG LC_ALL TZ ### Note: These are relative to where the selftest script lives, ### not the NUT top_srcdir etc. They can be exported by a Makefile. -[ -n "${BUILDDIR-}" ] || BUILDDIR="`dirname $0`" -[ -n "${SRCDIR-}" ] || SRCDIR="`dirname $0`" +[ -n "${BUILDDIR-}" ] || BUILDDIR="`dirname \"$0\"`" +[ -n "${SRCDIR-}" ] || SRCDIR="`dirname \"$0\"`" [ -n "${SHELL_PROGS-}" ] || SHELL_PROGS="/bin/sh" case "${DEBUG-}" in [Yy]|[Yy][Ee][Ss]) DEBUG=yes ;; From 4e0d4838548a61dde7ab0917e437ef5bc8e4c10e Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Mon, 24 Nov 2025 15:19:22 +0000 Subject: [PATCH 766/805] tests/nut-driver-enumerator-test.sh: revise shell script syntax with backticks and double-quotes [#3196] Signed-off-by: Jim Klimov --- tests/nut-driver-enumerator-test.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/nut-driver-enumerator-test.sh b/tests/nut-driver-enumerator-test.sh index b0c0ebea88..ff063d7723 100755 --- a/tests/nut-driver-enumerator-test.sh +++ b/tests/nut-driver-enumerator-test.sh @@ -93,7 +93,7 @@ run_testcase_generic() { shift 4 printf "Testing : SHELL='%s'\tCASE='%s'\t" "$USE_SHELL" "$CASE_DESCR" - OUT="`$CASE_CMD "$@"`" ; RESCODE=$? + OUT="`$CASE_CMD \"$@\"`" ; RESCODE=$? printf "Got : RESCODE='%s'\t" "$RESCODE" RES=0 @@ -116,7 +116,7 @@ run_testcase_generic() { ( rm -f "/tmp/.nde.text.expected.$$" "/tmp/.nde.text.actual.$$" \ && echo "$EXPECT_TEXT" > "/tmp/.nde.text.expected.$$" \ && echo "$OUT" > "/tmp/.nde.text.actual.$$" \ - && { OUTD="`diff -u "/tmp/.nde.text.expected.$$" "/tmp/.nde.text.actual.$$" 2>/dev/null`" + && { OUTD="`diff -u \"/tmp/.nde.text.expected.$$\" \"/tmp/.nde.text.actual.$$\" 2>/dev/null`" if echo "$OUTD" | head -1 | ${EGREP} '^[-+]' >/dev/null ; then echo "$OUTD" else From 6c63499904d094b64d73a81ca59336fa5c752008 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Mon, 24 Nov 2025 15:07:47 +0000 Subject: [PATCH 767/805] tests/NIT/nit.sh: revise shell script syntax with backticks and double-quotes [#3196] Signed-off-by: Jim Klimov --- tests/NIT/nit.sh | 54 ++++++++++++++++++++++++------------------------ 1 file changed, 27 insertions(+), 27 deletions(-) diff --git a/tests/NIT/nit.sh b/tests/NIT/nit.sh index 869d07f652..d92435c70a 100755 --- a/tests/NIT/nit.sh +++ b/tests/NIT/nit.sh @@ -159,8 +159,8 @@ isBusy_NUT_PORT() { # IPv6: # sl local_address remote_address st tx_queue rx_queue tr tm->when retrnsmt uid timeout inode # 0: 00000000000000000000000000000000:1F46 00000000000000000000000000000000:0000 0A 00000000:00000000 00:00000000 00000000 33 0 37451 1 00000000fa3c0c15 100 0 0 10 0 - NUT_PORT_HEX="`printf '%04X' "${NUT_PORT}"`" - NUT_PORT_HITS="`cat /proc/net/tcp /proc/net/tcp6 2>/dev/null | awk '{print $2}' | ${EGREP} ":${NUT_PORT_HEX}\$"`" \ + NUT_PORT_HEX="`printf '%04X' \"${NUT_PORT}\"`" + NUT_PORT_HITS="`cat /proc/net/tcp /proc/net/tcp6 2>/dev/null | awk '{print $2}' | ${EGREP} \":${NUT_PORT_HEX}\$\"`" \ && [ -n "$NUT_PORT_HITS" ] \ && log_debug "isBusy_NUT_PORT() found that NUT_PORT=${NUT_PORT} is busy per /proc/net/tcp*" \ && return 0 @@ -248,8 +248,8 @@ runcmd() { "$@" > "${NUT_STATEPATH}/runcmd.out" 2>"${NUT_STATEPATH}/runcmd.err" || CMDRES=$? NUT_DEBUG_LEVEL="${NUT_DEBUG_LEVEL_ORIG}" - CMDOUT="`cat "${NUT_STATEPATH}/runcmd.out"`" - CMDERR="`cat "${NUT_STATEPATH}/runcmd.err"`" + CMDOUT="`cat \"${NUT_STATEPATH}/runcmd.out\"`" + CMDERR="`cat \"${NUT_STATEPATH}/runcmd.err\"`" [ "$RUNCMD_QUIET_OUT" = true ] || { [ -z "$CMDOUT" ] || echo "$CMDOUT" ; } [ "$RUNCMD_QUIET_ERR" = true ] || { [ -z "$CMDERR" ] || echo "$CMDERR" >&2 ; } @@ -266,19 +266,19 @@ BUILDDIR="`pwd`" TOP_BUILDDIR="" case "${BUILDDIR}" in */tests/NIT) - TOP_BUILDDIR="`cd "${BUILDDIR}"/../.. && pwd`" ;; + TOP_BUILDDIR="`cd \"${BUILDDIR}\"/../.. && pwd`" ;; *) log_info "Current directory '${BUILDDIR}' is not a .../tests/NIT" ;; esac if test ! -w "${BUILDDIR}" ; then log_error "BUILDDIR='${BUILDDIR}' is not writeable, tests may fail below" fi -SRCDIR="`dirname "$0"`" -SRCDIR="`cd "$SRCDIR" && pwd`" +SRCDIR="`dirname \"$0\"`" +SRCDIR="`cd \"$SRCDIR\" && pwd`" TOP_SRCDIR="" case "${SRCDIR}" in */tests/NIT) - TOP_SRCDIR="`cd "${SRCDIR}"/../.. && pwd`" ;; + TOP_SRCDIR="`cd \"${SRCDIR}\"/../.. && pwd`" ;; *) log_info "Script source directory '${SRCDIR}' is not a .../tests/NIT" ;; esac @@ -363,7 +363,7 @@ get_user_id() { && [ "${_ID}" -ge 0 ] 2>/dev/null ; then echo "${_ID}"; return ; fi if _ID="`id ${1-} 2>/dev/null | sed -e 's,^.*uid=,,' -e 's,(.*$,,'`" \ && [ "${_ID}" -ge 0 ] 2>/dev/null ; then echo "${_ID}"; return ; fi - if [ x"${1-}" != x ] 2>/dev/null && _ID="`getent passwd "$1" 2>/dev/null | awk -F: '{print $3}'`" \ + if [ x"${1-}" != x ] 2>/dev/null && _ID="`getent passwd \"$1\" 2>/dev/null | awk -F: '{print $3}'`" \ && [ "${_ID}" -ge 0 ] 2>/dev/null ; then echo "${_ID}"; return ; fi # Fallback @@ -384,7 +384,7 @@ get_group_id() { && [ "${_ID}" -ge 0 ] 2>/dev/null ; then echo "${_ID}"; return ; fi if _ID="`id ${1-} 2>/dev/null | sed -e 's,^.*gid=,,' -e 's,(.*$,,'`" \ && [ "${_ID}" -ge 0 ] 2>/dev/null ; then echo "${_ID}"; return ; fi - if [ x"${1-}" != x ] 2>/dev/null && _ID="`getent group "$1" 2>/dev/null | awk -F: '{print $3}'`" \ + if [ x"${1-}" != x ] 2>/dev/null && _ID="`getent group \"$1\" 2>/dev/null | awk -F: '{print $3}'`" \ && [ "${_ID}" -ge 0 ] 2>/dev/null ; then echo "${_ID}"; return ; fi # TOTHINK: Fallback to get "my current group": touch a file and see who owns it? @@ -421,7 +421,7 @@ TWEAK_RUN_AS_USER="" TWEAK_RUN_AS_GROUP="" ARG_USER="" if [ x"${BUILTIN_RUN_AS_USER}" != x ] ; then - if [ "`get_user_id "${BUILTIN_RUN_AS_USER}"`" -ge 0 ] 2>/dev/null; then + if [ "`get_user_id \"${BUILTIN_RUN_AS_USER}\"`" -ge 0 ] 2>/dev/null; then # Do not bother to re-evaluate more IDs to rule out aliases - many names on same ID? if $I_AM_ROOT || [ x"${I_AM_NAME}" = x"${BUILTIN_RUN_AS_USER}" ] ; then log_info "Started as ${I_AM_NAME_REPORT}, and built-in RUN_AS_USER='${BUILTIN_RUN_AS_USER}' seems present on this system to run test daemons as" @@ -433,7 +433,7 @@ if [ x"${BUILTIN_RUN_AS_USER}" != x ] ; then # account identification databases of this runtime environment... if $I_AM_ROOT ; then for U in nobody daemon bin ; do - if [ "`get_user_id "${U}"`" -ge 0 ] ; then + if [ "`get_user_id \"${U}\"`" -ge 0 ] ; then TWEAK_RUN_AS_USER="${U}" break fi @@ -457,7 +457,7 @@ if [ x"${BUILTIN_RUN_AS_GROUP}" != x ] ; then # * In `drivers/main.c` we can set FS access for the pipe to data server # * Otherwise in `common.c::become_user()` we try to assume the default # GID of that user account we were asked to switch into. - if [ "`get_group_id "${BUILTIN_RUN_AS_GROUP}"`" -ge 0 ] 2>/dev/null ; then + if [ "`get_group_id \"${BUILTIN_RUN_AS_GROUP}\"`" -ge 0 ] 2>/dev/null ; then # Do not bother to re-evaluate more IDs to rule out aliases - many names on same ID? # TOTHINK: Would need I_AM_GROUP first?.. if $I_AM_ROOT ; then @@ -469,7 +469,7 @@ if [ x"${BUILTIN_RUN_AS_GROUP}" != x ] ; then # The string allegedly built into NUT binaries is unknown to the # account identification databases of this runtime environment... for G in nobody nogroup daemon bin ; do - if [ "`get_group_id "${G}"`" -ge 0 ] ; then + if [ "`get_group_id \"${G}\"`" -ge 0 ] ; then TWEAK_RUN_AS_GROUP="${G}" break fi @@ -518,7 +518,7 @@ if [ x"${TESTDIR}" = x ] ; then fi log_warn "Will now mktemp a TESTDIR under '${TMPDIR}'. It will be wiped when the NIT script exits." log_warn "If you want a pre-determined location, pre-export a usable TESTDIR value." - TESTDIR="`mktemp -d "${TMPDIR}/nit-tmp.$$.XXXXXX"`" || die "Failed to mktemp" + TESTDIR="`mktemp -d \"${TMPDIR}/nit-tmp.$$.XXXXXX\"`" || die "Failed to mktemp" if $I_AM_ROOT ; then # Cah be protected as 0700 by default chmod ugo+rx "${TESTDIR}" @@ -558,11 +558,11 @@ stop_daemons() { fi if [ -z "$PID_UPSSCHED" ] && [ -s "$NUT_PIDPATH/upssched.pid" ] ; then - PID_UPSSCHED="`head -1 "$NUT_PIDPATH/upssched.pid"`" + PID_UPSSCHED="`head -1 \"$NUT_PIDPATH/upssched.pid\"`" fi if [ -s "$NUT_PIDPATH/upssched.pid" ] ; then - PID_UPSSCHED_NOW="`head -1 "$NUT_PIDPATH/upssched.pid"`" + PID_UPSSCHED_NOW="`head -1 \"$NUT_PIDPATH/upssched.pid\"`" fi if [ -n "$PID_UPSD$PID_UPSMON$PID_DUMMYUPS$PID_DUMMYUPS1$PID_DUMMYUPS2$PID_UPSSCHED$PID_UPSSCHED_NOW" ] ; then @@ -615,7 +615,7 @@ else fi log_warn "Selected NUT_PORT=$NUT_PORT seems occupied; will try another in a few seconds" - COUNTDOWN="`expr "$COUNTDOWN" - 1`" + COUNTDOWN="`expr \"$COUNTDOWN\" - 1`" [ "$COUNTDOWN" = 0 ] || sleep 2 done @@ -633,7 +633,7 @@ else fi # Loop quickly, no sleep here - COUNTDOWN="`expr "$COUNTDOWN" - 1`" + COUNTDOWN="`expr \"$COUNTDOWN\" - 1`" done if [ "$COUNTDOWN" = 0 ] ; then @@ -1240,7 +1240,7 @@ sandbox_start_drivers() { sleep 5 if shouldDebug ; then - (ps -ef || ps -xawwu) 2>/dev/null | ${EGREP} '(ups|nut|dummy|'"`basename "$0"`"')' | ${EGREP} -v '(ssh|startups|grep)' || true + (ps -ef || ps -xawwu) 2>/dev/null | ${EGREP} '(ups|nut|dummy|'"`basename \"$0\"`"')' | ${EGREP} -v '(ssh|startups|grep)' || true fi if isPidAlive "$PID_DUMMYUPS" \ @@ -1267,7 +1267,7 @@ testcase_sandbox_start_upsd_alone() { UPS1 UPS2" # For windows runners (strip CR if any): - EXPECTED_UPSLIST="`echo "$EXPECTED_UPSLIST" | tr -d '\r'`" + EXPECTED_UPSLIST="`echo \"$EXPECTED_UPSLIST\" | tr -d '\r'`" fi log_info "[testcase_sandbox_start_upsd_alone] Query listing from UPSD by UPSC (driver not running yet)" @@ -1275,7 +1275,7 @@ UPS2" runcmd upsc -l localhost:$NUT_PORT || die "[testcase_sandbox_start_upsd_alone] upsd does not respond on port ${NUT_PORT} ($?): $CMDOUT" # For windows runners (printf can do wonders, so strip CR if any): if [ x"${TOP_SRCDIR}" != x ]; then - CMDOUT="`echo "$CMDOUT" | tr -d '\r'`" + CMDOUT="`echo \"$CMDOUT\" | tr -d '\r'`" fi if [ x"$CMDOUT" != x"$EXPECTED_UPSLIST" ] ; then log_error "[testcase_sandbox_start_upsd_alone] got this reply for upsc listing when '$EXPECTED_UPSLIST' was expected: '$CMDOUT'" @@ -1533,7 +1533,7 @@ isTestablePython() { return 0 fi - PY_SHEBANG="`head -1 "${TOP_BUILDDIR}/scripts/python/module/test_nutclient.py"`" + PY_SHEBANG="`head -1 \"${TOP_BUILDDIR}/scripts/python/module/test_nutclient.py\"`" PY_RES=3 case x"${PY_SHEBANG}" in x"#!"/*|x"#!"?":\\"*|x"#!"?":/"*) PY_RES=0 ;; # Seems like a full path @@ -1543,7 +1543,7 @@ isTestablePython() { esac if [ x"${PY_RES}" = x0 ] ; then log_debug "=======\nDetected python shebang: '${PY_SHEBANG}' (result=${PY_RES})" - PYTHON="`echo "${PY_SHEBANG}" | sed 's,^#!,,'`" + PYTHON="`echo \"${PY_SHEBANG}\" | sed 's,^#!,,'`" else log_error "[isTestablePython] Detected python shebang: '${PY_SHEBANG}' (result=${PY_RES})" fi @@ -1807,7 +1807,7 @@ testcase_sandbox_nutscanner_list() { else PORTS_WANT=3 fi - PORTS_SEEN="`echo "$CMDOUT" | ${EGREP} -c 'port *='`" + PORTS_SEEN="`echo \"$CMDOUT\" | ${EGREP} -c 'port *='`" if [ "$PORTS_WANT" != "$PORTS_SEEN" ]; then log_error "[testcase_sandbox_nutscanner_list] Too many 'port=' lines: want $PORTS_WANT != seen $PORTS_SEEN" >&2 @@ -1999,7 +1999,7 @@ if [ -n "${DEBUG_SLEEP-}" ] ; then fi if [ -z "$PID_UPSSCHED" ] && [ -s "$NUT_PIDPATH/upssched.pid" ] ; then - PID_UPSSCHED="`head -1 "$NUT_PIDPATH/upssched.pid"`" + PID_UPSSCHED="`head -1 \"$NUT_PIDPATH/upssched.pid\"`" fi log_separator @@ -2007,7 +2007,7 @@ if [ -n "${DEBUG_SLEEP-}" ] ; then log_info "Populated environment variables for this run into a file so you can source them: . '$NUT_CONFPATH/NIT.env'" printf "PID_NIT_SCRIPT='%s'\nexport PID_NIT_SCRIPT\n" "$$" >> "$NUT_CONFPATH/NIT.env" set | ${EGREP} '^TESTPASS_|PID_[^ =]*='"'?[0-9][0-9]*'?$" | while IFS='=' read K V ; do - V="`echo "$V" | tr -d "'"`" + V="`echo \"$V\" | tr -d \"'\"`" # Dummy comment to reset syntax highlighting due to ' quote above if [ -n "$V" ] ; then printf "%s='%s'\nexport %s\n" "$K" "$V" "$K" From 4d8847da5c5bdc26108b9fc93d2efaba7ec9bf70 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Mon, 24 Nov 2025 14:53:36 +0000 Subject: [PATCH 768/805] autogen.sh: revise shell script syntax with backticks and double-quotes [#3196] Signed-off-by: Jim Klimov --- autogen.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/autogen.sh b/autogen.sh index 6121fc9e25..880058a7ec 100755 --- a/autogen.sh +++ b/autogen.sh @@ -27,7 +27,7 @@ fi [ -n "${GREP}" ] || { GREP="`command -v grep`" && [ x"${GREP}" != x ] || { echo "$0: FAILED to locate GREP tool" >&2 ; exit 1 ; } ; export GREP ; } [ -n "${EGREP}" ] || { if ( [ x"`echo a | $GREP -E '(a|b)'`" = xa ] ) 2>/dev/null ; then EGREP="$GREP -E" ; else EGREP="`command -v egrep`" ; fi && [ x"${EGREP}" != x ] || { echo "$0: FAILED to locate EGREP tool" >&2 ; exit 1 ; } ; export EGREP ; } -NUT_VERSION_QUERY=UPDATE_FILE "`dirname $0`"/tools/gitlog2version.sh +NUT_VERSION_QUERY=UPDATE_FILE "`dirname \"$0\"`"/tools/gitlog2version.sh if [ -n "${PYTHON-}" ] ; then # May be a name/path of binary, or one with args - check both @@ -87,7 +87,7 @@ then echo "Proceeding without Augeas integration, be sure to not require it in configure script" >&2 touch scripts/augeas/nutupsconf.aug.in scripts/augeas/nutupsconf.aug.in.AUTOGEN_WITHOUT else - echo "Aborting $0! To avoid this, please export WITHOUT_NUT_AUGEAS=true and re-run" >&2 + echo "Aborting $0! To avoid this, please export WITHOUT_NUT_AUGEAS=true and re-run" >&2 echo "or better yet, export PYTHON=python-x.y and re-run" >&2 exit 1 fi From fe893ad8ff151f28bc174f9d49087fcc9803c95d Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Mon, 24 Nov 2025 14:27:50 +0000 Subject: [PATCH 769/805] ci_build.sh: revise shell script syntax with backticks and double-quotes [#3196] Signed-off-by: Jim Klimov --- ci_build.sh | 68 ++++++++++++++++++++++++++--------------------------- 1 file changed, 34 insertions(+), 34 deletions(-) diff --git a/ci_build.sh b/ci_build.sh index a2a2fbfa4c..8840fd706a 100755 --- a/ci_build.sh +++ b/ci_build.sh @@ -10,10 +10,10 @@ ################################################################################ set -e -SCRIPTDIR="`dirname "$0"`" -SCRIPTDIR="`cd "$SCRIPTDIR" && pwd`" +SCRIPTDIR="`dirname \"$0\"`" +SCRIPTDIR="`cd \"$SCRIPTDIR\" && pwd`" -SCRIPT_PATH="${SCRIPTDIR}/`basename $0`" +SCRIPT_PATH="${SCRIPTDIR}/`basename \"$0\"`" SCRIPT_ARGS=("$@") [ -n "${GREP}" ] || { GREP="`command -v grep`" && [ x"${GREP}" != x ] || { echo "$0: FAILED to locate GREP tool" >&2 ; exit 1 ; } ; export GREP ; } @@ -191,7 +191,7 @@ for TR_VARIANT in "tr 'A-Z' 'a-z'" "tr '[:upper:]' '[:lower:]'" "tr 'ABCDEFGHIJK done # Just in case we get blanks from CI - consider them as not-set: -if [ -z "`echo "${MAKE-}" | tr -d ' '`" ] ; then +if [ -z "`echo \"${MAKE-}\" | tr -d ' '`" ] ; then if [ "$1" = spellcheck -o "$1" = spellcheck-interactive -o "$1" = spellcheck-quick -o "$1" = spellcheck-interactive-quick ] \ && (command -v gmake) >/dev/null 2>/dev/null \ ; then @@ -218,7 +218,7 @@ normalize_path() { case "${D}" in "") continue ;; /) ;; - */) D="`echo "${D}" | sed 's,/*$,,'`" ;; + */) D="`echo \"${D}\" | sed 's,/*$,,'`" ;; esac case "${P}" in "${D}"|*":${D}"|"${D}:"*|*":${D}:"*) ;; @@ -305,7 +305,7 @@ optional_prepare_ccache() { else if [ -n "${CI_CCACHE_SYMLINKDIR}" ]; then # Tell ccache the PATH without itself in it, to avoid loops processing - PATH="`echo "$PATH" | sed -e 's,^'"${CI_CCACHE_SYMLINKDIR}"'/?:,,' -e 's,:'"${CI_CCACHE_SYMLINKDIR}"'/?:,,' -e 's,:'"${CI_CCACHE_SYMLINKDIR}"'/?$,,' -e 's,^'"${CI_CCACHE_SYMLINKDIR}"'/?$,,'`" + PATH="`echo \"$PATH\" | sed -e 's,^'\"${CI_CCACHE_SYMLINKDIR}\"'/?:,,' -e 's,:'\"${CI_CCACHE_SYMLINKDIR}\"'/?:,,' -e 's,:'\"${CI_CCACHE_SYMLINKDIR}\"'/?$,,' -e 's,^'\"${CI_CCACHE_SYMLINKDIR}\"'/?$,,'`" fi CCACHE_PATH="$PATH" CCACHE_DIR="${HOME}/.ccache" @@ -373,13 +373,13 @@ optional_prepare_compiler_family() { fi if ( [ "$COMPILER_FAMILY" = "GCC" ] && \ - case "`ver_gnucc "$CC"`" in + case "`ver_gnucc \"$CC\"`" in [123].*) true ;; 4.[0123][.,-]*) true ;; 4.[0123]) true ;; *) false ;; esac && \ - case "`ver_gnucc "$CXX"`" in + case "`ver_gnucc \"$CXX\"`" in [123].*) true ;; 4.[0123][.,-]*) true ;; 4.[0123]) true ;; @@ -458,7 +458,7 @@ optional_ensure_ccache() { if [ -x "${CI_CCACHE_SYMLINKDIR}/`basename "$CC"`" ]; then case "$CC" in *ccache*) ;; - */*) DIR_CC="`dirname "$CC"`" && [ -n "$DIR_CC" ] && DIR_CC="`cd "$DIR_CC" && pwd `" && [ -n "$DIR_CC" ] && [ -d "$DIR_CC" ] || DIR_CC="" + */*) DIR_CC="`dirname \"$CC\"`" && [ -n "$DIR_CC" ] && DIR_CC="`cd \"$DIR_CC\" && pwd `" && [ -n "$DIR_CC" ] && [ -d "$DIR_CC" ] || DIR_CC="" [ -z "$CCACHE_PATH" ] && CCACHE_PATH="$DIR_CC" || \ if echo "$CCACHE_PATH" | ${EGREP} '(^'"$DIR_CC"':.*|^'"$DIR_CC"'$|:'"$DIR_CC"':|:'"$DIR_CC"'$)' ; then CCACHE_PATH="$DIR_CC:$CCACHE_PATH" @@ -474,7 +474,7 @@ optional_ensure_ccache() { if [ -x "${CI_CCACHE_SYMLINKDIR}/`basename "$CXX"`" ]; then case "$CXX" in *ccache*) ;; - */*) DIR_CXX="`dirname "$CXX"`" && [ -n "$DIR_CXX" ] && DIR_CXX="`cd "$DIR_CXX" && pwd `" && [ -n "$DIR_CXX" ] && [ -d "$DIR_CXX" ] || DIR_CXX="" + */*) DIR_CXX="`dirname \"$CXX\"`" && [ -n "$DIR_CXX" ] && DIR_CXX="`cd \"$DIR_CXX\" && pwd `" && [ -n "$DIR_CXX" ] && [ -d "$DIR_CXX" ] || DIR_CXX="" [ -z "$CCACHE_PATH" ] && CCACHE_PATH="$DIR_CXX" || \ if echo "$CCACHE_PATH" | ${EGREP} '(^'"$DIR_CXX"':.*|^'"$DIR_CXX"'$|:'"$DIR_CXX"':|:'"$DIR_CXX"'$)' ; then CCACHE_PATH="$DIR_CXX:$CCACHE_PATH" @@ -490,7 +490,7 @@ optional_ensure_ccache() { && [ -x "${CI_CCACHE_SYMLINKDIR}/`basename "$CPP"`" ]; then case "$CPP" in *ccache*) ;; - */*) DIR_CPP="`dirname "$CPP"`" && [ -n "$DIR_CPP" ] && DIR_CPP="`cd "$DIR_CPP" && pwd `" && [ -n "$DIR_CPP" ] && [ -d "$DIR_CPP" ] || DIR_CPP="" + */*) DIR_CPP="`dirname \"$CPP\"`" && [ -n "$DIR_CPP" ] && DIR_CPP="`cd \"$DIR_CPP\" && pwd `" && [ -n "$DIR_CPP" ] && [ -d "$DIR_CPP" ] || DIR_CPP="" [ -z "$CCACHE_PATH" ] && CCACHE_PATH="$DIR_CPP" || \ if echo "$CCACHE_PATH" | ${EGREP} '(^'"$DIR_CPP"':.*|^'"$DIR_CPP"'$|:'"$DIR_CPP"':|:'"$DIR_CPP"'$)' ; then CCACHE_PATH="$DIR_CPP:$CCACHE_PATH" @@ -552,10 +552,10 @@ esac NCPUS="`cat /proc/cpuinfo | ${GREP} -wc processor`" || \ { [ -x /usr/sbin/psrinfo ] && NCPUS="`/usr/sbin/psrinfo | wc -l`"; } \ || NCPUS=1; } 2>/dev/null -[ x"$NCPUS" = x ] || NCPUS="`echo "$NCPUS" | tr -d ' '`" +[ x"$NCPUS" = x ] || NCPUS="`echo \"$NCPUS\" | tr -d ' '`" [ x"$NCPUS" != x -a "$NCPUS" -ge 1 ] || NCPUS=1 -[ x"$NPARMAKES" = x ] && { NPARMAKES="`expr "$NCPUS" '*' 2`" || NPARMAKES=2; } +[ x"$NPARMAKES" = x ] && { NPARMAKES="`expr \"$NCPUS\" '*' 2`" || NPARMAKES=2; } [ x"$NPARMAKES" != x -a "$NPARMAKES" -ge 1 ] || NPARMAKES=2 [ x"$MAXPARMAKES" != x ] && [ "$MAXPARMAKES" -ge 1 ] && \ [ "$NPARMAKES" -gt "$MAXPARMAKES" ] && \ @@ -703,7 +703,7 @@ if [ -z "$CI_OS_NAME" ]; then [ -z "$CI_OS_HINT" -o "$CI_OS_HINT" = "-" ] || break done - case "`echo "$CI_OS_HINT" | $TOLOWER`" in + case "`echo \"$CI_OS_HINT\" | $TOLOWER`" in *freebsd*) CI_OS_NAME="freebsd" ;; *openbsd*) @@ -867,7 +867,7 @@ detect_platform_PKG_CONFIG_PATH_and_FLAGS() { # then, including a PKG_CONFIG_PATH), where a "-" value leaves it empty. SYS_PKG_CONFIG_PATH="" # Let the OS guess... usually BUILTIN_PKG_CONFIG_PATH="`$PKG_CONFIG --variable pc_path pkg-config`" || BUILTIN_PKG_CONFIG_PATH="" - case "`echo "$CI_OS_NAME" | $TOLOWER`" in + case "`echo \"$CI_OS_NAME\" | $TOLOWER`" in *openindiana*|*omnios*|*solaris*|*illumos*|*sunos*) _ARCHES="${ARCH_TGT-}${ARCH-}${ARCH32-}${ARCH64-}" _BITS="${BITS-}" @@ -1086,7 +1086,7 @@ detect_platform_PKG_CONFIG_PATH_and_FLAGS() { fi # Do not check for existence of non-trivial values, we normalize the mess (if any) - PKG_CONFIG_PATH="`echo "${DEFAULT_PKG_CONFIG_PATH-}:${SYS_PKG_CONFIG_PATH-}:${PKG_CONFIG_PATH-}:${BUILTIN_PKG_CONFIG_PATH-}" | normalize_path`" + PKG_CONFIG_PATH="`echo \"${DEFAULT_PKG_CONFIG_PATH-}:${SYS_PKG_CONFIG_PATH-}:${PKG_CONFIG_PATH-}:${BUILTIN_PKG_CONFIG_PATH-}\" | normalize_path`" } # Would hold full path to the CONFIGURE_SCRIPT="${SCRIPTDIR}/${CONFIGURE_SCRIPT_FILENAME}" @@ -1149,7 +1149,7 @@ configure_nut() { fi # Help copy-pasting build setups from CI logs to terminal: - local CONFIG_OPTS_STR="`END=' \'; NUM=0; for F in "${CONFIG_OPTS[@]}" ; do NUM=$(($NUM + 1)); [ x"$NUM" = x"${#CONFIG_OPTS[@]}" ] && END=''; printf "'%s'%s\n" "$F" "$END" ; done`" + local CONFIG_OPTS_STR="`END=' \'; NUM=0; for F in \"${CONFIG_OPTS[@]}\" ; do NUM=$(($NUM + 1)); [ x\"$NUM\" = x\"${#CONFIG_OPTS[@]}\" ] && END=''; printf \"'%s'%s\n\" \"$F\" \"$END\" ; done`" while : ; do # Note the CI_SHELL_IS_FLAKY=true support below echo "=== CONFIGURING NUT: $CONFIGURE_SCRIPT ${CONFIG_OPTS_STR}" echo "=== CC='$CC' CXX='$CXX' CPP='$CPP'" @@ -1314,7 +1314,7 @@ check_gitignore() { echo "===" # Another invocation checks that there was nothing to complain about: - if [ -n "`git status $GIT_ARGS -s ${FILE_GLOB} ${FILE_GLOB_EXCLUDE} | ${EGREP} "^.. ${FILE_REGEX}"`" ] \ + if [ -n "`git status $GIT_ARGS -s ${FILE_GLOB} ${FILE_GLOB_EXCLUDE} | ${EGREP} \"^.. ${FILE_REGEX}\"`" ] \ && [ "$CI_REQUIRE_GOOD_GITIGNORE" != false ] \ ; then echo "FATAL: There are changes in $FILE_DESCR files listed above - tracked sources should be updated in the PR (even if generated - not all builders can do so), and build products should be added to a .gitignore file, everything made should be cleaned and no tracked files should be removed! You can 'export CI_REQUIRE_GOOD_GITIGNORE=false' if appropriate." >&2 @@ -1340,12 +1340,12 @@ consider_cleanup_shortcut() { fi if ( [ -s Makefile ] && ( - [ -n "`find "${SCRIPTDIR}" -name Makefile.am -newer "${CI_BUILDDIR}"/Makefile`" ] \ - || [ -n "`find "${SCRIPTDIR}" -name Makefile.in -newer "${CI_BUILDDIR}"/Makefile`" ] \ - || [ -n "`find "${SCRIPTDIR}" -name Makefile.am -newer "${CI_BUILDDIR}"/Makefile.in`" ] ) ) \ + [ -n "`find \"${SCRIPTDIR}\" -name Makefile.am -newer \"${CI_BUILDDIR}\"/Makefile`" ] \ + || [ -n "`find \"${SCRIPTDIR}\" -name Makefile.in -newer \"${CI_BUILDDIR}\"/Makefile`" ] \ + || [ -n "`find \"${SCRIPTDIR}\" -name Makefile.am -newer \"${CI_BUILDDIR}\"/Makefile.in`" ] ) ) \ || ( [ -s configure ] && ( - [ -n "`find "${SCRIPTDIR}" -name configure.ac -newer "${CI_BUILDDIR}"/configure`" ] \ - || [ -n "`find "${SCRIPTDIR}" -name '*.m4' -newer "${CI_BUILDDIR}"/configure`" ] ) ) \ + [ -n "`find \"${SCRIPTDIR}\" -name configure.ac -newer \"${CI_BUILDDIR}\"/configure`" ] \ + || [ -n "`find \"${SCRIPTDIR}\" -name '*.m4' -newer \"${CI_BUILDDIR}\"/configure`" ] ) ) \ ; then # Avoid reconfiguring just for the sake of distclean echo "=== Starting initial clean-up (from old build products): TAKING SHORTCUT because recipes changed" @@ -1468,7 +1468,7 @@ if [ -z "$BUILD_TYPE" ] ; then --with-docs|--with-docs=*|--with-doc|--with-doc=*) # Note: causes a developer-style build (not CI) # Arg will be passed to configure script as `--with-$1` - BUILD_TYPE="`echo "$1" | sed 's,^--with-,,'`" + BUILD_TYPE="`echo \"$1\" | sed 's,^--with-,,'`" shift ;; @@ -1576,8 +1576,8 @@ default|default-alldrv|default-alldrv:no-distcheck|default-all-errors|default-al CONFIG_OPTS+=("PKG_CONFIG_PATH=${PKG_CONFIG_PATH}") fi - PATH="`echo "${PATH}" | normalize_path`" - CCACHE_PATH="`echo "${CCACHE_PATH}" | normalize_path`" + PATH="`echo \"${PATH}\" | normalize_path`" + CCACHE_PATH="`echo \"${CCACHE_PATH}\" | normalize_path`" # Note: Potentially there can be spaces in entries for multiple # *FLAGS here; this should be okay as long as entry expands to @@ -1948,7 +1948,7 @@ default|default-alldrv|default-alldrv:no-distcheck|default-all-errors|default-al "default-tgt:"*) # Hook for matrix of custom distchecks primarily # e.g. distcheck-ci, distcheck-light, distcheck-valgrind, cppcheck, # maybe others later, as defined in top-level Makefile.am: - BUILD_TGT="`echo "$BUILD_TYPE" | sed 's,^default-tgt:,,'`" + BUILD_TGT="`echo \"$BUILD_TYPE\" | sed 's,^default-tgt:,,'`" if [ -n "${PARMAKE_FLAGS}" ]; then echo "`date`: Starting the parallel build attempt for singular target $BUILD_TGT..." else @@ -1957,7 +1957,7 @@ default|default-alldrv|default-alldrv:no-distcheck|default-all-errors|default-al # Note: Makefile.am already sets some default DISTCHECK_CONFIGURE_FLAGS # that include DISTCHECK_FLAGS if provided - DISTCHECK_FLAGS="`for F in "${CONFIG_OPTS[@]}" ; do echo "'$F' " ; done | tr '\n' ' '`" + DISTCHECK_FLAGS="`for F in \"${CONFIG_OPTS[@]}\" ; do echo \"'$F' \" ; done | tr '\n' ' '`" export DISTCHECK_FLAGS # Tell the sub-makes (likely distcheck*) to hush down @@ -1985,7 +1985,7 @@ default|default-alldrv|default-alldrv:no-distcheck|default-all-errors|default-al # Note: no PARMAKE_FLAGS here - better have this output readably # ordered in case of issues (in sequential replay below). ( echo "`date`: Starting the quiet build attempt for target $BUILD_TYPE..." >&2 - $CI_TIME $MAKE $MAKE_FLAGS_QUIET SPELLCHECK_ERROR_FATAL=yes -k $PARMAKE_FLAGS "`echo "$BUILD_TYPE" | sed 's,^default-,,'`" >/dev/null 2>&1 \ + $CI_TIME $MAKE $MAKE_FLAGS_QUIET SPELLCHECK_ERROR_FATAL=yes -k $PARMAKE_FLAGS "`echo \"$BUILD_TYPE\" | sed 's,^default-,,'`" >/dev/null 2>&1 \ && echo "`date`: SUCCEEDED the spellcheck" >&2 ) || \ ( echo "`date`: FAILED something in spellcheck above; re-starting a verbose build attempt to give more context first:" >&2 @@ -2591,7 +2591,7 @@ default|default-alldrv|default-alldrv:no-distcheck|default-all-errors|default-al ( # Note: Makefile.am already sets some default DISTCHECK_CONFIGURE_FLAGS # that include DISTCHECK_FLAGS if provided - DISTCHECK_FLAGS="`for F in "${CONFIG_OPTS[@]}" ; do echo "'$F' " ; done | tr '\n' ' '`" + DISTCHECK_FLAGS="`for F in \"${CONFIG_OPTS[@]}\" ; do echo \"'$F' \" ; done | tr '\n' ' '`" export DISTCHECK_FLAGS # Tell the sub-makes (distcheck) to hush down @@ -2626,7 +2626,7 @@ bindings) # NOTE: Alternative to optional_prepare_ccache() # FIXME: Can these be united and de-duplicated? if [ x"${CI_CCACHE_USE-}" != xno ] && [ -n "${CI_CCACHE_SYMLINKDIR}" ] && [ -d "${CI_CCACHE_SYMLINKDIR}" ] ; then - PATH="`echo "$PATH" | sed -e 's,^'"${CI_CCACHE_SYMLINKDIR}"'/?:,,' -e 's,:'"${CI_CCACHE_SYMLINKDIR}"'/?:,,' -e 's,:'"${CI_CCACHE_SYMLINKDIR}"'/?$,,' -e 's,^'"${CI_CCACHE_SYMLINKDIR}"'/?$,,'`" + PATH="`echo \"$PATH\" | sed -e 's,^'\"${CI_CCACHE_SYMLINKDIR}\"'/?:,,' -e 's,:'\"${CI_CCACHE_SYMLINKDIR}\"'/?:,,' -e 's,:'\"${CI_CCACHE_SYMLINKDIR}\"'/?$,,' -e 's,^'\"${CI_CCACHE_SYMLINKDIR}\"'/?$,,'`" CCACHE_PATH="$PATH" CCACHE_DIR="${HOME}/.ccache" if (command -v ccache || which ccache) && ls -la "${CI_CCACHE_SYMLINKDIR}" && mkdir -p "${CCACHE_DIR}"/ ; then @@ -2776,8 +2776,8 @@ bindings) [ -z "${LDFLAGS}" ] || echo "WARNING: SKIP: On '${CI_OS_NAME}' with ccache used, can not export LDFLAGS='${LDFLAGS}'" >&2 fi - PATH="`echo "${PATH}" | normalize_path`" - CCACHE_PATH="`echo "${CCACHE_PATH}" | normalize_path`" + PATH="`echo \"${PATH}\" | normalize_path`" + CCACHE_PATH="`echo \"${CCACHE_PATH}\" | normalize_path`" RES_CFG=0 ${CONFIGURE_SCRIPT} "${CONFIG_OPTS[@]}" \ @@ -2830,7 +2830,7 @@ cross-windows-mingw*) && [ -n "${CI_CCACHE_SYMLINKDIR}" ] \ && [ -d "${CI_CCACHE_SYMLINKDIR}" ] \ ; then - PATH="`echo "$PATH" | sed -e 's,^'"${CI_CCACHE_SYMLINKDIR}"'/?:,,' -e 's,:'"${CI_CCACHE_SYMLINKDIR}"'/?:,,' -e 's,:'"${CI_CCACHE_SYMLINKDIR}"'/?$,,' -e 's,^'"${CI_CCACHE_SYMLINKDIR}"'/?$,,'`" + PATH="`echo \"$PATH\" | sed -e 's,^'\"${CI_CCACHE_SYMLINKDIR}\"'/?:,,' -e 's,:'\"${CI_CCACHE_SYMLINKDIR}\"'/?:,,' -e 's,:'\"${CI_CCACHE_SYMLINKDIR}\"'/?$,,' -e 's,^'\"${CI_CCACHE_SYMLINKDIR}\"'/?$,,'`" CCACHE_PATH="$PATH" CCACHE_DIR="${HOME}/.ccache" if (command -v ccache || which ccache) && ls -la "${CI_CCACHE_SYMLINKDIR}" && mkdir -p "${CCACHE_DIR}"/ ; then From 8b5196fbc582b804f1d785d50cbf4aa9aa3a720c Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Mon, 24 Nov 2025 14:27:31 +0000 Subject: [PATCH 770/805] configure.ac, m4/*.m4: revise shell script syntax with backticks and double-quotes [#3196] Signed-off-by: Jim Klimov --- configure.ac | 160 ++++++++++++++++++------------------ m4/ax_realpath.m4 | 26 +++--- m4/ax_realpath_lib.m4 | 32 ++++---- m4/nut_check_aspell.m4 | 26 +++--- m4/nut_check_libavahi.m4 | 2 +- m4/nut_check_libfreeipmi.m4 | 4 +- m4/nut_check_libgd.m4 | 2 +- m4/nut_check_libltdl.m4 | 2 +- m4/nut_check_libmodbus.m4 | 2 +- m4/nut_check_libneon.m4 | 2 +- m4/nut_check_libnetsnmp.m4 | 4 +- m4/nut_check_libnss.m4 | 2 +- m4/nut_check_libopenssl.m4 | 2 +- m4/nut_check_libregex.m4 | 6 +- m4/nut_check_libusb.m4 | 6 +- m4/nut_check_libwrap.m4 | 2 +- m4/nut_check_python.m4 | 44 +++++----- m4/nut_compiler_family.m4 | 18 ++-- 18 files changed, 171 insertions(+), 171 deletions(-) diff --git a/configure.ac b/configure.ac index 876635983c..6ec2dd4e1a 100644 --- a/configure.ac +++ b/configure.ac @@ -24,9 +24,9 @@ dnl Oddly, autoconf-2.69 on CentOS 7 both complains that AC INIT argument dnl is not a literal, and does contain expected values in the generated dnl script and include/config.h. A "pure" m4 solution would be quieter. AC_INIT([nut], - m4_esyscmd_s([NUT_VERSION_QUERY=VER50 "`dirname "$0"`/tools/gitlog2version.sh" 2>/dev/null]), + m4_esyscmd_s([NUT_VERSION_QUERY=VER50 "`dirname \"$0\"`/tools/gitlog2version.sh" 2>/dev/null]), [https://github.com/networkupstools/nut/issues],[nut], - m4_esyscmd_s([NUT_VERSION_QUERY=URL "`dirname "$0"`/tools/gitlog2version.sh" 2>/dev/null])) + m4_esyscmd_s([NUT_VERSION_QUERY=URL "`dirname \"$0\"`/tools/gitlog2version.sh" 2>/dev/null])) dnl See docs/maintainer-guide.txt about releases - updating the version dnl above is a small part of the consistent ritual! @@ -43,7 +43,7 @@ dnl snapshots further set in stone. Either way, there should be a slash and dnl either a filename, or nothing. Adding a bogus filename and chopping it dnl off by `dirname` should do the trick. dnl NOTE: the resulting NUT_WEBSITE_BASE string does not end with a slash! -NUT_WEBSITE_BASE="`dirname "${PACKAGE_URL}index.html"`" +NUT_WEBSITE_BASE="`dirname \"${PACKAGE_URL}index.html\"`" dnl Fallback, no trailing slash! test -n "${NUT_WEBSITE_BASE-}" || NUT_WEBSITE_BASE='https://www.networkupstools.org' @@ -54,12 +54,12 @@ dnl If the NUT codebase in this workspace is being developed and rebuilt dnl without reconfiguration, detailed version in the binaries will differ dnl (that one comes from the NUT_VERSION_MACRO from nut_version.h file). dnl # Example: NUT_SOURCE_GITREV='2.8.2.695.1-696+g0e00f0777' -NUT_SOURCE_GITREV="`NUT_VERSION_QUERY=DESC50 "${srcdir}/tools/gitlog2version.sh" 2>/dev/null`" +NUT_SOURCE_GITREV="`NUT_VERSION_QUERY=DESC50 \"${srcdir}/tools/gitlog2version.sh\" 2>/dev/null`" dnl A true/false (literally) response that can be used for prettier messages dnl emitted by NUT code, or make some "auto" configuration choices below. -NUT_SOURCE_GITREV_IS_RELEASE="`NUT_VERSION_QUERY=IS_RELEASE "${srcdir}/tools/gitlog2version.sh" 2>/dev/null || echo false`" -NUT_SOURCE_GITREV_IS_PRERELEASE="`NUT_VERSION_QUERY=IS_PRERELEASE "${srcdir}/tools/gitlog2version.sh" 2>/dev/null || echo false`" +NUT_SOURCE_GITREV_IS_RELEASE="`NUT_VERSION_QUERY=IS_RELEASE \"${srcdir}/tools/gitlog2version.sh\" 2>/dev/null || echo false`" +NUT_SOURCE_GITREV_IS_PRERELEASE="`NUT_VERSION_QUERY=IS_PRERELEASE \"${srcdir}/tools/gitlog2version.sh\" 2>/dev/null || echo false`" AS_IF([$NUT_SOURCE_GITREV_IS_RELEASE], [NUT_SOURCE_GITREV_DEVREL="release"], [ AS_IF([$NUT_SOURCE_GITREV_IS_PRERELEASE], [NUT_SOURCE_GITREV_DEVREL="pre-release"], @@ -72,14 +72,14 @@ dnl this situation is only expected if NUT_SOURCE_GITREV_IS_RELEASE==true; dnl for a pre-release it may differ from even the base NUT_VERSION numbers dnl (e.g. a commit tagged as 2.8.3-rc5 can have its own NUT_VERSION based dnl on 2.8.2-something, but is assumed as a pre-release for 2.8.3 SEMVER). -NUT_SOURCE_GITREV_SEMVER="`NUT_VERSION_QUERY=SEMVER "${srcdir}/tools/gitlog2version.sh" 2>/dev/null`" +NUT_SOURCE_GITREV_SEMVER="`NUT_VERSION_QUERY=SEMVER \"${srcdir}/tools/gitlog2version.sh\" 2>/dev/null`" dnl Gitrev-based build identifier which can be used for e.g. PyPI uploads: dnl # Example: NUT_SOURCE_GITREV_NUMERIC='2.8.2.695.1.696' -dnl # NUT_SOURCE_GITREV_NUMERIC="`echo "${NUT_SOURCE_GITREV}" | sed -e 's/^v//' -e 's/@<:@+-@:>@g.*$//' -e 's/-/./g'`" +dnl # NUT_SOURCE_GITREV_NUMERIC="`echo \"${NUT_SOURCE_GITREV}\" | sed -e 's/^v//' -e 's/@<:@+-@:>@g.*$//' -e 's/-/./g'`" dnl # Without the commit-count since tag (dash-separated part): dnl # Example: NUT_SOURCE_GITREV_NUMERIC='2.8.2.695.1' -NUT_SOURCE_GITREV_NUMERIC="`echo "${NUT_SOURCE_GITREV}" | sed -e 's/^v//' -e 's/@<:@+-@:>@g.*$//' -e 's/-@<:@0-9@:>@*$//'`" +NUT_SOURCE_GITREV_NUMERIC="`echo \"${NUT_SOURCE_GITREV}\" | sed -e 's/^v//' -e 's/@<:@+-@:>@g.*$//' -e 's/-@<:@0-9@:>@*$//'`" dnl Note: except for experiments, do not pass this into config.h - use dnl the NUT_VERSION_MACRO from nut_version.h instead. Developers may @@ -315,7 +315,7 @@ dnl --------------------------------------------------------------------- dnl GNU and BSD make are okay with the syntax, but Sun make/dmake are not: AC_MSG_CHECKING([whether this make implementation supports export VAR=VAL syntax]) dnl # using printf formatting for some funniner shells out there -nut_am_output="`printf 'export VAR=VAL\ntest:\n\t@echo "VAR=%s%sVAR%s"\n' '\$' '(' ')' | ${MAKE-make} -f - test`" +nut_am_output="`printf 'export VAR=VAL\ntest:\n\t@echo \"VAR=%s%sVAR%s\"\n' '\$' '(' ')' | ${MAKE-make} -f - test`" nut_am_result="$?" AS_IF([test x"${nut_am_result}" = x0 -a x"${nut_am_output}" = x"VAR=VAL"], [ NUT_AM_MAKE_CAN_EXPORT="" @@ -340,14 +340,14 @@ dnl https://www.gnu.org/software/autoconf/manual/autoconf-2.68/html_node/Generic TAIL_ARGS_FROM_NTH_LINE="" ac_path_TAIL_found="" AC_PATH_PROGS_FEATURE_CHECK([TAIL], [tail gtail], - [_TAIL_OUT="`(echo "1"; echo "2"; echo "3"; echo "4"; echo "5"; echo "6"; echo "7") | $ac_path_TAIL +3`" || _TAIL_OUT="" + [_TAIL_OUT="`(echo \"1\"; echo \"2\"; echo \"3\"; echo \"4\"; echo \"5\"; echo \"6\"; echo \"7\") | $ac_path_TAIL +3`" || _TAIL_OUT="" AS_IF([(test x"${_TAIL_OUT}" != x && echo "${_TAIL_OUT}" | ${GREP} 3 && echo "${_TAIL_OUT}" | ${GREP} 7) >/dev/null], [AS_IF([(echo "${_TAIL_OUT}" | ${GREP} 1 || echo "${_TAIL_OUT}" | ${GREP} 2) >/dev/null], [], [ac_path_TAIL_found=: ac_cv_path_TAIL="${ac_path_TAIL}"]) ]) AS_IF([test x"${ac_path_TAIL_found}" != x:], - [_TAIL_OUT="`(echo "1"; echo "2"; echo "3"; echo "4"; echo "5"; echo "6"; echo "7") | $ac_path_TAIL -n +3`" || _TAIL_OUT="" + [_TAIL_OUT="`(echo \"1\"; echo \"2\"; echo \"3\"; echo \"4\"; echo \"5\"; echo \"6\"; echo \"7\") | $ac_path_TAIL -n +3`" || _TAIL_OUT="" AS_IF([(test x"${_TAIL_OUT}" != x && echo "${_TAIL_OUT}" | ${GREP} 3 && echo "${_TAIL_OUT}" | ${GREP} 7) >/dev/null], [AS_IF([(echo "${_TAIL_OUT}" | ${GREP} 1 || echo "${_TAIL_OUT}" | ${GREP} 2) >/dev/null], [], [ac_path_TAIL_found=: @@ -409,7 +409,7 @@ AS_CASE([x"${nut_with_confdir}"], [nut_with_confdir_suffix=""; RESULT_COMMENT='prefix was not customized...']) ], [ RESULT_COMMENT="normalized caller-provided suffix..." - nut_with_confdir_suffix="`echo "/${nut_with_confdir_suffix}" | sed -e 's,^/*,/,' -e 's,/*$,,'`" + nut_with_confdir_suffix="`echo \"/${nut_with_confdir_suffix}\" | sed -e 's,^/*,/,' -e 's,/*$,,'`" ] ) AC_MSG_RESULT([${RESULT_COMMENT} '${nut_with_confdir_suffix}']) @@ -505,7 +505,7 @@ dnl Note these defaults may change further below depending on OS and dnl certain other configure options (e.g. "in-place replacement") RUN_AS_USER="nobody" RUN_AS_GROUP="nobody" -AS_IF([test -n "`${PROBE_OS_GROUP} nogroup`" && test -z "`${PROBE_OS_GROUP} "${RUN_AS_GROUP}"`"], +AS_IF([test -n "`${PROBE_OS_GROUP} nogroup`" && test -z "`${PROBE_OS_GROUP} \"${RUN_AS_GROUP}\"`"], [RUN_AS_GROUP="nogroup"] ) @@ -660,26 +660,26 @@ AS_IF([test x"$nut_enable_inplace_runtime" = xyes -a x"${NUT_VERSION_DEPLOYED-}" AC_PATH_PROG([DEPLOYED_UPSIMAGE], [upsimage.cgi], [], [${PREFIX_CGIDIR}:${PREFIX_BINDIR}:${PATH}:/usr/lib/cgi-bin/nut:/usr/libexec/cgi-bin/nut:/usr/libexec/nut:/usr/libexec/nut/cgi-bin:/usr/lib/nut:/usr/lib/nut/cgi-bin]) AS_IF([test -x "${DEPLOYED_UPSD}"], [ AX_REALPATH([$DEPLOYED_UPSD], [DEPLOYED_UPSD]) - DEPLOYED_SBINDIR="`dirname "${DEPLOYED_UPSD}"`" + DEPLOYED_SBINDIR="`dirname \"${DEPLOYED_UPSD}\"`" ]) AS_IF([test -x "${DEPLOYED_UPSC}"], [ AX_REALPATH([$DEPLOYED_UPSC], [DEPLOYED_UPSC]) - DEPLOYED_BINDIR="`dirname "${DEPLOYED_UPSC}"`" + DEPLOYED_BINDIR="`dirname \"${DEPLOYED_UPSC}\"`" ]) AS_IF([test -x "${DEPLOYED_DUMMYUPS}"], [ AX_REALPATH([$DEPLOYED_DUMMYUPS], [DEPLOYED_DUMMYUPS]) - DEPLOYED_DRVDIR="`dirname "${DEPLOYED_DUMMYUPS}"`" + DEPLOYED_DRVDIR="`dirname \"${DEPLOYED_DUMMYUPS}\"`" ]) AS_IF([test -x "${DEPLOYED_UPSIMAGE}"], [ AX_REALPATH([$DEPLOYED_UPSIMAGE], [DEPLOYED_UPSIMAGE]) - DEPLOYED_CGIDIR="`dirname "${DEPLOYED_UPSIMAGE}"`" + DEPLOYED_CGIDIR="`dirname \"${DEPLOYED_UPSIMAGE}\"`" ]) DEPLOYED_PREFIX="" AS_IF([test -d "${DEPLOYED_SBINDIR}"], - [DEPLOYED_PREFIX="`dirname "${DEPLOYED_SBINDIR}"`"], + [DEPLOYED_PREFIX="`dirname \"${DEPLOYED_SBINDIR}\"`"], [AS_IF([test -d "${DEPLOYED_BINDIR}"], - [DEPLOYED_PREFIX="`dirname "${DEPLOYED_BINDIR}"`"])] + [DEPLOYED_PREFIX="`dirname \"${DEPLOYED_BINDIR}\"`"])] ) AC_MSG_CHECKING([for CONFIG_FLAGS of an already deployed NUT build (if it reports those)]) @@ -701,7 +701,7 @@ AS_IF([test x"$nut_enable_inplace_runtime" = xyes -a x"${NUT_VERSION_DEPLOYED-}" AS_IF([test -x "${DEPLOYED_TOOL}"], [], [continue]) AC_MSG_CHECKING([for CONFIG_FLAGS from ${DEPLOYED_TOOL}]) - CONFIG_FLAGS_DEPLOYED="`"${DEPLOYED_TOOL}" -DV 2>&1 | ${GREP} 'configured with flags:' | head -1 | sed 's,^.*configured with flags: *,,'`" \ + CONFIG_FLAGS_DEPLOYED="`\"${DEPLOYED_TOOL}\" -DV 2>&1 | ${GREP} 'configured with flags:' | head -1 | sed 's,^.*configured with flags: *,,'`" \ && test x"${CONFIG_FLAGS_DEPLOYED}" != x \ || CONFIG_FLAGS_DEPLOYED="" @@ -709,7 +709,7 @@ AS_IF([test x"$nut_enable_inplace_runtime" = xyes -a x"${NUT_VERSION_DEPLOYED-}" dnl that we've "reentered" the configuration script), so we tolerate a dnl better detailed string that is more than just a version, e.g.: dnl 2.8.2.1829-1829+g8f8a4f417 (development iteration after 2.8.2) built with gcc (Debian 10.2.1-6) 10.2.1 20210110 - NUT_VERSION_DEPLOYED="`"${DEPLOYED_TOOL}" -DV 2>&1 | ${GREP} 'configured with flags:' | head -1 | sed -e 's,^.*Network UPS Tools version \(.*\) configured with flags:.*$,\1,' -e 's, and *$,,'`" \ + NUT_VERSION_DEPLOYED="`\"${DEPLOYED_TOOL}\" -DV 2>&1 | ${GREP} 'configured with flags:' | head -1 | sed -e 's,^.*Network UPS Tools version \(.*\) configured with flags:.*$,\1,' -e 's, and *$,,'`" \ && test x"${NUT_VERSION_DEPLOYED}" != x \ || NUT_VERSION_DEPLOYED="" @@ -720,7 +720,7 @@ AS_IF([test x"$nut_enable_inplace_runtime" = xyes -a x"${NUT_VERSION_DEPLOYED-}" AS_IF([test -x "${LDD}" 2>/dev/null], [ for TOKEN in `$LDD "${DEPLOYED_TOOL}" 2>&1 | ${GREP} libupsclient` ; do case "${TOKEN}" in - /*/libupsclient*) DEPLOYED_LIBDIR="`dirname "$TOKEN"`" ;; + /*/libupsclient*) DEPLOYED_LIBDIR="`dirname \"$TOKEN\"`" ;; esac done ]) @@ -739,7 +739,7 @@ AS_IF([test x"$nut_enable_inplace_runtime" = xyes -a x"${NUT_VERSION_DEPLOYED-}" [*--prefix=*], [ for F in ${CONFIG_FLAGS_DEPLOYED} ${CONFIG_FLAGS} ; do case "$F" in - "--prefix="*) prefix="`echo "$F" | ( IFS='=' read K V ; echo "$V" )`" ;; + "--prefix="*) prefix="`echo \"$F\" | ( IFS='=' read K V ; echo \"$V\" )`" ;; esac done ] @@ -791,7 +791,7 @@ AS_IF([test x"$nut_enable_inplace_runtime" = xyes -a x"${NUT_VERSION_DEPLOYED-}" [*--datarootdir=*], [ for F in ${CONFIG_FLAGS_DEPLOYED} ${CONFIG_FLAGS} ; do case "$F" in - "--datarootdir="*) datarootdir="`echo "$F" | ( IFS='=' read K V ; echo "$V" )`" ;; + "--datarootdir="*) datarootdir="`echo \"$F\" | ( IFS='=' read K V ; echo \"$V\" )`" ;; esac done ] @@ -807,7 +807,7 @@ AS_IF([test x"$nut_enable_inplace_runtime" = xyes -a x"${NUT_VERSION_DEPLOYED-}" [*--datadir=*], [ for F in ${CONFIG_FLAGS_DEPLOYED} ${CONFIG_FLAGS} ; do case "$F" in - "--datadir="*) datadir="`echo "$F" | ( IFS='=' read K V ; echo "$V" )`" ;; + "--datadir="*) datadir="`echo \"$F\" | ( IFS='=' read K V ; echo \"$V\" )`" ;; esac done ] @@ -825,8 +825,8 @@ AS_IF([test x"$nut_enable_inplace_runtime" = xyes -a x"${NUT_VERSION_DEPLOYED-}" [AS_IF([test -f "${PREFIX_DATAROOTDIR}/cmdvartab" || test -f "${PREFIX_DATAROOTDIR}/driver.list"], [DEPLOYED_DATADIR="${PREFIX_DATAROOTDIR}"], [dnl FIXME: Be careful on WIN32 and its "find" vs. that in MINGW? - DEPLOYED_DATADIR="`find "${PREFIX_DATAROOTDIR}" -name cmdvartab | head -1 | sed 's,/@<:@^/@:>@*$,,'`" || DEPLOYED_DATADIR="" - AS_IF([test -z "${DEPLOYED_DATADIR}"], [DEPLOYED_DATADIR="`find "${PREFIX_DATAROOTDIR}" -name driver.list | head -1 | sed 's,/@<:@^/@:>@*$,,'`" || DEPLOYED_DATADIR=""]) + DEPLOYED_DATADIR="`find \"${PREFIX_DATAROOTDIR}\" -name cmdvartab | head -1 | sed 's,/@<:@^/@:>@*$,,'`" || DEPLOYED_DATADIR="" + AS_IF([test -z "${DEPLOYED_DATADIR}"], [DEPLOYED_DATADIR="`find \"${PREFIX_DATAROOTDIR}\" -name driver.list | head -1 | sed 's,/@<:@^/@:>@*$,,'`" || DEPLOYED_DATADIR=""]) ] )] ) @@ -846,7 +846,7 @@ AS_IF([test x"$nut_enable_inplace_runtime" = xyes -a x"${NUT_VERSION_DEPLOYED-}" [*--sysconfdir=*], [ for F in ${CONFIG_FLAGS_DEPLOYED} ${CONFIG_FLAGS} ; do case "$F" in - "--sysconfdir="*) sysconfdir="`echo "$F" | ( IFS='=' read K V ; echo "$V" )`" ; HAVE_DEPLOYED_CONFPATH=true ;; + "--sysconfdir="*) sysconfdir="`echo \"$F\" | ( IFS='=' read K V ; echo \"$V\" )`" ; HAVE_DEPLOYED_CONFPATH=true ;; esac done ]) @@ -854,7 +854,7 @@ AS_IF([test x"$nut_enable_inplace_runtime" = xyes -a x"${NUT_VERSION_DEPLOYED-}" [*--with-confdir=*], [ for F in ${CONFIG_FLAGS_DEPLOYED} ${CONFIG_FLAGS} ; do case "$F" in - "--with-confdir="*) nut_with_confdir="`echo "$F" | ( IFS='=' read K V ; echo "$V" )`" ; HAVE_DEPLOYED_CONFPATH=true ;; + "--with-confdir="*) nut_with_confdir="`echo \"$F\" | ( IFS='=' read K V ; echo \"$V\" )`" ; HAVE_DEPLOYED_CONFPATH=true ;; esac done ]) @@ -862,7 +862,7 @@ AS_IF([test x"$nut_enable_inplace_runtime" = xyes -a x"${NUT_VERSION_DEPLOYED-}" [*--with-confdir-suffix=*], [ for F in ${CONFIG_FLAGS_DEPLOYED} ${CONFIG_FLAGS} ; do case "$F" in - "--with-confdir-suffix="*) nut_with_confdir_suffix="`echo "$F" | ( IFS='=' read K V ; echo "$V" )`" ; HAVE_DEPLOYED_CONFPATH=true ;; + "--with-confdir-suffix="*) nut_with_confdir_suffix="`echo \"$F\" | ( IFS='=' read K V ; echo \"$V\" )`" ; HAVE_DEPLOYED_CONFPATH=true ;; esac done ]) @@ -870,7 +870,7 @@ AS_IF([test x"$nut_enable_inplace_runtime" = xyes -a x"${NUT_VERSION_DEPLOYED-}" [*--with-confdir-examples=*], [ for F in ${CONFIG_FLAGS_DEPLOYED} ${CONFIG_FLAGS} ; do case "$F" in - "--with-confdir-examples="*) nut_with_confdir_examples="`echo "$F" | ( IFS='=' read K V ; echo "$V" )`" ;; + "--with-confdir-examples="*) nut_with_confdir_examples="`echo \"$F\" | ( IFS='=' read K V ; echo \"$V\" )`" ;; esac done ],[ @@ -951,7 +951,7 @@ AS_IF([test x"$nut_enable_inplace_runtime" = xyes -a x"${NUT_VERSION_DEPLOYED-}" [*--libdir=*], [ for F in ${CONFIG_FLAGS_DEPLOYED} ${CONFIG_FLAGS} ; do case "$F" in - "--libdir="*) libdir="`echo "$F" | ( IFS='=' read K V ; echo "$V" )`" ;; + "--libdir="*) libdir="`echo \"$F\" | ( IFS='=' read K V ; echo \"$V\" )`" ;; esac done ] @@ -976,7 +976,7 @@ AS_IF([test x"$nut_enable_inplace_runtime" = xyes -a x"${NUT_VERSION_DEPLOYED-}" [*--libexecdir=*], [ for F in ${CONFIG_FLAGS_DEPLOYED} ${CONFIG_FLAGS} ; do case "$F" in - "--libexecdir="*) libexecdir="`echo "$F" | ( IFS='=' read K V ; echo "$V" )`" ;; + "--libexecdir="*) libexecdir="`echo \"$F\" | ( IFS='=' read K V ; echo \"$V\" )`" ;; esac done ] @@ -991,7 +991,7 @@ AS_IF([test x"$nut_enable_inplace_runtime" = xyes -a x"${NUT_VERSION_DEPLOYED-}" [*--with-pkgconfig-dir=*], [ for F in ${CONFIG_FLAGS_DEPLOYED} ${CONFIG_FLAGS} ; do case "$F" in - "--with-pkgconfig-dir="*) pkgconfigdir="`echo "$F" | ( IFS='=' read K V ; echo "$V" )`" ;; + "--with-pkgconfig-dir="*) pkgconfigdir="`echo \"$F\" | ( IFS='=' read K V ; echo \"$V\" )`" ;; esac done ] @@ -1012,8 +1012,8 @@ AS_IF([test x"$nut_enable_inplace_runtime" = xyes -a x"${NUT_VERSION_DEPLOYED-}" AS_IF([test -d "${udevdir}/rules.d"], [for F in "${udevdir}/rules.d"/*-nut-*.rules ; do if test -s "$F" ; then - nut_inplace_group="`${GREP} GROUP= "$F" | head -1 | sed 's,^.* GROUP="*\(.*\)"*.*$,\1,'`" \ - && test -n "`${PROBE_OS_GROUP} "${nut_inplace_group}"`" \ + nut_inplace_group="`${GREP} GROUP= \"$F\" | head -1 | sed 's,^.* GROUP=\"*\(.*\)\"*.*$,\1,'`" \ + && test -n "`${PROBE_OS_GROUP} \"${nut_inplace_group}\"`" \ && AC_MSG_RESULT([Got from ${F}]) \ && break \ || nut_inplace_group="" @@ -1047,7 +1047,7 @@ AS_IF([test x"$nut_enable_inplace_runtime" = xyes -a x"${NUT_VERSION_DEPLOYED-}" `${EGREP} '^ *##* *RUN_AS_USER' "${CONFPATH}/upsmon.conf" | awk '{print $3}'`\ ; do \ AS_IF([test -z "${nut_inplace_user}"], [ - test -n "`${PROBE_OS_USER} "${nut_inplace_user}"`" \ + test -n "`${PROBE_OS_USER} \"${nut_inplace_user}\"`" \ && AC_MSG_RESULT([Got from ${CONFPATH}/upsmon.conf]) \ || nut_inplace_user=""]) done @@ -1060,7 +1060,7 @@ AS_IF([test x"$nut_enable_inplace_runtime" = xyes -a x"${NUT_VERSION_DEPLOYED-}" `${EGREP} '^ *##* *RUN_AS_USER' "${CONFPATH}/upsmon.conf.sample" | awk '{print $3}'`\ ; do \ AS_IF([test -z "${nut_inplace_user}"], [ - test -n "`${PROBE_OS_USER} "${nut_inplace_user}"`" \ + test -n "`${PROBE_OS_USER} \"${nut_inplace_user}\"`" \ && AC_MSG_RESULT([Got from ${CONFPATH}/upsmon.conf]) \ || nut_inplace_user=""]) done @@ -1077,8 +1077,8 @@ AS_IF([test x"$nut_enable_inplace_runtime" = xyes -a x"${NUT_VERSION_DEPLOYED-}" "${LIBDIR}/pkgconfig/libnutclient.pc" \ ; do AS_IF([test -z "${nut_inplace_user}" && test -s "$F"], - [nut_inplace_user="`${EGREP} '^ *nutuser=' "$F" | sed 's,^ *nutuser=,,'`" \ - && test -n "`${PROBE_OS_USER} "${nut_inplace_user}"`" \ + [nut_inplace_user="`${EGREP} '^ *nutuser=' \"$F\" | sed 's,^ *nutuser=,,'`" \ + && test -n "`${PROBE_OS_USER} \"${nut_inplace_user}\"`" \ && AC_MSG_RESULT([Got from $F]) \ || nut_inplace_user="" ]) @@ -1806,7 +1806,7 @@ AC_MSG_CHECKING([whether ln -sr works]) dnl We need to relative-symlink some files. Or hardlink. Or copy... LN_S_R="cp -pR" if test "$as_ln_s" = "ln -s" ; then - _abs_srcdir="`cd "${srcdir}" && pwd`" || _abs_srcdir="" + _abs_srcdir="`cd \"${srcdir}\" && pwd`" || _abs_srcdir="" _abs_builddir="`pwd`" AS_IF([test x"${nut_enable_configure_debug}" = xyes], [ AC_MSG_NOTICE([(CONFIGURE-DEVEL-DEBUG) srcdir='${srcdir}' _abs_srcdir='${_abs_srcdir}' _abs_builddir='${_abs_builddir}']) @@ -1816,8 +1816,8 @@ if test "$as_ln_s" = "ln -s" ; then else dnl NOTE: Here we check equality of the file systems by the dnl devices they are mounted from (first column in df output): - _fs_srcdir="`df "${_abs_srcdir}" | tail -1 | awk '{print $1}'`" || fs_srcdir="XXXs" - _fs_builddir="`df "${_abs_builddir}" | tail -1 | awk '{print $1}'`" || fs_builddir="XXXb" + _fs_srcdir="`df \"${_abs_srcdir}\" | tail -1 | awk '{print $1}'`" || fs_srcdir="XXXs" + _fs_builddir="`df \"${_abs_builddir}\" | tail -1 | awk '{print $1}'`" || fs_builddir="XXXb" AS_IF([test x"${nut_enable_configure_debug}" = xyes], [ AC_MSG_NOTICE([(CONFIGURE-DEVEL-DEBUG) _fs_srcdir='${_fs_srcdir}' _fs_builddir='${_fs_builddir}']) ]) @@ -2375,7 +2375,7 @@ AC_ARG_WITH(drivers, [LB="[["; RB="]]"] ) dnl ###DEBUG### echo "RECURSIVE SEARCH FOR: '$1'" >&2 - SPACE="`printf "$LB"' \t'"$RB"`" + SPACE="`printf \"$LB\"' \t'\"$RB\"`" SPACES="${SPACE}*" sed -e "s/${SPACES}""$LB"'+'"$RB"'*='"${SPACES}/=/" \ -e "s/^${SPACES}//" < "$srcdir/drivers/Makefile.am" \ @@ -2398,8 +2398,8 @@ AC_ARG_WITH(drivers, | tr ' ' '\n' | while read TOKEN ; do case x"${TOKEN}" in x) ;; - 'x$('*')') get_drivers_makefile_value "`echo "${TOKEN}" | sed -e 's,^\$(,,' -e 's,)$,,'`" ;; - 'x${'*'}') get_drivers_makefile_value "`echo "${TOKEN}" | sed -e 's,^\${,,' -e 's,}$,,'`" ;; + 'x$('*')') get_drivers_makefile_value "`echo \"${TOKEN}\" | sed -e 's,^\$(,,' -e 's,)$,,'`" ;; + 'x${'*'}') get_drivers_makefile_value "`echo \"${TOKEN}\" | sed -e 's,^\${,,' -e 's,}$,,'`" ;; *) echo "${TOKEN} " ;; esac done dnl ###DEBUG### | tee -a /dev/stderr @@ -2411,7 +2411,7 @@ AC_ARG_WITH(drivers, [LB="[["; RB="]]"] ) dnl ###DEBUG### echo "SEARCH FOR: '$1'" >&2 - SPACE="`printf "$LB"' \t'"$RB"`" + SPACE="`printf \"$LB\"' \t'\"$RB\"`" SPACES="${SPACE}*" dnl Let it recurse, and only then we collect the @@ -2421,7 +2421,7 @@ AC_ARG_WITH(drivers, ) for DRVLIST_NAME in $DRVLIST_NAMES; do - OUT="`get_drvlist "$DRVLIST_NAME"`" \ + OUT="`get_drvlist \"$DRVLIST_NAME\"`" \ && test -n "$OUT" || OUT="" eval $DRVLIST_NAME="\$OUT" AC_MSG_NOTICE([Will check custom driver selection against $DRVLIST_NAME="$OUT"]) @@ -3372,9 +3372,9 @@ if test x"${nut_with_nut_monitor}" != xno ; then AS_CASE([x"${PYTHON2}"], [x/usr/bin/python2], [TRY_PYTHON2_VERS="python2 python2.7 python2.6"], [x/usr/bin/python], [TRY_PYTHON2_VERS="python python2 python2.7 python2.6"], - [TRY_PYTHON2_VERS="`basename "${PYTHON2}"`"] + [TRY_PYTHON2_VERS="`basename \"${PYTHON2}\"`"] ) - TRY_BASEDIR="`dirname "${PYTHON}"`" + TRY_BASEDIR="`dirname \"${PYTHON}\"`" for ARCHDIR in 64 amd64 sparcv9 32 i86 sparcv7 sparc ; do for TRY_VERNAME in $TRY_PYTHON2_VERS ; do TRY_PYTHON2="${TRY_BASEDIR}/${ARCHDIR}/${TRY_VERNAME}" @@ -3489,9 +3489,9 @@ if test x"${nut_with_nut_monitor}" != xno ; then AS_CASE([x"${PYTHON}"], [x/usr/bin/python2], [TRY_PYTHON2_VERS="python2 python2.7 python2.6"], [x/usr/bin/python], [TRY_PYTHON2_VERS="python python2 python2.7 python2.6"], - [TRY_PYTHON2_VERS="`basename "${PYTHON}"`"] + [TRY_PYTHON2_VERS="`basename \"${PYTHON}\"`"] ) - TRY_BASEDIR="`dirname "${PYTHON}"`" + TRY_BASEDIR="`dirname \"${PYTHON}\"`" for ARCHDIR in 64 amd64 sparcv9 32 i86 sparcv7 sparc ; do for TRY_VERNAME in $TRY_PYTHON2_VERS ; do TRY_PYTHON2="${TRY_BASEDIR}/${ARCHDIR}/${TRY_VERNAME}" @@ -3871,7 +3871,7 @@ have_disted_doc_man=no want_disted_doc_man=no if test -s "${abs_srcdir}"/docs/man/snmp-ups.8 ; then dnl Test that groff files exist (building from distributed tarball, not git repo) - if test x"PLACEHOLDER" = x"`cat "${abs_srcdir}"/docs/man/snmp-ups.8`" ; then + if test x"PLACEHOLDER" = x"`cat \"${abs_srcdir}\"/docs/man/snmp-ups.8`" ; then dnl REALLY should not happen in real builds, dnl but may be in distcheck-driven sub-builds dnl where the external build agreed to use @@ -3889,8 +3889,8 @@ for nut_doc_build_target in $nut_doc_build_list; do *=*=*) rm -rf "${DOCTESTDIR}" AC_MSG_ERROR([Invalid documentation format option: ${nut_doc_build_target}]) ;; *=*) - nut_doc_build_target_base="`echo "${nut_doc_build_target}" | sed 's,=.*$,,'`" - nut_doc_build_target_flag="`echo "${nut_doc_build_target}" | sed 's,^.*=,,'`" + nut_doc_build_target_base="`echo \"${nut_doc_build_target}\" | sed 's,=.*$,,'`" + nut_doc_build_target_flag="`echo \"${nut_doc_build_target}\" | sed 's,^.*=,,'`" ;; *) nut_doc_build_target_base="${nut_doc_build_target}" @@ -4088,7 +4088,7 @@ no) ;; *) dnl # yes, all, skip... if test -n "${DOC_CANNOTBUILD_LIST}"; then - DOC_CANNOTBUILD_LIST_LINES="`echo "${DOC_CANNOTBUILD_LIST}" | tr ' ' '\n' | ${EGREP} -v '^$'`" + DOC_CANNOTBUILD_LIST_LINES="`echo \"${DOC_CANNOTBUILD_LIST}\" | tr ' ' '\n' | ${EGREP} -v '^$'`" for DOCTYPE in ${nut_doc_build_list} ; do if echo "${DOC_CANNOTBUILD_LIST_LINES}" | ${EGREP} "^${DOCTYPE}(=yes)?\$" >/dev/null 2>/dev/null ; then AC_MSG_ERROR([Unable to build${DOC_CANNOTBUILD_LIST} documentation (check for 'no' results above)]) @@ -4351,7 +4351,7 @@ case "${nut_with_docs_changelog_start}" in GITLOG_START_POINT=v2.6.0 ], [dnl # Try to cut off from preceding release tag (as known in this git workspace index) - GITLOG_START_POINT=v"`echo "${NUT_SOURCE_GITREV_NUMERIC}" | sed -e 's/^\(@<:@0-9@:>@*\.@<:@0-9@:>@*\.@<:@0-9@:>@*\)@<:@^0-9@:>@*.*$/\1/'`" \ + GITLOG_START_POINT=v"`echo \"${NUT_SOURCE_GITREV_NUMERIC}\" | sed -e 's/^\(@<:@0-9@:>@*\.@<:@0-9@:>@*\.@<:@0-9@:>@*\)@<:@^0-9@:>@*.*$/\1/'`" \ && test x"${GITLOG_START_POINT}" != xv \ || GITLOG_START_POINT="master" ]) @@ -4375,11 +4375,11 @@ MAN_SECTION_CMD_SYS="${nut_with_docs_man_section_cmd_sys}" MAN_SECTION_CMD_USR="${nut_with_docs_man_section_cmd_usr}" MAN_SECTION_MISC="${nut_with_docs_man_section_misc}" -MAN_SECTION_API_BASE="`echo "${MAN_SECTION_API}" | sed 's/^\(@<:@0-9@:>@*\)@<:@^0-9@:>@.*$/\1/'`" -MAN_SECTION_CFG_BASE="`echo "${MAN_SECTION_CFG}" | sed 's/^\(@<:@0-9@:>@*\)@<:@^0-9@:>@.*$/\1/'`" -MAN_SECTION_CMD_SYS_BASE="`echo "${MAN_SECTION_CMD_SYS}" | sed 's/^\(@<:@0-9@:>@*\)@<:@^0-9@:>@.*$/\1/'`" -MAN_SECTION_CMD_USR_BASE="`echo "${MAN_SECTION_CMD_USR}" | sed 's/^\(@<:@0-9@:>@*\)@<:@^0-9@:>@.*$/\1/'`" -MAN_SECTION_MISC_BASE="`echo "${MAN_SECTION_MISC}" | sed 's/^\(@<:@0-9@:>@*\)@<:@^0-9@:>@.*$/\1/'`" +MAN_SECTION_API_BASE="`echo \"${MAN_SECTION_API}\" | sed 's/^\(@<:@0-9@:>@*\)@<:@^0-9@:>@.*$/\1/'`" +MAN_SECTION_CFG_BASE="`echo \"${MAN_SECTION_CFG}\" | sed 's/^\(@<:@0-9@:>@*\)@<:@^0-9@:>@.*$/\1/'`" +MAN_SECTION_CMD_SYS_BASE="`echo \"${MAN_SECTION_CMD_SYS}\" | sed 's/^\(@<:@0-9@:>@*\)@<:@^0-9@:>@.*$/\1/'`" +MAN_SECTION_CMD_USR_BASE="`echo \"${MAN_SECTION_CMD_USR}\" | sed 's/^\(@<:@0-9@:>@*\)@<:@^0-9@:>@.*$/\1/'`" +MAN_SECTION_MISC_BASE="`echo \"${MAN_SECTION_MISC}\" | sed 's/^\(@<:@0-9@:>@*\)@<:@^0-9@:>@.*$/\1/'`" dnl Full man page section IDs (e.g. '1m', '8') AC_DEFINE_UNQUOTED([MAN_SECTION_API], ["${MAN_SECTION_API}"], [man page section for library APIs]) @@ -5133,7 +5133,7 @@ Description=temp ExecStart=/bin/true Type=notify EOF - if myOUT="`"$SYSTEMD_ANALYZE_PROGRAM" verify "$myFILE" 2>&1`" ; then + if myOUT="`\"$SYSTEMD_ANALYZE_PROGRAM\" verify \"$myFILE\" 2>&1`" ; then if (echo "$myOUT" | ${GREP} "Failed to parse service type, ignoring") ; then true else @@ -5155,7 +5155,7 @@ Description=temp ExecStart=/bin/true Type=notify-reload EOF - if myOUT="`"$SYSTEMD_ANALYZE_PROGRAM" verify "$myFILE" 2>&1`" ; then + if myOUT="`\"$SYSTEMD_ANALYZE_PROGRAM\" verify \"$myFILE\" 2>&1`" ; then if (echo "$myOUT" | ${GREP} "Failed to parse service type, ignoring") ; then true else @@ -5827,9 +5827,9 @@ else AS_CASE(["${target_os}"], [*mingw*], [ dnl # At least tooling on MSYS2 semi-native builds can return dnl # semicolon-separated paths with possibly "C:/mingw..." spelling - DEFAULT_SEARCH_DIRS="`echo ":$DEFAULT_SEARCH_DIRS" | sed 's,\(@<:@:;@:>@\)\(@<:@A-Z@:>@\):/,:/\2/,g' | tr ':' '\n' | sed 's,/*$,,'`" + DEFAULT_SEARCH_DIRS="`echo \":$DEFAULT_SEARCH_DIRS\" | sed 's,\(@<:@:;@:>@\)\(@<:@A-Z@:>@\):/,:/\2/,g' | tr ':' '\n' | sed 's,/*$,,'`" ], - [DEFAULT_SEARCH_DIRS="`echo "$DEFAULT_SEARCH_DIRS" | tr ':' '\n' | sed 's,/*$,,'`"] + [DEFAULT_SEARCH_DIRS="`echo \"$DEFAULT_SEARCH_DIRS\" | tr ':' '\n' | sed 's,/*$,,'`"] ) NUT_LIBDIR_IN_DEFAULT_SEARCH_DIRS="no" @@ -5838,15 +5838,15 @@ else dnl # If NUT libdir does not exist, it is not systemic right away if test -d "${LIBDIR}" ; then - LIBDIR_REALPATH="`cd "${LIBDIR}" && pwd`" || LIBDIR_REALPATH="${LIBDIR}" - LIBDIR_REALPATH="`echo "${LIBDIR_REALPATH}" | sed 's,/*$,,'`" + LIBDIR_REALPATH="`cd \"${LIBDIR}\" && pwd`" || LIBDIR_REALPATH="${LIBDIR}" + LIBDIR_REALPATH="`echo \"${LIBDIR_REALPATH}\" | sed 's,/*$,,'`" for D in ${DEFAULT_SEARCH_DIRS} ; do if test x"$D" = x"${LIBDIR_REALPATH}" ; then NUT_LIBDIR_IN_DEFAULT_SEARCH_DIRS="yes" NUT_LIBDIR_IN_DEFAULT_SEARCH_DIRS_TEXT="NUT libdir is among common search paths" break else - D_REALPATH="`cd "${D}" 2>/dev/null && pwd`" && \ + D_REALPATH="`cd \"${D}\" 2>/dev/null && pwd`" && \ if test x"${D_REALPATH}" = x"${LIBDIR_REALPATH}" ; then NUT_LIBDIR_IN_DEFAULT_SEARCH_DIRS="yes" NUT_LIBDIR_IN_DEFAULT_SEARCH_DIRS_TEXT="NUT libdir is among common search paths" @@ -5883,7 +5883,7 @@ case "${nut_enable_ldflags_nut_rpath}" in fi if test "${nut_enable_ldflags_nut_rpath}" != no ; then if test x"${hardcode_libdir_flag_spec}" != x ; then - LDFLAGS_NUT_RPATH="`libdir='${libdir}'; eval echo "${hardcode_libdir_flag_spec}"`" + LDFLAGS_NUT_RPATH="`libdir='${libdir}'; eval echo \"${hardcode_libdir_flag_spec}\"`" else RPATH_CIRCUMSTANCE="autotools did not report a way to specify rpath for C" dnl # LDFLAGS_NUT_RPATH='-R${libdir} -Wl,-rpath,${libdir}' @@ -5920,7 +5920,7 @@ case "${nut_enable_ldflags_nut_rpath_cxx}" in fi if test "${nut_enable_ldflags_nut_rpath_cxx}" != no ; then if test x"${hardcode_libdir_flag_spec_CXX}" != x ; then - LDFLAGS_NUT_RPATH_CXX="`libdir='${libdir}'; eval echo "${hardcode_libdir_flag_spec_CXX}"`" + LDFLAGS_NUT_RPATH_CXX="`libdir='${libdir}'; eval echo \"${hardcode_libdir_flag_spec_CXX}\"`" else RPATH_CIRCUMSTANCE="autotools did not report a way to specify rpath for C++" dnl # LDFLAGS_NUT_RPATH_CXX='-R${libdir} -Wl,-rpath,${libdir}' @@ -6519,15 +6519,15 @@ AS_IF([test -n "${ac_abs_top_builddir}" && test -d "${ac_abs_top_builddir}"], [TOP_BUILDDIR="${ac_abs_top_builddir}"], [AS_IF([test -n "${ac_pwd}" && test -d "${ac_pwd}"], [TOP_BUILDDIR="${ac_pwd}"], - [TOP_BUILDDIR="`dirname "$0"`" - TOP_BUILDDIR="`cd "$TOP_BUILDDIR" && pwd`" || AC_MSG_ERROR([Can not detect TOP_BUILDDIR])] + [TOP_BUILDDIR="`dirname \"$0\"`" + TOP_BUILDDIR="`cd \"$TOP_BUILDDIR\" && pwd`" || AC_MSG_ERROR([Can not detect TOP_BUILDDIR])] )] ) dnl Quoted in case someone copy-pastes this path and it has whitespaces: AC_MSG_RESULT(['${TOP_BUILDDIR}']) -ABS_TOP_BUILDDIR="`cd "${TOP_BUILDDIR}" && pwd`" || AC_MSG_ERROR([Can not detect ABS_TOP_BUILDDIR]) -ABS_TOP_SRCDIR="`cd "${abs_srcdir}" && pwd`" || AC_MSG_ERROR([Can not detect ABS_TOP_SRCDIR]) +ABS_TOP_BUILDDIR="`cd \"${TOP_BUILDDIR}\" && pwd`" || AC_MSG_ERROR([Can not detect ABS_TOP_BUILDDIR]) +ABS_TOP_SRCDIR="`cd \"${abs_srcdir}\" && pwd`" || AC_MSG_ERROR([Can not detect ABS_TOP_SRCDIR]) AM_CONDITIONAL([BUILDING_IN_TREE], [test "${ABS_TOP_BUILDDIR}" = "${ABS_TOP_SRCDIR}"]) dnl When building ON Windows (mingw/MSYS2, cygwin, etc.) fudge these @@ -6539,14 +6539,14 @@ AS_CASE([${target_os}], dnl Cygwin path resolver AC_CHECK_TOOL([CYGPATH], [cygpath], [none]) AS_IF([test "x${CYGPATH}" != "xnone" && test x"`${CYGPATH}`" != x], [ - tmp="`${CYGPATH} -m "${ABS_TOP_BUILDDIR}" | sed -e 's,/,\\\\\\\\,g'`" && test -n "$tmp" && test -d "$tmp" && ABS_TOP_BUILDDIR="$tmp" - tmp="`${CYGPATH} -m "${ABS_TOP_SRCDIR}" | sed 's,/,\\\\\\\\,g'`" && test -n "$tmp" && test -d "$tmp" && ABS_TOP_SRCDIR="$tmp" + tmp="`${CYGPATH} -m \"${ABS_TOP_BUILDDIR}\" | sed -e 's,/,\\\\\\\\,g'`" && test -n "$tmp" && test -d "$tmp" && ABS_TOP_BUILDDIR="$tmp" + tmp="`${CYGPATH} -m \"${ABS_TOP_SRCDIR}\" | sed 's,/,\\\\\\\\,g'`" && test -n "$tmp" && test -d "$tmp" && ABS_TOP_SRCDIR="$tmp" ],[ dnl MSYS pwd with -W option to resolve AC_CHECK_TOOL([PWDTOOL], [pwd], [none]) AS_IF([test "x${PWDTOOL}" != "xnone" && test x"`${PWDTOOL} -W`" != x], [ - tmp="`(cd "${ABS_TOP_BUILDDIR}" && ${PWDTOOL} -W) | sed 's,/,\\\\\\\\,g'`" && test -n "$tmp" && test -d "$tmp" && ABS_TOP_BUILDDIR="$tmp" - tmp="`(cd "${ABS_TOP_SRCDIR}" && ${PWDTOOL} -W) | sed 's,/,\\\\\\\\,g'`" && test -n "$tmp" && test -d "$tmp" && ABS_TOP_SRCDIR="$tmp" + tmp="`(cd \"${ABS_TOP_BUILDDIR}\" && ${PWDTOOL} -W) | sed 's,/,\\\\\\\\,g'`" && test -n "$tmp" && test -d "$tmp" && ABS_TOP_BUILDDIR="$tmp" + tmp="`(cd \"${ABS_TOP_SRCDIR}\" && ${PWDTOOL} -W) | sed 's,/,\\\\\\\\,g'`" && test -n "$tmp" && test -d "$tmp" && ABS_TOP_SRCDIR="$tmp" ]) ]) diff --git a/m4/ax_realpath.m4 b/m4/ax_realpath.m4 index 6d0bc0f807..e190a08924 100644 --- a/m4/ax_realpath.m4 +++ b/m4/ax_realpath.m4 @@ -26,29 +26,29 @@ AC_DEFUN([AX_REALPATH_SHELL_ONELEVEL], TGT="$1" while test -h "$TGT" ; do - LS_OUT="`ls -ld "$TGT"`" || { RESOLVE_ERROR=$? ; break ; } - LINK="`expr "$LS_OUT" : '.*-> \(.*\)$'`" || { RESOLVE_ERROR=$? ; break ; } + LS_OUT="`ls -ld \"$TGT\"`" || { RESOLVE_ERROR=$? ; break ; } + LINK="`expr \"$LS_OUT\" : '.*-> \(.*\)$'`" || { RESOLVE_ERROR=$? ; break ; } if expr "$LINK" : '/.*' > /dev/null; then TGT="$LINK" else - TGT="`dirname "$TGT"`/$LINK" + TGT="`dirname \"$TGT\"`/$LINK" fi done if test "$RESOLVE_ERROR" = 0 ; then - TGTDIR="`dirname "$TGT"`" && \ - TGTDIR="`cd "$TGTDIR" && pwd`" || { - TGTDIR="`dirname "$TGT"`" || \ + TGTDIR="`dirname \"$TGT\"`" && \ + TGTDIR="`cd \"$TGTDIR\" && pwd`" || { + TGTDIR="`dirname \"$TGT\"`" || \ RESOLVE_ERROR=$? ; } if test "$RESOLVE_ERROR" = 0 ; then while test -h "$TGTDIR" ; do - LS_OUT="`ls -ld "$TGTDIR"`" || { RESOLVE_ERROR=$? ; break ; } - LINK="`expr "$LS_OUT" : '.*-> \(.*\)$'`" || { RESOLVE_ERROR=$? ; break ; } + LS_OUT="`ls -ld \"$TGTDIR\"`" || { RESOLVE_ERROR=$? ; break ; } + LINK="`expr \"$LS_OUT\" : '.*-> \(.*\)$'`" || { RESOLVE_ERROR=$? ; break ; } if expr "$LINK" : '/.*' > /dev/null; then TGTDIR="$LINK" else - PARENTDIR="`dirname "$TGTDIR"`" + PARENTDIR="`dirname \"$TGTDIR\"`" case "$PARENTDIR" in /) TGTDIR="/$LINK" ; break ;; *) TGTDIR="$PARENTDIR/$LINK" ;; @@ -93,11 +93,11 @@ AC_DEFUN([AX_REALPATH_SHELL_RECURSIVE], if test x"$RESOLVE_ERROR" = x0 ; then dnl Recurse to check the (grand)parent dir (if any) if test -n "$RESOLVE_SUFFIX" ; then - RESOLVE_SUFFIX="`basename "$RESOLVE_PREFIX"`/$RESOLVE_SUFFIX" + RESOLVE_SUFFIX="`basename \"$RESOLVE_PREFIX\"`/$RESOLVE_SUFFIX" else - RESOLVE_SUFFIX="`basename "$RESOLVE_PREFIX"`" + RESOLVE_SUFFIX="`basename \"$RESOLVE_PREFIX\"`" fi - RESOLVE_PREFIX="`dirname "$RESOLVE_PREFIX"`" + RESOLVE_PREFIX="`dirname \"$RESOLVE_PREFIX\"`" else dnl Bail out, keep latest answer break @@ -132,7 +132,7 @@ AC_DEFUN([AX_REALPATH], REALPRG="" AS_IF([test -n "$REALPATH"], [ - REALPRG="`${REALPATH} "$1"`" + REALPRG="`${REALPATH} \"$1\"`" ]) AS_IF([test -z "$REALPRG"], [ diff --git a/m4/ax_realpath_lib.m4 b/m4/ax_realpath_lib.m4 index f07ba4cf39..8ed8775a48 100644 --- a/m4/ax_realpath_lib.m4 +++ b/m4/ax_realpath_lib.m4 @@ -48,7 +48,7 @@ AC_DEFUN([AX_REALPATH_LIB], AS_IF([test "x$GCC" = xyes -o "x$CLANGCC" = xyes], [ myLIBNAME="$1" AS_CASE(["${myLIBNAME}"], - [-l*], [myLIBNAME="`echo "$myLIBNAME" | sed 's/^-l/lib/'`"] + [-l*], [myLIBNAME="`echo \"$myLIBNAME\" | sed 's/^-l/lib/'`"] ) dnl # Primarily we care to know dynamically linked (shared object) @@ -71,7 +71,7 @@ AC_DEFUN([AX_REALPATH_LIB], dnl Alas, the portable solution with sed is to avoid dnl parentheses and pipe chars, got too many different dnl ways to escape them in the wild - myLIBNAME_LD="`echo "$myLIBNAME" | sed -e 's/^lib/-l/' -e 's/\.dll$//' -e 's/\.dll\.a$//' -e 's/\.a$//' -e 's/\.o$//' -e 's/\.la$//' -e 's/\.lo$//' -e 's/\.lib$//' -e 's/\.dylib$//' -e 's/\.so\..*$//' -e 's/\.so//' -e 's/\.sl\..*$//' -e 's/\.sl//'`" + myLIBNAME_LD="`echo \"$myLIBNAME\" | sed -e 's/^lib/-l/' -e 's/\.dll$//' -e 's/\.dll\.a$//' -e 's/\.a$//' -e 's/\.o$//' -e 's/\.la$//' -e 's/\.lo$//' -e 's/\.lib$//' -e 's/\.dylib$//' -e 's/\.so\..*$//' -e 's/\.so//' -e 's/\.sl\..*$//' -e 's/\.sl//'`" ], [myLIBNAME_LD="-l$myLIBNAME"] dnl best-effort... ) @@ -97,7 +97,7 @@ AC_DEFUN([AX_REALPATH_LIB], dnl Resolve dynamic library "internal" name from its stub, if needed AS_CASE(["${myLIBPATH}"], [*.dll.a], [ - myLIBPATH="`$DLLTOOL -I "${myLIBPATH}"`" || myLIBPATH="" + myLIBPATH="`$DLLTOOL -I \"${myLIBPATH}\"`" || myLIBPATH="" ] ) @@ -126,9 +126,9 @@ AC_DEFUN([AX_REALPATH_LIB], ) ]) ], [ dnl # POSIX/MacOS builds - { myLIBPATH="`${CC} --print-file-name="$myLIBNAME"`" && test -n "$myLIBPATH" && test -s "$myLIBPATH" ; } \ - || { myLIBPATH="`${CC} $CFLAGS --print-file-name="$myLIBNAME"`" && test -n "$myLIBPATH" && test -s "$myLIBPATH" ; } \ - || { myLIBPATH="`${CC} $CFLAGS $LDFLAGS $LIBS --print-file-name="$myLIBNAME"`" && test -n "$myLIBPATH" && test -s "$myLIBPATH" ; } \ + { myLIBPATH="`${CC} --print-file-name=\"$myLIBNAME\"`" && test -n "$myLIBPATH" && test -s "$myLIBPATH" ; } \ + || { myLIBPATH="`${CC} $CFLAGS --print-file-name=\"$myLIBNAME\"`" && test -n "$myLIBPATH" && test -s "$myLIBPATH" ; } \ + || { myLIBPATH="`${CC} $CFLAGS $LDFLAGS $LIBS --print-file-name=\"$myLIBNAME\"`" && test -n "$myLIBPATH" && test -s "$myLIBPATH" ; } \ || myLIBPATH="" ] ) @@ -137,9 +137,9 @@ AC_DEFUN([AX_REALPATH_LIB], for TOKEN in $CFLAGS $LDFLAGS $LIBS ; do D="" case "$TOKEN" in - -R*|-L*) D="`echo "$TOKEN" | sed 's,^-[RL],,'`" ;; - -Wl,-R*) D="`echo "$TOKEN" | sed 's,^-Wl\,-R,,'`" ;; - -Wl,-rpath,*) D="`echo "$TOKEN" | sed 's,^-Wl\,-rpath\,,,'`" ;; + -R*|-L*) D="`echo \"$TOKEN\" | sed 's,^-[RL],,'`" ;; + -Wl,-R*) D="`echo \"$TOKEN\" | sed 's,^-Wl\,-R,,'`" ;; + -Wl,-rpath,*) D="`echo \"$TOKEN\" | sed 's,^-Wl\,-rpath\,,,'`" ;; esac if test -z "$D" || test ! -d "$D" ; then continue ; fi if test -s "$D/${myLIBNAME}" 2>/dev/null ; then @@ -170,13 +170,13 @@ AC_DEFUN([AX_REALPATH_LIB], dnl Try MacOS-style LD as fallback; expecting strings like dnl ld: warning: /usr/local/lib/libneon.dylib, ignoring unexpected dylib file my_uname_m="`uname -m`" - { myLIBPATH="`${LD} -dynamic -r -arch "${target_cpu}" -search_dylibs_first "${myLIBNAME_LD}" 2>&1 | ${GREP} -w dylib | sed 's/^@<:@^\/@:>@*\(\/.*\.dylib\),.*$/\1/'`" && test -n "$myLIBPATH" && test -s "$myLIBPATH" ; } \ - || { myLIBPATH="`${LD} $LDFLAGS -dynamic -r -arch "${target_cpu}" -search_dylibs_first "${myLIBNAME_LD}" 2>&1 | ${GREP} -w dylib | sed 's/^@<:@^\/@:>@*\(\/.*\.dylib\),.*$/\1/'`" && test -n "$myLIBPATH" && test -s "$myLIBPATH" ; } \ - || { myLIBPATH="`${LD} $LDFLAGS $LIBS -dynamic -r -arch "${target_cpu}" -search_dylibs_first "${myLIBNAME_LD}" 2>&1 | ${GREP} -w dylib | sed 's/^@<:@^\/@:>@*\(\/.*\.dylib\),.*$/\1/'`" && test -n "$myLIBPATH" && test -s "$myLIBPATH" ; } \ + { myLIBPATH="`${LD} -dynamic -r -arch \"${target_cpu}\" -search_dylibs_first \"${myLIBNAME_LD}\" 2>&1 | ${GREP} -w dylib | sed 's/^@<:@^\/@:>@*\(\/.*\.dylib\),.*$/\1/'`" && test -n "$myLIBPATH" && test -s "$myLIBPATH" ; } \ + || { myLIBPATH="`${LD} $LDFLAGS -dynamic -r -arch \"${target_cpu}\" -search_dylibs_first \"${myLIBNAME_LD}\" 2>&1 | ${GREP} -w dylib | sed 's/^@<:@^\/@:>@*\(\/.*\.dylib\),.*$/\1/'`" && test -n "$myLIBPATH" && test -s "$myLIBPATH" ; } \ + || { myLIBPATH="`${LD} $LDFLAGS $LIBS -dynamic -r -arch \"${target_cpu}\" -search_dylibs_first \"${myLIBNAME_LD}\" 2>&1 | ${GREP} -w dylib | sed 's/^@<:@^\/@:>@*\(\/.*\.dylib\),.*$/\1/'`" && test -n "$myLIBPATH" && test -s "$myLIBPATH" ; } \ || if test x"${target_cpu}" != x"${my_uname_m}" ; then - { myLIBPATH="`${LD} -dynamic -r -arch "${my_uname_m}" -search_dylibs_first "${myLIBNAME_LD}" 2>&1 | ${GREP} -w dylib | sed 's/^@<:@^\/@:>@*\(\/.*\.dylib\),.*$/\1/'`" && test -n "$myLIBPATH" && test -s "$myLIBPATH" ; } \ - || { myLIBPATH="`${LD} $LDFLAGS -dynamic -r -arch "${my_uname_m}" -search_dylibs_first "${myLIBNAME_LD}" 2>&1 | ${GREP} -w dylib | sed 's/^@<:@^\/@:>@*\(\/.*\.dylib\),.*$/\1/'`" && test -n "$myLIBPATH" && test -s "$myLIBPATH" ; } \ - || { myLIBPATH="`${LD} $LDFLAGS $LIBS -dynamic -r -arch "${my_uname_m}" -search_dylibs_first "${myLIBNAME_LD}" 2>&1 | ${GREP} -w dylib | sed 's/^@<:@^\/@:>@*\(\/.*\.dylib\),.*$/\1/'`" && test -n "$myLIBPATH" && test -s "$myLIBPATH" ; } \ + { myLIBPATH="`${LD} -dynamic -r -arch \"${my_uname_m}\" -search_dylibs_first \"${myLIBNAME_LD}\" 2>&1 | ${GREP} -w dylib | sed 's/^@<:@^\/@:>@*\(\/.*\.dylib\),.*$/\1/'`" && test -n "$myLIBPATH" && test -s "$myLIBPATH" ; } \ + || { myLIBPATH="`${LD} $LDFLAGS -dynamic -r -arch \"${my_uname_m}\" -search_dylibs_first \"${myLIBNAME_LD}\" 2>&1 | ${GREP} -w dylib | sed 's/^@<:@^\/@:>@*\(\/.*\.dylib\),.*$/\1/'`" && test -n "$myLIBPATH" && test -s "$myLIBPATH" ; } \ + || { myLIBPATH="`${LD} $LDFLAGS $LIBS -dynamic -r -arch \"${my_uname_m}\" -search_dylibs_first \"${myLIBNAME_LD}\" 2>&1 | ${GREP} -w dylib | sed 's/^@<:@^\/@:>@*\(\/.*\.dylib\),.*$/\1/'`" && test -n "$myLIBPATH" && test -s "$myLIBPATH" ; } \ || myLIBPATH="" else myLIBPATH="" @@ -199,7 +199,7 @@ AC_DEFUN([AX_REALPATH_LIB], # dnl may be present in a group (e.g. AS_NEEDED), and comment # dnl strings are inconsistent (useless to match by). AC_MSG_RESULT([yes, iterate further]) - myLIBPATH_LDSCRIPT="`${GREP} -w GROUP "${myLIBPATH}" | sed 's,^.*GROUP *( *\(/@<:@^ @:>@*\.so@<:@^ @:>@*\)@<:@^0-9a-zA-Z_.-@:>@.*$,\1,'`" + myLIBPATH_LDSCRIPT="`${GREP} -w GROUP \"${myLIBPATH}\" | sed 's,^.*GROUP *( *\(/@<:@^ @:>@*\.so@<:@^ @:>@*\)@<:@^0-9a-zA-Z_.-@:>@.*$,\1,'`" AS_IF([test -n "${myLIBPATH_LDSCRIPT}" && test -s "${myLIBPATH_LDSCRIPT}"], [ AC_MSG_NOTICE([will dig into ${myLIBPATH_LDSCRIPT}]) diff --git a/m4/nut_check_aspell.m4 b/m4/nut_check_aspell.m4 index 1d5d1721a2..73b31cf00b 100644 --- a/m4/nut_check_aspell.m4 +++ b/m4/nut_check_aspell.m4 @@ -33,7 +33,7 @@ if test -z "${nut_have_aspell_seen}"; then ASPELL_VERSION="`LANG=C LC_ALL=C ${ASPELL} --version 2>/dev/null | sed -e 's,^.*@<:@Aa@:>@spell \(@<:@0-9.@:>@*\),\1,' -e 's,@<:@^0-9.@:>@.*,,'`" || ASPELL_VERSION="none" AC_MSG_RESULT([${ASPELL_VERSION}]) - ASPELL_VERSION_MINMAJ="`echo "${ASPELL_VERSION}" | sed 's,\.@<:@0-9@:>@@<:@0-9@:>@*$,,'`" + ASPELL_VERSION_MINMAJ="`echo \"${ASPELL_VERSION}\" | sed 's,\.@<:@0-9@:>@@<:@0-9@:>@*$,,'`" dnl FIXME: Some systems have more complicated layouts, e.g. dnl /usr/lib/amd64/aspell-0.60/tex-filter.so @@ -43,18 +43,18 @@ if test -z "${nut_have_aspell_seen}"; then dnl fallback to built-in paths below if this initial guesswork dnl failed. This may need some more-direct addressing later. AC_MSG_CHECKING([for aspell "lib" filtering resources directory]) - ASPELL_BINDIR="`dirname "$ASPELL"`" + ASPELL_BINDIR="`dirname \"$ASPELL\"`" if test -d "${ASPELL_BINDIR}/../lib" ; then if test x"${ASPELL_VERSION}" != x"none" && test -d "${ASPELL_BINDIR}/../lib/aspell-${ASPELL_VERSION}" ; then - ASPELL_FILTER_LIB_PATH="`cd "${ASPELL_BINDIR}/../lib/aspell-${ASPELL_VERSION}" && pwd`" \ + ASPELL_FILTER_LIB_PATH="`cd \"${ASPELL_BINDIR}/../lib/aspell-${ASPELL_VERSION}\" && pwd`" \ || ASPELL_FILTER_LIB_PATH="${ASPELL_BINDIR}/../lib/aspell-${ASPELL_VERSION}" else if test x"${ASPELL_VERSION_MINMAJ}" != x"none" && test -d "${ASPELL_BINDIR}/../lib/aspell-${ASPELL_VERSION_MINMAJ}" ; then - ASPELL_FILTER_LIB_PATH="`cd "${ASPELL_BINDIR}/../lib/aspell-${ASPELL_VERSION_MINMAJ}" && pwd`" \ + ASPELL_FILTER_LIB_PATH="`cd \"${ASPELL_BINDIR}/../lib/aspell-${ASPELL_VERSION_MINMAJ}\" && pwd`" \ || ASPELL_FILTER_LIB_PATH="${ASPELL_BINDIR}/../lib/aspell-${ASPELL_VERSION_MINMAJ}" else if test -d "${ASPELL_BINDIR}/../lib/aspell" ; then - ASPELL_FILTER_LIB_PATH="`cd "${ASPELL_BINDIR}/../lib/aspell" && pwd`" \ + ASPELL_FILTER_LIB_PATH="`cd \"${ASPELL_BINDIR}/../lib/aspell\" && pwd`" \ || ASPELL_FILTER_LIB_PATH="${ASPELL_BINDIR}/../lib/aspell" fi fi @@ -63,18 +63,18 @@ if test -z "${nut_have_aspell_seen}"; then AC_MSG_RESULT([${ASPELL_FILTER_LIB_PATH}]) AC_MSG_CHECKING([for aspell "share" filtering resources directory]) - ASPELL_BINDIR="`dirname "$ASPELL"`" + ASPELL_BINDIR="`dirname \"$ASPELL\"`" if test -d "${ASPELL_BINDIR}/../share" ; then if test x"${ASPELL_VERSION}" != x"none" && test -d "${ASPELL_BINDIR}/../share/aspell-${ASPELL_VERSION}" ; then - ASPELL_FILTER_SHARE_PATH="`cd "${ASPELL_BINDIR}/../share/aspell-${ASPELL_VERSION}" && pwd`" \ + ASPELL_FILTER_SHARE_PATH="`cd \"${ASPELL_BINDIR}/../share/aspell-${ASPELL_VERSION}\" && pwd`" \ || ASPELL_FILTER_SHARE_PATH="${ASPELL_BINDIR}/../share/aspell-${ASPELL_VERSION}" else if test x"${ASPELL_VERSION_MINMAJ}" != x"none" && test -d "${ASPELL_BINDIR}/../share/aspell-${ASPELL_VERSION_MINMAJ}" ; then - ASPELL_FILTER_SHARE_PATH="`cd "${ASPELL_BINDIR}/../share/aspell-${ASPELL_VERSION_MINMAJ}" && pwd`" \ + ASPELL_FILTER_SHARE_PATH="`cd \"${ASPELL_BINDIR}/../share/aspell-${ASPELL_VERSION_MINMAJ}\" && pwd`" \ || ASPELL_FILTER_SHARE_PATH="${ASPELL_BINDIR}/../share/aspell-${ASPELL_VERSION_MINMAJ}" else if test -d "${ASPELL_BINDIR}/../share/aspell" ; then - ASPELL_FILTER_SHARE_PATH="`cd "${ASPELL_BINDIR}/../share/aspell" && pwd`" \ + ASPELL_FILTER_SHARE_PATH="`cd \"${ASPELL_BINDIR}/../share/aspell\" && pwd`" \ || ASPELL_FILTER_SHARE_PATH="${ASPELL_BINDIR}/../share/aspell" fi fi @@ -86,18 +86,18 @@ if test -z "${nut_have_aspell_seen}"; then dnl # May be in a platform-dependent subdir (e.g. Debian Linux) dnl # or not (e.g. MinGW/MSYS2, OpenIndiana): if test -d "${ASPELL_FILTER_LIB_PATH}" ; then - ASPELL_FILTER_TEX_PATH="`find "${ASPELL_FILTER_LIB_PATH}" -name "tex.amf"`" \ + ASPELL_FILTER_TEX_PATH="`find \"${ASPELL_FILTER_LIB_PATH}\" -name \"tex.amf\"`" \ && test x"${ASPELL_FILTER_TEX_PATH}" != x \ - && ASPELL_FILTER_TEX_PATH="`dirname "${ASPELL_FILTER_TEX_PATH}"`" \ + && ASPELL_FILTER_TEX_PATH="`dirname \"${ASPELL_FILTER_TEX_PATH}\"`" \ && test -d "${ASPELL_FILTER_TEX_PATH}" \ || ASPELL_FILTER_TEX_PATH="none" fi dnl # Fallback (e.g. on FreeBSD): if test x"${ASPELL_FILTER_TEX_PATH}" = xnone \ && test -d "${ASPELL_FILTER_SHARE_PATH}" ; then - ASPELL_FILTER_TEX_PATH="`find "${ASPELL_FILTER_SHARE_PATH}" -name "tex.amf"`" \ + ASPELL_FILTER_TEX_PATH="`find \"${ASPELL_FILTER_SHARE_PATH}\" -name \"tex.amf\"`" \ && test x"${ASPELL_FILTER_TEX_PATH}" != x \ - && ASPELL_FILTER_TEX_PATH="`dirname "${ASPELL_FILTER_TEX_PATH}"`" \ + && ASPELL_FILTER_TEX_PATH="`dirname \"${ASPELL_FILTER_TEX_PATH}\"`" \ && test -d "${ASPELL_FILTER_TEX_PATH}" \ || ASPELL_FILTER_TEX_PATH="none" fi diff --git a/m4/nut_check_libavahi.m4 b/m4/nut_check_libavahi.m4 index 0226b5fc5d..d7ff54b978 100644 --- a/m4/nut_check_libavahi.m4 +++ b/m4/nut_check_libavahi.m4 @@ -91,7 +91,7 @@ if test -z "${nut_have_avahi_seen}"; then AX_REALPATH_LIB([${TOKEN}], [SOPATH_LIBAVAHI], []) AS_IF([test -n "${SOPATH_LIBAVAHI}" && test -s "${SOPATH_LIBAVAHI}"], [ AC_DEFINE_UNQUOTED([SOPATH_LIBAVAHI],["${SOPATH_LIBAVAHI}"],[Path to dynamic library on build system]) - SOFILE_LIBAVAHI="`basename "$SOPATH_LIBAVAHI"`" + SOFILE_LIBAVAHI="`basename \"$SOPATH_LIBAVAHI\"`" AC_DEFINE_UNQUOTED([SOFILE_LIBAVAHI],["${SOFILE_LIBAVAHI}"],[Base file name of dynamic library on build system]) break ]) diff --git a/m4/nut_check_libfreeipmi.m4 b/m4/nut_check_libfreeipmi.m4 index 07b88d9747..0b4551ccac 100644 --- a/m4/nut_check_libfreeipmi.m4 +++ b/m4/nut_check_libfreeipmi.m4 @@ -88,7 +88,7 @@ if test -z "${nut_have_libfreeipmi_seen}"; then dnl Collect possibly updated dependencies after AC SEARCH LIBS: AS_IF([test x"${LIBS}" != x"${LIBS_ORIG} ${depLIBS}"], [ AS_IF([test x = x"${LIBS_ORIG}"], [depLIBS="$LIBS"], [ - depLIBS="`echo "$LIBS" | sed -e 's|'"${LIBS_ORIG}"'| |' -e 's|^ *||' -e 's| *$||'`" + depLIBS="`echo \"$LIBS\" | sed -e 's|'\"${LIBS_ORIG}\"'| |' -e 's|^ *||' -e 's| *$||'`" ]) ]) @@ -110,7 +110,7 @@ if test -z "${nut_have_libfreeipmi_seen}"; then AX_REALPATH_LIB([${TOKEN}], [SOPATH_LIBFREEIPMI], []) AS_IF([test -n "${SOPATH_LIBFREEIPMI}" && test -s "${SOPATH_LIBFREEIPMI}"], [ AC_DEFINE_UNQUOTED([SOPATH_LIBFREEIPMI],["${SOPATH_LIBFREEIPMI}"],[Path to dynamic library on build system]) - SOFILE_LIBFREEIPMI="`basename "$SOPATH_LIBFREEIPMI"`" + SOFILE_LIBFREEIPMI="`basename \"$SOPATH_LIBFREEIPMI\"`" AC_DEFINE_UNQUOTED([SOFILE_LIBFREEIPMI],["${SOFILE_LIBFREEIPMI}"],[Base file name of dynamic library on build system]) break ]) diff --git a/m4/nut_check_libgd.m4 b/m4/nut_check_libgd.m4 index def3363e87..ebc781ba5c 100644 --- a/m4/nut_check_libgd.m4 +++ b/m4/nut_check_libgd.m4 @@ -145,7 +145,7 @@ if test -z "${nut_have_libgd_seen}"; then dnl Collect possibly updated dependencies after AC SEARCH LIBS: AS_IF([test x"${LIBS}" != x"${LIBS_ORIG} ${depLIBS}"], [ AS_IF([test x = x"${LIBS_ORIG}"], [depLIBS="$LIBS"], [ - depLIBS="`echo "$LIBS" | sed -e 's|'"${LIBS_ORIG}"'| |' -e 's|^ *||' -e 's| *$||'`" + depLIBS="`echo \"$LIBS\" | sed -e 's|'\"${LIBS_ORIG}\"'| |' -e 's|^ *||' -e 's| *$||'`" ]) ]) diff --git a/m4/nut_check_libltdl.m4 b/m4/nut_check_libltdl.m4 index a7c6021180..cd57323495 100644 --- a/m4/nut_check_libltdl.m4 +++ b/m4/nut_check_libltdl.m4 @@ -72,7 +72,7 @@ if test -z "${nut_have_libltdl_seen}"; then dnl Collect possibly updated dependencies after AC SEARCH LIBS: AS_IF([test x"${LIBS}" != x"${LIBS_ORIG} ${depLIBS}"], [ AS_IF([test x = x"${LIBS_ORIG}"], [depLIBS="$LIBS"], [ - depLIBS="`echo "$LIBS" | sed -e 's|'"${LIBS_ORIG}"'| |' -e 's|^ *||' -e 's| *$||'`" + depLIBS="`echo \"$LIBS\" | sed -e 's|'\"${LIBS_ORIG}\"'| |' -e 's|^ *||' -e 's| *$||'`" ]) ]) diff --git a/m4/nut_check_libmodbus.m4 b/m4/nut_check_libmodbus.m4 index 81e680bcae..7cb8c2146b 100644 --- a/m4/nut_check_libmodbus.m4 +++ b/m4/nut_check_libmodbus.m4 @@ -250,7 +250,7 @@ modbus_set_byte_timeout(ctx, to_sec, to_usec);]) #include ], [modbus_t *ctx = modbus_new_rtu(NULL, 0, 0, 0, 0); if (ctx) modbus_free(ctx);])], [AS_IF([test -x "conftest$ac_exeext"], [ - AS_IF([test -n "`${LDD} "conftest$ac_exeext" | ${GREP} "libmodbus"`" 2>/dev/null], + AS_IF([test -n "`${LDD} \"conftest$ac_exeext\" | ${GREP} \"libmodbus\"`" 2>/dev/null], [LIBMODBUS_LINKTYPE="dynamic"], [LIBMODBUS_LINKTYPE="static"]) ])]) dnl If not GNU LDD, try other tools? diff --git a/m4/nut_check_libneon.m4 b/m4/nut_check_libneon.m4 index 69df17715b..80a326fa78 100644 --- a/m4/nut_check_libneon.m4 +++ b/m4/nut_check_libneon.m4 @@ -86,7 +86,7 @@ if test -z "${nut_have_neon_seen}"; then AX_REALPATH_LIB([${TOKEN}], [SOPATH_LIBNEON], []) AS_IF([test -n "${SOPATH_LIBNEON}" && test -s "${SOPATH_LIBNEON}"], [ AC_DEFINE_UNQUOTED([SOPATH_LIBNEON],["${SOPATH_LIBNEON}"],[Path to dynamic library on build system]) - SOFILE_LIBNEON="`basename "$SOPATH_LIBNEON"`" + SOFILE_LIBNEON="`basename \"$SOPATH_LIBNEON\"`" AC_DEFINE_UNQUOTED([SOFILE_LIBNEON],["${SOFILE_LIBNEON}"],[Base file name of dynamic library on build system]) break ]) diff --git a/m4/nut_check_libnetsnmp.m4 b/m4/nut_check_libnetsnmp.m4 index 1e8fcb6d2b..3a848fcc85 100644 --- a/m4/nut_check_libnetsnmp.m4 +++ b/m4/nut_check_libnetsnmp.m4 @@ -151,7 +151,7 @@ if test -z "${nut_have_libnetsnmp_seen}"; then dnl # In Makefiles be sure to use _LDFLAGS (not _LIBADD) to smuggle linker dnl # arguments when building "if WITH_SNMP_STATIC" recipe blocks! dnl # For a practical example, see tools/nut-scanner/Makefile.am. - depLIBS="`echo " $depLIBS" | sed 's/ -l/ -Wl,-l/g'`" + depLIBS="`echo \" $depLIBS\" | sed 's/ -l/ -Wl,-l/g'`" LIBS="${LIBS_ORIG} ${depLIBS}" AS_UNSET([ac_cv_func_init_snmp]) AC_CHECK_FUNCS(init_snmp, [ @@ -362,7 +362,7 @@ int num = NETSNMP_DRAFT_BLUMENTHAL_AES_04 + 1; /* if defined, NETSNMP_DRAFT_BLUM AX_REALPATH_LIB([${TOKEN}], [SOPATH_LIBNETSNMP], []) AS_IF([test -n "${SOPATH_LIBNETSNMP}" && test -s "${SOPATH_LIBNETSNMP}"], [ AC_DEFINE_UNQUOTED([SOPATH_LIBNETSNMP],["${SOPATH_LIBNETSNMP}"],[Path to dynamic library on build system]) - SOFILE_LIBNETSNMP="`basename "$SOPATH_LIBNETSNMP"`" + SOFILE_LIBNETSNMP="`basename \"$SOPATH_LIBNETSNMP\"`" AC_DEFINE_UNQUOTED([SOFILE_LIBNETSNMP],["${SOFILE_LIBNETSNMP}"],[Base file name of dynamic library on build system]) break ]) diff --git a/m4/nut_check_libnss.m4 b/m4/nut_check_libnss.m4 index 3b694c65df..7c5babd4d0 100644 --- a/m4/nut_check_libnss.m4 +++ b/m4/nut_check_libnss.m4 @@ -100,7 +100,7 @@ if test -z "${nut_have_libnss_seen}"; then addCFLAGS="" for TOKEN in ${depCFLAGS} ; do case "${TOKEN}" in - -I*) TOKENDIR="`echo "$TOKEN" | sed 's,^-I,,'`" + -I*) TOKENDIR="`echo \"$TOKEN\" | sed 's,^-I,,'`" case " ${CFLAGS} ${addCFLAGS} " in *" -isystem $TOKENDIR "*) ;; *) addCFLAGS="${addCFLAGS} -isystem $TOKENDIR" ;; diff --git a/m4/nut_check_libopenssl.m4 b/m4/nut_check_libopenssl.m4 index 4bf3a83265..bcf6e0f7cf 100644 --- a/m4/nut_check_libopenssl.m4 +++ b/m4/nut_check_libopenssl.m4 @@ -101,7 +101,7 @@ if test -z "${nut_have_libopenssl_seen}"; then addCFLAGS="" for TOKEN in ${depCFLAGS} ; do case "${TOKEN}" in - -I*) TOKENDIR="`echo "$TOKEN" | sed 's,^-I,,'`" + -I*) TOKENDIR="`echo \"$TOKEN\" | sed 's,^-I,,'`" case " ${CFLAGS} ${addCFLAGS} " in *" -isystem $TOKENDIR "*) ;; *) addCFLAGS="${addCFLAGS} -isystem $TOKENDIR" ;; diff --git a/m4/nut_check_libregex.m4 b/m4/nut_check_libregex.m4 index 8df545890d..1697c3715a 100644 --- a/m4/nut_check_libregex.m4 +++ b/m4/nut_check_libregex.m4 @@ -48,8 +48,8 @@ if test -z "${nut_have_libregex_seen}"; then ) AS_IF([test x"$LIBREGEX_VERSION" != xnone && test x"$LIBREGEX_MODULE" != x], - [depCFLAGS="`$PKG_CONFIG --silence-errors --cflags "${LIBREGEX_MODULE}" 2>/dev/null`" - depLIBS="`$PKG_CONFIG --silence-errors --libs "${LIBREGEX_MODULE}" 2>/dev/null`" + [depCFLAGS="`$PKG_CONFIG --silence-errors --cflags \"${LIBREGEX_MODULE}\" 2>/dev/null`" + depLIBS="`$PKG_CONFIG --silence-errors --libs \"${LIBREGEX_MODULE}\" 2>/dev/null`" depREQUIRES="${LIBREGEX_MODULE}" depCFLAGS_SOURCE="pkg-config" depLIBS_SOURCE="pkg-config" @@ -116,7 +116,7 @@ if test -z "${nut_have_libregex_seen}"; then dnl Collect possibly updated dependencies after AC SEARCH LIBS: AS_IF([test x"${LIBS}" != x"${LIBS_ORIG} ${depLIBS}"], [ AS_IF([test x = x"${LIBS_ORIG}"], [depLIBS="$LIBS"], [ - depLIBS="`echo "$LIBS" | sed -e 's|'"${LIBS_ORIG}"'| |' -e 's|^ *||' -e 's| *$||'`" + depLIBS="`echo \"$LIBS\" | sed -e 's|'\"${LIBS_ORIG}\"'| |' -e 's|^ *||' -e 's| *$||'`" ]) ]) diff --git a/m4/nut_check_libusb.m4 b/m4/nut_check_libusb.m4 index 8e2e03f07d..56b59245ea 100644 --- a/m4/nut_check_libusb.m4 +++ b/m4/nut_check_libusb.m4 @@ -310,7 +310,7 @@ if test -z "${nut_have_libusb_seen}"; then dnl Collect possibly updated dependencies after AC SEARCH LIBS: AS_IF([test x"${LIBS}" != x"${LIBS_ORIG} ${depLIBS}"], [ AS_IF([test x = x"${LIBS_ORIG}"], [depLIBS="$LIBS"], [ - depLIBS="`echo "$LIBS" | sed -e 's|'"${LIBS_ORIG}"'| |' -e 's|^ *||' -e 's| *$||'`" + depLIBS="`echo \"$LIBS\" | sed -e 's|'\"${LIBS_ORIG}\"'| |' -e 's|^ *||' -e 's| *$||'`" ]) ]) depLIBS="-R/usr/sfw/lib ${depLIBS}" @@ -389,7 +389,7 @@ if test -z "${nut_have_libusb_seen}"; then AX_REALPATH_LIB([${TOKEN}], [SOPATH_LIBUSB1], []) AS_IF([test -n "${SOPATH_LIBUSB1}" && test -s "${SOPATH_LIBUSB1}"], [ AC_DEFINE_UNQUOTED([SOPATH_LIBUSB1],["${SOPATH_LIBUSB1}"],[Path to dynamic library on build system]) - SOFILE_LIBUSB1="`basename "$SOPATH_LIBUSB1"`" + SOFILE_LIBUSB1="`basename \"$SOPATH_LIBUSB1\"`" AC_DEFINE_UNQUOTED([SOFILE_LIBUSB1],["${SOFILE_LIBUSB1}"],[Base file name of dynamic library on build system]) break ]) @@ -413,7 +413,7 @@ if test -z "${nut_have_libusb_seen}"; then AX_REALPATH_LIB([${TOKEN}], [SOPATH_LIBUSB0], []) AS_IF([test -n "${SOPATH_LIBUSB0}" && test -s "${SOPATH_LIBUSB0}"], [ AC_DEFINE_UNQUOTED([SOPATH_LIBUSB0],["${SOPATH_LIBUSB0}"],[Path to dynamic library on build system]) - SOFILE_LIBUSB0="`basename "$SOPATH_LIBUSB0"`" + SOFILE_LIBUSB0="`basename \"$SOPATH_LIBUSB0\"`" AC_DEFINE_UNQUOTED([SOFILE_LIBUSB0],["${SOFILE_LIBUSB0}"],[Base file name of dynamic library on build system]) break ]) diff --git a/m4/nut_check_libwrap.m4 b/m4/nut_check_libwrap.m4 index fd55fd3beb..484603b459 100644 --- a/m4/nut_check_libwrap.m4 +++ b/m4/nut_check_libwrap.m4 @@ -22,7 +22,7 @@ if test -z "${nut_have_libwrap_seen}"; then dnl Collect possibly updated dependencies after AC SEARCH LIBS: AS_IF([test x"${LIBS}" != x"${LIBS_ORIG}"], [ AS_IF([test x = x"${LIBS_ORIG}"], [depLIBS="$LIBS"], [ - depLIBS="`echo "$LIBS" | sed -e 's|'"${LIBS_ORIG}"'| |' -e 's|^ *||' -e 's| *$||'`" + depLIBS="`echo \"$LIBS\" | sed -e 's|'\"${LIBS_ORIG}\"'| |' -e 's|^ *||' -e 's| *$||'`" ]) ]) diff --git a/m4/nut_check_python.m4 b/m4/nut_check_python.m4 index 518035b859..a43a08bf32 100644 --- a/m4/nut_check_python.m4 +++ b/m4/nut_check_python.m4 @@ -55,17 +55,17 @@ AC_DEFUN([NUT_CHECK_PYTHON_INTERIM_RESULTS], AC_DEFUN([NUT_CHECK_PYTHON_DEFAULT_BEST], [ dnl Pick the top-most hit (smallest prio number, to be considered if no explicit variants were requested) - FOUND_PYTHONS="`( echo "${nut_with_python}|${PYTHON}"; echo "${nut_with_python2}|${PYTHON2}"; echo "${nut_with_python3}|${PYTHON3}" ) | ${EGREP} -v '\|\(no\)*$' | ${EGREP} -v '^no\|'`" + FOUND_PYTHONS="`( echo \"${nut_with_python}|${PYTHON}\"; echo \"${nut_with_python2}|${PYTHON2}\"; echo \"${nut_with_python3}|${PYTHON3}\" ) | ${EGREP} -v '\|\(no\)*$' | ${EGREP} -v '^no\|'`" AS_IF([test x"${FOUND_PYTHONS}" = x], [ AC_MSG_NOTICE([No Python interpreter versions were found or requested]) ], [ - NON_AUTO="`echo "${FOUND_PYTHONS}" | ${EGREP} -v "^auto-prio="`" - BEST_AUTO="`echo "${FOUND_PYTHONS}" | ${EGREP} "^auto-prio=" | sort -n | head -1`" + NON_AUTO="`echo \"${FOUND_PYTHONS}\" | ${EGREP} -v \"^auto-prio=\"`" + BEST_AUTO="`echo \"${FOUND_PYTHONS}\" | ${EGREP} \"^auto-prio=\" | sort -n | head -1`" AS_IF([test x"${NON_AUTO}" = x], [ dnl All findings were auto-prio, else silently keep what we have dnl from "auto", "yes" or explicit settings - BEST_AUTO_PRIO="`echo "${BEST_AUTO}" | sed 's,|.*$,,'`" - BEST_AUTO_PYTHON="`echo "${BEST_AUTO}" | sed 's,^.*|,,'`" + BEST_AUTO_PRIO="`echo \"${BEST_AUTO}\" | sed 's,|.*$,,'`" + BEST_AUTO_PYTHON="`echo \"${BEST_AUTO}\" | sed 's,^.*|,,'`" AS_IF([test x"${BEST_AUTO_PYTHON}" != x], [ AC_MSG_NOTICE([Got an auto-priority preferred hit: ${BEST_AUTO_PRIO} => ${BEST_AUTO_PYTHON}"]) AS_CASE([x"${nut_with_python3}"], @@ -161,7 +161,7 @@ AC_DEFUN([NUT_CHECK_PYTHON], ], [*], [ dnl Note: no "realpath" here, see comment below - myPYTHON="`command -v "${PYTHON}" 2>/dev/null`" && test -n "${myPYTHON}" && test -x "${myPYTHON}" \ + myPYTHON="`command -v \"${PYTHON}\" 2>/dev/null`" && test -n "${myPYTHON}" && test -x "${myPYTHON}" \ && PYTHON="${myPYTHON}" \ || PYTHON="/usr/bin/env ${PYTHON}" unset myPYTHON @@ -230,14 +230,14 @@ AC_DEFUN([NUT_CHECK_PYTHON_SITE_PACKAGES], dnl Note that the list at getsitepackages() MAY start dnl with a "platlib" location (including compiled code): AS_IF([test x"`${PYTHON} -c 'import sys; print (sys.version_info >= (3, 2))'`" = xTrue || test x"`${PYTHON} -c 'import sys; print (sys.version_info >= (2, 7) and sys.version_info < (3, 0))'`"], - [nut_cv_PYTHON_SITE_PACKAGES="`${PYTHON} -c 'import sysconfig; print(sysconfig.get_path("purelib"))'`"], + [nut_cv_PYTHON_SITE_PACKAGES="`${PYTHON} -c 'import sysconfig; print(sysconfig.get_path(\"purelib\"))'`"], [nut_cv_PYTHON_SITE_PACKAGES="`${PYTHON} -c 'import site; print(site.getsitepackages().pop(0))'`"]) ] ) AS_CASE(["$nut_cv_PYTHON_SITE_PACKAGES"], [*:*], [ dnl Note: on Windows MSYS2 this embeds "C:/msys64/mingw..." into the string [nut#1584] - nut_cv_PYTHON_SITE_PACKAGES="`cd "$nut_cv_PYTHON_SITE_PACKAGES" && pwd`" + nut_cv_PYTHON_SITE_PACKAGES="`cd \"$nut_cv_PYTHON_SITE_PACKAGES\" && pwd`" ] ) ]) @@ -264,16 +264,16 @@ AC_DEFUN([NUT_CHECK_PYTHON2], AS_CASE(["${PYTHON_VERSION_INFO_REPORT}"], [*major=2,*], [ PYTHON2="`${PYTHON} -c 'import sys; print(sys.executable);' 2>/dev/null`" && test -n "${PYTHON2}" || PYTHON2="${PYTHON}" - PYTHON2="`realpath "${PYTHON2}" 2>/dev/null`" && test -n "${PYTHON2}" || { + PYTHON2="`realpath \"${PYTHON2}\" 2>/dev/null`" && test -n "${PYTHON2}" || { PYTHON2="${PYTHON}" - PYTHON_CONFIG="`command -v "${PYTHON}-config" 2>/dev/null`" || PYTHON_CONFIG="" + PYTHON_CONFIG="`command -v \"${PYTHON}-config\" 2>/dev/null`" || PYTHON_CONFIG="" if test -n "${PYTHON_CONFIG}" ; then mySHEBANG_SCRIPT="`${PYTHON_CONFIG} --config-dir 2>/dev/null`/python-config.py" \ || mySHEBANG_SCRIPT="${PYTHON_CONFIG}" if test -f "${mySHEBANG_SCRIPT}" ; then - mySHEBANG="`head -1 "${mySHEBANG_SCRIPT}" | ${EGREP} '^#!'`" || mySHEBANG="" + mySHEBANG="`head -1 \"${mySHEBANG_SCRIPT}\" | ${EGREP} '^#!'`" || mySHEBANG="" if test -n "${mySHEBANG}" ; then - PYTHON2="`echo "${mySHEBANG}" | sed 's,^#! *,,'`" \ + PYTHON2="`echo \"${mySHEBANG}\" | sed 's,^#! *,,'`" \ && test -n "${PYTHON2}" || PYTHON2="${PYTHON}" fi fi @@ -320,7 +320,7 @@ AC_DEFUN([NUT_CHECK_PYTHON2], PYTHON2="/usr/bin/env ${PYTHON2}" ], [*], [ - myPYTHON="`command -v "${PYTHON2}" 2>/dev/null`" && test -n "${myPYTHON}" && test -x "${myPYTHON}" \ + myPYTHON="`command -v \"${PYTHON2}\" 2>/dev/null`" && test -n "${myPYTHON}" && test -x "${myPYTHON}" \ && PYTHON2="${myPYTHON}" \ || PYTHON2="/usr/bin/env ${PYTHON2}" unset myPYTHON @@ -372,14 +372,14 @@ AC_DEFUN([NUT_CHECK_PYTHON2_SITE_PACKAGES], dnl Note that the list at getsitepackages() MAY start dnl with a "platlib" location (including compiled code): AS_IF([test x"`${PYTHON2} -c 'import sys; print (sys.version_info >= (2, 7) and sys.version_info < (3, 0))'`"], - [nut_cv_PYTHON2_SITE_PACKAGES="`${PYTHON2} -c 'import sysconfig; print(sysconfig.get_path("purelib"))'`"], + [nut_cv_PYTHON2_SITE_PACKAGES="`${PYTHON2} -c 'import sysconfig; print(sysconfig.get_path(\"purelib\"))'`"], [nut_cv_PYTHON2_SITE_PACKAGES="`${PYTHON2} -c 'import site; print(site.getsitepackages().pop(0))'`"]) ] ) AS_CASE(["$nut_cv_PYTHON2_SITE_PACKAGES"], [*:*], [ dnl Note: on Windows MSYS2 this embeds "C:/msys64/mingw..." into the string [nut#1584] - nut_cv_PYTHON2_SITE_PACKAGES="`cd "$nut_cv_PYTHON2_SITE_PACKAGES" && pwd`" + nut_cv_PYTHON2_SITE_PACKAGES="`cd \"$nut_cv_PYTHON2_SITE_PACKAGES\" && pwd`" ] ) ]) @@ -406,16 +406,16 @@ AC_DEFUN([NUT_CHECK_PYTHON3], AS_CASE(["${PYTHON_VERSION_INFO_REPORT}"], [*major=3,*], [ PYTHON3="`${PYTHON} -c 'import sys; print(sys.executable);' 2>/dev/null`" && test -n "${PYTHON3}" || PYTHON3="${PYTHON}" - PYTHON3="`realpath "${PYTHON3}" 2>/dev/null`" && test -n "${PYTHON3}" || { + PYTHON3="`realpath \"${PYTHON3}\" 2>/dev/null`" && test -n "${PYTHON3}" || { PYTHON3="${PYTHON}" - PYTHON_CONFIG="`command -v "${PYTHON}-config" 2>/dev/null`" || PYTHON_CONFIG="" + PYTHON_CONFIG="`command -v \"${PYTHON}-config\" 2>/dev/null`" || PYTHON_CONFIG="" if test -n "${PYTHON_CONFIG}" ; then mySHEBANG_SCRIPT="`${PYTHON_CONFIG} --config-dir 2>/dev/null`/python-config.py" \ || mySHEBANG_SCRIPT="${PYTHON_CONFIG}" if test -f "${mySHEBANG_SCRIPT}" ; then - mySHEBANG="`head -1 "${mySHEBANG_SCRIPT}" | ${EGREP} '^#!'`" || mySHEBANG="" + mySHEBANG="`head -1 \"${mySHEBANG_SCRIPT}\" | ${EGREP} '^#!'`" || mySHEBANG="" if test -n "${mySHEBANG}" ; then - PYTHON3="`echo "${mySHEBANG}" | sed 's,^#! *,,'`" \ + PYTHON3="`echo \"${mySHEBANG}\" | sed 's,^#! *,,'`" \ && test -n "${PYTHON3}" || PYTHON3="${PYTHON}" fi fi @@ -462,7 +462,7 @@ AC_DEFUN([NUT_CHECK_PYTHON3], PYTHON3="/usr/bin/env ${PYTHON3}" ], [*], [ - myPYTHON="`command -v "${PYTHON3}" 2>/dev/null`" && test -n "${myPYTHON}" && test -x "${myPYTHON}" \ + myPYTHON="`command -v \"${PYTHON3}\" 2>/dev/null`" && test -n "${myPYTHON}" && test -x "${myPYTHON}" \ && PYTHON3="${myPYTHON}" \ || PYTHON3="/usr/bin/env ${PYTHON3}" unset myPYTHON @@ -514,14 +514,14 @@ AC_DEFUN([NUT_CHECK_PYTHON3_SITE_PACKAGES], dnl Note that the list at getsitepackages() MAY start dnl with a "platlib" location (including compiled code): AS_IF([test x"`${PYTHON3} -c 'import sys; print (sys.version_info >= (3, 2))'`" = xTrue], - [nut_cv_PYTHON3_SITE_PACKAGES="`${PYTHON3} -c 'import sysconfig; print(sysconfig.get_path("purelib"))'`"], + [nut_cv_PYTHON3_SITE_PACKAGES="`${PYTHON3} -c 'import sysconfig; print(sysconfig.get_path(\"purelib\"))'`"], [nut_cv_PYTHON3_SITE_PACKAGES="`${PYTHON3} -c 'import site; print(site.getsitepackages().pop(0))'`"]) ] ) AS_CASE(["$nut_cv_PYTHON3_SITE_PACKAGES"], [*:*], [ dnl Note: on Windows MSYS2 this embeds "C:/msys64/mingw..." into the string [nut#1584] - nut_cv_PYTHON3_SITE_PACKAGES="`cd "$nut_cv_PYTHON3_SITE_PACKAGES" && pwd`" + nut_cv_PYTHON3_SITE_PACKAGES="`cd \"$nut_cv_PYTHON3_SITE_PACKAGES\" && pwd`" ] ) ]) diff --git a/m4/nut_compiler_family.m4 b/m4/nut_compiler_family.m4 index db8042f3fc..f1719c8ae3 100644 --- a/m4/nut_compiler_family.m4 +++ b/m4/nut_compiler_family.m4 @@ -37,15 +37,15 @@ if test -z "${nut_compiler_family_seen}"; then )]) AS_IF([test "x$GCC" = "x" && test "$nut_cv_GCC" = yes], [GCC=yes - CC_VERSION="`echo "${CC_VERSION_FULL}" | ${GREP} -i gcc | head -1`" \ + CC_VERSION="`echo \"${CC_VERSION_FULL}\" | ${GREP} -i gcc | head -1`" \ && test -n "${CC_VERSION}" || CC_VERSION="" ]) AS_IF([test "x$GXX" = "x" && test "$nut_cv_GXX" = yes], [GXX=yes - CXX_VERSION="`echo "${CXX_VERSION_FULL}" | ${EGREP} -i 'g++|gcc' | head -1`" \ + CXX_VERSION="`echo \"${CXX_VERSION_FULL}\" | ${EGREP} -i 'g++|gcc' | head -1`" \ && test -n "${CXX_VERSION}" || CXX_VERSION="" ]) AS_IF([test "x$GPP" = "x" && test "$nut_cv_GPP" = yes], [GPP=yes - CPP_VERSION="`echo "${CPP_VERSION_FULL}" | ${EGREP} -i 'cpp|gcc' | head -1`" \ + CPP_VERSION="`echo \"${CPP_VERSION_FULL}\" | ${EGREP} -i 'cpp|gcc' | head -1`" \ && test -n "${CPP_VERSION}" || CPP_VERSION="" ]) @@ -74,21 +74,21 @@ if test -z "${nut_compiler_family_seen}"; then )]) AS_IF([test "x$CLANGCC" = "x" && test "$nut_cv_CLANGCC" = yes], [CLANGCC=yes - CC_VERSION="`echo "${CC_VERSION_FULL}" | ${GREP} -v "Dir:" | tr '\n' ';' | sed -e 's, *;,;,g' -e 's,;$,,' -e 's,;,; ,g'`" \ + CC_VERSION="`echo \"${CC_VERSION_FULL}\" | ${GREP} -v \"Dir:\" | tr '\n' ';' | sed -e 's, *;,;,g' -e 's,;$,,' -e 's,;,; ,g'`" \ && test -n "${CC_VERSION}" || CC_VERSION="" ]) AS_IF([test "x$CLANGXX" = "x" && test "$nut_cv_CLANGXX" = yes], [CLANGXX=yes - CXX_VERSION="`echo "${CXX_VERSION_FULL}" | ${GREP} -v "Dir:" | tr '\n' ';' | sed -e 's, *;,;,g' -e 's,;$,,' -e 's,;,; ,g'`" \ + CXX_VERSION="`echo \"${CXX_VERSION_FULL}\" | ${GREP} -v \"Dir:\" | tr '\n' ';' | sed -e 's, *;,;,g' -e 's,;$,,' -e 's,;,; ,g'`" \ && test -n "${CXX_VERSION}" || CXX_VERSION="" ]) AS_IF([test "x$CLANGPP" = "x" && test "$nut_cv_CLANGPP" = yes], [CLANGPP=yes - CPP_VERSION="`echo "${CPP_VERSION_FULL}" | ${GREP} -v "Dir:" | tr '\n' ';' | sed -e 's, *;,;,g' -e 's,;$,,' -e 's,;,; ,g'`" \ + CPP_VERSION="`echo \"${CPP_VERSION_FULL}\" | ${GREP} -v \"Dir:\" | tr '\n' ';' | sed -e 's, *;,;,g' -e 's,;$,,' -e 's,;,; ,g'`" \ && test -n "${CPP_VERSION}" || CPP_VERSION="" ]) - AS_IF([test "x$CC_VERSION" = x], [CC_VERSION="`echo "${CC_VERSION_FULL}" | head -1`"]) - AS_IF([test "x$CXX_VERSION" = x], [CXX_VERSION="`echo "${CXX_VERSION_FULL}" | head -1`"]) - AS_IF([test "x$CPP_VERSION" = x], [CPP_VERSION="`echo "${CPP_VERSION_FULL}" | head -1`"]) + AS_IF([test "x$CC_VERSION" = x], [CC_VERSION="`echo \"${CC_VERSION_FULL}\" | head -1`"]) + AS_IF([test "x$CXX_VERSION" = x], [CXX_VERSION="`echo \"${CXX_VERSION_FULL}\" | head -1`"]) + AS_IF([test "x$CPP_VERSION" = x], [CPP_VERSION="`echo \"${CPP_VERSION_FULL}\" | head -1`"]) fi ]) From de783bf8c4f201c8b4e3770206ecee01fcdbaaee Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Mon, 24 Nov 2025 14:33:54 +0000 Subject: [PATCH 771/805] scripts/Windows/*.sh: revise shell script syntax with backticks and double-quotes [#3196] Signed-off-by: Jim Klimov --- scripts/Windows/build-mingw-nut.sh | 10 ++++----- scripts/Windows/build-mingw-prereqs.sh | 8 +++---- scripts/Windows/dllldd.sh | 30 +++++++++++++------------- 3 files changed, 24 insertions(+), 24 deletions(-) diff --git a/scripts/Windows/build-mingw-nut.sh b/scripts/Windows/build-mingw-nut.sh index 040c352a15..210e4a786a 100755 --- a/scripts/Windows/build-mingw-nut.sh +++ b/scripts/Windows/build-mingw-nut.sh @@ -7,8 +7,8 @@ #set -x -SCRIPTDIR="`dirname "$0"`" -SCRIPTDIR="`cd "$SCRIPTDIR" && pwd`" +SCRIPTDIR="`dirname \"$0\"`" +SCRIPTDIR="`cd \"$SCRIPTDIR\" && pwd`" DLLLDD_SOURCED=true . "${SCRIPTDIR}/dllldd.sh" @@ -69,7 +69,7 @@ case "$SOURCEMODE" in stable) # FIXME # Stable version (download the latest stable archive) - VER_OPT_SHORT="`echo "$VER_OPT" | awk -F. '{print $1"."$2}'`" + VER_OPT_SHORT="`echo \"$VER_OPT\" | awk -F. '{print $1\".\"$2}'`" if [ ! -s "nut-$VER_OPT.tar.gz" ] ; then wget "https://www.networkupstools.org/source/$VER_OPT_SHORT/nut-$VER_OPT.tar.gz" fi @@ -209,10 +209,10 @@ do_build_mingw_nut() { (cd "$INSTALL_DIR" && { dllldddir . | while read D ; do cp -pf "$D" ./bin/ ; done ; } ) || true # Hardlink libraries for sbin (alternative: all bins in one dir): - (cd "$INSTALL_DIR/sbin" && { DESTDIR="$INSTALL_DIR" dllldddir . | while read D ; do ln -f ../bin/"`basename "$D"`" ./ ; done ; } ) || true + (cd "$INSTALL_DIR/sbin" && { DESTDIR="$INSTALL_DIR" dllldddir . | while read D ; do ln -f ../bin/"`basename \"$D\"`" ./ ; done ; } ) || true # Hardlink libraries for cgi-bin if present: - (cd "$INSTALL_DIR/cgi-bin" 2>/dev/null && { DESTDIR="$INSTALL_DIR" dllldddir . | while read D ; do ln -f ../bin/"`basename "$D"`" ./ ; done ; } ) \ + (cd "$INSTALL_DIR/cgi-bin" 2>/dev/null && { DESTDIR="$INSTALL_DIR" dllldddir . | while read D ; do ln -f ../bin/"`basename \"$D\"`" ./ ; done ; } ) \ || echo "NOTE: FAILED to process OPTIONAL cgi-bin directory; was NUT CGI enabled?" >&2 fi diff --git a/scripts/Windows/build-mingw-prereqs.sh b/scripts/Windows/build-mingw-prereqs.sh index 89fd507407..84192bdedb 100755 --- a/scripts/Windows/build-mingw-prereqs.sh +++ b/scripts/Windows/build-mingw-prereqs.sh @@ -52,7 +52,7 @@ prepareEnv() { [ -n "${PREFIX_ROOT-}" ] || PREFIX_ROOT="/" [ -n "${PREFIX-}" ] || PREFIX="${PREFIX_ROOT}/$MINGW_PREFIX" # Normalize away extra slashes, they confuse at least MSYS2 tools - PREFIX="`echo "${PREFIX}" | sed 's,//*,/,g'`" + PREFIX="`echo \"${PREFIX}\" | sed 's,//*,/,g'`" case "${PATH}" in "${PREFIX}/bin"|"${PREFIX}/bin:"*|*":${PREFIX}/bin:"*|*":${PREFIX}/bin") ;; *) PATH="${PREFIX}/bin:${PATH}" ;; @@ -84,7 +84,7 @@ prepareEnv() { HOST_FLAG="--host=$ARCH" [ -n "${PREFIX_ROOT-}" ] || PREFIX_ROOT="/usr" [ -n "${PREFIX-}" ] || PREFIX="${PREFIX_ROOT}/${ARCH}" - PREFIX="`echo "${PREFIX}" | sed 's,//*,/,g'`" + PREFIX="`echo \"${PREFIX}\" | sed 's,//*,/,g'`" export ARCH PREFIX @@ -233,7 +233,7 @@ provide_libmodbus_git() ( # there's nothing to change (avoid re-packaging of CI artifact cache) cd "${DEP_DIRNAME}" && \ LOCAL_HASH="`git log -1 --format='%H'`" && \ - OTHER_HASH="`git ls-remote "${DEP_GITREPO}" | grep -E '(refs/(heads|tags)/'"${DEP_VERSION}"'$|^'"${DEP_VERSION}"')' | awk '{print $1}'`" && \ + OTHER_HASH="`git ls-remote \"${DEP_GITREPO}\" | grep -E '(refs/(heads|tags)/'\"${DEP_VERSION}\"'$|^'\"${DEP_VERSION}\"')' | awk '{print $1}'`" && \ if [ x"${LOCAL_HASH}" = x"${OTHER_HASH}" ] ; then echo "FETCH: Current git commit in '`pwd`' matches current '${DEP_VERSION}' in '${DEP_GITREPO}'" >&2 else @@ -241,7 +241,7 @@ provide_libmodbus_git() ( git fetch --tags && \ git fetch --all && \ git checkout "${DEP_VERSION}" && \ - _GITDIFF="`git diff "origin/${DEP_VERSION}"`" && \ + _GITDIFF="`git diff \"origin/${DEP_VERSION}\"`" && \ if [ -n "${_GITDIFF}" ] ; then # Ensure rebase etc. or fail git pull && \ diff --git a/scripts/Windows/dllldd.sh b/scripts/Windows/dllldd.sh index 1827f572e3..c7a57a0319 100755 --- a/scripts/Windows/dllldd.sh +++ b/scripts/Windows/dllldd.sh @@ -6,7 +6,7 @@ # for Windows, bundled with open-source dependencies. # # Copyright (C) -# 2022 Jim Klimov +# 2022-2025 Jim Klimov REGEX_WS="`printf '[\t ]'`" REGEX_NOT_WS="`printf '[^\t ]'`" @@ -26,24 +26,24 @@ dllldd() ( for OD in objdump "$ARCH-objdump" ; do (command -v "$OD" >/dev/null 2>/dev/null) || continue - ODOUT="`$OD -x "$@" 2>/dev/null | grep -Ei "DLL Name:" | awk '{print $NF}' | sort | uniq | grep -vEi '^(/.*/)?(msvcrt|userenv|bcrypt|rpcrt4|usp10|(advapi|kernel|user|wsock|ws2_|gdi|ole||shell)(32|64))\.dll$'`" \ + ODOUT="`$OD -x \"$@\" 2>/dev/null | grep -Ei \"DLL Name:\" | awk '{print $NF}' | sort | uniq | grep -vEi '^(/.*/)?(msvcrt|userenv|bcrypt|rpcrt4|usp10|(advapi|kernel|user|wsock|ws2_|gdi|ole||shell)(32|64))\.dll$'`" \ && [ -n "$ODOUT" ] || continue for F in $ODOUT ; do if [ -n "$DESTDIR" -a -d "${DESTDIR}" ] ; then - OUT="`find "$DESTDIR" -type f -name "$F" \! -size 0 2>/dev/null | head -1`" \ + OUT="`find \"$DESTDIR\" -type f -name \"$F\" \! -size 0 2>/dev/null | head -1`" \ && [ -n "$OUT" ] && { echo "$OUT" ; SEEN="`expr $SEEN + 1`" ; continue ; } fi if [ -n "$ARCH" -a -d "/usr/${ARCH}" ] ; then - OUT="`ls -1 "/usr/${ARCH}/bin/$F" "/usr/${ARCH}/lib/$F" 2>/dev/null || true`" \ + OUT="`ls -1 \"/usr/${ARCH}/bin/$F\" \"/usr/${ARCH}/lib/$F\" 2>/dev/null || true`" \ && [ -n "$OUT" ] && { echo "$OUT" ; SEEN="`expr $SEEN + 1`" ; continue ; } fi if [ -n "$MSYSTEM_PREFIX" -a -d "$MSYSTEM_PREFIX" ] ; then - OUT="`ls -1 "${MSYSTEM_PREFIX}/bin/$F" "${MSYSTEM_PREFIX}/lib/$F" 2>/dev/null || true`" \ + OUT="`ls -1 \"${MSYSTEM_PREFIX}/bin/$F\" \"${MSYSTEM_PREFIX}/lib/$F\" 2>/dev/null || true`" \ && [ -n "$OUT" ] && { echo "$OUT" ; SEEN="`expr $SEEN + 1`" ; continue ; } fi if [ -n "$MINGW_PREFIX" -a "$MINGW_PREFIX" != "$MSYSTEM_PREFIX" -a -d "$MINGW_PREFIX" ] ; then - OUT="`ls -1 "${MINGW_PREFIX}/bin/$F" "${MINGW_PREFIX}/lib/$F" 2>/dev/null || true`" \ + OUT="`ls -1 \"${MINGW_PREFIX}/bin/$F\" \"${MINGW_PREFIX}/lib/$F\" 2>/dev/null || true`" \ && [ -n "$OUT" ] && { echo "$OUT" ; SEEN="`expr $SEEN + 1`" ; continue ; } fi @@ -66,7 +66,7 @@ dllldd() ( else # FIXME: Try to look up in config.log first? if [ -n "$ARCH" ] && (command -v "${ARCH}-gcc") 2>/dev/null >/dev/null ; then - COMPILER_PATHS="`"${ARCH}-gcc" --print-search-dirs | grep libraries: | sed 's,^libraries: *=/,/,'`" + COMPILER_PATHS="`\"${ARCH}-gcc\" --print-search-dirs | grep libraries: | sed 's,^libraries: *=/,/,'`" fi fi if [ -n "$CXX" ] ; then @@ -75,13 +75,13 @@ dllldd() ( else # FIXME: Try to look up in config.log first? if [ -n "$ARCH" ] && (command -v "${ARCH}-g++") 2>/dev/null >/dev/null ; then - COMPILER_PATHS="`"${ARCH}-g++" --print-search-dirs | grep libraries: | sed 's,^libraries: *=/,/,'`" + COMPILER_PATHS="`\"${ARCH}-g++\" --print-search-dirs | grep libraries: | sed 's,^libraries: *=/,/,'`" fi fi if [ -n "$COMPILER_PATHS" ] ; then - COMPILER_PATHS="`echo "$COMPILER_PATHS" | tr ':' '\n'`" + COMPILER_PATHS="`echo \"$COMPILER_PATHS\" | tr ':' '\n'`" for P in $COMPILER_PATHS ; do - OUT="`ls -1 "${P}/$F" 2>/dev/null || true`" \ + OUT="`ls -1 \"${P}/$F\" 2>/dev/null || true`" \ && [ -n "$OUT" ] && { echo "$OUT" ; SEEN="`expr $SEEN + 1`" ; continue 2 ; } done fi @@ -98,7 +98,7 @@ dllldd() ( # libiconv-2.dll => /mingw64/bin/libiconv-2.dll (0x7ffd26c90000) # but it tends to say "not a dynamic executable" # or that file type is not supported - OUT="`ldd "$@" 2>/dev/null | grep -Ei '\.dll' | grep -E '/(bin|lib)/' | sed "s,^${REGEX_WS}*\(${REGEX_NOT_WS}${REGEX_NOT_WS}*\)${REGEX_WS}${REGEX_WS}*=>${REGEX_WS}${REGEX_WS}*\(${REGEX_NOT_WS}${REGEX_NOT_WS}*\)${REGEX_WS}.*\$,\2," | sort | uniq | grep -Ei '\.dll$'`" \ + OUT="`ldd \"$@\" 2>/dev/null | grep -Ei '\.dll' | grep -E '/(bin|lib)/' | sed \"s,^${REGEX_WS}*\(${REGEX_NOT_WS}${REGEX_NOT_WS}*\)${REGEX_WS}${REGEX_WS}*=>${REGEX_WS}${REGEX_WS}*\(${REGEX_NOT_WS}${REGEX_NOT_WS}*\)${REGEX_WS}.*\$,\2,\" | sort | uniq | grep -Ei '\.dll$'`" \ && [ -n "$OUT" ] && { echo "$OUT" ; return 0 ; } return 1 @@ -128,7 +128,7 @@ dllldddir() ( fi # Assume no whitespace in built/MSYS/MinGW paths... - ORIGFILES="`find "$@" -type f | grep -Ei '\.(exe|dll)$'`" || return + ORIGFILES="`find \"$@\" -type f | grep -Ei '\.(exe|dll)$'`" || return # Quick OK, nothing here? [ -n "$ORIGFILES" ] || return 0 @@ -149,15 +149,15 @@ dllldddir() ( # Next iteration we drill into those we have not seen yet #if [ -n "$BASH_VERSION" ] ; then - # NEXTDLLS="`diffvars_bash "$SEENDLLS" "$MOREDLLS"`" + # NEXTDLLS="`diffvars_bash \"$SEENDLLS\" \"$MOREDLLS\"`" #else echo "$SEENDLLS" > "$TMP1" echo "$MOREDLLS" > "$TMP2" - NEXTDLLS="`diff -bu "$TMP1" "$TMP2" | grep -E '^\+[^+]' | sed 's,^\+,,'`" + NEXTDLLS="`diff -bu \"$TMP1\" \"$TMP2\" | grep -E '^\+[^+]' | sed 's,^\+,,'`" #fi if [ -n "$NEXTDLLS" ] ; then - SEENDLLS="`( echo "$SEENDLLS" ; echo "$NEXTDLLS" ) | sort | uniq`" + SEENDLLS="`( echo \"$SEENDLLS\" ; echo \"$NEXTDLLS\" ) | sort | uniq`" fi done From 31067181512cd56e3ab6d0f934f8504cf82c15ec Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Mon, 24 Nov 2025 14:36:22 +0000 Subject: [PATCH 772/805] scripts/fuse/*: revise shell script syntax with backticks and double-quotes [#3196] Signed-off-by: Jim Klimov --- scripts/fuse/execfuse-nut/getattr | 12 ++++++------ scripts/fuse/execfuse-nut/read_file | 8 ++++---- scripts/fuse/execfuse-nut/readdir | 10 +++++----- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/scripts/fuse/execfuse-nut/getattr b/scripts/fuse/execfuse-nut/getattr index 6a13a013a5..9929acdad7 100755 --- a/scripts/fuse/execfuse-nut/getattr +++ b/scripts/fuse/execfuse-nut/getattr @@ -2,11 +2,11 @@ # Simple PoC of NUT client as a FUSE mountable filesystem # Requires https://github.com/vi/execfuse -# Copyright (C) 2024 by Jim Klimov +# Copyright (C) 2024-2025 by Jim Klimov # Licensed GPLv2+ as NUT codebase if [ x"$NUT_DEBUG_FUSE" = xtrue ] ; then - exec 2>"/tmp/nut-debug-fuse-`basename $0`.log" + exec 2>"/tmp/nut-debug-fuse-`basename \"$0\"`.log" echo "ARGS($#, $0): 1='$1' 2='$2' @='$@'" >&2 fi @@ -20,17 +20,17 @@ case "$1" in ;; /by-server/*/*/*) # VARNAME - F="`basename "$1"`" + F="`basename \"$1\"`" # UPSSRV/UPSNAME - D="`echo "$1" | sed 's,^/by-server/\(.*\)/'"$F"'$,\1,'`" + D="`echo \"$1\" | sed 's,^/by-server/\(.*\)/'\"$F\"'$,\1,'`" ;; /by-server/*/*) # UPSSRV/UPSNAME - D="`echo "$1" | sed 's,^/by-server/\(.*\)$,\1,'`" + D="`echo \"$1\" | sed 's,^/by-server/\(.*\)$,\1,'`" ;; /by-server/*) # No further slash # UPSSRV - D="`basename "$1"`" + D="`basename \"$1\"`" ;; /client-location|/client-version) F="$1" diff --git a/scripts/fuse/execfuse-nut/read_file b/scripts/fuse/execfuse-nut/read_file index 22300d92f5..bcdba8bd9e 100755 --- a/scripts/fuse/execfuse-nut/read_file +++ b/scripts/fuse/execfuse-nut/read_file @@ -2,11 +2,11 @@ # Simple PoC of NUT client as a FUSE mountable filesystem # Requires https://github.com/vi/execfuse -# Copyright (C) 2024 by Jim Klimov +# Copyright (C) 2024-2025 by Jim Klimov # Licensed GPLv2+ as NUT codebase if [ x"$NUT_DEBUG_FUSE" = xtrue ] ; then - exec 2>"/tmp/nut-debug-fuse-`basename $0`.log" + exec 2>"/tmp/nut-debug-fuse-`basename \"$0\"`.log" echo "ARGS($#, $0): 1='$1' 2='$2' @='$@'" >&2 fi @@ -17,8 +17,8 @@ case "$1" in /by-server/*/*/*/*) # Don't want subdirs here ;; /by-server/*/*/*) - VARNAME="`basename "$1"`" - UPS="`echo "$1" | sed 's,^/by-server/\([^/]*\)/\([^/]*\)/'"$VARNAME"'$,\2@\1,'`" + VARNAME="`basename \"$1\"`" + UPS="`echo \"$1\" | sed 's,^/by-server/\([^/]*\)/\([^/]*\)/'\"$VARNAME\"'$,\2@\1,'`" if [ x"$NUT_DEBUG_FUSE" = xtrue ] ; then #echo "+upsc '$UPS' '$VARNAME'" >&2 set -x diff --git a/scripts/fuse/execfuse-nut/readdir b/scripts/fuse/execfuse-nut/readdir index 27f13696b0..a5f92acabf 100755 --- a/scripts/fuse/execfuse-nut/readdir +++ b/scripts/fuse/execfuse-nut/readdir @@ -2,11 +2,11 @@ # Simple PoC of NUT client as a FUSE mountable filesystem # Requires https://github.com/vi/execfuse -# Copyright (C) 2024 by Jim Klimov +# Copyright (C) 2024-2025 by Jim Klimov # Licensed GPLv2+ as NUT codebase if [ x"$NUT_DEBUG_FUSE" = xtrue ] ; then - exec 2>"/tmp/nut-debug-fuse-`basename $0`.log" + exec 2>"/tmp/nut-debug-fuse-`basename \"$0\"`.log" echo "ARGS($#, $0): 1='$1' 2='$2' @='$@'" >&2 #echo "ARGS: $#: $@" >&2 #set | grep -E '^[^ =]*=' >&2 @@ -48,15 +48,15 @@ case "$1" in exit 2 # ENOENT ;; /by-server/*/*) # list device variables - UPSNAME="`basename "$1"`" - UPSSRV="`echo "$1" | sed 's,^/by-server/\(.*\)/'"$UPSNAME"'$,\1,'`" + UPSNAME="`basename \"$1\"`" + UPSSRV="`echo \"$1\" | sed 's,^/by-server/\(.*\)/'\"$UPSNAME\"'$,\1,'`" print_dots for VARNAME in `upsc "$UPSNAME@$UPSSRV" | awk -F: '{print $1}'` ; do printf 'ino=1 mode=-r--r--r-- nlink=1 uid=0 gid=0 rdev=0 size=16 blksize=512 blocks=1 atime=0 mtime=0 ctime=0 %s\0' "$VARNAME" done ;; /by-server/*) # devices on hostname - UPSSRV="`basename "$1"`" + UPSSRV="`basename \"$1\"`" print_dots for UPSNAME in `upsc -l "$UPSSRV"` ; do printf 'ino=1 mode=drwxr-xr-x nlink=16 uid=0 gid=0 rdev=0 size=16 blksize=512 blocks=1 atime=0 mtime=0 ctime=0 %s\0' "$UPSNAME" From b532aed6bc5b75f21b3448333de606818e9994d0 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Mon, 24 Nov 2025 14:34:33 +0000 Subject: [PATCH 773/805] scripts/{Aix,Solaris}: revise packaging and init shell script syntax with backticks and double-quotes [#3196] Signed-off-by: Jim Klimov --- scripts/Aix/nut.init.in | 4 ++-- scripts/Solaris/postinstall.in | 4 ++-- scripts/Solaris/preinstall.in | 2 +- scripts/Solaris/preremove.in | 6 +++--- scripts/Solaris/reset-ups-usb-solaris.sh.sample | 2 +- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/scripts/Aix/nut.init.in b/scripts/Aix/nut.init.in index f8bd09444b..b94cc1c777 100755 --- a/scripts/Aix/nut.init.in +++ b/scripts/Aix/nut.init.in @@ -86,7 +86,7 @@ do_stop() { RETVAL=0 if test -e "${NUT_RUN_DIR}"/upsmon.pid; then echo "Stopping UPS monitor: \c" - PID="`cat "${NUT_RUN_DIR}"/upsmon.pid`" + PID="`cat \"${NUT_RUN_DIR}\"/upsmon.pid`" kill -15 $PID && success || { RETVAL=$?; failure; } rm "${NUT_RUN_DIR}"/upsmon.pid fi @@ -94,7 +94,7 @@ do_stop() { if [ "$SERVER" = "yes" ]; then if test -e "${NUT_RUN_DIR}"/upsd.pid; then echo "Stopping upsd: \c" - PID="`cat "${NUT_RUN_DIR}"/upsd.pid`" + PID="`cat \"${NUT_RUN_DIR}\"/upsd.pid`" kill -15 $PID && success || { RETVAL=$?; failure; } rm "${NUT_RUN_DIR}"/upsd.pid fi diff --git a/scripts/Solaris/postinstall.in b/scripts/Solaris/postinstall.in index 112fa1aaba..30407c2ed9 100755 --- a/scripts/Solaris/postinstall.in +++ b/scripts/Solaris/postinstall.in @@ -30,7 +30,7 @@ if [ -z "$res" ]; then /usr/sbin/useradd -c "Network UPS Tools" -g "@RUN_AS_GROUP@" -G root -d "@STATEPATH@" -s /bin/false @RUN_AS_USER@ fi -res="`groups "@RUN_AS_GROUP@" | grep -w "@RUN_AS_USER@"`" || res="" +res="`groups \"@RUN_AS_GROUP@\" | grep -w \"@RUN_AS_USER@\"`" || res="" if [ -z "$res" ]; then /usr/sbin/usermod -g "@RUN_AS_GROUP@" -G root "@RUN_AS_USER@" fi @@ -95,7 +95,7 @@ if test -x /usr/sbin/svcadm && test -x /usr/sbin/svccfg && test -x /usr/bin/svcs # This may still fail if the daemon instance is somehow enabled (admin) PREV_ACTIVE_ENUMERATOR="" if test -s "${ACTIVE_ENUMERATOR_FMRI_FILE}" ; then - PREV_ACTIVE_ENUMERATOR="`head -1 "${ACTIVE_ENUMERATOR_FMRI_FILE}"`" + PREV_ACTIVE_ENUMERATOR="`head -1 \"${ACTIVE_ENUMERATOR_FMRI_FILE}\"`" fi [ x"nut-driver-enumerator:default" = x"${PREV_ACTIVE_ENUMERATOR}" ] && PREV_ACTIVE_ENUMERATOR="" for ACTIVE_ENUMERATOR in ${PREV_ACTIVE_ENUMERATOR} nut-driver-enumerator:default ; do diff --git a/scripts/Solaris/preinstall.in b/scripts/Solaris/preinstall.in index 42da1ceaf6..eb71714ef7 100755 --- a/scripts/Solaris/preinstall.in +++ b/scripts/Solaris/preinstall.in @@ -17,7 +17,7 @@ if [ "$?" != 0 ]; then /usr/sbin/useradd -c "Network UPS Tools" -g "@RUN_AS_GROUP@" -G root -d "@STATEPATH@" -s /bin/false "@RUN_AS_USER@" fi -res="`groups "@RUN_AS_GROUP@" | grep -w "@RUN_AS_USER@"`" || res="" +res="`groups \"@RUN_AS_GROUP@\" | grep -w \"@RUN_AS_USER@\"`" || res="" if [ -z "$res" ]; then /usr/sbin/usermod -g "@RUN_AS_GROUP@" -G root "@RUN_AS_USER@" fi diff --git a/scripts/Solaris/preremove.in b/scripts/Solaris/preremove.in index 1054d76782..83d3a074d0 100755 --- a/scripts/Solaris/preremove.in +++ b/scripts/Solaris/preremove.in @@ -28,7 +28,7 @@ if test -x /usr/sbin/svcadm && test -x /usr/sbin/svccfg && test -x /usr/bin/svcs # instance of nut-driver-enumerator so we can pass it to the # next lifetime in case of re-install of NUT and keep the # user's previously declared preference. - ACTIVE_ENUMERATOR="`/usr/bin/svcs -H -o state,fmri '*/nut-driver-enumerator:*' | while read S F ; do [ "$S" != "disabled" ] && [ "$S" != "offline" ] && echo "$F" && break ; done`" + ACTIVE_ENUMERATOR="`/usr/bin/svcs -H -o state,fmri '*/nut-driver-enumerator:*' | while read S F ; do [ \"$S\" != \"disabled\" ] && [ \"$S\" != \"offline\" ] && echo \"$F\" && break ; done`" if [ -n "$ACTIVE_ENUMERATOR" ]; then rm -f "${ACTIVE_ENUMERATOR_FMRI_FILE}" touch "${ACTIVE_ENUMERATOR_FMRI_FILE}" @@ -61,8 +61,8 @@ if test -x /usr/sbin/svcadm && test -x /usr/sbin/svccfg && test -x /usr/bin/svcs for S in `/usr/bin/svcs -H -o fmri '*/nut-driver:*' | grep -wv default` `/usr/bin/svcs -H -o fmri '*/nut-driver-enumerator:*' | grep -wv default` ; do echo "Removing NUT service: $S..." # Note: S here is a full FMRI URL - SB="`echo "$S" | sed 's,:[^:]*$,,'`" - SI="`echo "$S" | sed 's,^.*:\([^:]*\)$,\1,'`" + SB="`echo \"$S\" | sed 's,:[^:]*$,,'`" + SI="`echo \"$S\" | sed 's,^.*:\([^:]*\)$,\1,'`" /usr/sbin/svcadm disable -s "$S" /usr/sbin/svccfg -s "$SB" delete -f "$SI" || \ /usr/sbin/svccfg delete "$S" diff --git a/scripts/Solaris/reset-ups-usb-solaris.sh.sample b/scripts/Solaris/reset-ups-usb-solaris.sh.sample index 893df71fc1..4715df5da5 100755 --- a/scripts/Solaris/reset-ups-usb-solaris.sh.sample +++ b/scripts/Solaris/reset-ups-usb-solaris.sh.sample @@ -34,7 +34,7 @@ date svcs -p "$DEVICE" ; upsc "$DEVICE" DO_SVC=false -if [ "`svcs -Hostate "$DEVICE"`" = "online" ]; then +if [ "`svcs -Hostate \"$DEVICE\"`" = "online" ]; then DO_SVC=true svcadm disable -ts "$DEVICE" fi From b8d5dbe125a04a0b53b2d397db434920073440ef Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Mon, 24 Nov 2025 14:50:14 +0000 Subject: [PATCH 774/805] scripts/installer/*: revise packaging and init shell script syntax with backticks and double-quotes [#3196] Signed-off-by: Jim Klimov --- scripts/installer/aix/aix_init | 8 +-- scripts/installer/common/init | 2 +- scripts/installer/common/ipp-event.sh | 2 +- .../installer/common/ipp-host-shutdown.sample | 4 +- scripts/installer/common/ipp-os-shutdown | 30 ++++---- .../installer/common/ipp-shutdown-daemon.sh | 4 +- scripts/installer/common/ipp-status | 20 +++--- scripts/installer/common/ipp-wrapper | 2 +- scripts/installer/common/shutdown | 2 +- scripts/installer/install.sh | 72 +++++++++---------- scripts/installer/uninstall-ipp | 2 +- 11 files changed, 74 insertions(+), 74 deletions(-) diff --git a/scripts/installer/aix/aix_init b/scripts/installer/aix/aix_init index 1ff2104499..91b7f6bbf7 100755 --- a/scripts/installer/aix/aix_init +++ b/scripts/installer/aix/aix_init @@ -112,7 +112,7 @@ do_start() { do_stop() { if test -e "${NUT_RUN_DIR}/upsmon.pid" ; then echo "Stopping UPS monitor: \c" - PID="`cat "${NUT_RUN_DIR}/upsmon.pid"`" + PID="`cat \"${NUT_RUN_DIR}/upsmon.pid\"`" ( kill $PID && success || failure ) || \ RETVAL=$? rm "${NUT_RUN_DIR}/upsmon.pid" @@ -121,7 +121,7 @@ do_stop() { if [ "$SERVER" = "yes" ]; then if test -e "${NUT_RUN_DIR}/upsd.pid" ; then echo "Stopping upsd: \c" - PID="`cat "${NUT_RUN_DIR}/upsd.pid"`" + PID="`cat \"${NUT_RUN_DIR}/upsd.pid\"`" ( kill -9 $PID && success || failure ) || \ RETVAL=$? rm "${NUT_RUN_DIR}/upsd.pid" @@ -186,7 +186,7 @@ case "$1" in if [ "$SERVER" = "yes" ]; then RETVAL_UPSD=1 if test -f "${NUT_LOCK_FILE}" -o -s "${NUT_RUN_DIR}/upsd.pid" ; then - PID_UPSD="`cat "${NUT_RUN_DIR}/upsd.pid"`" && \ + PID_UPSD="`cat \"${NUT_RUN_DIR}/upsd.pid\"`" && \ test -n "$PID_UPSD" && \ test -d "/proc/${PID_UPSD}" && \ echo "upsd is running with PID $PID_UPSD" && \ @@ -200,7 +200,7 @@ case "$1" in RETVAL_UPSMON=1 if test -s "${NUT_RUN_DIR}/upsmon.pid" ; then - PID_UPSMON="`cat "${NUT_RUN_DIR}/upsmon.pid"`" && \ + PID_UPSMON="`cat \"${NUT_RUN_DIR}/upsmon.pid\"`" && \ test -n "$PID_UPSMON" && \ test -d "/proc/${PID_UPSMON}" && \ echo "upsmon is running with PID $PID_UPSMON" && \ diff --git a/scripts/installer/common/init b/scripts/installer/common/init index 04e1f08cce..e5ab70c6ff 100755 --- a/scripts/installer/common/init +++ b/scripts/installer/common/init @@ -69,7 +69,7 @@ fi # TODO: Here we want to refine the list to only MONITORed UPSes that power us? # Convert to parsing of "ipp-status -p" which reports all needed details -upslist="`"$NUT_UPSC" -l`" +upslist="`\"$NUT_UPSC\" -l`" echo "$upslist" for u in $upslist; do echo "Disabling poweroff for UPS outlet-groups on '$u' ..." diff --git a/scripts/installer/common/ipp-event.sh b/scripts/installer/common/ipp-event.sh index 3a04844616..e1dd73f95e 100644 --- a/scripts/installer/common/ipp-event.sh +++ b/scripts/installer/common/ipp-event.sh @@ -40,7 +40,7 @@ fi #call notifier script $CMD_NOTIFIER "$*" & -PROC="`ps -ef | grep "$DAEMON" | awk -F" " '{print $2}'`" +PROC="`ps -ef | grep \"$DAEMON\" | awk -F\" \" '{print $2}'`" case "$1" in ONBATT) if [ $PROC = "" ];then diff --git a/scripts/installer/common/ipp-host-shutdown.sample b/scripts/installer/common/ipp-host-shutdown.sample index c56ec7da56..0bbe060176 100644 --- a/scripts/installer/common/ipp-host-shutdown.sample +++ b/scripts/installer/common/ipp-host-shutdown.sample @@ -50,7 +50,7 @@ logmsg() { # The custom shutdown routine if clusterware is present if [ -x /etc/init.d/NONEXISTENT/clusterware ]; then get_ldate - logmsg "`printf "$MessageCustomShutdownStarting_s" "clusterware"`" + logmsg "`printf \"$MessageCustomShutdownStarting_s\" \"clusterware\"`" trap 'echo "$MessageIrreversibleTrap">&2' 1 2 3 15 @@ -72,7 +72,7 @@ if [ -x /etc/init.d/NONEXISTENT/clusterware ]; then echo 'SDFLAG_COMMONOPTIONS="$SDFLAG_UNGRACEFUL"' >&3 get_ldate - logmsg "`printf "$MessageCustomShutdownCompleted_s" "clusterware"`" + logmsg "`printf \"$MessageCustomShutdownCompleted_s\" \"clusterware\"`" trap '-' 1 2 3 15 fi diff --git a/scripts/installer/common/ipp-os-shutdown b/scripts/installer/common/ipp-os-shutdown index 944ef21cdf..570659e334 100755 --- a/scripts/installer/common/ipp-os-shutdown +++ b/scripts/installer/common/ipp-os-shutdown @@ -186,7 +186,7 @@ check_pid() { # Returns: PID in $1 is running = 0; not running = 1; syntax errors = 2 [ -n "$1" ] && [ "$1" -gt 0 ] || return 2 [ -d "/proc/$1" ] && return 0 - ( (ps -ef || ps -xawwu ) | grep -v grep | egrep "`basename $0`|shutdown" | \ + ( (ps -ef || ps -xawwu ) | grep -v grep | egrep "`basename \"$0\"`|shutdown" | \ awk '{print $2}' | grep -w "$1" ) 2>/dev/null && return 0 return 1 } @@ -205,7 +205,7 @@ check_pidfile() { # No PID is running - return 1 # No file / bad filename / other errors - then return 2 if [ -n "$1" ] && [ -s "$1" ] && [ -r "$1" ]; then - PIDS="`head -1 "$1"`" && [ -n "$PIDS" ] || return 2 + PIDS="`head -1 \"$1\"`" && [ -n "$PIDS" ] || return 2 check_pids_atleastone $PIDS || return 1 return 0 fi @@ -234,9 +234,9 @@ cancel_shutdown() { case "$?" in 0) echo "$MessageCannotCancelNone"; return 0 ;; 1) - PIDS="`head -1 "$SHUTDOWN_PIDFILE"`" && [ -n "$PIDS" ] || return 1 + PIDS="`head -1 \"$SHUTDOWN_PIDFILE\"`" && [ -n "$PIDS" ] || return 1 get_ldate - logmsg "`printf "${MessageCancelingPIDS_s}\n" "$PIDS"`" + logmsg "`printf \"${MessageCancelingPIDS_s}\n\" \"$PIDS\"`" kill -9 $PIDS rm -f "$SHUTDOWN_PIDFILE" "$SHUTDOWN_PIDFILE_IRREVERSIBLE" return 0 ;; @@ -257,7 +257,7 @@ while [ "$#" -gt 0 ]; do esac shift ;; +0) SHUTDOWN_TIMER="0" ;; - +[1-9]*) N="`echo "$1" | sed 's,^\+,,'`" && N="`expr 0 + "$N"`" && \ + +[1-9]*) N="`echo \"$1\" | sed 's,^\+,,'`" && N="`expr 0 + \"$N\"`" && \ [ "$N" -gt -1 ] && SHUTDOWN_TIMER="$N" || \ echo "Bad time parameter '$1', ignoring" >&2 ;; --help|help) usage; exit 0 ;; @@ -293,7 +293,7 @@ case "$RES" in esac if [ -f "$CONFIG_UPSMON" ]; then - _VAR="`egrep '^[ \t]*POWERDOWNFLAG ' "$CONFIG_UPSMON" | sed 's,^[ \t]*POWERDOWNFLAG ,,'`" + _VAR="`egrep '^[ \t]*POWERDOWNFLAG ' \"$CONFIG_UPSMON\" | sed 's,^[ \t]*POWERDOWNFLAG ,,'`" _VAR="$(echo "$_VAR" | sed -e 's,^"\(.*\)"$,\1,g' -e "s,^\'\(.*\)\'$,\1,g")" if [ $? = 0 ] && [ -n "$_VAR" ]; then POWERDOWNFLAG="$_VAR" @@ -319,7 +319,7 @@ if [ "$SHUTDOWN_TIMER" -gt -1 ] 2>/dev/null; then else SHUTDOWN_TIMER_SEC="`expr $SHUTDOWN_TIMER \* 60`" \ || SHUTDOWN_TIMER_SEC="120" - logmsg "`printf "${MessageShutdownIsDelayed_s}\n" "${SHUTDOWN_TIMER_SEC}"`" + logmsg "`printf \"${MessageShutdownIsDelayed_s}\n\" \"${SHUTDOWN_TIMER_SEC}\"`" echo "+ ${SHUTDOWN_TIMER_SEC}" >> "$SHUTDOWN_PIDFILE" trap 'get_ldate; logmsg "$MessageTimerAbortedTrap">&2 ; exit 0' 1 2 3 15 /usr/bin/sleep ${SHUTDOWN_TIMER_SEC} @@ -351,13 +351,13 @@ if [ -n "${SHUTDOWNSCRIPT_CUSTOM-}" ] && \ export CONSOLE_NOTIF CMD_WALL SYSLOG_NOTIF CMD_SYSLOG export SDFLAG_COMMONOPTIONS SDFLAG_UNGRACEFUL get_ldate - logmsg "`printf "$MessageCustomShutdownStarting_s" "$SHUTDOWNSCRIPT_CUSTOM"`" + logmsg "`printf \"$MessageCustomShutdownStarting_s\" \"$SHUTDOWNSCRIPT_CUSTOM\"`" rm -f "$SHUTDOWN_PIDFILE.custom" touch "$SHUTDOWN_PIDFILE.custom" chmod 600 "$SHUTDOWN_PIDFILE.custom" "$SHUTDOWNSCRIPT_CUSTOM" 3>"$SHUTDOWN_PIDFILE.custom" get_ldate - logmsg "`printf "$MessageCustomShutdownCompleted_s" "$SHUTDOWNSCRIPT_CUSTOM"`" + logmsg "`printf \"$MessageCustomShutdownCompleted_s\" \"$SHUTDOWNSCRIPT_CUSTOM\"`" # Some variables for this script could be modified in the custom one [ -s "$SHUTDOWN_PIDFILE.custom" ] && . "$SHUTDOWN_PIDFILE.custom" rm -f "$SHUTDOWN_PIDFILE.custom" @@ -374,12 +374,12 @@ if [ -s "$POWERDOWNFLAG" ] || "$NUT_UPSMON" -K ; then fi get_ldate if [ x"$POWERDOWNFLAG_UPSMON" = xyes ] ; then - logmsg "`printf "$MessageKillpowerFileExists_s" "$POWERDOWNFLAG"`" + logmsg "`printf \"$MessageKillpowerFileExists_s\" \"$POWERDOWNFLAG\"`" else - logmsg "`printf "$MessageKillpowerFileAbsent_s" "$POWERDOWNFLAG"`" + logmsg "`printf \"$MessageKillpowerFileAbsent_s\" \"$POWERDOWNFLAG\"`" fi if [ -n "$POWERDOWNFLAG_USER" ] ; then - logmsg "`printf "$MessageKillpowerArgumentExists_s" "$POWERDOWNFLAG_USER"`" + logmsg "`printf \"$MessageKillpowerArgumentExists_s\" \"$POWERDOWNFLAG_USER\"`" else logmsg "$MessageKillpowerArgumentAbsent" fi @@ -389,10 +389,10 @@ if [ x"$POWERDOWNFLAG_UPSMON" = xyes -o "$POWERDOWNFLAG_USER" = "enforce" ] && \ ; then # We will cut our (dev-assumed) power, so should poweroff to be safe... if [ -z "${SDFLAG_POWERSTATE-}" ] ; then - CONSOLE_NOTIF=1 SYSLOG_NOTIF=1 logmsg "`printf "$MessageUPSpowercycleCommandingPoweroff_s" "$DELAY"`" + CONSOLE_NOTIF=1 SYSLOG_NOTIF=1 logmsg "`printf \"$MessageUPSpowercycleCommandingPoweroff_s\" \"$DELAY\"`" SDFLAG_POWERSTATE="$SDFLAG_POWEROFF" else - CONSOLE_NOTIF=1 SYSLOG_NOTIF=1 logmsg "`printf "$MessageUPSpowercycleCommanding_s" "$DELAY"`" + CONSOLE_NOTIF=1 SYSLOG_NOTIF=1 logmsg "`printf \"$MessageUPSpowercycleCommanding_s\" \"$DELAY\"`" fi POWERDOWNFLAG_USER=enforce "$NUT_UPS_SHUTDOWN" else @@ -418,6 +418,6 @@ fi SDFLAG_POWERSTATE="$SDFLAG_POWERSTATE_DEFAULT" get_ldate -CONSOLE_NOTIF=1 SYSLOG_NOTIF=1 logmsg "`printf "$MessageRunningCmd_s" "$CMD_SHUTDOWN $SDFLAG_POWERSTATE $SDFLAG_COMMONOPTIONS"`" +CONSOLE_NOTIF=1 SYSLOG_NOTIF=1 logmsg "`printf \"$MessageRunningCmd_s\" \"$CMD_SHUTDOWN $SDFLAG_POWERSTATE $SDFLAG_COMMONOPTIONS\"`" # Launch the operating system shutdown command $CMD_SHUTDOWN $SDFLAG_POWERSTATE $SDFLAG_COMMONOPTIONS diff --git a/scripts/installer/common/ipp-shutdown-daemon.sh b/scripts/installer/common/ipp-shutdown-daemon.sh index 3f9c027457..ace015da29 100644 --- a/scripts/installer/common/ipp-shutdown-daemon.sh +++ b/scripts/installer/common/ipp-shutdown-daemon.sh @@ -36,6 +36,6 @@ fi # Convert to parsing of "ipp-status -p" which reports all needed details for dev in `$NUT_UPSC -l 2>/dev/null`; do - shutdown="`$NUT_UPSC "$dev"@localhost ups.timer.shutdown 2>/dev/null`" - reboot="`$NUT_UPSC "$dev"@localhost ups.timer.reboot 2>/dev/null`" + shutdown="`\"$NUT_UPSC\" \"$dev\"@localhost ups.timer.shutdown 2>/dev/null`" + reboot="`\"$NUT_UPSC\" \"$dev\"@localhost ups.timer.reboot 2>/dev/null`" done diff --git a/scripts/installer/common/ipp-status b/scripts/installer/common/ipp-status index b7f15a5811..6f6e2b6ca3 100755 --- a/scripts/installer/common/ipp-status +++ b/scripts/installer/common/ipp-status @@ -72,11 +72,11 @@ devices_formatted="yes" # get_devices_info() { for dev in `$awk '/^MONITOR / { print $2 }' "$CONFIG_UPSMON"`; do - status="`$NUT_UPSC "$dev" ups.status 2>/dev/null`" - runtime="`$NUT_UPSC "$dev" battery.runtime 2>/dev/null`" - batterypct="`$NUT_UPSC "$dev" battery.charge 2>/dev/null`" - supplies="`get_pwr_value "$dev" | egrep '^[0-9]*$'`" - upsmon_ms="`get_ms_value "$dev" | egrep 'master|slave'`" + status="`$NUT_UPSC \"$dev\" ups.status 2>/dev/null`" + runtime="`$NUT_UPSC \"$dev\" battery.runtime 2>/dev/null`" + batterypct="`$NUT_UPSC \"$dev\" battery.charge 2>/dev/null`" + supplies="`get_pwr_value \"$dev\" | egrep '^[0-9]*$'`" + upsmon_ms="`get_ms_value \"$dev\" | egrep 'master|slave'`" echo "$dev:$status:$runtime:$batterypct:$supplies:$upsmon_ms" done @@ -178,8 +178,8 @@ overall_status() { # when UPS are on battery # Get non-low battery UPSes (still protecting the system) - protectors="`echo "$devices_info" | parse_protectors_knowngood "${onbattery_sdtimer}"`" - protectors_unknown="`echo "$devices_info" | parse_protectors_unknown`" + protectors="`echo \"$devices_info\" | parse_protectors_knowngood \"${onbattery_sdtimer}\"`" + protectors_unknown="`echo \"$devices_info\" | parse_protectors_unknown`" # Get total powervalue of protecting UPSes protectors_pwr_value=0 @@ -187,7 +187,7 @@ overall_status() { not_protectors=0 for ups in $protectors; do - pwr_value="`get_pwr_value "$ups"`" + pwr_value="`get_pwr_value \"$ups\"`" test -n "$pwr_value" || pwr_value=1 @@ -199,7 +199,7 @@ overall_status() { done for ups in $protectors_unknown; do - pwr_value="`get_pwr_value "$ups"`" + pwr_value="`get_pwr_value \"$ups\"`" test -n "$pwr_value" || pwr_value=1 @@ -398,7 +398,7 @@ HERE # Usage # usage() { - this="`basename $0`" + this="`basename \"$0\"`" cat <&2 diff --git a/scripts/installer/common/shutdown b/scripts/installer/common/shutdown index bbb223d644..9b1d0a906d 100755 --- a/scripts/installer/common/shutdown +++ b/scripts/installer/common/shutdown @@ -80,7 +80,7 @@ DELAYON="`expr $DELAY + 10`" # and/or take into account the killpower flag-file (upsmon master vs. slave # and/or `upsmon -k` status) # Convert to parsing of "ipp-status -p" which reports all needed details -upslist="`"$NUT_UPSC" -l`" +upslist="`\"$NUT_UPSC\" -l`" echo "$upslist" # NOTE: not all UPSes and not all drivers support all possible instcmd's # so we try as many as possible diff --git a/scripts/installer/install.sh b/scripts/installer/install.sh index f1ed69c4e5..ecf6dac76f 100755 --- a/scripts/installer/install.sh +++ b/scripts/installer/install.sh @@ -45,7 +45,7 @@ NUT_PORT="3493" ADMIN_FILE="/tmp/ipp_admin_file" -cd "`dirname $0`" +cd "`dirname \"$0\"`" . "$COMMON_DIR/string.sh" @@ -539,14 +539,14 @@ initial_configure () { chmod 640 "$instpath/etc/upsd.users" >> "$LOG_FILE" 2>&1 # Report the SHUTDOWNSCRIPT_CUSTOM value or that it is missing - _VAR="`egrep '^[ \t]*SHUTDOWNSCRIPT_CUSTOM=' "$instpath/etc/ipp.conf" 2>/dev/null`" || CC_SHUTDOWNSCRIPT_CUSTOM="" + _VAR="`egrep '^[ \t]*SHUTDOWNSCRIPT_CUSTOM=' \"$instpath/etc/ipp.conf\" 2>/dev/null`" || CC_SHUTDOWNSCRIPT_CUSTOM="" if [ -n "${_VAR}" ] ; then - _VAR="`echo "${_VAR}" | sed 's,^[ \t]*SHUTDOWNSCRIPT_CUSTOM=,,'`" - _VAR="`echo "${_VAR}" | sed -e 's,^"\(.*\)"$,\1,g' -e "s,^\'\(.*\)\'$,\1,g"`" + _VAR="`echo \"${_VAR}\" | sed 's,^[ \t]*SHUTDOWNSCRIPT_CUSTOM=,,'`" + _VAR="`echo \"${_VAR}\" | sed -e 's,^\"\(.*\)\"$,\1,g' -e \"s,^\'\(.*\)\'$,\1,g\"`" case "${_VAR}" in - *NUT_DIR*) _VAR1="`egrep '^[^\#]*NUT_DIR=' "$instpath/etc/ipp.conf" 2>/dev/null`" \ - && [ -n "${_VAR1}" ] && _VAR1="`eval $_VAR1 && echo "$NUT_DIR"`" && [ -n "${_VAR1}" ] \ - && _VAR2="`NUT_DIR="${_VAR1}" ; eval echo "${_VAR}"`" \ + *NUT_DIR*) _VAR1="`egrep '^[^\#]*NUT_DIR=' \"$instpath/etc/ipp.conf\" 2>/dev/null`" \ + && [ -n "${_VAR1}" ] && _VAR1="`eval $_VAR1 && echo \"$NUT_DIR\"`" && [ -n "${_VAR1}" ] \ + && _VAR2="`NUT_DIR=\"${_VAR1}\" ; eval echo \"${_VAR}\"`" \ && [ -n "${_VAR2}" ] && _VAR="${_VAR2}" ;; esac if [ -n "${_VAR}" ] && [ -s "${_VAR}" ] && [ -x "${_VAR}" ]; then @@ -585,8 +585,8 @@ display_device () { while [ "$DISP_COUNTER" -le "$C_NUM_DEV" ]; do eval TMP=\$C_DEVICE"$DISP_COUNTER" -# DEV_TYPE="`printf "${DISP_COUNTER}- $TMP" | awk -F' ' '{print \$2}'`" - DEV_CONF="`echo "$TMP" | awk -F' ' '{print \$3}'`" +# DEV_TYPE="`printf \"${DISP_COUNTER}- $TMP\" | awk -F' ' '{print \$2}'`" + DEV_CONF="`echo \"$TMP\" | awk -F' ' '{print \$3}'`" echo " " "$DISP_COUNTER". "$DEV_TYPE" "$DEV_CONF" DISP_COUNTER="`expr $DISP_COUNTER + 1`" done @@ -857,7 +857,7 @@ choose_ask_scan_serial() { } choose_serial() { - serial_list="`$NUTCONF --scan-serial auto 2>> "$LOG_FILE"`" + serial_list="`$NUTCONF --scan-serial auto 2>> \"$LOG_FILE\"`" if [ x"$serial_list" = x"" ]; then echo read_def $CS_ERR_NO_SERIAL "" @@ -876,7 +876,7 @@ choose_serial() { i="1" for s in $serial_list; do - DEV_NAME="`echo "$s" | awk -F' ' '{print \$3}'`" + DEV_NAME="`echo \"$s\" | awk -F' ' '{print \$3}'`" echo " $i. $DEV_NAME" i="`expr $i + 1`" done @@ -919,7 +919,7 @@ choose_manual_serial () { necho $CS_MANUAL_SERIAL_2 read_def $CS_MANUAL_SERIAL_3 "" - DEV="`$NUTCONF --scan-serial $answer 2>> "$LOG_FILE"`" + DEV="`$NUTCONF --scan-serial $answer 2>> \"$LOG_FILE\"`" if [ "$DEV" = "" ]; then read_def $CS_MANUAL_SERIAL_ERR "" @@ -986,14 +986,14 @@ choose_xml() { necho $CS_SNMP_6 echo - LIST_XML="`$NUTCONF --scan-xml-http 2>> "$LOG_FILE"`" + LIST_XML="`$NUTCONF --scan-xml-http 2>> \"$LOG_FILE\"`" if [ "$LIST_XML" = "" ]; then read_def $CS_SNMP_7 "" choose_snmp return $? fi - LIST_XML="`echo "$LIST_XML" | sort`" + LIST_XML="`echo \"$LIST_XML\" | sort`" echo @@ -1005,8 +1005,8 @@ choose_xml() { for s in $LIST_XML; do #FIXME: If there is a comma in the description, the description #will be shown up to this comma only. - IP_ADDR="`echo "$s" | awk -F' ' '{print \$3}' | sed 's/http:\/\///g'`" - #DESC="`echo "$s" | awk -F\" '{print $6}' | sed -e "s/^.*\"\(.*\)\".*$/\1/"`" + IP_ADDR="`echo \"$s\" | awk -F' ' '{print \$3}' | sed 's/http:\/\///g'`" + #DESC="`echo \"$s\" | awk -F\" '{print $6}' | sed -e \"s/^.*\"\(.*\)\".*$/\1/\"`" echo " $i. $IP_ADDR" i="`expr $i + 1`" done @@ -1076,9 +1076,9 @@ choose_snmp() { necho $CS_SNMP_6 echo - list="`$NUTCONF --scan-snmp "$FIRST_IP" "$LAST_IP" community="$C_COMMUNITY" 2>> "$LOG_FILE"`" + list="`$NUTCONF --scan-snmp \"$FIRST_IP\" \"$LAST_IP\" community=\"$C_COMMUNITY\" 2>> \"$LOG_FILE\"`" - list="`echo "$list" | sort`" + list="`echo \"$list\" | sort`" echo filter_snmp_list @@ -1096,8 +1096,8 @@ choose_snmp() { for s in $LIST_SNMP; do #FIXME: If there is a comma in the description, the description #will be shown up to this comma only. - IP_ADDR="`echo "$s" | awk -F' ' '{print \$3}'`" - #DESC="`echo "$s" | awk -F\" '{print $6}' | sed -e "s/^.*\"\(.*\)\".*$/\1/"`" + IP_ADDR="`echo \"$s\" | awk -F' ' '{print \$3}'`" + #DESC="`echo \"$s\" | awk -F\" '{print $6}' | sed -e \"s/^.*\"\(.*\)\".*$/\1/\"`" echo " $i. $IP_ADDR" i="`expr $i + 1`" done @@ -1141,17 +1141,17 @@ filter_snmp_list() { IFS=" " for s in $list; do - IP_SNMP="`echo "$s" | awk -F' ' '{print \$3}'`" + IP_SNMP="`echo \"$s\" | awk -F' ' '{print \$3}'`" TO_ADD="$s" for x in $LIST_XML; do - IP_XML="`echo "$x" | awk -F' ' '{print \$3}' | sed 's/http:\/\///g'`" + IP_XML="`echo \"$x\" | awk -F' ' '{print \$3}' | sed 's/http:\/\///g'`" if [ "$IP_SNMP" = "$IP_XML" ]; then TO_ADD="" break fi done if [ ! "$TO_ADD" = "" ]; then - LIST_SNMP="`echo "$LIST_SNMP";echo "$TO_ADD"`" + LIST_SNMP="`echo \"$LIST_SNMP\";echo \"$TO_ADD\"`" fi done IFS="$OLD1_IFS" @@ -1181,7 +1181,7 @@ choose_server() { necho $CS_SERVER_5 echo - list="`$NUTCONF --scan-nut "$FIRST_IP" "$LAST_IP" "$NUT_PORT" 2>> "$LOG_FILE"`" + list="`$NUTCONF --scan-nut \"$FIRST_IP\" \"$LAST_IP\" \"$NUT_PORT\" 2>> \"$LOG_FILE\"`" #TODO parse scan results if [ "$list" = "" ]; then read_def $CS_SERVER_6 "" @@ -1196,7 +1196,7 @@ choose_server() { i="1" for s in $list; do - UPS="`echo "$s" | awk -F' ' '{print \$3}'`" + UPS="`echo \"$s\" | awk -F' ' '{print \$3}'`" echo " $i. $UPS" i="`expr $i + 1`" done @@ -1261,7 +1261,7 @@ get_networked_device() { while [ "$NDEV" -lt "$C_NUM_DEV" ]; do NDEV="`expr $NDEV + 1`" eval TMP=\$C_DEVICE"$NDEV" - DRIVER="`echo "$TMP" | awk -F' ' '{print \$2}'`" + DRIVER="`echo \"$TMP\" | awk -F' ' '{print \$2}'`" if [ "$DRIVER" = "netxml-ups" ]; then C_NUM_NETWORK_DEVICE="`expr $C_NUM_NETWORK_DEVICE + 1`" fi @@ -1514,9 +1514,9 @@ apply_conf_client() { $NUTCONF --set-user upsmon=slave password=upsmon 2>> "$LOG_FILE" eval TMP=\$C_DEVICE$NDEV - DEV="`echo "$TMP" | awk -F' ' '{print \$3}'`" - UPS="`echo "$DEV" | awk -F'@' '{print \$1}'`" - HOST="`echo "$DEV"| awk -F'@' '{print \$2}'`" + DEV="`echo \"$TMP\" | awk -F' ' '{print \$3}'`" + UPS="`echo \"$DEV\" | awk -F'@' '{print \$1}'`" + HOST="`echo \"$DEV\"| awk -F'@' '{print \$2}'`" # TODO: Here we assume that one UPS powers one input of the server # Logically this can mismatch our setting of MINSUPPLIES if the user # (later) specifies real powersource counts, and topology is not 1:1 @@ -1525,18 +1525,18 @@ apply_conf_client() { while [ "$NDEV" -lt "$C_NUM_DEV" ]; do NDEV="`expr $NDEV + 1`" eval TMP=\$C_DEVICE$NDEV - DEV="`echo "$TMP" | awk -F' ' '{print \$3}'`" - UPS="`echo "$DEV" | awk -F'@' '{print \$1}'`" - HOST="`echo "$DEV"| awk -F'@' '{print \$2}'`" + DEV="`echo \"$TMP\" | awk -F' ' '{print \$3}'`" + UPS="`echo \"$DEV\" | awk -F'@' '{print \$1}'`" + HOST="`echo \"$DEV\"| awk -F'@' '{print \$2}'`" $NUTCONF --add-monitor "${UPS}" "$HOST" 1 upsmon upsmon slave 2>> "$LOG_FILE" done } split_device () { eval TMP=\$C_DEVICE$NDEV - ID="`echo "$TMP" | awk -F' ' '{print \$1}'`" - DRIVER="`echo "$TMP" | awk -F' ' '{print \$2}'`" - PORT="`echo "$TMP" | awk -F' ' '{print \$3}'`" + ID="`echo \"$TMP\" | awk -F' ' '{print \$1}'`" + DRIVER="`echo \"$TMP\" | awk -F' ' '{print \$2}'`" + PORT="`echo \"$TMP\" | awk -F' ' '{print \$3}'`" } setup_tty () { @@ -1788,7 +1788,7 @@ ret=TRUE necho $WELCOME_STR1 # echo " `pwd`/$0 Version 5.0.0" - lineStr="`head "-$STR_VERSION" $installres |tail -1`" + lineStr="`head \"-$STR_VERSION\" $installres |tail -1`" #echo " `pwd`/$0 $lineStr $lineStr1" echo " $lineStr $IPP_VERSION" diff --git a/scripts/installer/uninstall-ipp b/scripts/installer/uninstall-ipp index 3e6f1d4fc9..8a652f6746 100755 --- a/scripts/installer/uninstall-ipp +++ b/scripts/installer/uninstall-ipp @@ -11,7 +11,7 @@ export PATH NUT_PACKAGE_SOLARI="NUT_solaris_sparc_package2.6.5.local" NUT_PACKAGE_SOLINT="NUT_solaris_i386_package2.6.5.local" -cd "`dirname "$0"`" +cd "`dirname \"$0\"`" #configuration data C_MODE="standalone" From 4dfe0cbd737d78838e94a5d5863b168352587407 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Mon, 24 Nov 2025 15:00:17 +0000 Subject: [PATCH 775/805] scripts/obs/nut.spec: revise packaging and init shell script syntax with backticks and double-quotes [#3196] Signed-off-by: Jim Klimov --- scripts/obs/nut.spec | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/obs/nut.spec b/scripts/obs/nut.spec index 37f8212b82..a2b98f77d3 100644 --- a/scripts/obs/nut.spec +++ b/scripts/obs/nut.spec @@ -527,13 +527,13 @@ fi find %{buildroot} -type f -name '*.sh' -o -name '*.py' -o -name '*.pl' | \ while read F ; do if head -1 "$F" | grep bin/env >/dev/null ; then - F_SHEBANG="`head -1 "$F"`" + F_SHEBANG="`head -1 \"$F\"`" - F_SHELL_SHORT="`echo "$F_SHEBANG" | sed -e 's,^.*bin/env *,,' -e 's, .*$,,'`" \ + F_SHELL_SHORT="`echo \"$F_SHEBANG\" | sed -e 's,^.*bin/env *,,' -e 's, .*$,,'`" \ && [ -n "$F_SHELL_SHORT" ] \ || { echo "WARNING: Failed to extract an interpreter from shebang '${F_SHEBANG}'" >&2 ; continue ; } - F_SHELL_PATH="`command -v "$F_SHELL_SHORT"`" \ + F_SHELL_PATH="`command -v \"$F_SHELL_SHORT\"`" \ && [ -n "$F_SHELL_PATH" ] && [ -x "$F_SHELL_PATH" ] \ || { echo "WARNING: Failed to find executable path to interpreter '${F_SHELL_SHORT}' from shebang '${F_SHEBANG}'" >&2 ; continue; } From 4898f0432ce2aa02d1dc01fa6df2ed2711509e1f Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Mon, 24 Nov 2025 15:03:31 +0000 Subject: [PATCH 776/805] scripts/python/app/NUT-Monitor: revise shell script syntax with backticks and double-quotes [#3196] Signed-off-by: Jim Klimov --- scripts/python/app/NUT-Monitor | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/scripts/python/app/NUT-Monitor b/scripts/python/app/NUT-Monitor index c977fc2c48..380f9694cf 100755 --- a/scripts/python/app/NUT-Monitor +++ b/scripts/python/app/NUT-Monitor @@ -20,10 +20,10 @@ case "${PREFER_PY2-}" in esac # Detect which variant of NUT-Monitor we can run on the local system: -[ -s "$0"-py2gtk2 -a -x "$0"-py2gtk2 ] && PYTHON_PY2GTK2_SHEBANG="`head -1 "$0"-py2gtk2 | sed 's,^#!,,'`" || PYTHON_PY2GTK2_SHEBANG="" -[ -s "$0"-py3qt5 -a -x "$0"-py3qt5 ] && PYTHON_PY3QT5_SHEBANG="`head -1 "$0"-py3qt5 | sed 's,^#!,,'`" || PYTHON_PY3QT5_SHEBANG="" -[ -s "$0"-py3qt6 -a -x "$0"-py3qt6 ] && PYTHON_PY3QT6_SHEBANG="`head -1 "$0"-py3qt6 | sed 's,^#!,,'`" || PYTHON_PY3QT6_SHEBANG="" -SCRIPTDIR="`dirname "$0"`" && SCRIPTDIR="`cd "$SCRIPTDIR" && pwd`" || SCRIPTDIR="./" +[ -s "$0"-py2gtk2 -a -x "$0"-py2gtk2 ] && PYTHON_PY2GTK2_SHEBANG="`head -1 \"$0\"-py2gtk2 | sed 's,^#!,,'`" || PYTHON_PY2GTK2_SHEBANG="" +[ -s "$0"-py3qt5 -a -x "$0"-py3qt5 ] && PYTHON_PY3QT5_SHEBANG="`head -1 \"$0\"-py3qt5 | sed 's,^#!,,'`" || PYTHON_PY3QT5_SHEBANG="" +[ -s "$0"-py3qt6 -a -x "$0"-py3qt6 ] && PYTHON_PY3QT6_SHEBANG="`head -1 \"$0\"-py3qt6 | sed 's,^#!,,'`" || PYTHON_PY3QT6_SHEBANG="" +SCRIPTDIR="`dirname \"$0\"`" && SCRIPTDIR="`cd \"$SCRIPTDIR\" && pwd`" || SCRIPTDIR="./" PYTHON_PY2GTK2="" for P in "$PYTHON2" "$PYTHON_PY2GTK2_SHEBANG" "python2" "python" ; do From f43615469b3cb23f6528de4b767f759069367fa3 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Mon, 24 Nov 2025 15:04:44 +0000 Subject: [PATCH 777/805] scripts/subdriver/gen-snmp-subdriver.sh: revise shell script syntax with backticks and double-quotes [#3196] Signed-off-by: Jim Klimov --- scripts/subdriver/gen-snmp-subdriver.sh | 34 ++++++++++++------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/scripts/subdriver/gen-snmp-subdriver.sh b/scripts/subdriver/gen-snmp-subdriver.sh index e07c8301c1..17e3e3474e 100755 --- a/scripts/subdriver/gen-snmp-subdriver.sh +++ b/scripts/subdriver/gen-snmp-subdriver.sh @@ -3,7 +3,7 @@ # an auxiliary script to produce a "stub" snmp-ups subdriver from # SNMP data from a real agent or from dump files # -# Version: 0.17 +# Version: 0.18 # # See also: docs/snmp-subdrivers.txt # @@ -107,11 +107,11 @@ fi NAME=gen-snmp-subdriver TMPDIR="${TEMPDIR:-/tmp}" SYSOID_NUMBER=".1.3.6.1.2.1.1.2.0" -DEBUG="`mktemp "$TMPDIR/$NAME-DEBUG.XXXXXX"`" -DFL_NUMWALKFILE="`mktemp "$TMPDIR/$NAME-NUMWALK.XXXXXX"`" -DFL_STRWALKFILE="`mktemp "$TMPDIR/$NAME-STRWALK.XXXXXX"`" -TMP_NUMWALKFILE="`mktemp "$TMPDIR/$NAME-TMP-NUMWALK.XXXXXX"`" -TMP_STRWALKFILE="`mktemp "$TMPDIR/$NAME-TMP-STRWALK.XXXXXX"`" +DEBUG="`mktemp \"$TMPDIR/$NAME-DEBUG.XXXXXX\"`" +DFL_NUMWALKFILE="`mktemp \"$TMPDIR/$NAME-NUMWALK.XXXXXX\"`" +DFL_STRWALKFILE="`mktemp \"$TMPDIR/$NAME-STRWALK.XXXXXX\"`" +TMP_NUMWALKFILE="`mktemp \"$TMPDIR/$NAME-TMP-NUMWALK.XXXXXX\"`" +TMP_STRWALKFILE="`mktemp \"$TMPDIR/$NAME-TMP-STRWALK.XXXXXX\"`" # Platforms vary with tooling abilitites... TOLOWER="cat" @@ -134,7 +134,7 @@ get_snmp_data() { # 1) get the sysOID (points the mfr specif MIB), apart if there's an override if [ -z "$SYSOID" ] then - SYSOID="`snmpget -On -v1 -c "$COMMUNITY" -Ov "$HOSTNAME" "$SYSOID_NUMBER" | cut -d' ' -f2`" + SYSOID="`snmpget -On -v1 -c \"$COMMUNITY\" -Ov \"$HOSTNAME\" \"$SYSOID_NUMBER\" | cut -d' ' -f2`" echo "sysOID retrieved: ${SYSOID}" else echo "Using the provided sysOID override ($SYSOID)" @@ -166,14 +166,14 @@ get_snmp_data() { generate_C() { # create file names, lowercase - LDRIVER="`echo "$DRIVER" | $TOLOWER`" - UDRIVER="`echo "$DRIVER" | $TOUPPER`" + LDRIVER="`echo \"$DRIVER\" | $TOLOWER`" + UDRIVER="`echo \"$DRIVER\" | $TOUPPER`" # keep dashes in name for files CFILE="$LDRIVER-mib.c" HFILE="$LDRIVER-mib.h" # but replace with underscores for the structures and defines - LDRIVER="`echo "$LDRIVER" | tr - _`" - UDRIVER="`echo "$UDRIVER" | tr - _`" + LDRIVER="`echo \"$LDRIVER\" | tr - _`" + UDRIVER="`echo \"$UDRIVER\" | tr - _`" # generate header file # NOTE: with <<-EOF leading TABs are all stripped @@ -302,7 +302,7 @@ EOF while IFS= read -r line; do LINENB="`expr $LINENB + 1`" FULL_STR_OID="$line" - STR_OID="`echo "$line" | cut -d'.' -f1`" + STR_OID="`echo \"$line\" | cut -d'.' -f1`" echo "$line" | ${GREP} STRING > /dev/null if [ $? -eq 0 ]; then ST_FLAG_TYPE="ST_FLAG_STRING" @@ -312,7 +312,7 @@ EOF SU_INFOSIZE="1" fi # get the matching numeric OID - NUM_OID="`sed -n "${LINENB}p" "${NUMWALKFILE}" | cut -d' ' -f1`" + NUM_OID="`sed -n \"${LINENB}p\" \"${NUMWALKFILE}\" | cut -d' ' -f1`" printf "\t/* ${FULL_STR_OID} */\n\tsnmp_info_default(\"unmapped.${STR_OID}\", ${ST_FLAG_TYPE}, ${SU_INFOSIZE}, \"${NUM_OID}\", NULL, SU_FLAG_OK, NULL),\n" done < "${STRWALKFILE}" >> "${CFILE}" @@ -416,7 +416,7 @@ else fi # Extract the sysOID # Format is "1.3.6.1.2.1.1.2.0 = OID: 1.3.6.1.4.1.4555.1.1.1" - DEVICE_SYSOID="`${GREP} 1.3.6.1.2.1.1.2.0 "$RAWWALKFILE" | cut -d' ' -f4`" + DEVICE_SYSOID="`${GREP} 1.3.6.1.2.1.1.2.0 \"$RAWWALKFILE\" | cut -d' ' -f4`" if [ -n "$DEVICE_SYSOID" ]; then echo "Found sysOID $DEVICE_SYSOID" else @@ -434,7 +434,7 @@ else echo -n "Converting string SNMP walk..." while IFS=' = ' read NUM_OID OID_VALUE do - STR_OID="`snmptranslate -Os -m ALL -M+. "$NUM_OID" 2>/dev/null`" + STR_OID="`snmptranslate -Os -m ALL -M+. \"$NUM_OID\" 2>/dev/null`" # Uncomment the below line to get debug logs #echo "Got: $STR_OID = $OID_VALUE" printf "." @@ -493,8 +493,8 @@ NUMWALKFILE="${TMP_NUMWALKFILE}" STRWALKFILE="${TMP_STRWALKFILE}" # FIXME: sanity checks (! -z contents -a same `wc -l`) -NUM_OID_COUNT="`cat "$NUMWALKFILE" | wc -l`" -STR_OID_COUNT="`cat "$STRWALKFILE" | wc -l`" +NUM_OID_COUNT="`cat \"$NUMWALKFILE\" | wc -l`" +STR_OID_COUNT="`cat \"$STRWALKFILE\" | wc -l`" echo "SNMP OIDs extracted = $NUM_OID_COUNT / $NUM_OID_COUNT" From 2d87962740f65d3320fe455ea209ad13c4afdfb1 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Mon, 24 Nov 2025 15:05:10 +0000 Subject: [PATCH 778/805] scripts/subdriver/gen-usbhid-subdriver.sh: revise shell script syntax with backticks and double-quotes [#3196] Signed-off-by: Jim Klimov --- scripts/subdriver/gen-usbhid-subdriver.sh | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/scripts/subdriver/gen-usbhid-subdriver.sh b/scripts/subdriver/gen-usbhid-subdriver.sh index 0e4bd0ec01..e6b90b5bdf 100755 --- a/scripts/subdriver/gen-usbhid-subdriver.sh +++ b/scripts/subdriver/gen-usbhid-subdriver.sh @@ -80,12 +80,12 @@ fi NAME=gen-usbhid-subdriver TMPDIR="${TEMPDIR:-/tmp}" -DEBUG="`mktemp "$TMPDIR/$NAME-DEBUG.XXXXXX"`" -UTABLE="`mktemp "$TMPDIR/$NAME-UTABLE.XXXXXX"`" -USAGES="`mktemp "$TMPDIR/$NAME-USAGES.XXXXXX"`" -SUBST="`mktemp "$TMPDIR/$NAME-SUBST.XXXXXX"`" -SEDFILE="`mktemp "$TMPDIR/$NAME-SEDFILE.XXXXXX"`" -NEWUTABLE="`mktemp "$TMPDIR/$NAME-NEWUTABLE.XXXXXX"`" +DEBUG="`mktemp \"$TMPDIR/$NAME-DEBUG.XXXXXX\"`" +UTABLE="`mktemp \"$TMPDIR/$NAME-UTABLE.XXXXXX\"`" +USAGES="`mktemp \"$TMPDIR/$NAME-USAGES.XXXXXX\"`" +SUBST="`mktemp \"$TMPDIR/$NAME-SUBST.XXXXXX\"`" +SEDFILE="`mktemp \"$TMPDIR/$NAME-SEDFILE.XXXXXX\"`" +NEWUTABLE="`mktemp \"$TMPDIR/$NAME-NEWUTABLE.XXXXXX\"`" # save standard input to a file if [ -z "$FILE" ]; then From 74bebca2ef0208e48ebb569e09d58c15a5e01798 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Mon, 24 Nov 2025 15:05:46 +0000 Subject: [PATCH 779/805] scripts/upsdrvsvcctl/nut-driver-enumerator.sh.in: revise shell script syntax with backticks and double-quotes [#3196] Signed-off-by: Jim Klimov --- .../upsdrvsvcctl/nut-driver-enumerator.sh.in | 136 +++++++++--------- 1 file changed, 68 insertions(+), 68 deletions(-) diff --git a/scripts/upsdrvsvcctl/nut-driver-enumerator.sh.in b/scripts/upsdrvsvcctl/nut-driver-enumerator.sh.in index 82e24cc21b..b7516d1dbc 100644 --- a/scripts/upsdrvsvcctl/nut-driver-enumerator.sh.in +++ b/scripts/upsdrvsvcctl/nut-driver-enumerator.sh.in @@ -327,7 +327,7 @@ common_isFiled() { [ "${#UPSLIST_FILE}" != 0 ] && \ for UPSF in $UPSLIST_FILE ; do [ "$1" = "$UPSF" ] && return 0 - [ "`$hook_validInstanceName "$UPSF"`" = "$1" ] && return 0 + [ "`$hook_validInstanceName \"$UPSF\"`" = "$1" ] && return 0 done return 1 } @@ -336,7 +336,7 @@ common_isRegistered() { [ "${#UPSLIST_SVCS}" != 0 ] && \ for UPSS in $UPSLIST_SVCS ; do [ "$1" = "$UPSS" ] && return 0 - [ "`$hook_validInstanceName "$1"`" = "$UPSS" ] && return 0 + [ "`$hook_validInstanceName \"$1\"`" = "$UPSS" ] && return 0 done return 1 } @@ -358,11 +358,11 @@ upslist_equals() { # Trivial case 1: equal strings [ "$1" = "$2" ] && return 0 # Trivial case 2: different amount of entries - [ "`echo "$1" | wc -l`" = "`echo "$2" | wc -l`" ] || return $? + [ "`echo \"$1\" | wc -l`" = "`echo \"$2\" | wc -l`" ] || return $? _TMP_DEV_SVC="" for _DEV in $1 ; do - DEVINST="`$hook_validInstanceName "${_DEV}"`" + DEVINST="`$hook_validInstanceName \"${_DEV}\"`" for _SVC in $2 ; do [ "${_DEV}" = "${_SVC}" ] \ || [ "$DEVINST" = "${_SVC}" ] \ @@ -377,7 +377,7 @@ ${_DEV} = ${_SVC}" ; } [ "${#_TMP_DEV_SVC}" = 0 ] && return 1 # Exit code : is the built mapping as long as the source list(s)? - [ "`echo "$1" | wc -l`" = "`echo "${_TMP_DEV_SVC}" | wc -l`" ] + [ "`echo \"$1\" | wc -l`" = "`echo \"${_TMP_DEV_SVC}\" | wc -l`" ] } upssvcconf_checksum_unchanged() { @@ -385,7 +385,7 @@ upssvcconf_checksum_unchanged() { # compare checksums of the configuration section from the file and the # stashed configuration in a service instance (if any). # FIXME : optimize by caching, we likely have quite a few requests - [ "`upsconf_getSection_MD5 "$1"`" = "`$hook_getSavedMD5 "$2"`" ] + [ "`upsconf_getSection_MD5 \"$1\"`" = "`$hook_getSavedMD5 \"$2\"`" ] } upslist_checksums_unchanged() { @@ -397,7 +397,7 @@ upslist_checksums_unchanged() { _TMP_SVC="" for _DEV in $1 ; do - DEVINST="`$hook_validInstanceName "${_DEV}"`" + DEVINST="`$hook_validInstanceName \"${_DEV}\"`" for _SVC in $2 ; do if [ "${_DEV}" = "${_SVC}" ] \ || [ "$DEVINST" = "${_SVC}" ] \ @@ -553,7 +553,7 @@ EOF } upsconf_getSection_MD5() { - calc_md5 "`upsconf_getSection "$@"`" + calc_md5 "`upsconf_getSection \"$@\"`" } upsconf_getSection_SDP() { @@ -577,7 +577,7 @@ upsconf_getValue() { # Note: Primary aim of this egrep is to pick either assignments or flags # As a by-product it can be used to test if a particular value is set ;) - SECTION_CONTENT="`$GETSECTION "$1"`" || return + SECTION_CONTENT="`$GETSECTION \"$1\"`" || return shift KEYS="$*" @@ -585,7 +585,7 @@ upsconf_getValue() { RES_L=0 VALUE="" - LINE="`echo "$SECTION_CONTENT" | $EGREP '(^'"$1"'=|^'"$1"'$)'`" \ + LINE="`echo \"$SECTION_CONTENT\" | $EGREP '(^'\"$1\"'=|^'\"$1\"'$)'`" \ && VALUE="$(echo "$LINE" | sed -e "s,^$1=,," -e 's,^\"\(.*\)\"$,\1,' -e "s,^'\(.*\)'\$,\1,")" \ || RES_L=$? @@ -619,13 +619,13 @@ upsconf_getDriverMedia() { # unit), newline-separated (drvnametype). Empty type for unclassified # results, assuming no known special dependencies (note that depending on # particular system's physics, both serial and network media may need USB). - CURR_DRV="`upsconf_getDriver "$1"`" || return $? + CURR_DRV="`upsconf_getDriver \"$1\"`" || return $? case "$CURR_DRV" in *netxml*|*snmp*|*ipmi*|*powerman*|*-mib*|*avahi*) printf '%s\n%s\n' "$CURR_DRV" "network" ; return ;; *apcupsd-ups*) # Relay from a nearby apcupsd network server into NUT ecosystem: - CURR_PORT="`upsconf_getPort "$1"`" || CURR_PORT="" + CURR_PORT="`upsconf_getPort \"$1\"`" || CURR_PORT="" case "$CURR_PORT" in *localhost*|*127.0.0.1*|*::1*) printf '%s\n%s\n' "$CURR_DRV" "network-localhost" ; return ;; @@ -634,8 +634,8 @@ upsconf_getDriverMedia() { esac ;; *apc_modbus*) - CURR_PORT="`upsconf_getPort "$1"`" || CURR_PORT="" - CURR_PORTTYPE="`upsconf_getValue "$1" 'porttype'`" || CURR_PORTTYPE="" + CURR_PORT="`upsconf_getPort \"$1\"`" || CURR_PORT="" + CURR_PORTTYPE="`upsconf_getValue \"$1\" 'porttype'`" || CURR_PORTTYPE="" case "$CURR_PORTTYPE" in *usb*) printf '%s\n%s\n' "$CURR_DRV" "usb" ; return ;; @@ -663,13 +663,13 @@ upsconf_getDriverMedia() { *usb*) printf '%s\n%s\n' "$CURR_DRV" "usb" ; return ;; nutdrv_qx) # May be direct serial or USB - CURR_PORT="`upsconf_getPort "$1"`" || CURR_PORT="" + CURR_PORT="`upsconf_getPort \"$1\"`" || CURR_PORT="" case "$CURR_PORT" in auto|/dev/*usb*|/dev/*hid*) printf '%s\n%s\n' "$CURR_DRV" "usb" ; return ;; /dev/*) # See drivers/nutdrv_qx.c :: upsdrv_initups() for a list - if [ -n "`upsconf_getValue "$1" 'subdriver' 'vendorid' 'productid' 'vendor' 'product' 'serial' 'bus' 'busport' 'langid_fix'`" ] \ + if [ -n "`upsconf_getValue \"$1\" 'subdriver' 'vendorid' 'productid' 'vendor' 'product' 'serial' 'bus' 'busport' 'langid_fix'`" ] \ ; then printf '%s\n%s\n' "$CURR_DRV" "usb" ; return else @@ -681,7 +681,7 @@ upsconf_getDriverMedia() { esac ;; *dummy*) # May be networked (proxy to remote NUT) - CURR_PORT="`upsconf_getPort "$1"`" || CURR_PORT="" + CURR_PORT="`upsconf_getPort \"$1\"`" || CURR_PORT="" case "$CURR_PORT" in *@localhost|*@|*@127.0.0.1|*@::1) printf '%s\n%s\n' "$CURR_DRV" "network-localhost,drivers=`echo "${CURR_PORT}" | sed 's,@.*$,,'`" ; return ;; @@ -701,7 +701,7 @@ upsconf_getDriverMedia() { } upsconf_getMedia() { - _DRVMED="`upsconf_getDriverMedia "$1"`" || return + _DRVMED="`upsconf_getDriverMedia \"$1\"`" || return echo "${_DRVMED}" | @TAIL@ @TAIL_ARGS_FROM_NTH_LINE@ +2 return 0 } @@ -716,18 +716,18 @@ upsconf_list_dev_drv_socket_checksum() { upslist_normalizeFile_once || return # Propagate errors upwards fi for _DEV in $UPSLIST_FILE ; do - _DRV="`upsconf_getDriver "${_DEV}"`" - _MD5="`upsconf_getSection_MD5 "${_DEV}"`" + _DRV="`upsconf_getDriver \"${_DEV}\"`" + _MD5="`upsconf_getSection_MD5 \"${_DEV}\"`" printf '%s\t%s\t%s\t%s\n' "${_DEV}" "${_DRV}" "${_DRV}-${_DEV}" "${_MD5}" done } upsconf_debug() { - _DRV="`upsconf_getDriver "$1"`" - _PRT="`upsconf_getPort "$1"`" - _MED="`upsconf_getMedia "$1"`" - _MD5="`upsconf_getSection_MD5 "$1"`" - NAME_MD5="`calc_md5 "$1"`" + _DRV="`upsconf_getDriver \"$1\"`" + _PRT="`upsconf_getPort \"$1\"`" + _MED="`upsconf_getMedia \"$1\"`" + _MD5="`upsconf_getSection_MD5 \"$1\"`" + NAME_MD5="`calc_md5 \"$1\"`" # Not public, not in usage() # Used by tests, echo as formatted here to stdout echo "INST: ${NAME_MD5}~[$1]: DRV='${_DRV}' PORT='${_PRT}' MEDIA='${_MED}' SECTIONMD5='${_MD5}'" @@ -735,8 +735,8 @@ upsconf_debug() { calc_md5() { # Tries several ways to produce an MD5 of the "$1" argument - _MD5="`echo "$1" | md5sum 2>/dev/null | awk '{print $1}'`" && [ -n "${_MD5}" ] || \ - { _MD5="`echo "$1" | openssl dgst -md5 2>/dev/null | awk '{print $NF}'`" && [ -n "${_MD5}" ]; } || \ + _MD5="`echo \"$1\" | md5sum 2>/dev/null | awk '{print $1}'`" && [ -n "${_MD5}" ] || \ + { _MD5="`echo \"$1\" | openssl dgst -md5 2>/dev/null | awk '{print $NF}'`" && [ -n "${_MD5}" ]; } || \ return 1 echo "${_MD5}" @@ -746,8 +746,8 @@ calc_md5_file() { # Tries several ways to produce an MD5 of the file named by "$1" argument [ -s "$1" ] || return 2 - _MD5="`md5sum 2>/dev/null < "$1" | awk '{print $1}'`" && [ -n "${_MD5}" ] || \ - { _MD5="`openssl dgst -md5 2>/dev/null < "$1" | awk '{print $NF}'`" && [ -n "${_MD5}" ]; } || \ + _MD5="`md5sum 2>/dev/null < \"$1\" | awk '{print $1}'`" && [ -n "${_MD5}" ] || \ + { _MD5="`openssl dgst -md5 2>/dev/null < \"$1\" | awk '{print $NF}'`" && [ -n "${_MD5}" ]; } || \ return 1 echo "${_MD5}" @@ -775,7 +775,7 @@ smf_registerInstance() { smf_unregisterInstance "$SVCINST" fi /usr/sbin/svccfg -s nut-driver add "$DEVICE" || \ - { SVCINST="`smf_validInstanceName "$1"`" || return + { SVCINST="`smf_validInstanceName \"$1\"`" || return if /usr/bin/svcs "nut-driver:$SVCINST" >/dev/null 2>&1 ; then smf_unregisterInstance "$SVCINST" fi @@ -784,7 +784,7 @@ smf_registerInstance() { DEPSVC="" DEPREQ="" - _MED="`upsconf_getMedia "$DEVICE"`" + _MED="`upsconf_getMedia \"$DEVICE\"`" case "${_MED}" in usb|usb,*) DEPSVC="$DEPSVC_USB_SMF" @@ -810,8 +810,8 @@ smf_registerInstance() { case "${DEPDRV}" in *-*) # May be "drivername-upsname", where either sub-string # may have dashes inside too; try to find the right one: - OTHERDEV="`echo "${OTHERLIST}" | awk '($3 == "'"${DEPDRV}"'") { print $1 }'`" && \ - OTHERDRV="`echo "${OTHERLIST}" | awk '($3 == "'"${DEPDRV}"'") { print $2 }'`" && \ + OTHERDEV="`echo \"${OTHERLIST}\" | awk '($3 == \"'\"${DEPDRV}\"'\") { print $1 }'`" && \ + OTHERDRV="`echo \"${OTHERLIST}\" | awk '($3 == \"'\"${DEPDRV}\"'\") { print $2 }'`" && \ [ x"${DEPDRV}" = x"${OTHERDRV}-${OTHERDEV}" ] && \ [ x"${OTHERDEV}" != x"${DEVICE}" ] \ || { @@ -835,7 +835,7 @@ smf_registerInstance() { log_warn "Device ${DEVICE} depends on another ${DEPDRV} but we did not find a config section for it" fi done - if [ x"`echo "$DEPSVC" | tr -d ' '`" != x ] ; then DEPREQ="$DEPREQ_DRV_FULL_SMF" ; fi + if [ x"`echo \"$DEPSVC\" | tr -d ' '`" != x ] ; then DEPREQ="$DEPREQ_DRV_FULL_SMF" ; fi ;; esac @@ -857,7 +857,7 @@ smf_registerInstance() { log_info "OK: Defined the '$DEPREQ' dependency for '$SVCINST' on '$DEPSVC'" || log_error "FAILED to define the '$DEPREQ' dependency for '$SVCINST' on '$DEPSVC'" fi - smf_setSavedMD5 "$SVCINST" "`upsconf_getSection_MD5 "$DEVICE"`" + smf_setSavedMD5 "$SVCINST" "`upsconf_getSection_MD5 \"$DEVICE\"`" # Save original device (config section) name to speed up some searches smf_setSavedDeviceName "$SVCINST" "$DEVICE" smf_setDocLink "$SVCINST" "$DEVICE" @@ -981,7 +981,7 @@ smf_setDocLink() { # into service instance $1 [ -n "$1" ] || return # No-op for global section __TARGET_FMRI="nut-driver:$1" - __DRV="`upsconf_getDriver "$2"`" + __DRV="`upsconf_getDriver \"$2\"`" ### Sample: #tm_common_name template @@ -1054,7 +1054,7 @@ systemd_registerInstance() { return 0 fi log_warn "RETRY with validInstanceName of '$1'" - SVCINST="`systemd_validInstanceName "$1"`" && \ + SVCINST="`systemd_validInstanceName \"$1\"`" && \ /bin/systemctl enable 'nut-driver@'"$SVCINST".service || { RES=$? if /bin/systemctl list-unit-files | awk '$2 == "masked" {print $1}' | $EGREP "^nut-driver@${SVCINST}.service$"; then @@ -1068,7 +1068,7 @@ systemd_registerInstance() { DEPSVC="" DEPREQ="" - _MED="`upsconf_getMedia "$DEVICE"`" + _MED="`upsconf_getMedia \"$DEVICE\"`" case "${_MED}" in usb|usb,*) DEPSVC="$DEPSVC_USB_SYSTEMD" @@ -1096,8 +1096,8 @@ systemd_registerInstance() { case "${DEPDRV}" in *-*) # May be "drivername-upsname", where either sub-string # may have dashes inside too; try to find the right one: - OTHERDEV="`echo "${OTHERLIST}" | awk '($3 == "'"${DEPDRV}"'") { print $1 }'`" && \ - OTHERDRV="`echo "${OTHERLIST}" | awk '($3 == "'"${DEPDRV}"'") { print $2 }'`" && \ + OTHERDEV="`echo \"${OTHERLIST}\" | awk '($3 == \"'\"${DEPDRV}\"'\") { print $1 }'`" && \ + OTHERDRV="`echo \"${OTHERLIST}\" | awk '($3 == \"'\"${DEPDRV}\"'\") { print $2 }'`" && \ [ x"${DEPDRV}" = x"${OTHERDRV}-${OTHERDEV}" ] && \ [ x"${OTHERDEV}" != x"${DEVICE}" ] \ || { @@ -1121,7 +1121,7 @@ systemd_registerInstance() { log_warn "Device ${DEVICE} depends on another ${DEPDRV} but we did not find a config section for it" fi done - if [ x"`echo "$DEPSVC" | tr -d ' '`" != x ] ; then DEPREQ="$DEPREQ_DRV_FULL_SYSTEMD" ; fi + if [ x"`echo \"$DEPSVC\" | tr -d ' '`" != x ] ; then DEPREQ="$DEPREQ_DRV_FULL_SYSTEMD" ; fi ;; esac @@ -1140,7 +1140,7 @@ EOF [ $? = 0 ] && log_info "OK: Defined the '$DEPREQ'+After dependency for '$SVCINST' on '$DEPSVC'" || log_error "FAILED to define the '$DEPREQ'+After dependency for '$SVCINST' on '$DEPSVC'" fi - systemd_setSavedMD5 "$SVCINST" "`upsconf_getSection_MD5 "$DEVICE"`" + systemd_setSavedMD5 "$SVCINST" "`upsconf_getSection_MD5 \"$DEVICE\"`" systemd_setSavedDeviceName "$SVCINST" "$DEVICE" systemd_setDocLink "$SVCINST" "$DEVICE" @@ -1222,7 +1222,7 @@ systemd_setDocLink() { log_info "Saving documentation links for driver of device (config section) named $2 into service instance $1..." PROPFILE="${SYSTEMD_CONFPATH}/nut-driver@$1.service.d/nut-driver-enumerator-generated-doclink.conf" mkdir -p "${SYSTEMD_CONFPATH}/nut-driver@$1.service.d" && \ - __DRV="`upsconf_getDriver "$2"`" + __DRV="`upsconf_getDriver \"$2\"`" cat > "${PROPFILE}" << EOF [Unit] Documentation=man:${__DRV}(@MAN_SECTION_CMD_SYS@) @@ -1248,7 +1248,7 @@ EOF } systemd_restart_upsd() { # Do not restart/reload if not already running - case "`/bin/systemctl is-active "nut-server"`" in + case "`/bin/systemctl is-active \"nut-server\"`" in active|unknown) ;; # unknown meant "starting" in our testing... failed) log_warn "Note: nut-server unit was 'failed' - not disabled by user, so (re)starting it (probably had no config initially)" ;; *) return 0 ;; @@ -1265,7 +1265,7 @@ systemd_restart_upsd() { systemd_restart_drv() { # Do not restart/reload if not already running - case "`/bin/systemctl is-active "nut-driver@$1"`" in + case "`/bin/systemctl is-active \"nut-driver@$1\"`" in active|unknown) ;; *) return 0 ;; esac @@ -1478,7 +1478,7 @@ nut_driver_enumerator_main() { # We can only exit quickly if both there are no changed sections and no # new or removed sections since last run. { [ -z "$UPSLIST_FILE" -a -z "$UPSLIST_SVCS" ] || { \ - NEW_CHECKSUM="`upslist_checksums_unchanged "$UPSLIST_FILE" "$UPSLIST_SVCS"`" \ + NEW_CHECKSUM="`upslist_checksums_unchanged \"$UPSLIST_FILE\" \"$UPSLIST_SVCS\"`" \ && [ "${#NEW_CHECKSUM}" = 0 ] \ && upslist_equals "$UPSLIST_FILE" "$UPSLIST_SVCS" ; \ } ; } \ @@ -1502,8 +1502,8 @@ nut_driver_enumerator_main() { # and may be the MD5-normalized version in certain cases. # For some operations below we need the original ups.conf # section name for the device - the CURR_DEV value. - CURR_DEV="`USE_SAVEDINST=true get_device_for_service "${UPSS}"`" && [ "${#CURR_DEV}" -gt 0 ] || CURR_DEV="${UPSS}" - CURR_DRV="`upsconf_getDriver "${CURR_DEV}"`" || CURR_DRV="" + CURR_DEV="`USE_SAVEDINST=true get_device_for_service \"${UPSS}\"`" && [ "${#CURR_DEV}" -gt 0 ] || CURR_DEV="${UPSS}" + CURR_DRV="`upsconf_getDriver \"${CURR_DEV}\"`" || CURR_DRV="" DO_UNREGISTER=yes if [ -n "$CURR_DRV" ] ; then # If reload is handled and does not complain, @@ -1522,7 +1522,7 @@ nut_driver_enumerator_main() { # Re-registration to reconcile below should set the "saved" values else log_info "Keeping ${SERVICE_FRAMEWORK} service instance '${UPSS}' whose section '${CURR_DEV}' in config file has changed: live reload sufficed. Saving updated info into service properties." - $hook_setSavedMD5 "$UPSS" "`upsconf_getSection_MD5 "${CURR_DEV}"`" + $hook_setSavedMD5 "$UPSS" "`upsconf_getSection_MD5 \"${CURR_DEV}\"`" # TOTHINK: This is already there, else we redefine units for bigger discrepancies? # $hook_setSavedDeviceName "$UPSS" "${CURR_DEV}" fi @@ -1579,7 +1579,7 @@ nut_driver_enumerator_main() { # NOTE: Check this at the last moment to minimize # the chance of still not noticing the change made # at just the wrong moment. - UPSCONF_CHECKSUM_END="`calc_md5_file "$UPSCONF"`" || true + UPSCONF_CHECKSUM_END="`calc_md5_file \"$UPSCONF\"`" || true if [ "$UPSCONF_CHECKSUM_END" != "$UPSCONF_CHECKSUM_START" ] ; then # NOTE: even if daemonized, the sleep between iterations # can be configured into an uncomfortably long lag, so @@ -1651,7 +1651,7 @@ nut_driver_enumerator_full_reconfigure() { # NOTE: Check this at the last moment to minimize # the chance of still not noticing the change made # at just the wrong moment. - UPSCONF_CHECKSUM_END="`calc_md5_file "$UPSCONF"`" || true + UPSCONF_CHECKSUM_END="`calc_md5_file \"$UPSCONF\"`" || true if [ "$UPSCONF_CHECKSUM_END" != "$UPSCONF_CHECKSUM_START" ] ; then log_info "'$UPSCONF' changed while $0 $* was processing its older contents; re-running the script to pick up and reconcile the late-coming changes" nut_driver_enumerator_main ; return $? @@ -1675,9 +1675,9 @@ list_services_for_devices() { UPSLIST_SVCS_RAW="`$hook_listInstances_raw`" && [ "${#UPSLIST_SVCS_RAW}" != 0 ] \ || { log_warn "No service units detected" ; return 1; } for DEV in $UPSLIST_FILE ; do - vINST="`$hook_validInstanceName "$DEV"`" - vUNITD="`$hook_validFullUnitName "$DEV"`" - vUNITI="`$hook_validFullUnitName "$vINST"`" + vINST="`$hook_validInstanceName \"$DEV\"`" + vUNITD="`$hook_validFullUnitName \"$DEV\"`" + vUNITI="`$hook_validFullUnitName \"$vINST\"`" # First pass over simple verbatim names for INST in $UPSLIST_SVCS ; do if [ "$INST" = "$DEV" ] ; then @@ -1716,14 +1716,14 @@ list_services_for_devices_once() { # Pre-cache config file data, if nobody read it yet, # and keep in main script context for reuse (no subshell) upslist_readFile_once && \ - SVCS_DEVS_LIST="`list_services_for_devices "$@"`" || return $? + SVCS_DEVS_LIST="`list_services_for_devices \"$@\"`" || return $? } get_device_for_service() { [ -z "$1" ] && { log_error "Service (instance) name argument required"; return 1; } # Instance name can be a hash or "native" NUT section name - SVC="`$hook_validInstanceSuffixName "$1"`" && [ -n "$SVC" ] \ + SVC="`$hook_validInstanceSuffixName \"$1\"`" && [ -n "$SVC" ] \ || { log_error "Error getting SVC name from the inputs"; return 1; } # Reading the config is too expensive to do for every @@ -1731,7 +1731,7 @@ get_device_for_service() { if [ "${USE_SAVEDINST-}" != false ]; then # Try to use last-stashed values from service properties first # (NOTE: saved value is assumed to be valid if present) - SAVEDINST="`$hook_getSavedDeviceName "$SVC"`" || SAVEDINST="" + SAVEDINST="`$hook_getSavedDeviceName \"$SVC\"`" || SAVEDINST="" [ "${#SAVEDINST}" = 0 ] || { echo "$SAVEDINST" ; return 0 ; } fi @@ -1749,7 +1749,7 @@ get_device_for_service() { if [ "$FINAL_RES" = 0 ]; then echo "$SVCS_DEVS_LIST" | $GREP "$SVC" | ( \ while read _SVC _DEV ; do - _SVC="`$hook_validInstanceSuffixName "${_SVC}"`" || exit + _SVC="`$hook_validInstanceSuffixName \"${_SVC}\"`" || exit [ "${_SVC}" = "${SVC}" ] && echo "${_DEV}" && exit 0 done ; exit 1 ) && return 0 fi @@ -1764,7 +1764,7 @@ get_service_for_device() { # Cheap check in service instance metadata, if saved # (NOTE: saved value is assumed to be valid if present) if [ "${USE_SAVEDSVC-}" != false ]; then - SAVEDSVC="`$hook_findSavedDeviceName "$DEV"`" || SAVEDSVC="" + SAVEDSVC="`$hook_findSavedDeviceName \"$DEV\"`" || SAVEDSVC="" [ "${#SAVEDSVC}" = 0 ] || { echo "$SAVEDSVC" ; return 0 ; } fi @@ -1774,9 +1774,9 @@ get_service_for_device() { || { log_warn "No service instances detected" ; return 1; } UPSLIST_SVCS_RAW="`$hook_listInstances_raw`" && [ "${#UPSLIST_SVCS_RAW}" != 0 ] \ || { log_warn "No service units detected" ; return 1; } - vINST="`$hook_validInstanceName "$DEV"`" - vUNITD="`$hook_validFullUnitName "$DEV"`" - vUNITI="`$hook_validFullUnitName "$vINST"`" + vINST="`$hook_validInstanceName \"$DEV\"`" + vUNITD="`$hook_validFullUnitName \"$DEV\"`" + vUNITI="`$hook_validFullUnitName \"$vINST\"`" # First pass over simple verbatim names for INST in $UPSLIST_SVCS ; do @@ -1826,10 +1826,10 @@ update_upslist_savednames_find_missing() { # and write the values learned from mapping above _MISSING_RES=0 for SVCINST in $SVCINSTS_NO_DEVICE ; do - _DEV="`printf '%s\n' "$SVCS_DEVS_LIST" | awk '( \$1 == "'"${SVCINST}"'" ) {print \$NF}'`" + _DEV="`printf '%s\n' \"$SVCS_DEVS_LIST\" | awk '( \$1 == \"'\"${SVCINST}\"'\" ) {print \$NF}'`" log_warn "Service instance '$SVCINST' did not have a device recorded into properties, setting to '${_DEV}'" [ -n "${_DEV}" ] || { log_warn "The device name value for '$SVCINST' is empty, skipping" ; _MISSING_RES=1 ; continue ; } - $hook_setSavedDeviceName "`$hook_validInstanceSuffixName "$SVCINST"`" "${_DEV}" || _MISSING_RES=$? + $hook_setSavedDeviceName "`$hook_validInstanceSuffixName \"$SVCINST\"`" "${_DEV}" || _MISSING_RES=$? done return ${_MISSING_RES} } @@ -1848,7 +1848,7 @@ trap_handle_hup_sleep() { log_info "Received a HUP in my sleep, reprocessing configs right now!" # Avoid re-parsing main twice, though don't recalculate # checksums needlessly on every loop cycle, either... - UPSCONF_CHECKSUM_START="`calc_md5_file "$UPSCONF"`" || true + UPSCONF_CHECKSUM_START="`calc_md5_file \"$UPSCONF\"`" || true RECONFIGURE_ASAP=true if [ -n "$1" ] ; then # Kill the sleeper PID @@ -1901,7 +1901,7 @@ daemonize() { # Save the checksum of ups.conf as early as possible, # to test in the end that it is still the same file. -UPSCONF_CHECKSUM_START="`calc_md5_file "$UPSCONF"`" || true +UPSCONF_CHECKSUM_START="`calc_md5_file \"$UPSCONF\"`" || true # By default, update wrapping of devices into services if [ $# = 0 ]; then @@ -1913,8 +1913,8 @@ if [ $# = 1 ] ; then [ -n "$DAEMON_SLEEP" ] || DAEMON_SLEEP=60 # Note: Not all shells have 'case ... ;&' support case "$1" in - --daemon=*) DAEMON_SLEEP="`echo "$1" | sed 's,^--daemon=,,'`" ;; - --daemon-after=*) DAEMON_SLEEP="`echo "$1" | sed 's,^--daemon-after=,,'`" ;; + --daemon=*) DAEMON_SLEEP="`echo \"$1\" | sed 's,^--daemon=,,'`" ;; + --daemon-after=*) DAEMON_SLEEP="`echo \"$1\" | sed 's,^--daemon-after=,,'`" ;; esac case "$1" in --daemon-after|--daemon-after=*) From f956ab1ae34ae0edb1a60bbbed559668f8f61c3e Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Mon, 24 Nov 2025 15:06:36 +0000 Subject: [PATCH 780/805] scripts/upsdrvsvcctl/upsdrvsvcctl.in: revise shell script syntax with backticks and double-quotes [#3196] Signed-off-by: Jim Klimov --- scripts/upsdrvsvcctl/upsdrvsvcctl.in | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/scripts/upsdrvsvcctl/upsdrvsvcctl.in b/scripts/upsdrvsvcctl/upsdrvsvcctl.in index 6ca0a9bc1a..0eb1eb6a5c 100755 --- a/scripts/upsdrvsvcctl/upsdrvsvcctl.in +++ b/scripts/upsdrvsvcctl/upsdrvsvcctl.in @@ -1,7 +1,7 @@ #!/bin/sh # # Copyright (C) 2016-2018 Eaton -# Copyright (C) 2020-2024 Jim Klimov +# Copyright (C) 2020-2025 Jim Klimov # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -161,7 +161,7 @@ while [ $# -gt 0 ]; do ;; status) RES=0 - STATUSES="`NUT_QUIET_INIT_BANNER=true "${UPSDRVCTL}" status $2`" || RES=$? + STATUSES="`NUT_QUIET_INIT_BANNER=true \"${UPSDRVCTL}\" status $2`" || RES=$? if [ x"${STATUSES}" = x ]; then exit $RES fi @@ -184,8 +184,8 @@ while [ $# -gt 0 ]; do printf '%-'"${SVC_NAME_WIDTH}"'s\t%'"${SVC_STATE_WIDTH}"'s\t%s\n' "SVC_NAME" "SVC_STATE" "$LINE" continue fi - DEV_NAME="`echo "$LINE" | awk '{print $1}'`" - SVC_NAME="`echo "$SVCINSTS" | awk '($NF == "'"${DEV_NAME}"'") {print $1}'`" && [ -n "$SVC_NAME" ] || SVC_NAME="N/A" + DEV_NAME="`echo \"$LINE\" | awk '{print $1}'`" + SVC_NAME="`echo \"$SVCINSTS\" | awk '($NF == \"'\"${DEV_NAME}\"'\") {print $1}'`" && [ -n "$SVC_NAME" ] || SVC_NAME="N/A" if [ x"$SVC_NAME" = "N/A" ]; then SVC_STATE="N/A" else @@ -196,7 +196,7 @@ while [ $# -gt 0 ]; do ;; systemd) SVC_STATE="" CMDRES=0 - OUT="`$CMDREPORT is-enabled "${SVC_NAME}" 2>/dev/null`" || CMDRES=$? + OUT="`$CMDREPORT is-enabled \"${SVC_NAME}\" 2>/dev/null`" || CMDRES=$? if [ x"$OUT" != x ] ; then SVC_STATE="${OUT}" ; else [ 0 = "$CMDRES" ] && SVC_STATE="enabled" || SVC_STATE="disabled" fi @@ -206,7 +206,7 @@ while [ $# -gt 0 ]; do # The masked unit state has no separate query in some (all?) # systemd versions and can be reported as part of the above CMDRES=0 - OUT="`$CMDREPORT is-masked "${SVC_NAME}" 2>/dev/null`" || CMDRES=$? + OUT="`$CMDREPORT is-masked \"${SVC_NAME}\" 2>/dev/null`" || CMDRES=$? if [ x"$OUT" != x ] ; then if [ x"${SVC_STATE}" != xmasked ] && [ x"${SVC_STATE}" != x"${OUT}" ] ; then SVC_STATE="${SVC_STATE},${OUT}" @@ -216,7 +216,7 @@ while [ $# -gt 0 ]; do fi CMDRES=0 - OUT="`$CMDREPORT is-active "${SVC_NAME}" 2>/dev/null`" || CMDRES=$? + OUT="`$CMDREPORT is-active \"${SVC_NAME}\" 2>/dev/null`" || CMDRES=$? if [ x"$OUT" != x ] ; then SVC_STATE="${SVC_STATE},${OUT}" else @@ -224,7 +224,7 @@ while [ $# -gt 0 ]; do fi CMDRES=0 - OUT="`$CMDREPORT is-failed "${SVC_NAME}" 2>/dev/null`" || CMDRES=$? + OUT="`$CMDREPORT is-failed \"${SVC_NAME}\" 2>/dev/null`" || CMDRES=$? if [ x"$OUT" != x ] ; then if [ x"${OUT}" != xactive ] && [ x"${OUT}" != xinactive ] ; then SVC_STATE="${SVC_STATE},${OUT}" @@ -242,7 +242,7 @@ while [ $# -gt 0 ]; do start|stop) ACTION="$1" if [ -n "$2" ] ; then - SVCINST="`$ENUMERATOR --get-service-for-device "$2"`" || exit + SVCINST="`$ENUMERATOR --get-service-for-device \"$2\"`" || exit shift fi ;; From 504ec7343109be7e51ff7eb934818b15a691dcc0 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Mon, 24 Nov 2025 15:07:07 +0000 Subject: [PATCH 781/805] scripts/valgrind/valgrind.sh.in: revise shell script syntax with backticks and double-quotes [#3196] Signed-off-by: Jim Klimov --- scripts/valgrind/valgrind.sh.in | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/valgrind/valgrind.sh.in b/scripts/valgrind/valgrind.sh.in index 966c29f751..7de2662cee 100755 --- a/scripts/valgrind/valgrind.sh.in +++ b/scripts/valgrind/valgrind.sh.in @@ -4,8 +4,8 @@ # NOTE: If there are system problems to suppress, re-run the test with # --gen-suppressions=all option, and update the .valgrind.supp file. -SCRIPTDIR="`dirname "$0"`" -SCRIPTDIR="`cd "$SCRIPTDIR" && pwd`" +SCRIPTDIR="`dirname \"$0\"`" +SCRIPTDIR="`cd \"$SCRIPTDIR\" && pwd`" LTEXEC="" [ -n "${LIBTOOL-}" ] || LIBTOOL="`command -v glibtool`" 2>/dev/null From ea78a36d9e456ffcd73ecf8a120b4cdd5128cb0a Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Mon, 24 Nov 2025 15:01:17 +0000 Subject: [PATCH 782/805] tools/driver-list-format.sh: revise shell script syntax with backticks and double-quotes [#3196] Signed-off-by: Jim Klimov --- tools/driver-list-format.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tools/driver-list-format.sh b/tools/driver-list-format.sh index 9b6f9dc125..4e36f55c36 100755 --- a/tools/driver-list-format.sh +++ b/tools/driver-list-format.sh @@ -12,7 +12,7 @@ ################################################################################ # Adapt path for either dist target or manual call -CURRENT_PATH="`dirname $0`" +CURRENT_PATH="`dirname \"$0\"`" DRVLIST_PATH="" # Integrate with Makefile recipes @@ -84,7 +84,7 @@ do # verify that lines are either empty, all-comments, # or have six quoted fields (and optional comment); # the fields may be empty (just two double-quotes). - BADLINES="`$EGREP -v "${VALID_LINE}" < "${TMPBUILD_PATH}/${drvfile}.tabbed"`" + BADLINES="`$EGREP -v \"${VALID_LINE}\" < \"${TMPBUILD_PATH}/${drvfile}.tabbed\"`" if [ x"${BADLINES}" != x ] ; then echo "$0: ERROR: markup of '${DRVLIST_PATH}/${drvfile}' needs to be fixed: some lines are not exactly 6 fields (and optional comment)" >&2 echo "$BADLINES" | head -5 @@ -101,7 +101,7 @@ do mv -f "${TMPBUILD_PATH}/${drvfile}.tabbed" "${DRVLIST_PATH}/${drvfile}" fi else # Checking; also report the diff markup - if OUTD="`diff -u "${TMPBUILD_PATH}/${drvfile}.tabbed" "${DRVLIST_PATH}/${drvfile}" 2>/dev/null`" ; then + if OUTD="`diff -u \"${TMPBUILD_PATH}/${drvfile}.tabbed\" \"${DRVLIST_PATH}/${drvfile}\" 2>/dev/null`" ; then # Ok, no differences encountered OUTD="" else @@ -109,7 +109,7 @@ do if echo "$OUTD" | head -1 | ${EGREP} '^[-+]' >/dev/null ; then true else - if OUTD="`diff "${TMPBUILD_PATH}/${drvfile}.tabbed" "${DRVLIST_PATH}/${drvfile}"`" ; then + if OUTD="`diff \"${TMPBUILD_PATH}/${drvfile}.tabbed\" \"${DRVLIST_PATH}/${drvfile}\"`" ; then # Ok, no differences encountered OUTD="" fi From 9016bbd2b68cf07eec37c0aa9360c87437d3d618 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Mon, 24 Nov 2025 15:09:53 +0000 Subject: [PATCH 783/805] tools/gitlog2version.sh: revise shell script syntax with backticks and double-quotes [#3196] Signed-off-by: Jim Klimov --- tools/gitlog2version.sh | 42 ++++++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/tools/gitlog2version.sh b/tools/gitlog2version.sh index 5ee50b4986..a33ad54505 100755 --- a/tools/gitlog2version.sh +++ b/tools/gitlog2version.sh @@ -70,8 +70,8 @@ TZ=UTC export LANG LC_ALL TZ if [ x"${abs_top_srcdir}" = x ]; then - SCRIPT_DIR="`dirname "$0"`" - SCRIPT_DIR="`cd "${SCRIPT_DIR}" && pwd`" + SCRIPT_DIR="`dirname \"$0\"`" + SCRIPT_DIR="`cd \"${SCRIPT_DIR}\" && pwd`" abs_top_srcdir="${SCRIPT_DIR}/.." fi if [ x"${abs_top_builddir}" = x ]; then @@ -202,7 +202,7 @@ getver_git() { # echo "${DESC}" | sed -e 's/^v\([0-9]\)/\1/' -e 's,^.*/,,' # Follow https://semver.org/#spec-item-10 about build metadata: # it is (a dot-separated list) separated by a plus sign from preceding - DESC="`echo "${DESC}" | sed 's/\(-[0-9][0-9]*\)-\(g[0-9a-fA-F][0-9a-fA-F]*\)$/\1+\2/'`" + DESC="`echo \"${DESC}\" | sed 's/\(-[0-9][0-9]*\)-\(g[0-9a-fA-F][0-9a-fA-F]*\)$/\1+\2/'`" if [ x"${DESC}" = x ] ; then echo "$0: FAILED to 'git describe' this codebase" >&2 check_shallow_git "NOTE: Current checkout is shallow, may not include enough history to describe it" @@ -224,7 +224,7 @@ getver_git() { # some of it if looking at a historic snapshot, or nothing if looking # at the tagged commit (it is the merge base for itself and any of # its descendants): - BASE="`git merge-base HEAD "${NUT_VERSION_GIT_TRUNK}"`" || BASE="" + BASE="`git merge-base HEAD \"${NUT_VERSION_GIT_TRUNK}\"`" || BASE="" if [ x"${BASE}" = x ] ; then echo "$0: FAILED to get a git merge-base of this codebase vs. '${NUT_VERSION_GIT_TRUNK}'" >&2 check_shallow_git "NOTE: Current checkout is shallow, may not include enough history to describe it or find intersections with other trees" @@ -233,10 +233,10 @@ getver_git() { fi # Nearest (annotated by default) tag preceding the HEAD in history: - TAG="`echo "${DESC}" | sed 's/-[0-9][0-9]*[+-]g[0-9a-fA-F][0-9a-fA-F]*$//'`" + TAG="`echo \"${DESC}\" | sed 's/-[0-9][0-9]*[+-]g[0-9a-fA-F][0-9a-fA-F]*$//'`" TAG_PRERELEASE="" if [ -n "${DESC_PRERELEASE}" ] ; then - TAG_PRERELEASE="`echo "${DESC_PRERELEASE}" | sed 's/-[0-9][0-9]*[+-]g[0-9a-fA-F][0-9a-fA-F]*$//'`" + TAG_PRERELEASE="`echo \"${DESC_PRERELEASE}\" | sed 's/-[0-9][0-9]*[+-]g[0-9a-fA-F][0-9a-fA-F]*$//'`" if [ x"${DESC_PRERELEASE}" != x"${TAG_PRERELEASE}" ] ; then # We did chop off something, so `git describe` above did not hit # exactly the tagged commit, but something later - not interesting @@ -250,13 +250,13 @@ getver_git() { # Commit count since the tag, and hash, of the current HEAD commit; # empty e.g. when HEAD is the release-tagged commit: - SUFFIX="`echo "${DESC}" | sed 's/^.*\(-[0-9][0-9]*[+-]g[0-9a-fA-F][0-9a-fA-F]*\)$/\1/'`" \ + SUFFIX="`echo \"${DESC}\" | sed 's/^.*\(-[0-9][0-9]*[+-]g[0-9a-fA-F][0-9a-fA-F]*\)$/\1/'`" \ && [ x"${SUFFIX}" != x"${TAG}" ] || SUFFIX="" # Tack on "this commit is a pre-release!" info, if known SUFFIX_PRERELEASE="" if [ -n "${TAG_PRERELEASE}" ] ; then - SUFFIX_PRERELEASE="`echo "${TAG_PRERELEASE}" | tr '-' '+'`" + SUFFIX_PRERELEASE="`echo \"${TAG_PRERELEASE}\" | tr '-' '+'`" if [ -n "${SUFFIX}" ] ; then SUFFIX="${SUFFIX}+${SUFFIX_PRERELEASE}" else @@ -271,7 +271,7 @@ getver_git() { DESC5="${VER5}${SUFFIX}" # Strip up to two trailing zeroes for trunk snapshots and releases - VER50="`echo "${VER5}" | sed -e 's/\.0$//' -e 's/\.0$//'`" + VER50="`echo \"${VER5}\" | sed -e 's/\.0$//' -e 's/\.0$//'`" DESC50="${VER50}${SUFFIX}" # Leave exactly 3 components @@ -281,9 +281,9 @@ getver_git() { if [ -n "${TAG_PRERELEASE}" ] ; then # Actually report as SEMVER the version of (next) release # for which this commit is candidate - SEMVER="`echo "${TAG_PRERELEASE}" | sed -e 's/^v*//' -e 's/^\([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\)[^0-9].*$/\1/'`" + SEMVER="`echo \"${TAG_PRERELEASE}\" | sed -e 's/^v*//' -e 's/^\([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\)[^0-9].*$/\1/'`" else - SEMVER="`echo "${VER5}" | sed -e 's/^\([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\)\..*$/\1/'`" + SEMVER="`echo \"${VER5}\" | sed -e 's/^\([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\)\..*$/\1/'`" fi fi # FIXME? Add ".0" up to 3 components? @@ -307,41 +307,41 @@ getver_default() { # Assume triplet (possibly prefixed with `v`) + suffix # like `v2.8.3-rc6` or `2.8.2-beta-1` # FIXME: Check the assumption better! - SUFFIX="`echo "${NUT_VERSION_DEFAULT}" | ${EGREP} '^v*[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*([0-9]*|[-](rc|alpha|beta)[-]*[0-9][0-9]*)$' | sed -e 's/^v*//' -e 's/^\([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\)\([^0-9].*\)$/\2/'`" \ + SUFFIX="`echo \"${NUT_VERSION_DEFAULT}\" | ${EGREP} '^v*[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*([0-9]*|[-](rc|alpha|beta)[-]*[0-9][0-9]*)$' | sed -e 's/^v*//' -e 's/^\([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\)\([^0-9].*\)$/\2/'`" \ && [ -n "${SUFFIX}" ] \ - && SUFFIX_PRERELEASE="`echo "${SUFFIX}" | sed 's/^-*//'`" \ - && NUT_VERSION_DEFAULT="`echo "${NUT_VERSION_DEFAULT}" | sed -e 's/'"${SUFFIX}"'$//'`" + && SUFFIX_PRERELEASE="`echo \"${SUFFIX}\" | sed 's/^-*//'`" \ + && NUT_VERSION_DEFAULT="`echo \"${NUT_VERSION_DEFAULT}\" | sed -e 's/'\"${SUFFIX}\"'$//'`" ;; *+rc*|*+alpha*|*+beta*) # Consider forced `2.8.2.2878.3-2881+g45029249f+v2.8.3+rc6` values # We remove up to 5 dot-separated leading numbers, so # for the example above, `-2881+g45029249f` remains: - tmpSUFFIX="`echo "${NUT_VERSION_DEFAULT}" | ${EGREP} '^v*[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*(.*\+(rc|alpha|beta)[+-]*[0-9][0-9]*)$' | sed -e 's/^v*//' -e 's/^\([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\)\([^0-9].*\)$/\2/' -e 's/^\(\.[0-9][0-9]*\)//' -e 's/^\(\.[0-9][0-9]*\)//'`" \ + tmpSUFFIX="`echo \"${NUT_VERSION_DEFAULT}\" | ${EGREP} '^v*[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*(.*\+(rc|alpha|beta)[+-]*[0-9][0-9]*)$' | sed -e 's/^v*//' -e 's/^\([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\)\([^0-9].*\)$/\2/' -e 's/^\(\.[0-9][0-9]*\)//' -e 's/^\(\.[0-9][0-9]*\)//'`" \ || tmpSUFFIX="" if [ -n "${tmpSUFFIX}" ] && [ x"${tmpSUFFIX}" != "${NUT_VERSION_DEFAULT}" ] ; then # Extract tagged NUT version from that suffix SUFFIX="${tmpSUFFIX}" # for the example above, `v2.8.3+rc6` remains - tmpTAG_PRERELEASE="`echo "${tmpSUFFIX}" | sed 's/^.*[^0-9]\([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*[+]\(rc\|alpha\|beta\)[+-]*[0-9][0-9]*\)$/\1/'`" \ + tmpTAG_PRERELEASE="`echo \"${tmpSUFFIX}\" | sed 's/^.*[^0-9]\([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*[+]\(rc\|alpha\|beta\)[+-]*[0-9][0-9]*\)$/\1/'`" \ || tmpTAG_PRERELEASE="" if [ -n "${tmpTAG_PRERELEASE}" ] && [ x"${tmpSUFFIX}" != "${tmpTAG_PRERELEASE}" ] ; then # Replace back pluses to dashes for the tag TAG_PRERELEASE="v`echo "${tmpTAG_PRERELEASE}" | sed -e 's/[+]\(rc\|alpha\|beta\)/-\1/' -e 's/\(rc\|alpha\|beta\)[+]/\1-/'`" if [ -z "${SEMVER}" ] ; then # for the example above, `2.8.3` remains: - SEMVER="`echo "${tmpTAG_PRERELEASE}" | sed -e 's/[-+].*$//'`" + SEMVER="`echo \"${tmpTAG_PRERELEASE}\" | sed -e 's/[-+].*$//'`" fi # for the example above, `rc6` remains: - SUFFIX_PRERELEASE="`echo "${tmpTAG_PRERELEASE}" | sed 's/^[^+-]*[+-]//'`" + SUFFIX_PRERELEASE="`echo \"${tmpTAG_PRERELEASE}\" | sed 's/^[^+-]*[+-]//'`" # for the example above, `2.8.2.2878.3-2881+g45029249f` remains: - NUT_VERSION_DEFAULT="`echo "${NUT_VERSION_DEFAULT}" | sed -e 's/'"${SUFFIX}"'$//'`" + NUT_VERSION_DEFAULT="`echo \"${NUT_VERSION_DEFAULT}\" | sed -e 's/'\"${SUFFIX}\"'$//'`" fi fi ;; esac - NUT_VERSION_DEFAULT_DOTS="`echo "${NUT_VERSION_DEFAULT}" | sed 's/[^.]*//g' | tr -d '\n' | wc -c`" + NUT_VERSION_DEFAULT_DOTS="`echo \"${NUT_VERSION_DEFAULT}\" | sed 's/[^.]*//g' | tr -d '\n' | wc -c`" # Ensure at least 4 dots (5 presumed-numeric components) NUT_VERSION_DEFAULT5_DOTS="${NUT_VERSION_DEFAULT_DOTS}" @@ -359,7 +359,7 @@ getver_default() { NUT_VERSION_DEFAULT3_DOTS="`expr $NUT_VERSION_DEFAULT3_DOTS + 1`" done while [ "${NUT_VERSION_DEFAULT3_DOTS}" -gt 2 ] ; do - NUT_VERSION_DEFAULT3="`echo "${NUT_VERSION_DEFAULT3}" | sed 's,\.[0-9][0-9]*[^.]*$,,'`" + NUT_VERSION_DEFAULT3="`echo \"${NUT_VERSION_DEFAULT3}\" | sed 's,\.[0-9][0-9]*[^.]*$,,'`" NUT_VERSION_DEFAULT3_DOTS="`expr $NUT_VERSION_DEFAULT3_DOTS - 1`" done From e24693fc668e203ec565649dc39e6e16ea364995 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Mon, 24 Nov 2025 15:10:41 +0000 Subject: [PATCH 784/805] tools/nut-dumpdiff.sh: revise shell script syntax with backticks and double-quotes [#3196] Signed-off-by: Jim Klimov --- tools/nut-dumpdiff.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/nut-dumpdiff.sh b/tools/nut-dumpdiff.sh index aa664ade66..2fa45f4db2 100755 --- a/tools/nut-dumpdiff.sh +++ b/tools/nut-dumpdiff.sh @@ -24,8 +24,8 @@ fi [ -n "${EGREP}" ] || { if ( [ x"`echo a | $GREP -E '(a|b)'`" = xa ] ) 2>/dev/null ; then EGREP="$GREP -E" ; else EGREP="`command -v egrep`" ; fi && [ x"${EGREP}" != x ] || { echo "$0: FAILED to locate EGREP tool" >&2 ; exit 1 ; } ; } # Pre-sort just in case: -DATA1="`sort -n < "$1"`" -DATA2="`sort -n < "$2"`" +DATA1="`sort -n < \"$1\"`" +DATA2="`sort -n < \"$2\"`" # Strip away same-context lines, # and lines with measurements that are either decimal numbers From fc275c76d21a94f96f919f42bf7750bdd004f89a Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Mon, 24 Nov 2025 15:11:11 +0000 Subject: [PATCH 785/805] tools/nut-ddl-dump.sh: revise shell script syntax with backticks and double-quotes [#3196] Signed-off-by: Jim Klimov --- tools/nut-ddl-dump.sh | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/tools/nut-ddl-dump.sh b/tools/nut-ddl-dump.sh index 4a1a9f3958..a651c05dfb 100755 --- a/tools/nut-ddl-dump.sh +++ b/tools/nut-ddl-dump.sh @@ -4,7 +4,7 @@ ################################################################################ # Authors: # Copyright (C) 2015 - 2017 by Arnaud Quette -# Copyright (C) 2020 - 2023 by Jim Klimov +# Copyright (C) 2020 - 2025 by Jim Klimov # License: GPL v2+ ################################################################################ # FIXME: @@ -24,7 +24,7 @@ else fi # Test communication with the device -upscResult="`upsc "${DDL_DEVICE_NAME}" 2> /dev/null`" +upscResult="`upsc \"${DDL_DEVICE_NAME}\" 2> /dev/null`" if [ $? -gt 0 ]; then echo "Can't communicate with ${DDL_DEVICE_NAME}" >&2 exit @@ -32,25 +32,25 @@ fi # Collect more information dumpDate="`date -R`" -upsrwResult="`upsrw "${DDL_DEVICE_NAME}" 2> /dev/null`" -upscmdResult="`upscmd -l "${DDL_DEVICE_NAME}" 2> /dev/null`" +upsrwResult="`upsrw \"${DDL_DEVICE_NAME}\" 2> /dev/null`" +upscmdResult="`upscmd -l \"${DDL_DEVICE_NAME}\" 2> /dev/null`" # Build the filename # ________. # Process the Manufacturer name -RAW_DDL_MFR="`upsc "${DDL_DEVICE_NAME}" device.mfr 2>/dev/null`" +RAW_DDL_MFR="`upsc \"${DDL_DEVICE_NAME}\" device.mfr 2>/dev/null`" if [ "${RAW_DDL_MFR}" = "EATON" ]; then RAW_DDL_MFR="Eaton" fi # Replace spaces with underscores -DDL_MFR="`echo "${RAW_DDL_MFR}" | sed s/\ /_/g`" +DDL_MFR="`echo \"${RAW_DDL_MFR}\" | sed s/\ /_/g`" # Process the Model name # Replace spaces with underscores -RAW_DDL_MODEL="`upsc "${DDL_DEVICE_NAME}" device.model 2>/dev/null`" -DDL_MODEL="`echo "${RAW_DDL_MODEL}" | sed s/\ /_/g`" +RAW_DDL_MODEL="`upsc \"${DDL_DEVICE_NAME}\" device.model 2>/dev/null`" +DDL_MODEL="`echo \"${RAW_DDL_MODEL}\" | sed s/\ /_/g`" # Process the driver name and NUT version -DDL_DRIVER_NAME="`upsc "${DDL_DEVICE_NAME}" driver.name 2>/dev/null`" -DDL_NUT_VERSION="`upsc "${DDL_DEVICE_NAME}" driver.version 2>/dev/null`" +DDL_DRIVER_NAME="`upsc \"${DDL_DEVICE_NAME}\" driver.name 2>/dev/null`" +DDL_NUT_VERSION="`upsc \"${DDL_DEVICE_NAME}\" driver.version 2>/dev/null`" # TODO: check if a similar file exists in nut-ddl repo, to update Report nb DDL_REPORT_NUMBER="01" DDL_FILENAME="${DDL_MFR}__${DDL_MODEL}__${DDL_DRIVER_NAME}__${DDL_NUT_VERSION}__${DDL_REPORT_NUMBER}.dev" From 3fdc49d01a9d7746685f519f6bb5799937162f52 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Mon, 24 Nov 2025 15:14:43 +0000 Subject: [PATCH 786/805] docs/ci-farm-lxc-setup.txt: revise shell script syntax with backticks and double-quotes [#3196] Signed-off-by: Jim Klimov --- docs/ci-farm-lxc-setup.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/ci-farm-lxc-setup.txt b/docs/ci-farm-lxc-setup.txt index d9b882b665..2b4218aae8 100644 --- a/docs/ci-farm-lxc-setup.txt +++ b/docs/ci-farm-lxc-setup.txt @@ -175,7 +175,7 @@ Initial container installation (for various guest OSes) ------ ... # If debian-archive-keyring isn't installed, fetch GPG keys directly - releasekeyring="`grep -E '^keyring ' "/usr/share/debootstrap/scripts/$release" | sed -e 's,^keyring ,,' -e 's,[ #].*$,,'`" 2>/dev/null + releasekeyring="`grep -E '^keyring ' \"/usr/share/debootstrap/scripts/$release\" | sed -e 's,^keyring ,,' -e 's,[ #].*$,,'`" 2>/dev/null if [ -z $releasekeyring ]; then releasekeyring=/usr/share/keyrings/debian-archive-keyring.gpg fi From a4f9eac2386408d973737b6ae40c21555526a344 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Mon, 24 Nov 2025 15:15:54 +0000 Subject: [PATCH 787/805] docs/docinfo.xml.sh.in: revise shell script syntax with backticks and double-quotes [#3196] Signed-off-by: Jim Klimov --- docs/docinfo.xml.sh.in | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/docs/docinfo.xml.sh.in b/docs/docinfo.xml.sh.in index d42a7a746f..6f83364053 100755 --- a/docs/docinfo.xml.sh.in +++ b/docs/docinfo.xml.sh.in @@ -9,8 +9,8 @@ # Copyright (C) 2023-2025 by Jim Klimov # Licensed under GPLv2+ terms -SCRIPTDIR="`dirname "$0"`" \ -&& SCRIPTDIR="`cd "${SCRIPTDIR}" && pwd`" \ +SCRIPTDIR="`dirname \"$0\"`" \ +&& SCRIPTDIR="`cd \"${SCRIPTDIR}\" && pwd`" \ && [ -n "${SCRIPTDIR}" ] && [ -d "${SCRIPTDIR}" ] \ || exit @@ -28,10 +28,10 @@ esac generate_tags() { # Find commits whose history includes DOCINFO_OLDEST_TAG for RELTAG in `git tag -l 'v*' --contains "${DOCINFO_OLDEST_TAG}" | $EGREP '^v[0-9]+\.[0-9]+\.[0-9]+$' | sed -e 's,-.*$,,' | sort -nr | uniq` ; do - NUT_RELEASE="`echo "$RELTAG" | sed -e 's,^v,,'`" + NUT_RELEASE="`echo \"$RELTAG\" | sed -e 's,^v,,'`" grep "${NUT_RELEASE}" "${DOCINFO_XML}" >/dev/null 2>&1 && continue - NUT_RELEASER="`git log -1 --pretty=format:'%cn' "${RELTAG}" | tr -d 'a-z '`" + NUT_RELEASER="`git log -1 --pretty=format:'%cn' \"${RELTAG}\" | tr -d 'a-z '`" # Beware to not use "|" in formatting below! Used for sed magic later. git log -1 --pretty=tformat:' %n @NUT_RELEASE@%n %cs%n @NUT_RELEASER@%n %n %n' \ "${RELTAG}" \ @@ -90,7 +90,7 @@ fi # the leading space to enforce it in "sed a" command # (it eats whitespace otherwise). echo "INJECTING to DOCINFO_XML:" >&2 -NEWTAGS_SED="`echo "$NEWTAGS" | tr '\n' '|' | sed -e 's,\([/<>]\),\\1,g' -e 's,^ ,\\\\ ,'`" || exit +NEWTAGS_SED="`echo \"$NEWTAGS\" | tr '\n' '|' | sed -e 's,\([/<>]\),\\1,g' -e 's,^ ,\\\\ ,'`" || exit echo "NEWTAGS_SED: $NEWTAGS_SED" >&2 sed -e '//a'"$NEWTAGS_SED" \ @@ -98,7 +98,7 @@ sed -e '//a'"$NEWTAGS_SED" \ | tr '|' '\n' \ > "${DOCINFO_XML}.tmp" -OUTD="`diff -bu "${DOCINFO_XML}" "${DOCINFO_XML}.tmp" 2>/dev/null`" +OUTD="`diff -bu \"${DOCINFO_XML}\" \"${DOCINFO_XML}.tmp\" 2>/dev/null`" if echo "$OUTD" | head -1 | ${EGREP} '^[-+]' >/dev/null ; then echo "$OUTD" else From 0032f5237e930c2087e30e6189a088d81f436b16 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Mon, 24 Nov 2025 15:40:28 +0000 Subject: [PATCH 788/805] */Makefile.am: revise shell script syntax with backticks and double-quotes; single-quote Make variable expansions into shell [#3196] Signed-off-by: Jim Klimov --- Makefile.am | 38 +++++----- docs/Makefile.am | 114 +++++++++++++++--------------- docs/man/Makefile.am | 64 ++++++++--------- scripts/python/Makefile.am | 20 +++--- scripts/python/module/Makefile.am | 34 ++++----- tests/Makefile.am | 20 +++--- tools/Makefile.am | 10 +-- 7 files changed, 151 insertions(+), 149 deletions(-) diff --git a/Makefile.am b/Makefile.am index d1c8f7e3e1..c0e1341aed 100644 --- a/Makefile.am +++ b/Makefile.am @@ -686,11 +686,11 @@ spellcheck spellcheck-interactive: (cd $(builddir)/docs && $(MAKE) $(AM_MAKEFLAGS) -k -s $(abs_top_builddir)/docs/.prep-src-docs) || RES=$$? ; \ (cd $(builddir)/docs/man && $(MAKE) $(AM_MAKEFLAGS) -k -s $(abs_top_builddir)/docs/man/.prep-src-docs) || RES=$$? ; \ for D in $(SPELLCHECK_DIRS_MOST) ; do \ - D="`echo "$$D" | sed 's,^spellcheck/,,'`" ; \ + D="`echo \"$$D\" | sed 's,^spellcheck/,,'`" ; \ (cd "$(builddir)/$$D" && $(MAKE) $(AM_MAKEFLAGS) -k -s $@) || RES=$$? ; \ done ; \ for D in $(SPELLCHECK_DIRS_LAST) ; do \ - D="`echo "$$D" | sed 's,^spellcheck/,,'`" ; \ + D="`echo \"$$D\" | sed 's,^spellcheck/,,'`" ; \ (cd "$(builddir)/$$D" && $(MAKE) $(AM_MAKEFLAGS) SPELLCHECK_REPORT_MAYBE_UPDATED_DICT=yes -k -s $@) || RES=$$? ; \ done ; \ exit $$RES ; \ @@ -703,7 +703,7 @@ spellcheck spellcheck-interactive: ( $(MAKE) $(AM_MAKEFLAGS) SPELLCHECK_TGT='$@' SUBDIR_MAKE_VERBOSE="$${SUBDIR_MAKE_VERBOSE}" -k -s $(SPELLCHECK_DIRS) && exit ; \ echo "WARNING: FAILED fanned-out attempt in $@, retrying with NUT_MAKE_SKIP_FANOUT" >&2 ; \ $(MAKE) $(AM_MAKEFLAGS) NUT_MAKE_SKIP_FANOUT=true SPELLCHECK_TGT='$@' -k -s $(SPELLCHECK_DIRS) ) || exit ; \ - if [ x"$@" = xspellcheck-interactive ] ; then \ + if [ x'$@' = xspellcheck-interactive ] ; then \ echo "SUCCESS: $@: follow up with spellcheck-quick to revise and update timestamps"; \ $(MAKE) $(AM_MAKEFLAGS) spellcheck-quick ; \ fi @@ -787,7 +787,7 @@ maintainer-asciidocs: esac ; \ printf '%s\n' "$${LINE}" >> "$${F}.$${EXT}" || exit ; \ done < "$$F" || { echo "$@: FAILED injection for $${F}" >&2; exit 1; } ; \ - if test -s "$${F}.2.tmp" && test -z "`diff "$${F}.2.tmp" docs/asciidoc-vars.conf | tr -d '\n'`" ; then \ + if test -s "$${F}.2.tmp" && test -z "`diff \"$${F}.2.tmp\" docs/asciidoc-vars.conf | tr -d '\n'`" ; then \ rm -f "$${F}"*.tmp ; \ echo "$@: SKIP: no changes: $$F"; continue ; \ fi; \ @@ -852,7 +852,7 @@ check-scripts-syntax: @echo 'NOTE: modern bash complains about scripts using backticks (warning not error), which we ignore in NUT codebase for portability reasons: `...` obsolete, use $$(...)' @RUNBASH=bash; if [ -x /bin/bash ] && /bin/bash -c 'echo $${BASH_VERSION}' | $(EGREP) '^[456789]\.' ; then RUNBASH=/bin/bash ; else if [ -x /usr/bin/env ] ; then RUNBASH="/usr/bin/env bash"; fi; fi ; \ for F in `git ls-files || find . -type f` ; do \ - case "`file "$$F"`" in \ + case "`file \"$$F\"`" in \ *"Bourne-Again shell script"*) ( set -x ; $$RUNBASH -n "$$F" ; ) ;; \ *"POSIX shell script"*|*"shell script"*) ( set -x ; /bin/sh -n "$$F" ; ) ;; \ esac || { RES=$$? ; echo "ERROR: Syntax check failed for script file: $$F" >&2 ; exit $$RES ; } ; \ @@ -964,42 +964,42 @@ CHANGELOG_REQUIRE_GROUP_BY_DATE_AUTHOR_ENVVAR = true $(abs_top_builddir)/ChangeLog: tools/gitlog2changelog.py dummy-stamp @cd $(abs_top_srcdir) && \ if ( test -e .git ) 2>/dev/null || test -d .git || test -f .git || test -h .git ; then \ - NUT_GITDIR=".git" ; if test -r "$${NUT_GITDIR}" -a ! -d "$${NUT_GITDIR}" ; then GD="`$(EGREP) '^gitdir:' "$${NUT_GITDIR}" | sed 's/^gitdir: *//'`" && test -n "$$GD" -a -d "$$GD" && NUT_GITDIR="$$GD" ; fi ; \ - if test -s "$@" -a -d "$${NUT_GITDIR}" && test -z "`find "$${NUT_GITDIR}" -newer "$@" 2>/dev/null`" ; then \ + NUT_GITDIR=".git" ; if test -r "$${NUT_GITDIR}" -a ! -d "$${NUT_GITDIR}" ; then GD="`$(EGREP) '^gitdir:' \"$${NUT_GITDIR}\" | sed 's/^gitdir: *//'`" && test -n "$$GD" -a -d "$$GD" && NUT_GITDIR="$$GD" ; fi ; \ + if test -s '$@' -a -d "$${NUT_GITDIR}" && test -z "`find \"$${NUT_GITDIR}\" -newer '$@' 2>/dev/null`" ; then \ echo " DOC-CHANGELOG-GENERATE $@ : SKIP (keep existing)" ; \ echo "Using still-valid ChangeLog file generated earlier from same revision of Git source metadata in '$${NUT_GITDIR}'" >&2 ; \ else \ - if test -s "$@" ; then \ + if test -s '$@' ; then \ echo " DOC-CHANGELOG-GENERATE $@ : RE-GENERATE (older than Git workspace metadata) ..." ; \ else \ echo " DOC-CHANGELOG-GENERATE $@ : GENERATE (currently absent) ..." ; \ fi ; \ - CHANGELOG_FILE="$@" $(WITH_PDF_NONASCII_TITLES_ENVVAR) \ + CHANGELOG_FILE='$@' $(WITH_PDF_NONASCII_TITLES_ENVVAR) \ CHANGELOG_REQUIRE_GROUP_BY_DATE_AUTHOR="$(CHANGELOG_REQUIRE_GROUP_BY_DATE_AUTHOR_ENVVAR)" \ $(abs_top_builddir)/tools/gitlog2changelog.py $(GITLOG_START_POINT) $(GITLOG_END_POINT) \ && { echo " DOC-CHANGELOG-GENERATE $@ : SUCCESS"; } \ || { \ echo " DOC-CHANGELOG-GENERATE $@ : FAILED (non-fatal)" >&2 ; \ - printf "gitlog2changelog.py failed to generate the ChangeLog.\n\nNOTE: See https://github.com/networkupstools/nut/commits/master for change history.\n\n" > "$@" ; \ + printf "gitlog2changelog.py failed to generate the ChangeLog.\n\nNOTE: See https://github.com/networkupstools/nut/commits/master for change history.\n\n" > '$@' ; \ } ; \ fi ; \ else \ if test x"$(abs_top_srcdir)" != x"$(abs_top_builddir)" -a -s ./ChangeLog ; then \ echo " DOC-CHANGELOG-GENERATE $@ : SKIP (keep existing)" ; \ - if diff ./ChangeLog "$@" >/dev/null 2>/dev/null ; then \ + if diff ./ChangeLog '$@' >/dev/null 2>/dev/null ; then \ echo "Using distributed ChangeLog file from sources (and builddir already has content identical to one in srcdir)" >&2 ; \ else \ echo "Using distributed ChangeLog file from sources (and builddir is not srcdir)" >&2 ; \ - rm -f "$@" || true ; \ - cp -pf ./ChangeLog "$@" || { cat ./ChangeLog > "$@" ; touch -r ./ChangeLog "$@" || true ; } ; \ + rm -f '$@' || true ; \ + cp -pf ./ChangeLog '$@' || { cat ./ChangeLog > '$@' ; touch -r ./ChangeLog '$@' || true ; } ; \ fi ; \ else \ - if test -s "$@" ; then \ + if test -s '$@' ; then \ echo " DOC-CHANGELOG-GENERATE $@ : SKIP (keep existing)" ; \ echo "Using distributed ChangeLog file from sources (and builddir is srcdir)" >&2 ; \ else \ echo " DOC-CHANGELOG-GENERATE $@ : FAILED (non-fatal)" >&2 ; \ - printf "Failed to generate the ChangeLog.\n\nNOTE: See https://github.com/networkupstools/nut/commits/master for change history.\n\n" > "$@" ; \ + printf "Failed to generate the ChangeLog.\n\nNOTE: See https://github.com/networkupstools/nut/commits/master for change history.\n\n" > '$@' ; \ fi ; \ fi ; \ fi @@ -1494,7 +1494,7 @@ install-win-bundle-thirdparty: '$(abs_top_srcdir)/scripts/Windows/dllldd.sh' dllldddir . \ | while read D ; do \ echo " DLL->sbin $$D" 2>&1 ; \ - ln -f '$(DESTDIR)/$(bindir)'/"`basename "$$D"`" ./ ; \ + ln -f '$(DESTDIR)/$(bindir)'/"`basename \"$$D\"`" ./ ; \ done ; \ ) || exit ; \ ( if test x"$(driverexecdir)" = x"$(bindir)" ; then exit 0 ; fi ; \ @@ -1503,7 +1503,7 @@ install-win-bundle-thirdparty: '$(abs_top_srcdir)/scripts/Windows/dllldd.sh' dllldddir . \ | while read D ; do \ echo " DLL->drv $$D" 2>&1 ; \ - ln -f '$(DESTDIR)/$(bindir)'/"`basename "$$D"`" ./ ; \ + ln -f '$(DESTDIR)/$(bindir)'/"`basename \"$$D\"`" ./ ; \ done ; \ ) || exit ; \ ( if test -z "$(cgiexecdir)" -o ! -d "$(DESTDIR)/$(cgiexecdir)" ; then exit 0 ; fi ; \ @@ -1514,7 +1514,7 @@ install-win-bundle-thirdparty: '$(abs_top_srcdir)/scripts/Windows/dllldd.sh' dllldddir . \ | while read D ; do \ echo " DLL->cgi $$D" 2>&1 ; \ - ln -f '$(DESTDIR)/$(bindir)'/"`basename "$$D"`" ./ ; \ + ln -f '$(DESTDIR)/$(bindir)'/"`basename \"$$D\"`" ./ ; \ done ; \ ) || exit ; \ ( if test x"$(libexecdir)" = x"$(bindir)" ; then exit 0 ; fi ; \ @@ -1525,7 +1525,7 @@ install-win-bundle-thirdparty: '$(abs_top_srcdir)/scripts/Windows/dllldd.sh' dllldddir . \ | while read D ; do \ echo " DLL->libexec $$D" 2>&1 ; \ - ln -f '$(DESTDIR)/$(bindir)'/"`basename "$$D"`" ./ ; \ + ln -f '$(DESTDIR)/$(bindir)'/"`basename \"$$D\"`" ./ ; \ done ; \ ) || exit @echo "CHECKING if any executable files were installed to locations other than those covered by this recipe, so might not have needed DLLs bundled near them" >&2 ; \ diff --git a/docs/Makefile.am b/docs/Makefile.am index a96c84eb42..98376f75a0 100644 --- a/docs/Makefile.am +++ b/docs/Makefile.am @@ -9,6 +9,8 @@ # shells, e.g. "ksh" seems to actively dislike unbalanced double-quotes # inside the backticks (e.g. matched in some grep/sed regexes below), # although generally the approach works for such "VAL" assignments too. +# In any case, it is portable and preferable to instead write that like +# VAL="`cmd \"some params\"`" # Note that the newer "$(...)" syntax is not portable, older shells # have no idea about it, and it is cumbersome with `make` substitution. # Keep a lookout with multi-platform NUT CI jobs, and try to use single @@ -308,8 +310,8 @@ ChangeLog.html-contentchecked: FIRST_ENTRY="`$(EGREP) '^[0-9]' '$(top_builddir)/ChangeLog' | head -1 | entry_filter`" || FIRST_ENTRY="" ; \ LAST_ENTRY="`$(EGREP) '^[0-9]' '$(top_builddir)/ChangeLog' | tail -1 | entry_filter`" || LAST_ENTRY="" ; \ if [ -n "$${FIRST_ENTRY}" ] ; then \ - O="`$(EGREP) -c "^$${FIRST_ENTRY}" '$(top_builddir)/ChangeLog'`" ; \ - N="`$(EGREP) -c "title.*$${FIRST_ENTRY}" 'ChangeLog.html'`" ; \ + O="`$(EGREP) -c \"^$${FIRST_ENTRY}\" '$(top_builddir)/ChangeLog'`" ; \ + N="`$(EGREP) -c \"title.*$${FIRST_ENTRY}\" 'ChangeLog.html'`" ; \ MIN="`expr $${O} + 1`" && [ "$${MIN}" -gt 0 ] 2>/dev/null || MIN=1 ; \ MAX="`expr $${O} + $${O}`" && [ "$${MAX}" -gt 2 ] 2>/dev/null || MAX=2 ; \ if [ "$${N}" -lt "$${MIN}" ] || [ "$${N}" -gt "$${MAX}" ]; then \ @@ -322,8 +324,8 @@ ChangeLog.html-contentchecked: fi ; \ fi; \ if [ -n "$${SECOND_ENTRY}" ] ; then \ - O="`$(EGREP) -c "^$${SECOND_ENTRY}" '$(top_builddir)/ChangeLog'`" ; \ - N="`$(EGREP) -c "title.*$${SECOND_ENTRY}" 'ChangeLog.html'`" ; \ + O="`$(EGREP) -c \"^$${SECOND_ENTRY}\" '$(top_builddir)/ChangeLog'`" ; \ + N="`$(EGREP) -c \"title.*$${SECOND_ENTRY}\" 'ChangeLog.html'`" ; \ MIN="`expr $${O} + 1`" && [ "$${MIN}" -gt 0 ] 2>/dev/null || MIN=1 ; \ MAX="`expr $${O} + $${O}`" && [ "$${MAX}" -gt 2 ] 2>/dev/null || MAX=2 ; \ if [ "$${N}" -lt "$${MIN}" ] || [ "$${N}" -gt "$${MAX}" ]; then \ @@ -336,8 +338,8 @@ ChangeLog.html-contentchecked: fi ; \ fi; \ if [ -n "$${LAST_ENTRY}" ] ; then \ - O="`$(EGREP) -c "^$${LAST_ENTRY}" '$(top_builddir)/ChangeLog'`" ; \ - N="`$(EGREP) -c "title.*$${LAST_ENTRY}" 'ChangeLog.html'`" ; \ + O="`$(EGREP) -c \"^$${LAST_ENTRY}\" '$(top_builddir)/ChangeLog'`" ; \ + N="`$(EGREP) -c \"title.*$${LAST_ENTRY}\" 'ChangeLog.html'`" ; \ MIN="`expr $${O} + 1`" && [ "$${MIN}" -gt 0 ] 2>/dev/null || MIN=1 ; \ MAX="`expr $${O} + $${O}`" && [ "$${MAX}" -gt 2 ] 2>/dev/null || MAX=2 ; \ if [ "$${N}" -lt "$${MIN}" ] || [ "$${N}" -gt "$${MAX}" ]; then \ @@ -372,7 +374,7 @@ check-html-single: .check-html-single test -s "$$F" && { file "$$F" | $(EGREP) -i '(XML|HTML.*document)' > /dev/null ; } || FAILED="$$FAILED $$F" ; \ case "$$F" in \ *ChangeLog*) if [ -s '$(top_builddir)/ChangeLog' ] ; then \ - $(MAKE) $(AM_MAKEFLAGS) "`basename "$$F"`"-contentchecked || FAILED="$$FAILED $$F" ; \ + $(MAKE) $(AM_MAKEFLAGS) "`basename \"$$F\"`"-contentchecked || FAILED="$$FAILED $$F" ; \ fi ;; \ esac ; \ done; if test -n "$$FAILED" ; then \ @@ -459,7 +461,7 @@ MAINTAINER_ASCIIDOCS_CHANGELOG_DEBUG = no -e 's,\(https*://[^ \+]*\)[\]*[+],\1%2B,g' \ ; } > "$@.tmp.$$$$" \ && test -s "$@.tmp.$$$$" \ - && mv -f "$@.tmp.$$$$" "$@" \ + && mv -f "$@.tmp.$$$$" '$@' \ || { RES="$$?" ; rm -f "$@.tmp.$$$$" ; exit $$RES ; } @if [ x'$@' = x'$(top_builddir)/ChangeLog.adoc-parsed' ] ; then \ touch -r '$@' '$(top_builddir)/docs/.ChangeLog.adoc-parsed.latest' || touch '$(top_builddir)/docs/.ChangeLog.adoc-parsed.latest' ; \ @@ -468,7 +470,7 @@ MAINTAINER_ASCIIDOCS_CHANGELOG_DEBUG = no $(top_builddir)/ChangeLog.adoc-parsed: $(top_builddir)/ChangeLog.adoc .ChangeLog.adoc-parsed.latest: $(top_builddir)/ChangeLog.adoc-parsed - @[ x"$?" != x ] && touch -r '$?' '$@' || touch '$@' + @[ x'$?' != x ] && touch -r '$?' '$@' || touch '$@' CLEANFILES += .ChangeLog.adoc-parsed.latest @@ -479,7 +481,7 @@ $(top_builddir)/ChangeLog: dummy # BSD Make dislikes the path resolution here and does not always populate '$<' # (and claims why: "Using $< in a non-suffix rule context is a GNUmake idiom"), -# but it has a "$?" for "list of dependencies that are newer than the target". +# but it has a '$?' for "list of dependencies that are newer than the target". # For more details see https://man.freebsd.org/cgi/man.cgi if WITH_PDF_NONASCII_TITLES A2X_ASCII_IDS = @@ -500,7 +502,7 @@ MAINTAINER_ASCIIDOCS_CHANGELOG_DELAY = 10 # already running and bail out early if the file exists. Otherwise we bite # the bullet and spend a few seconds, and then re-check if another thread # did exist and finished first. -# Weird ways about "INPUT": in some cases the "$?" came in empty, in others +# Weird ways about "INPUT": in some cases the '$?' came in empty, in others # it has several files listed, e.g. full paths to "ChangeLog .prep-src-docs". # The "$<" may only be used for suffix rules (and nothing forbids it from # reporting the two changed files noted above, either). The approach below @@ -509,24 +511,24 @@ MAINTAINER_ASCIIDOCS_CHANGELOG_DELAY = 10 # of "make" implementations. # FIXME: Fallback URL should refer not to "master" but current commit/tag? $(top_builddir)/ChangeLog.adoc: $(top_builddir)/ChangeLog - @INPUT="`for F in $? ; do case "$$F" in */ChangeLog) [ -s "$$F" ] && echo "$$F"; exit 0 ;; esac; done`"; \ + @INPUT="`for F in $? ; do case \"$$F\" in */ChangeLog) [ -s \"$$F\" ] && echo \"$$F\"; exit 0 ;; esac; done`"; \ test -n "$${INPUT}" || INPUT="$(top_builddir)/ChangeLog" ; \ - test -n "$${INPUT}" && test -n "$@" && test -s "$${INPUT}" \ + test -n "$${INPUT}" && test -n '$@' && test -s "$${INPUT}" \ || { \ MSG="FAILED to resolve input or output filename with this make implementation, or input was not generated!"; \ echo " DOC-CHANGELOG-ASCIIDOC SKIP: $${MSG}" >&2; \ - test -n "$@" && { printf '=== Failed to generate the ChangeLog\n\n%s\n\nNOTE: See https://github.com/networkupstools/nut/commits/master for change history.\n\n' "$${MSG}" > "$@" ; } ; \ + test -n '$@' && { printf '=== Failed to generate the ChangeLog\n\n%s\n\nNOTE: See https://github.com/networkupstools/nut/commits/master for change history.\n\n' "$${MSG}" > '$@' ; } ; \ exit ; \ } ; \ - if [ -s '$@' ] && [ x"`find '$@' -newer "$${INPUT}" 2>/dev/null`" != x ] ; then echo " DOC-CHANGELOG-ASCIIDOC $${INPUT} => $@ : SKIP (keep existing)"; rm -f "$@.tmp.$$$$"; exit 0 ; fi ; \ + if [ -s '$@' ] && [ x"`find '$@' -newer \"$${INPUT}\" 2>/dev/null`" != x ] ; then echo " DOC-CHANGELOG-ASCIIDOC $${INPUT} => $@ : SKIP (keep existing)"; rm -f "$@.tmp.$$$$"; exit 0 ; fi ; \ W=0 ; \ if [ "$(MAINTAINER_ASCIIDOCS_CHANGELOG_DELAY)" -gt 0 ] 2>/dev/null ; then \ echo " DOC-CHANGELOG-ASCIIDOC $${INPUT} => $@ : Block for up to $(MAINTAINER_ASCIIDOCS_CHANGELOG_DELAY) sec, maybe another thread will make the file first" ; \ - while [ "$${W}" -lt "$(MAINTAINER_ASCIIDOCS_CHANGELOG_DELAY)" ] && [ x"`find '$@.tmp.'* '$@' -newer "$${INPUT}" 2>/dev/null`" = x ] ; do sleep 1 ; W="`expr $$W + 1`"; done ; touch "$@.tmp.$$$$"; \ - if [ x"`find '$@' -newer "$${INPUT}" 2>/dev/null`" != x ] ; then echo " DOC-CHANGELOG-ASCIIDOC $${INPUT} => $@ : SKIP (keep existing)"; rm -f "$@.tmp.$$$$"; exit 0 ; fi ; \ + while [ "$${W}" -lt "$(MAINTAINER_ASCIIDOCS_CHANGELOG_DELAY)" ] && [ x"`find '$@.tmp.'* '$@' -newer \"$${INPUT}\" 2>/dev/null`" = x ] ; do sleep 1 ; W="`expr $$W + 1`"; done ; touch "$@.tmp.$$$$"; \ + if [ x"`find '$@' -newer \"$${INPUT}\" 2>/dev/null`" != x ] ; then echo " DOC-CHANGELOG-ASCIIDOC $${INPUT} => $@ : SKIP (keep existing)"; rm -f "$@.tmp.$$$$"; exit 0 ; fi ; \ fi ; \ - if [ -s "$@" ] ; then echo " DOC-CHANGELOG-ASCIIDOC $${INPUT} => $@ : RE-GENERATE" ; else echo " DOC-CHANGELOG-ASCIIDOC $${INPUT} => $@ : GENERATE" ; fi ; \ - { if [ x"$(MAINTAINER_ASCIIDOCS_CHANGELOG_DEBUG)" != xno ] ; then ls -la "$${INPUT}" "$@" || true ; stat "$${INPUT}" "$@" || true ; fi ; } ; \ + if [ -s '$@' ] ; then echo " DOC-CHANGELOG-ASCIIDOC $${INPUT} => $@ : RE-GENERATE" ; else echo " DOC-CHANGELOG-ASCIIDOC $${INPUT} => $@ : GENERATE" ; fi ; \ + { if [ x"$(MAINTAINER_ASCIIDOCS_CHANGELOG_DEBUG)" != xno ] ; then ls -la "$${INPUT}" '$@' || true ; stat "$${INPUT}" '$@' || true ; fi ; } ; \ if [ "$(MAINTAINER_ASCIIDOCS_CHANGELOG_DELAY)" -gt 0 ] 2>/dev/null ; then \ echo " DOC-CHANGELOG-ASCIIDOC $${INPUT} => $@ : PROCEED, waited for $${W} sec" ; \ fi ; \ @@ -542,10 +544,10 @@ $(top_builddir)/ChangeLog.adoc: $(top_builddir)/ChangeLog -e 's,\[\[\([^]]*\)\]\],[\1],g' \ -e 's,^\([ '"$${TABCHAR}"'][ '"$${TABCHAR}"']*\)\([0-9]\),\1{empty}\2,g' \ < "$${INPUT}" >> "$@.tmp.$$$$" \ - && if [ x"`find '$@' -newer "$${INPUT}" 2>/dev/null`" != x ] ; then \ + && if [ x"`find '$@' -newer \"$${INPUT}\" 2>/dev/null`" != x ] ; then \ echo " DOC-CHANGELOG-ASCIIDOC $${INPUT} => $@ : SKIP (keep recently born competitor)"; rm -f "$@.tmp.$$$$"; \ else \ - test -s "$@.tmp.$$$$" && mv -f "$@.tmp.$$$$" "$@" \ + test -s "$@.tmp.$$$$" && mv -f "$@.tmp.$$$$" '$@' \ || { RES="$$?" ; rm -f "$@.tmp.$$$$" ; exit $$RES ; } ; \ fi @@ -610,8 +612,8 @@ docinfo-since-v2.8.3.xml: docinfo.xml *''*) echo "$$LINE" ;; \ *) if test x"$$OLDEST_SEEN" = xfalse || $$IN_REVISION ; then echo "$$LINE" ; fi ;; \ esac ; \ - done < "$?" > "$@".tmp \ - && mv -f "$@".tmp "$@" + done < '$?' > '$@'.tmp \ + && mv -f '$@'.tmp '$@' # Some versions of asciidoc ignore the argument of :docinfo: tag # and require (TXT_BASE_NAME)-docinfo.xml to exist: @@ -680,7 +682,7 @@ A2X_COMMON_OPTS = $(ASCIIDOC_VERBOSE) \ DOCBUILD_BEGIN = { \ if test -n "$${A2X_OUTDIR}" && test "$${A2X_OUTDIR}" != '.' ; then \ rm -rf "./$${A2X_OUTDIR}" || true ; \ - test -d "$@" && rm -rf "$@" || true ; \ + test -d '$@' && rm -rf '$@' || true ; \ _CWD="`pwd`" && (cd '$(abs_builddir)' && $(MKDIR_P) "$${_CWD}/$${A2X_OUTDIR}") || exit ; \ case "$${A2X_OUTDIR}" in \ tmp/pdf.*) ln -s ../../images "./$${A2X_OUTDIR}" ; \ @@ -706,7 +708,7 @@ DOCBUILD_BEGIN = { \ DOCBUILD_END = { \ if test -n "$${A2X_OUTDIR}" && test "$${A2X_OUTDIR}" != '.' ; then \ chmod -R u+w "./$${A2X_OUTDIR}" || true; \ - test -d "$@" && rm -rf "$@" || true ; \ + test -d '$@' && rm -rf '$@' || true ; \ rm -f "./$${A2X_OUTDIR}/"*docinfo*.xml* || exit ; \ mv -f "./$${A2X_OUTDIR}/$(@F)" ./ || exit ; \ mv -f "./$${A2X_OUTDIR}/"*.* ./ 2>/dev/null || true ; \ @@ -748,7 +750,7 @@ GENERATE_HTML_SINGLE = ( \ $(MAKE) $(AM_MAKEFLAGS) "`basename '$(@F)'`"-contentchecked || RES=$$? ; \ if [ "$$RES" != 0 ] ; then \ echo " DOC-HTML Generating $@ (retry once)" >&2; \ - rm -f "$@"; \ + rm -f '$@'; \ A2X_OUTDIR="tmp/html-single.$(@F).$$$$-retry" ; \ $(DOCBUILD_BEGIN) ; RES=0; rm -f "`basename '$(@F)'`"-contentchecked || true ; \ $(A2X) $(A2X_COMMON_OPTS) --attribute=xhtml11_format --format=xhtml --xsl-file=$(srcdir)/xhtml.xsl '$<' || RES=$$? ; \ @@ -769,7 +771,7 @@ GENERATE_HTML_SINGLE = ( \ # Note: extra age check here because *.chunked is a directory and not all # "make" implementations check its age vs. source files, just always build: GENERATE_HTML_CHUNKED = ( \ - if [ -d "$@" ] && [ x"`find '$@' -newer "$<" 2>/dev/null`" != x ] ; then \ + if [ -d '$@' ] && [ x"`find '$@' -newer '$<' 2>/dev/null`" != x ] ; then \ echo " DOC-HTML-CHUNKED SKIP: keep existing $@"; \ exit 0 ; \ fi ; \ @@ -888,8 +890,8 @@ SPELLCHECK_RECIPE_DEBUG_STREAM = /dev/null $(SPELLCHECK_BUILDDIR)/$(SPELLCHECK_SRC_ONE)-spellchecked: $(SPELLCHECK_SRCDIR)/$(SPELLCHECK_SRC_ONE) $(abs_top_srcdir)/docs/Makefile.am $(abs_srcdir)/$(NUT_SPELL_DICT) @LANG=C; LC_ALL=C; export LANG; export LC_ALL; \ if test x"$(SPELLCHECK_SRC_ONE)" = x ; then echo " SKIP Bogus spellcheck call for empty target filename (with make target $@ from `pwd`)" >&2 ; exit 0; fi; \ - case "$@" in *-spellchecked) ;; *) echo " SKIP Bogus spellcheck call for non '*-spellchecked' target filename (with make target $@ from `pwd`)" >&2 ; exit 0;; esac; \ - rm -f "$@" || true ; \ + case '$@' in *-spellchecked) ;; *) echo " SKIP Bogus spellcheck call for non '*-spellchecked' target filename (with make target $@ from `pwd`)" >&2 ; exit 0;; esac; \ + rm -f '$@' || true ; \ $(MKDIR_P) "$(@D)" || exit ; \ REPORT_SRCDIR="$(SPELLCHECK_SRCDIR)"; \ REPORT_SRC_ONE="$(SPELLCHECK_SRC_ONE)"; \ @@ -909,7 +911,7 @@ $(SPELLCHECK_BUILDDIR)/$(SPELLCHECK_SRC_ONE)-spellchecked: $(SPELLCHECK_SRCDIR)/ esac; \ if [ x"$${REPORT_SRCDIR}" != x ] ; then \ tmpREPORT_PREFIX="NUT source root :: $${REPORT_SRCDIR} :: " ; \ - REPORT_SRCDIR="`cd "$${REPORT_SRCDIR}" && { pwd >$(SPELLCHECK_RECIPE_DEBUG_STREAM) ; pwd | sed 's|^'"$(abs_top_srcdir)"'/*||' ; }`" \ + REPORT_SRCDIR="`cd \"$${REPORT_SRCDIR}\" && { pwd >$(SPELLCHECK_RECIPE_DEBUG_STREAM) ; pwd | sed 's|^'\"$(abs_top_srcdir)\"'/*||' ; }`" \ || { REPORT_SRCDIR="$(SPELLCHECK_SRCDIR)" ; REPORT_SRC_ONE="$(SPELLCHECK_SRC_ONE)" ; REPORT_PREFIX="" ; } ; \ fi ; \ echo "=== Got REPORT_SRCDIR='$${REPORT_SRCDIR}'" >$(SPELLCHECK_RECIPE_DEBUG_STREAM) ; \ @@ -935,7 +937,7 @@ $(SPELLCHECK_BUILDDIR)/$(SPELLCHECK_SRC_ONE)-spellchecked: $(SPELLCHECK_SRCDIR)/ echo " ASPELL Spell checking on $${REPORT_PREFIX}$${REPORT_SRCDIR}$${REPORT_SRC_ONE}"; \ fi ; \ OUT="`(sed 's,^\(.*\)$$, \1,' | $(ASPELL) -a $(ASPELL_NUT_TEXMODE_ARGS) $(ASPELL_NUT_COMMON_ARGS) 2>&1) < '$(SPELLCHECK_SRCDIR)/$(SPELLCHECK_SRC_ONE)'`" \ - && { if test -n "$$OUT" ; then OUT="`echo "$$OUT" | $(EGREP) -b -v '$(ASPELL_OUT_NOTERRORS)' `" ; fi; \ + && { if test -n "$$OUT" ; then OUT="`echo \"$$OUT\" | $(EGREP) -b -v '$(ASPELL_OUT_NOTERRORS)' `" ; fi; \ test -z "$$OUT" ; } \ || { RES=$$? ; \ echo "FAILED : Aspell reported errors here:" >&2 \ @@ -947,7 +949,7 @@ $(SPELLCHECK_BUILDDIR)/$(SPELLCHECK_SRC_ONE)-spellchecked: $(SPELLCHECK_SRCDIR)/ echo "FAILED: Admonition block should contain a sentence, not starting with a lower-case letter" >&2 ; \ exit 2 ; \ fi ; \ - touch "$@" + touch '$@' # If NUT_MAKE_SKIP_FANOUT!=true we have a hack to spellcheck certain files more # quickly (in parallel). This approach is constrained to files with a known @@ -955,9 +957,9 @@ $(SPELLCHECK_BUILDDIR)/$(SPELLCHECK_SRC_ONE)-spellchecked: $(SPELLCHECK_SRCDIR)/ # (extension-less docs and relative links are built sequentially). SPELLCHECK_AUTO_ONE = ( \ SPELLCHECK_SRC_ONE="`basename '$?'`" ; \ - rm -f "$@".failed ; \ + rm -f '$@'.failed ; \ $(MAKE) $(AM_MAKEFLAGS) -k -s -f "$(abs_top_builddir)/docs/Makefile" SPELLCHECK_SRC="" SPELLCHECK_SRC_ONE="$${SPELLCHECK_SRC_ONE}" SPELLCHECK_BUILDDIR="$(SPELLCHECK_BUILDDIR)" SPELLCHECK_SRCDIR="$(SPELLCHECK_SRCDIR)" VPATH="$(SPELLCHECK_SRCDIR):$(SPELLCHECK_BUILDDIR):$(VPATH)" "$(SPELLCHECK_BUILDDIR)/$${SPELLCHECK_SRC_ONE}-spellchecked" \ - || { RES=$$? ; touch "$@".failed; exit $$RES; } \ + || { RES=$$? ; touch '$@'.failed; exit $$RES; } \ ) .txt.txt-spellchecked-auto: @@ -994,14 +996,14 @@ spellcheck: || FAILED="$$FAILED $(SPELLCHECK_SRCDIR)/$$docsrc"; \ done ; \ else \ - SPELLCHECK_AUTO_TGT="`for docsrc in $(SPELLCHECK_SRC); do case "$${docsrc}" in */*) ;; *.adoc|*.txt|*.in|*.conf|*.sample) printf '%s ' "$${docsrc}-spellchecked-auto" ;; esac ; done`" ; \ - SPELLCHECK_NOEXT_DOCS="`for docsrc in $(SPELLCHECK_SRC); do case "$${docsrc}" in */*) printf '%s ' "$${docsrc}" ;; *.adoc|*.txt|*.in|*.conf|*.sample) ;; *) printf '%s ' "$${docsrc}" ;; esac ; done`" ; \ + SPELLCHECK_AUTO_TGT="`for docsrc in $(SPELLCHECK_SRC); do case \"$${docsrc}\" in */*) ;; *.adoc|*.txt|*.in|*.conf|*.sample) printf '%s ' \"$${docsrc}-spellchecked-auto\" ;; esac ; done`" ; \ + SPELLCHECK_NOEXT_DOCS="`for docsrc in $(SPELLCHECK_SRC); do case \"$${docsrc}\" in */*) printf '%s ' \"$${docsrc}\" ;; *.adoc|*.txt|*.in|*.conf|*.sample) ;; *) printf '%s ' \"$${docsrc}\" ;; esac ; done`" ; \ if test "$(SPELLCHECK_ENV_DEBUG)" != no ; then \ echo "ASPELL MAKEFILE DEBUG: from `pwd`: SPELLCHECK_NOEXT_DOCS='$${SPELLCHECK_NOEXT_DOCS}' SPELLCHECK_AUTO_TGT='$${SPELLCHECK_AUTO_TGT}'" ; \ else true ; fi ; \ if [ x"$${SPELLCHECK_AUTO_TGT}" != x ] ; then \ $(MAKE) $(AM_MAKEFLAGS) -k -s -f "$(abs_top_builddir)/docs/Makefile" SPELLCHECK_SRC="" SPELLCHECK_BUILDDIR="$(SPELLCHECK_BUILDDIR)" SPELLCHECK_SRCDIR="$(SPELLCHECK_SRCDIR)" VPATH="$(SPELLCHECK_SRCDIR):$(SPELLCHECK_BUILDDIR):$(VPATH)" $${SPELLCHECK_AUTO_TGT} ; \ - FAILED="`for docsrc in $(SPELLCHECK_SRC); do if [ -f "$(SPELLCHECK_BUILDDIR)/$${docsrc}-spellchecked-auto.failed" ] ; then printf '%s ' "$(SPELLCHECK_SRCDIR)/$${docsrc}" ; rm -f "$(SPELLCHECK_BUILDDIR)/$${docsrc}-spellchecked-auto.failed" ; fi ; done`" ; \ + FAILED="`for docsrc in $(SPELLCHECK_SRC); do if [ -f \"$(SPELLCHECK_BUILDDIR)/$${docsrc}-spellchecked-auto.failed\" ] ; then printf '%s ' \"$(SPELLCHECK_SRCDIR)/$${docsrc}\" ; rm -f \"$(SPELLCHECK_BUILDDIR)/$${docsrc}-spellchecked-auto.failed\" ; fi ; done`" ; \ fi ; \ if [ x"$${SPELLCHECK_NOEXT_DOCS}" != x ] ; then \ for docsrc in $${SPELLCHECK_NOEXT_DOCS} ; do \ @@ -1040,13 +1042,13 @@ $(abs_builddir)/$(NUT_SPELL_DICT).sorted: $(abs_srcdir)/$(NUT_SPELL_DICT) @cp -pf $(abs_srcdir)/$(NUT_SPELL_DICT) $(abs_builddir)/$(NUT_SPELL_DICT).bak-pre-sorting @LANG=$(ASPELL_ENV_LANG); LC_ALL=$(ASPELL_ENV_LANG); export LANG; export LC_ALL; ( \ WORDLIST="`tail -n +2 < '$(?)' | sort | uniq`"; \ - WORDCOUNT="`echo "$$WORDLIST" | wc -l`"; \ - head -1 < "$?" | while read P L C E ; do echo "$$P $$L $$WORDCOUNT $$E"; break; done ; \ + WORDCOUNT="`echo \"$$WORDLIST\" | wc -l`"; \ + head -1 < '$?' | while read P L C E ; do echo "$$P $$L $$WORDCOUNT $$E"; break; done ; \ echo "$$WORDLIST"; \ - ) > "$@" - @cp -f "$@" "$(abs_builddir)/$(NUT_SPELL_DICT)" + ) > '$@' + @cp -f '$@' "$(abs_builddir)/$(NUT_SPELL_DICT)" @if [ "$(abs_builddir)" != "$(abs_srcdir)" ] ; then \ - cp -f "$@" "$?" || true ; \ + cp -f '$@' '$?' || true ; \ cp -f "$(abs_builddir)/$(NUT_SPELL_DICT).bak-pre-sorting" "$(abs_srcdir)/" || true ; \ fi @@ -1133,10 +1135,10 @@ $(NUT_SPELL_DICT).usage-report: $(NUT_SPELL_DICT) git grep -q "$$W" -- ':!*.dict*' || git grep -qE "[0-9_,./\ -]$$W[0-9_,./\ -]" -- ':!*.dict*' ) \ && echo "+++ $$W" \ || ( \ - HITS_CS="`git grep "$$W" -- ':!*.dict*'`" || true; \ - HITS_CI="`git grep -i "$$W" -- ':!*.dict*'`" || true; \ - if [ -n "$$HITS_CS" ] ; then HITC_CS="`echo "$$HITS_CS" | wc -l`" ; else HITC_CS=0; fi; \ - if [ -n "$$HITS_CI" ] ; then HITC_CI="`echo "$$HITS_CI" | wc -l`" ; else HITC_CI=0; fi; \ + HITS_CS="`git grep \"$$W\" -- ':!*.dict*'`" || true; \ + HITS_CI="`git grep -i \"$$W\" -- ':!*.dict*'`" || true; \ + if [ -n "$$HITS_CS" ] ; then HITC_CS="`echo \"$$HITS_CS\" | wc -l`" ; else HITC_CS=0; fi; \ + if [ -n "$$HITS_CI" ] ; then HITC_CI="`echo \"$$HITS_CI\" | wc -l`" ; else HITC_CI=0; fi; \ printf '%s (%d case-sensitive/%d case-insensitive)\n' "--- $$W" "$$HITC_CS" "$$HITC_CI"; \ if [ "$$HITC_CS" != 0 ] ; then echo "$$HITS_CS" ; echo "^^^"; else \ if [ "$$HITC_CI" != 0 ] ; then echo "$$HITS_CI" ; echo "^^^"; fi; \ @@ -1144,10 +1146,10 @@ $(NUT_SPELL_DICT).usage-report: $(NUT_SPELL_DICT) ); \ done > "$@.tmp.$$$$" \ && test -s "$@.tmp.$$$$" \ - && mv -f "$@.tmp.$$$$" "$@" \ + && mv -f "$@.tmp.$$$$" '$@' \ || { RES="$$?" ; rm -f "$@.tmp.$$$$" ; exit $$RES ; } @echo "Reporting words from $? possibly not used in current inspected code base revision under $(abs_top_srcdir)" >&2 ; \ - $(EGREP) '^--- ' < "$@" | $(GREP) '(0 ' || echo "SUCCESS: None found" + $(EGREP) '^--- ' < '$@' | $(GREP) '(0 ' || echo "SUCCESS: None found" CLEANFILES += $(NUT_SPELL_DICT).usage-report.tmp MAINTAINERCLEANFILES += $(NUT_SPELL_DICT).usage-report @@ -1179,7 +1181,7 @@ $(abs_top_builddir)/docs/.prep-src-docs: $(PREP_SRC) Makefile COUNT=0; \ for F in $(PREP_SRC) ; do \ case "$$F" in \ - /*) F="`echo "$$F" | sed 's#^$(abs_top_srcdir)/*#./#'`"; \ + /*) F="`echo \"$$F\" | sed 's#^$(abs_top_srcdir)/*#./#'`"; \ if test x"$${linkroot}" = x"$(abs_builddir)" ; then \ linkroot="$(abs_top_builddir)" ; \ cd "$(abs_top_builddir)" ; \ @@ -1211,13 +1213,13 @@ $(abs_top_builddir)/docs/.prep-src-docs: $(PREP_SRC) Makefile esac; \ COUNT="`expr $$COUNT + 1`" ; \ done ; \ - if test ! -f "$@" ; then touch "$@" ; fi ; \ + if test ! -f '$@' ; then touch '$@' ; fi ; \ else \ COUNT=30 ; \ touch "$@.$$$$" ; \ while test -f "$@.working" -a "$$COUNT" -gt 0 ; do sleep 1; COUNT="`expr $$COUNT - 1`"; done ; \ touch "$@.working" ; \ - if test -n "`find "$@" -newer "$@.$$$$" 2>/dev/null`" ; then \ + if test -n "`find '$@' -newer \"$@.$$$$\" 2>/dev/null`" ; then \ rm -f "$@.$$$$" "$@.working" ; \ exit 0; \ fi ; \ @@ -1226,20 +1228,20 @@ $(abs_top_builddir)/docs/.prep-src-docs: $(PREP_SRC) Makefile linksrcroot="$(abs_srcdir)" ; \ for F in `echo $(PREP_SRC) | tr ' ' '\n' | sort -n | uniq` ; do \ case "$$F" in \ - /*) F="`echo "$$F" | sed 's#^$(abs_top_srcdir)/*#./#'`"; \ + /*) F="`echo \"$$F\" | sed 's#^$(abs_top_srcdir)/*#./#'`"; \ if test x"$${linkroot}" = x"$(abs_builddir)" ; then \ linkroot="$(abs_top_builddir)" ; \ linksrcroot="$(abs_top_srcdir)" ; \ cd "$(abs_top_builddir)" ; \ fi ;; \ - "$(srcdir)"/*) F="`echo "$$F" | sed 's#^$(srcdir)/*#./#'`" ;; \ + "$(srcdir)"/*) F="`echo \"$$F\" | sed 's#^$(srcdir)/*#./#'`" ;; \ */*) ;; \ *) \ linkroot="$(abs_builddir)" ; \ linksrcroot="$(abs_srcdir)" ; \ cd "$(abs_top_builddir)" ;; \ esac ; \ - D="`dirname "$$F"`" ; \ + D="`dirname \"$$F\"`" ; \ (cd '$(abs_builddir)' && $(MKDIR_P) "$${linkroot}/$$D") || { rm -f "$@.working" ; exit 1 ; } ; \ if test ! -s "$${linkroot}/$$F" && test -s "$${linksrcroot}/$$F" ; then \ echo " LN '$${linksrcroot}/$$F' => '$${linkroot}/$$F' (PWD = '`pwd`')" ; \ @@ -1282,7 +1284,7 @@ $(abs_top_builddir)/docs/.prep-src-docs: $(PREP_SRC) Makefile COUNT="`expr $$COUNT + 1`" ; \ done ; \ fi ; \ - if test "$$COUNT" -gt 0 -o ! -f "$@" ; then touch "$@" ; fi + if test "$$COUNT" -gt 0 -o ! -f '$@' ; then touch '$@' ; fi @rm -f "$@.working" # Dirs to clean, etc. @@ -1290,7 +1292,7 @@ clean-local: $(AM_V_at)rm -rf *.chunked *.bak tmp $(AM_V_at)for F in $(PREP_SRC) ; do \ case "$$F" in \ - /*) F="`echo "$$F" | sed 's#^$(abs_top_srcdir)/*#./#'`"; cd "$(abs_top_builddir)" ;; \ + /*) F="`echo \"$$F\" | sed 's#^$(abs_top_srcdir)/*#./#'`"; cd "$(abs_top_builddir)" ;; \ esac ; \ if test x"$(abs_srcdir)" != x"$(abs_builddir)" ; then \ if test -L "$$F" || test -h "$$F" ; then \ diff --git a/docs/man/Makefile.am b/docs/man/Makefile.am index 210b5c707c..6e5e131699 100644 --- a/docs/man/Makefile.am +++ b/docs/man/Makefile.am @@ -130,7 +130,7 @@ LIST_FILES = ( \ TOTAL=0; \ for P in $${FILENAMES} ; do \ TOTAL="`expr $$TOTAL + 1`" ; \ - F="`basename "$$P"`" ; \ + F="`basename \"$$P\"`" ; \ if [ -s "$(abs_builddir)/$$F" ] ; then \ echo "BUILDDIR: $(builddir)/$$F" ; \ else \ @@ -161,7 +161,7 @@ FAKE_FILES = ( \ TOTAL=0; \ for P in $${FILENAMES} ; do \ TOTAL="`expr $$TOTAL + 1`" ; \ - F="`basename "$$P"`" ; \ + F="`basename \"$$P\"`" ; \ if [ ! -s "$(abs_builddir)/$$F" ] && [ ! -s "$(abs_srcdir)/$$F" ] ; then \ echo "PLACEHOLDER" > "$(abs_builddir)/$$F" ; \ MISSING="`expr $$MISSING + 1`" ; \ @@ -177,9 +177,9 @@ FAKE_FILES_RM = ( \ TOTAL=0; \ for P in $${FILENAMES} ; do \ TOTAL="`expr $$TOTAL + 1`" ; \ - F="`basename "$$P"`" ; \ + F="`basename \"$$P\"`" ; \ if [ -s "$(abs_builddir)/$$F" ] \ - && [ x"PLACEHOLDER" = x"`cat "$(abs_builddir)/$$F"`" ] ; then \ + && [ x"PLACEHOLDER" = x"`cat \"$(abs_builddir)/$$F\"`" ] ; then \ rm -f "$(abs_builddir)/$$F" ; \ MISSING="`expr $$MISSING + 1`" ; \ fi ; \ @@ -441,13 +441,13 @@ INST_HTML_CLIENT_MANS_FICTION = \ NUT-Monitor-py3qt6.html NUT-Monitor-py2gtk2.html: NUT-Monitor.html - test -n "$?" -a -s "$@" && rm -f $@ && ln -s $? $@ + test -n '$?' -a -s '$@' && rm -f $@ && ln -s $? $@ NUT-Monitor-py3qt5.html: NUT-Monitor.html - test -n "$?" -a -s "$@" && rm -f $@ && ln -s $? $@ + test -n '$?' -a -s '$@' && rm -f $@ && ln -s $? $@ NUT-Monitor-py3qt6.html: NUT-Monitor.html - test -n "$?" -a -s "$@" && rm -f $@ && ln -s $? $@ + test -n '$?' -a -s '$@' && rm -f $@ && ln -s $? $@ else !WITH_NUT_MONITOR @@ -843,28 +843,28 @@ HTML_DEV_MANS_FICTION = \ nutscan_add_commented_option_to_device.html upscli_readline_timeout.html: upscli_readline.html - test -n "$?" -a -s "$@" && rm -f $@ && ln -s $? $@ + test -n '$?' -a -s '$@' && rm -f $@ && ln -s $? $@ upscli_sendline_timeout.html: upscli_sendline.html - test -n "$?" -a -s "$@" && rm -f $@ && ln -s $? $@ + test -n '$?' -a -s '$@' && rm -f $@ && ln -s $? $@ upscli_tryconnect.html: upscli_connect.html - test -n "$?" -a -s "$@" && rm -f $@ && ln -s $? $@ + test -n '$?' -a -s '$@' && rm -f $@ && ln -s $? $@ nutscan_scan_ip_range_snmp.html: nutscan_scan_snmp.html - test -n "$?" -a -s "$@" && rm -f $@ && ln -s $? $@ + test -n '$?' -a -s '$@' && rm -f $@ && ln -s $? $@ nutscan_scan_ip_range_xml_http.html: nutscan_scan_xml_http_range.html - test -n "$?" -a -s "$@" && rm -f $@ && ln -s $? $@ + test -n '$?' -a -s '$@' && rm -f $@ && ln -s $? $@ nutscan_scan_ip_range_nut.html: nutscan_scan_nut.html - test -n "$?" -a -s "$@" && rm -f $@ && ln -s $? $@ + test -n '$?' -a -s '$@' && rm -f $@ && ln -s $? $@ nutscan_scan_ip_range_ipmi.html: nutscan_scan_ipmi.html - test -n "$?" -a -s "$@" && rm -f $@ && ln -s $? $@ + test -n '$?' -a -s '$@' && rm -f $@ && ln -s $? $@ nutscan_add_commented_option_to_device.html: nutscan_add_option_to_device.html - test -n "$?" -a -s "$@" && rm -f $@ && ln -s $? $@ + test -n '$?' -a -s '$@' && rm -f $@ && ln -s $? $@ # Drivers related manpages @@ -1594,7 +1594,7 @@ CLEANFILES = linkman-*.txt.tmp* # Note we can have a pre-built file from the tarball, sort of useful when # e.g. no man page building tools are locally available (we might not be -# able to render a new instance though). At least do not let "$@" confuse +# able to render a new instance though). At least do not let '$@' confuse # us into overwriting its instance in srcdir (if differs from builddir). linkman-driver-names.txt: Makefile @echo " GENERATE-LINKMAN $@" @@ -1809,7 +1809,7 @@ CLEANFILES += *.xml *.html *.pdf DOCBUILD_BEGIN = { \ if test -n "$${A2X_OUTDIR}" && test "$${A2X_OUTDIR}" != '.' ; then \ rm -rf "./$${A2X_OUTDIR}" || true ; \ - test -d "$@" && rm -rf "$@" || true ; \ + test -d '$@' && rm -rf '$@' || true ; \ _CWD="`pwd`" && (cd '$(abs_builddir)' && $(MKDIR_P) "$${_CWD}/$${A2X_OUTDIR}") || exit ; \ for F in $(LINKMAN_INCLUDE_GENERATED) ; do \ if [ -s "./$$F" ] ; then ln -f -s "../../$$F" "./$${A2X_OUTDIR}/" ; else \ @@ -1830,7 +1830,7 @@ DOCBUILD_BEGIN = { \ DOCBUILD_END = { \ if test -n "$${A2X_OUTDIR}" && test "$${A2X_OUTDIR}" != '.' ; then \ chmod -R u+w "./$${A2X_OUTDIR}" || true ; \ - test -d "$@" && rm -rf "$@" || true ; \ + test -d '$@' && rm -rf '$@' || true ; \ for F in $(LINKMAN_INCLUDE_GENERATED) ; do \ rm -f "./$${A2X_OUTDIR}/$$F" || true ; \ done ; \ @@ -1897,7 +1897,7 @@ if KNOWN_UNABLE_MANS .txt.$(MAN_SECTION_CMD_SYS) .txt-prepped.$(MAN_SECTION_CMD_SYS) \ .txt.$(MAN_SECTION_CMD_USR) .txt-prepped.$(MAN_SECTION_CMD_USR) \ .txt.$(MAN_SECTION_MISC) .txt-prepped.$(MAN_SECTION_MISC) : - @if [ -r "$@" -o -r "$(srcdir)/$(@F)" ] $(SRC_PREBUILT_CLAUSE); then \ + @if [ -r '$@' -o -r "$(srcdir)/$(@F)" ] $(SRC_PREBUILT_CLAUSE); then \ echo "Not (re)building $@ manual page, since 'asciidoc', 'xmllint' or 'xsltproc' were not functional (even though found)." ; \ else \ echo "Could not find prebuilt $@ manual page." ; \ @@ -1947,7 +1947,7 @@ endif !KNOWN_UNABLE_MANS else !HAVE_ASCIIDOC .txt.html: - @if [ -r "$@" -o -r "$(srcdir)/$(@F)" ] $(SRC_PREBUILT_CLAUSE); then \ + @if [ -r '$@' -o -r "$(srcdir)/$(@F)" ] $(SRC_PREBUILT_CLAUSE); then \ echo "Not (re)building $@ manual page (as HTML), since 'asciidoc', 'xmllint' or 'xsltproc' were not found." ; \ else \ echo "Could not find prebuilt $@ manual page (as HTML)." ; \ @@ -1956,7 +1956,7 @@ else !HAVE_ASCIIDOC fi .txt.$(MAN_SECTION_CMD_USR): - @if [ -r "$@" -o -r "$(srcdir)/$(@F)" ] $(SRC_PREBUILT_CLAUSE); then \ + @if [ -r '$@' -o -r "$(srcdir)/$(@F)" ] $(SRC_PREBUILT_CLAUSE); then \ echo "Not (re)building $@ manual page, since 'asciidoc', 'xmllint' or 'xsltproc' were not found." ; \ else \ echo "Could not find prebuilt $@ manual page." ; \ @@ -1965,7 +1965,7 @@ else !HAVE_ASCIIDOC fi .txt.$(MAN_SECTION_API): - @if [ -r "$@" -o -r "$(srcdir)/$(@F)" ] $(SRC_PREBUILT_CLAUSE); then \ + @if [ -r '$@' -o -r "$(srcdir)/$(@F)" ] $(SRC_PREBUILT_CLAUSE); then \ echo "Not (re)building $@ manual page, since 'asciidoc', 'xmllint' or 'xsltproc' were not found." ; \ else \ echo "Could not find prebuilt $@ manual page." ; \ @@ -1974,7 +1974,7 @@ else !HAVE_ASCIIDOC fi .txt.$(MAN_SECTION_CFG): - @if [ -r "$@" -o -r "$(srcdir)/$(@F)" ] $(SRC_PREBUILT_CLAUSE); then \ + @if [ -r '$@' -o -r "$(srcdir)/$(@F)" ] $(SRC_PREBUILT_CLAUSE); then \ echo "Not (re)building $@ manual page, since 'asciidoc', 'xmllint' or 'xsltproc' were not found." ; \ else \ echo "Could not find prebuilt $@ manual page." ; \ @@ -1983,7 +1983,7 @@ else !HAVE_ASCIIDOC fi .txt.$(MAN_SECTION_CMD_SYS): - @if [ -r "$@" -o -r "$(srcdir)/$(@F)" ] $(SRC_PREBUILT_CLAUSE); then \ + @if [ -r '$@' -o -r "$(srcdir)/$(@F)" ] $(SRC_PREBUILT_CLAUSE); then \ echo "Not (re)building $@ manual page, since 'asciidoc', 'xmllint' or 'xsltproc' were not found." ; \ else \ echo "Could not find prebuilt $@ manual page." ; \ @@ -1992,7 +1992,7 @@ else !HAVE_ASCIIDOC fi .txt.$(MAN_SECTION_MISC): - @if [ -r "$@" -o -r "$(srcdir)/$(@F)" ] $(SRC_PREBUILT_CLAUSE); then \ + @if [ -r '$@' -o -r "$(srcdir)/$(@F)" ] $(SRC_PREBUILT_CLAUSE); then \ echo "Not (re)building $@ manual page, since 'asciidoc', 'xmllint' or 'xsltproc' were not found." ; \ else \ echo "Could not find prebuilt $@ manual page." ; \ @@ -2063,7 +2063,7 @@ $(abs_top_builddir)/docs/man/.prep-src-docs: $(PREP_SRC) Makefile COUNT=0; \ for F in $(PREP_SRC) ; do \ case "$$F" in \ - /*) F="`echo "$$F" | sed "s#^$(abs_top_srcdir)/*#./#"`"; \ + /*) F="`echo \"$$F\" | sed 's#^$(abs_top_srcdir)/*#./#'`"; \ if test x"$${linkroot}" = x"$(abs_builddir)" ; then \ linkroot="$(abs_top_builddir)" ; \ cd "$(abs_top_builddir)" ; \ @@ -2105,7 +2105,7 @@ $(abs_top_builddir)/docs/man/.prep-src-docs: $(PREP_SRC) Makefile touch "$@.$$$$" ; \ while test -f "$@.working" -a "$$COUNT" -gt 0 ; do sleep 1; COUNT="`expr $$COUNT - 1`"; done ; \ touch "$@.working" ; \ - if test -n "`find "$@" -newer "$@.$$$$" 2>/dev/null`" ; then \ + if test -n "`find '$@' -newer \"$@.$$$$\" 2>/dev/null`" ; then \ rm -f "$@.$$$$" "$@.working" ; \ exit 0; \ fi ; \ @@ -2114,20 +2114,20 @@ $(abs_top_builddir)/docs/man/.prep-src-docs: $(PREP_SRC) Makefile linksrcroot="$(abs_srcdir)" ; \ for F in `echo $(PREP_SRC) | tr ' ' '\n' | sort -n | uniq` ; do \ case "$$F" in \ - /*) F="`echo "$$F" | sed "s#^$(abs_top_srcdir)/*#./#"`"; \ + /*) F="`echo \"$$F\" | sed 's#^$(abs_top_srcdir)/*#./#'`"; \ if test x"$${linkroot}" = x"$(abs_builddir)" ; then \ linkroot="$(abs_top_builddir)" ; \ linksrcroot="$(abs_top_srcdir)" ; \ cd "$(abs_top_builddir)" ; \ fi ;; \ - "$(srcdir)"/*) F="`echo "$$F" | sed 's#^$(srcdir)/*#./#'`" ;; \ + "$(srcdir)"/*) F="`echo \"$$F\" | sed 's#^$(srcdir)/*#./#'`" ;; \ */*) ;; \ *) \ linkroot="$(abs_builddir)" ; \ linksrcroot="$(abs_srcdir)" ; \ cd "$(abs_top_builddir)" ;; \ esac ; \ - D="`dirname "$$F"`" ; \ + D="`dirname \"$$F\"`" ; \ (cd '$(abs_builddir)' && $(MKDIR_P) "$${linkroot}/$$D") || { rm -f "$@.working" ; exit 1 ; } ; \ if test ! -f "$${linkroot}/$$F" && test ! -h "$${linkroot}/$$F" && test -s "$${linksrcroot}/$$F" ; then \ echo " LN '$${linksrcroot}/$$F' => '$${linkroot}/$$F' (PWD = '`pwd`')" >&2 ; \ @@ -2175,7 +2175,7 @@ $(abs_top_builddir)/docs/man/.prep-src-docs: $(PREP_SRC) Makefile COUNT="`expr $$COUNT + 1`" ; \ done ; \ fi ; \ - if test "$$COUNT" -gt 0 -o ! -f "$@" ; then touch "$@" ; fi + if test "$$COUNT" -gt 0 -o ! -f '$@' ; then touch '$@' ; fi @rm -f "$@.working" MAINTAINERCLEANFILES = Makefile.in .dirstamp @@ -2184,7 +2184,7 @@ clean-local: clean-man-pages $(AM_V_at)rm -rf tmp $(AM_V_at)for F in $(PREP_SRC) ; do \ case "$$F" in \ - /*) F="`echo "$$F" | sed "s#^$(abs_top_srcdir)/*#./#"`"; cd "$(abs_top_builddir)" ;; \ + /*) F="`echo \"$$F\" | sed 's#^$(abs_top_srcdir)/*#./#'`"; cd "$(abs_top_builddir)" ;; \ esac ; \ if test x"$(abs_srcdir)" != x"$(abs_builddir)" ; then \ if test -L "$$F" || test -h "$$F" ; then \ diff --git a/scripts/python/Makefile.am b/scripts/python/Makefile.am index 6627798374..e70abffd34 100644 --- a/scripts/python/Makefile.am +++ b/scripts/python/Makefile.am @@ -114,7 +114,7 @@ install-data-hook-app-locale-symlinks: @cd "$(DESTDIR)$(nutmonitordir)/app/locale" || exit ; \ $(DEF_TOUPPER) ; \ for L in fr it ru ; do \ - UTF8_NAME="$$L"_"`echo "$$L" | $${TOUPPER}`".UTF-8 || exit ; \ + UTF8_NAME="$$L"_"`echo \"$$L\" | $${TOUPPER}`".UTF-8 || exit ; \ UTF8_POFILE="$${L}/$${UTF8_NAME}.po" || exit ; \ UTF8_SUBDIR="$${UTF8_NAME}" || exit ; \ rm -f "$${UTF8_POFILE}" || true ; rm -f "$${UTF8_SUBDIR}" || true ; \ @@ -127,7 +127,7 @@ uninstall-hook-app-locale-symlinks: cd "$(DESTDIR)$(nutmonitordir)/app/locale" || exit ; \ $(DEF_TOUPPER) ; \ for L in fr it ru ; do \ - UTF8_NAME="$$L"_"`echo "$$L" | $${TOUPPER}`".UTF-8 || exit ; \ + UTF8_NAME="$$L"_"`echo \"$$L\" | $${TOUPPER}`".UTF-8 || exit ; \ UTF8_POFILE="$${L}/$${UTF8_NAME}.po" || exit ; \ UTF8_SUBDIR="$${UTF8_NAME}" || exit ; \ rm -f "$${UTF8_POFILE}" || RES=$$? ; \ @@ -197,17 +197,17 @@ ACT_MSGFMT = { \ app/locale/fr/LC_MESSAGES/NUT-Monitor.mo: $(abs_builddir)/app/locale/fr/LC_MESSAGES/NUT-Monitor.mo $(abs_builddir)/app/locale/fr/LC_MESSAGES/NUT-Monitor.mo: app/locale/fr/fr.po @$(MKDIR_P) "$(builddir)/app/locale/fr/LC_MESSAGES" - SRCFILE="$?"; OUTFILE="$@"; $(ACT_MSGFMT) + SRCFILE='$?'; OUTFILE='$@'; $(ACT_MSGFMT) app/locale/it/LC_MESSAGES/NUT-Monitor.mo: $(abs_builddir)/app/locale/it/LC_MESSAGES/NUT-Monitor.mo $(abs_builddir)/app/locale/it/LC_MESSAGES/NUT-Monitor.mo: app/locale/it/it.po @$(MKDIR_P) "$(builddir)/app/locale/it/LC_MESSAGES" - SRCFILE="$?"; OUTFILE="$@"; $(ACT_MSGFMT) + SRCFILE='$?'; OUTFILE='$@'; $(ACT_MSGFMT) app/locale/ru/LC_MESSAGES/NUT-Monitor.mo: $(abs_builddir)/app/locale/ru/LC_MESSAGES/NUT-Monitor.mo $(abs_builddir)/app/locale/ru/LC_MESSAGES/NUT-Monitor.mo: app/locale/ru/ru.po @$(MKDIR_P) "$(builddir)/app/locale/ru/LC_MESSAGES" - SRCFILE="$?"; OUTFILE="$@"; $(ACT_MSGFMT) + SRCFILE='$?'; OUTFILE='$@'; $(ACT_MSGFMT) endif HAVE_MSGFMT if WITH_NUT_MONITOR_PY2GTK2 @@ -239,8 +239,8 @@ sysbin_SCRIPTS = NUT-Monitor # Dummy redirector for /usr/bin/... presence NUT-Monitor: Makefile - @echo '#!/bin/sh' > "$@" - @echo 'exec "$(nutmonitordir)/app/NUT-Monitor" "$$@"' >> "$@" + @echo '#!/bin/sh' > '$@' + @echo 'exec "$(nutmonitordir)/app/NUT-Monitor" "$$@"' >> '$@' endif WITH_NUT_MONITOR @@ -282,17 +282,17 @@ SPELLCHECK_SRC = \ # paths when parsing the other makefile (e.g. MKDIR_P that may be defined # via expanded $(top_builddir)/install-sh): #%-spellchecked: % Makefile.am $(top_srcdir)/docs/Makefile.am $(abs_srcdir)/$(NUT_SPELL_DICT) -# +$(MAKE) -s -f $(top_builddir)/docs/Makefile $(AM_MAKEFLAGS) MKDIR_P="$(MKDIR_P)" builddir="$(builddir)" srcdir="$(srcdir)" top_builddir="$(top_builddir)" top_srcdir="$(top_srcdir)" SPELLCHECK_SRC_ONE="$<" SPELLCHECK_SRCDIR="$(srcdir)" SPELLCHECK_BUILDDIR="$(builddir)" $@ +# +$(MAKE) -s -f $(top_builddir)/docs/Makefile $(AM_MAKEFLAGS) MKDIR_P="$(MKDIR_P)" builddir="$(builddir)" srcdir="$(srcdir)" top_builddir="$(top_builddir)" top_srcdir="$(top_srcdir)" SPELLCHECK_SRC_ONE='$<' SPELLCHECK_SRCDIR="$(srcdir)" SPELLCHECK_BUILDDIR="$(builddir)" $@ # NOTE: Portable suffix rules do not allow prerequisites, so we shim them here # by a wildcard target in case the make implementation can put the two together. *-spellchecked: Makefile.am $(top_srcdir)/docs/Makefile.am $(abs_srcdir)/$(NUT_SPELL_DICT) .sample.sample-spellchecked: - +$(MAKE) -s -f $(top_builddir)/docs/Makefile $(AM_MAKEFLAGS) MKDIR_P="$(MKDIR_P)" builddir="$(builddir)" srcdir="$(srcdir)" top_builddir="$(top_builddir)" top_srcdir="$(top_srcdir)" SPELLCHECK_SRC_ONE="$<" SPELLCHECK_SRCDIR="$(srcdir)" SPELLCHECK_BUILDDIR="$(builddir)" $@ + +$(MAKE) -s -f $(top_builddir)/docs/Makefile $(AM_MAKEFLAGS) MKDIR_P="$(MKDIR_P)" builddir="$(builddir)" srcdir="$(srcdir)" top_builddir="$(top_builddir)" top_srcdir="$(top_srcdir)" SPELLCHECK_SRC_ONE='$<' SPELLCHECK_SRCDIR="$(srcdir)" SPELLCHECK_BUILDDIR="$(builddir)" $@ .in.in-spellchecked: - +$(MAKE) -s -f $(top_builddir)/docs/Makefile $(AM_MAKEFLAGS) MKDIR_P="$(MKDIR_P)" builddir="$(builddir)" srcdir="$(srcdir)" top_builddir="$(top_builddir)" top_srcdir="$(top_srcdir)" SPELLCHECK_SRC_ONE="$<" SPELLCHECK_SRCDIR="$(srcdir)" SPELLCHECK_BUILDDIR="$(builddir)" $@ + +$(MAKE) -s -f $(top_builddir)/docs/Makefile $(AM_MAKEFLAGS) MKDIR_P="$(MKDIR_P)" builddir="$(builddir)" srcdir="$(srcdir)" top_builddir="$(top_builddir)" top_srcdir="$(top_srcdir)" SPELLCHECK_SRC_ONE='$<' SPELLCHECK_SRCDIR="$(srcdir)" SPELLCHECK_BUILDDIR="$(builddir)" $@ spellcheck spellcheck-interactive spellcheck-sortdict: +$(MAKE) -f $(top_builddir)/docs/Makefile $(AM_MAKEFLAGS) MKDIR_P="$(MKDIR_P)" builddir="$(builddir)" srcdir="$(srcdir)" top_builddir="$(top_builddir)" top_srcdir="$(top_srcdir)" SPELLCHECK_SRC="$(SPELLCHECK_SRC)" SPELLCHECK_SRCDIR="$(srcdir)" SPELLCHECK_BUILDDIR="$(builddir)" $@ diff --git a/scripts/python/module/Makefile.am b/scripts/python/module/Makefile.am index b8e854580a..b8f1553dc9 100644 --- a/scripts/python/module/Makefile.am +++ b/scripts/python/module/Makefile.am @@ -62,7 +62,7 @@ PyNUTClient: .pypi-src # Tagged releases should only have three blocks of digits separated by dots upload publish: +@echo " PYPI Checking upload type for module version '$(NUT_SOURCE_GITREV_NUMERIC)'" ; \ - case x"`echo "$(NUT_SOURCE_GITREV_NUMERIC)" | tr -d '[0-9]'`" in \ + case x"`echo '$(NUT_SOURCE_GITREV_NUMERIC)' | tr -d '[0-9]'`" in \ x..) echo " PYPI ...release"; $(MAKE) $(AM_MAKEFLAGS) upload-pypi ;; \ x*) echo " PYPI ...testing"; $(MAKE) $(AM_MAKEFLAGS) upload-testpypi ;; \ esac @@ -70,10 +70,10 @@ upload publish: # README.txt is also a part of module standard expectations .pypi-src: test_nutclient.py.in PyNUT.py.in setup.py.in README.adoc Makefile $(top_srcdir)/LICENSE-GPL3 @echo " PYPI Generate PyPI module source" - @rm -rf $(GENERATED_SRC) "$@" + @rm -rf $(GENERATED_SRC) '$@' @mkdir -p PyNUTClient - @for S in "$(srcdir)"/*.py.in ; do \ - B="`basename "$${S}" .in`" ; \ + @for S in '$(srcdir)'/*.py.in ; do \ + B="`basename \"$${S}\" .in`" ; \ if test x"$${B}" = xsetup.py ; then \ if test ! -s "$${B}" ; then \ sed -e "s/[@]NUT_SOURCE_GITREV_NUMERIC[@]/$(NUT_SOURCE_GITREV_NUMERIC)/" < "$(srcdir)/$${B}.in" > "$${B}" || exit ; \ @@ -90,27 +90,27 @@ upload publish: cp -pf "$(srcdir)/README.adoc" README.txt || exit ; \ cp -pf "$(top_srcdir)/LICENSE-GPL3" . || exit ; \ echo "from . import PyNUT" > PyNUTClient/__init__.py || exit - @touch "$@" + @touch '$@' .pypi-tools-python: @echo " PYPI Checking that PYTHON_DEFAULT variable is defined and usable: $(PYTHON_DEFAULT)" @test -n "$(PYTHON_DEFAULT)" && command -v $(PYTHON_DEFAULT) - @touch "$@" + @touch '$@' .pypi-tools-dist-wheel: .pypi-tools-python @echo " PYPI Prepare PyPI tools to generate a distribution (wheel)" @$(PYTHON_DEFAULT) -m pip install wheel - @touch "$@" + @touch '$@' .pypi-tools-dist-build: .pypi-tools-python @echo " PYPI Prepare PyPI tools to generate a distribution (build)" @$(PYTHON_DEFAULT) -m pip install build - @touch "$@" + @touch '$@' .pypi-tools-tox: .pypi-tools-python @echo " PYPI Prepare Python multi-environment testing tools (tox)" @$(PYTHON_DEFAULT) -m pip install tox - @touch "$@" + @touch '$@' # Install via OS packaging or pip? # https://twine.readthedocs.io/en/stable/ @@ -119,21 +119,21 @@ upload publish: @$(PYTHON_DEFAULT) -m pip install twine @command -v twine @test -s $(HOME)/.pypirc - @touch "$@" + @touch '$@' # Using pypa/setuptools .pypi-dist: .pypi-src +@$(MAKE) $(AM_MAKEFLAGS) .pypi-dist-pip-build || \ $(MAKE) $(AM_MAKEFLAGS) .pypi-dist-obsolete || \ $(MAKE) $(AM_MAKEFLAGS) .pypi-dist-pip-wheel - @touch "$@" + @touch '$@' # The most modern approach as of 2023 .pypi-dist-pip-build: .pypi-tools-dist-build .pypi-src @echo " PYPI Generate PyPI module distribution (using 'build' module)" - @rm -rf $(GENERATED_DIST) "$@" + @rm -rf $(GENERATED_DIST) '$@' @$(PYTHON_DEFAULT) -m build --skip-dependency-check --no-isolation - @touch "$@" + @touch '$@' # Using "setup.py" directly causes warnings about its deprecation # While "pip" distribution generator also uses it internally, @@ -141,15 +141,15 @@ upload publish: # Does not support "sdist" though. Oh well. .pypi-dist-pip-wheel: .pypi-tools-dist-wheel .pypi-src @echo " PYPI Generate PyPI module distribution (using 'pip wheel'; note no 'sdist' here)" - @rm -rf $(GENERATED_DIST) "$@" + @rm -rf $(GENERATED_DIST) '$@' @$(PYTHON_DEFAULT) -m pip wheel --no-deps -w dist . - @touch "$@" + @touch '$@' .pypi-dist-obsolete: .pypi-tools-dist-wheel .pypi-src @echo " PYPI Generate PyPI module distribution (using setup.py directly)" - @rm -rf $(GENERATED_DIST) "$@" + @rm -rf $(GENERATED_DIST) '$@' @$(PYTHON_DEFAULT) setup.py sdist bdist_wheel - @touch "$@" + @touch '$@' # These need $HOME/.pypirc prepared with credentials (API tokens) from # https://pypi.org/manage/account/ and https://test.pypi.org/manage/account/ diff --git a/tests/Makefile.am b/tests/Makefile.am index 012eb4cf61..af017973e5 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -64,13 +64,13 @@ check_SCRIPTS += nutlogtest-nofail.sh CLEANFILES += nutlogtest-nofail.sh nutlogtest$(EXEEXT) nutlogtest nutlogtest-nofail.sh: nutlogtest$(EXEEXT) - @echo '#!/bin/sh' > $@ - @echo 'echo "WARNING: Your C library requires workarounds to print NULL values!" >&2' >> $@ - @echo 'echo "If nutlogtest below, or generally some NUT program, crashes with" >&2' >> $@ - @echo 'echo "a segmentation fault (especially during verbose debug) - that may be why" >&2' >> $@ - @echo 'SCRIPT_DIR="`dirname "$$0"`"' >> $@ - @echo '"$${SCRIPT_DIR}/nutlogtest" "$$@" || echo "nutlogtest FAILED but it was expected"' >> $@ - @chmod +x $@ + @echo '#!/bin/sh' > '$@' + @echo 'echo "WARNING: Your C library requires workarounds to print NULL values!" >&2' >> '$@' + @echo 'echo "If nutlogtest below, or generally some NUT program, crashes with" >&2' >> '$@' + @echo 'echo "a segmentation fault (especially during verbose debug) - that may be why" >&2' >> '$@' + @echo 'SCRIPT_DIR="`dirname \"$$0\"`"' >> '$@' + @echo '"$${SCRIPT_DIR}/nutlogtest" "$$@" || echo "nutlogtest FAILED but it was expected"' >> '$@' + @chmod +x '$@' # NOTE: Keep the line above empty! else !REQUIRE_NUT_STRARG @@ -91,7 +91,7 @@ LINKED_SOURCE_FILES = hidparser.c # NOTE: Not using "$<" due to a legacy Sun/illumos dmake bug with resolver # of dynamic vars, see e.g. https://man.omnios.org/man1/make#BUGS hidparser.c: $(top_srcdir)/drivers/hidparser.c - test -s "$@" || ln -s -f "$(top_srcdir)/drivers/hidparser.c" "$@" + test -s '$@' || ln -s -f "$(top_srcdir)/drivers/hidparser.c" '$@' if WITH_USB TESTS += getvaluetest getexponenttest-belkin-hid @@ -124,10 +124,10 @@ TESTS += gpiotest # NOTE: Not using "$<" due to a legacy Sun/illumos dmake bug with resolver # of dynamic vars, see e.g. https://man.omnios.org/man1/make#BUGS generic_gpio_libgpiod.c: $(top_srcdir)/drivers/generic_gpio_libgpiod.c - test -s "$@" || ln -s -f "$(top_srcdir)/drivers/generic_gpio_libgpiod.c" "$@" + test -s '$@' || ln -s -f "$(top_srcdir)/drivers/generic_gpio_libgpiod.c" '$@' generic_gpio_common.c: $(top_srcdir)/drivers/generic_gpio_common.c - test -s "$@" || ln -s -f "$(top_srcdir)/drivers/generic_gpio_common.c" "$@" + test -s '$@' || ln -s -f "$(top_srcdir)/drivers/generic_gpio_common.c" '$@' gpiotest_SOURCES = generic_gpio_utest.c generic_gpio_liblocal.c nodist_gpiotest_SOURCES = generic_gpio_libgpiod.c generic_gpio_common.c diff --git a/tools/Makefile.am b/tools/Makefile.am index 2982109b24..43931ebf42 100644 --- a/tools/Makefile.am +++ b/tools/Makefile.am @@ -101,19 +101,19 @@ $(GENERATED_SNMP_FILES): $(top_srcdir)/drivers/*-mib.c $(top_srcdir)/tools/nut-s # use files pre-generated in SRCDIR if those in BUILDDIR dir are empty # or did not appear. $(GENERATED_USB_OS_FILES): $(GENERATED_USB_FILES) - @test -s "$@" || echo "WARNING: GENERATED_USB_OS_FILES: '$@' is empty or missing; do not use this build to generate 'dist' tarballs" >&2 + @test -s '$@' || echo "WARNING: GENERATED_USB_OS_FILES: '$@' is empty or missing; do not use this build to generate 'dist' tarballs" >&2 @$(MKDIR_P) "$(@D)" - @if test ! -s "$@" ; then \ + @if test ! -s '$@' ; then \ if test x"$(top_srcdir)" != x"$(top_builddir)" ; then \ - RELNAME="`echo "$@" | sed 's,^$(top_builddir)/*,,'`" ; \ + RELNAME="`echo '$@' | sed 's,^$(top_builddir)/*,,'`" ; \ SRCNAME="$(top_srcdir)/$${RELNAME}" ; \ if test -s "$${SRCNAME}" ; then \ echo "WARNING: GENERATED_USB_OS_FILES: using '$${SRCNAME}' for '$@'" >&2 ; \ - cp "$${SRCNAME}" "$@" ; \ + cp "$${SRCNAME}" '$@' ; \ fi ; \ fi ; \ fi - @touch "$@" + @touch '$@' $(GENERATED_USB_FILES): $(top_srcdir)/drivers/*-hid.c $(top_srcdir)/drivers/*usb*.c $(top_srcdir)/drivers/nutdrv_qx.c $(top_srcdir)/tools/nut-usbinfo.pl @if perl -e 1; then \ From 844f98770eb35bcb9929ab66851f69fd4610a484 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Mon, 24 Nov 2025 15:48:20 +0000 Subject: [PATCH 789/805] NEWS.adoc: update about fixed back/double quoted shell scripting nuances [#3196] Signed-off-by: Jim Klimov --- NEWS.adoc | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/NEWS.adoc b/NEWS.adoc index 1652766201..2127bbc2d1 100644 --- a/NEWS.adoc +++ b/NEWS.adoc @@ -40,6 +40,12 @@ https://github.com/networkupstools/nut/milestone/12 to patterns defined in link:docs/nut-names.txt[] - common code: + * Generally improved shell script portability (including `Makefile.am` + embedded recipes) when mixing back-quotes and double-quotes. Namely, + the classic Solaris `ksh` implementation (also used in current versions + of Solaris and illumos based distributions) was strict about following + (an older revision of) the POSIX standard here, and some use-cases + misbehaved with our older script spelling. [issue #3196] * Introduced `setproctag()` and `getproctag()` (see examples in `upsmon`) to help track the log messages from massively-forking NUT daemons. [#3084] * Extended with plural `checkprocnames()` and `compareprocnames()`, From d9f114dc12a728a8bb7b8628da38f3da9367a6dd Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Tue, 25 Nov 2025 10:57:34 +0100 Subject: [PATCH 790/805] docs/man/snmp-ups-dmf.txt: fix an admonition block to contain a sentence Signed-off-by: Jim Klimov --- docs/man/snmp-ups-dmf.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/man/snmp-ups-dmf.txt b/docs/man/snmp-ups-dmf.txt index c2ba3fa313..145e911193 100644 --- a/docs/man/snmp-ups-dmf.txt +++ b/docs/man/snmp-ups-dmf.txt @@ -153,7 +153,7 @@ is present, the driver will load in alphabetic order all DMF files located in the specified path instead of the default path (e.g. from `/usr/local/share/nut/dmfsnmp.custom/*.dmf`). -NOTE: the `mibs` option, if specified and pointing to a specific MIB mapping, +NOTE: The `mibs` option, if specified and pointing to a specific MIB mapping, should refer to a mapping named in one of the ultimately loaded DMF files. REQUIREMENTS From 12d8236a8e308782043b8efaa284c7697a596a98 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Tue, 25 Nov 2025 12:29:33 +0100 Subject: [PATCH 791/805] m4/*lua.m4: revise shell script syntax with backticks and double-quotes [#3196] Signed-off-by: Jim Klimov --- m4/ax_lua.m4 | 2 +- m4/nut_check_liblua.m4 | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/m4/ax_lua.m4 b/m4/ax_lua.m4 index 9920c83451..2ca6c32ce9 100644 --- a/m4/ax_lua.m4 +++ b/m4/ax_lua.m4 @@ -202,7 +202,7 @@ AC_DEFUN([AX_PROG_LUA], m4_define_default([_AX_LUA_INTERPRETER_LIST], [lua lua5.3 lua53 lua5.2 lua52 lua5.1 lua51 lua50])], [ dnl Order preferred version first (e.g. avoid header version mismatch later) - _LUA_NODOT="`echo "$1" | sed 's,\.,,'`" + _LUA_NODOT="`echo \"$1\" | sed 's,\.,,'`" AS_IF([test x"$1" = x"${_LUA_NODOT}"], [_LUA_NODOT=''], dnl no-op [_LUA_NODOT="lua${_LUA_NODOT}"]) dnl Retry without the dot in version diff --git a/m4/nut_check_liblua.m4 b/m4/nut_check_liblua.m4 index 9595b66911..cbb309d2a4 100644 --- a/m4/nut_check_liblua.m4 +++ b/m4/nut_check_liblua.m4 @@ -38,7 +38,7 @@ if test -z "${nut_have_lua_seen}"; then lua54 lua5.4 lua-54 lua-5.4 \ lua55 lua5.5 lua-55 lua-5.5 \ ; do - LUA_VERSION="`$PKG_CONFIG --silence-errors --modversion "$V" 2>/dev/null`" + LUA_VERSION="`$PKG_CONFIG --silence-errors --modversion \"$V\" 2>/dev/null`" if test "$?" != "0" -o -z "${LUA_VERSION}"; then LUA_VERSION="none" else @@ -122,7 +122,7 @@ if test -z "${nut_have_lua_seen}"; then AX_REALPATH_LIB([${TOKEN}], [SOPATH_LIBLUA], []) AS_IF([test -n "${SOPATH_LIBLUA}" && test -s "${SOPATH_LIBLUA}"], [ AC_DEFINE_UNQUOTED([SOPATH_LIBLUA],["${SOPATH_LIBLUA}"],[Path to dynamic library on build system]) - SOFILE_LIBLUA="`basename "$SOPATH_LIBLUA"`" + SOFILE_LIBLUA="`basename \"$SOPATH_LIBLUA\"`" AC_DEFINE_UNQUOTED([SOFILE_LIBLUA],["${SOFILE_LIBLUA}"],[Base file name of dynamic library on build system]) break ]) From f9e9232bb569e38d579351afa903dcbc1f93d73f Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Tue, 25 Nov 2025 12:31:18 +0100 Subject: [PATCH 792/805] scripts/DMF/*.sh: revise shell script syntax with backticks and double-quotes [#3196] Signed-off-by: Jim Klimov --- scripts/DMF/dmfify-mib.sh | 8 ++++---- scripts/DMF/gen-legacy-mibfiles-list.sh | 10 +++++----- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/scripts/DMF/dmfify-mib.sh b/scripts/DMF/dmfify-mib.sh index 526b69038a..6f3234773a 100755 --- a/scripts/DMF/dmfify-mib.sh +++ b/scripts/DMF/dmfify-mib.sh @@ -6,7 +6,7 @@ # # Copyright (C) 2016 Michal Vyskocil # Copyright (C) 2016 - 2021 Jim Klimov -# Copyright (C) 2022 - 2024 Jim Klimov +# Copyright (C) 2022 - 2025 Jim Klimov # # A bashism, important for us here @@ -17,7 +17,7 @@ XSD_DMFSNMP_VERSION='1.0.0' XSD_DMFSNMP_XMLNS='http://www.networkupstools.org/dmf/snmp/snmp-ups' # Where to look for python scripts - same dir as this shell script -_SCRIPT_DIR="`cd $(dirname "$0") && pwd`" || \ +_SCRIPT_DIR="`cd $(dirname \"$0\") && pwd`" || \ _SCRIPT_DIR="./" # Fallback can fail [ -n "${ABS_OUTDIR-}" ] || ABS_OUTDIR="`pwd`" || exit [ -n "${ABS_BUILDDIR-}" ] || ABS_BUILDDIR="${ABS_OUTDIR}" @@ -111,7 +111,7 @@ if [ -n "${CC-}" ] ; then esac case "$CC" in /*) ;; - *) CC="`command -v "$CC"`" ;; + *) CC="`command -v \"$CC\"`" ;; esac case "$CC" in *" "*|*" "*) $CC --help >/dev/null 2>/dev/null && CC_WITH_ARGS=true;; @@ -150,7 +150,7 @@ if [ -n "${CPP-}" ] ; then esac case "$CPP" in /*) ;; - *) CPP="`command -v "$CPP"`" ;; + *) CPP="`command -v \"$CPP\"`" ;; esac case "$CPP" in # FIXME: Make CPP single-token and prepend args to CPPFLAGS (if any) diff --git a/scripts/DMF/gen-legacy-mibfiles-list.sh b/scripts/DMF/gen-legacy-mibfiles-list.sh index 8ce00141ea..50a33f719f 100755 --- a/scripts/DMF/gen-legacy-mibfiles-list.sh +++ b/scripts/DMF/gen-legacy-mibfiles-list.sh @@ -9,11 +9,11 @@ # Be portable - no bash etc... plain minimal shell. Tested with bash, dash, # busybox sh and ksh for good measure. # -# Copyright (C) 2016-2024 Jim Klimov +# Copyright (C) 2016-2025 Jim Klimov # # Relative to here we look for old sources -_SCRIPT_DIR="`cd $(dirname "$0") && pwd`" || \ +_SCRIPT_DIR="`cd $(dirname \"$0\") && pwd`" || \ _SCRIPT_DIR="./" # Fallback can fail # Note that technically it is not required that this is an ".in" template @@ -42,7 +42,7 @@ LEGACY_NUT_C_MIBS_LIST="" sort_LEGACY_NUT_C_MIBS() { [ -n "${LEGACY_NUT_C_MIBS_LIST}" ] || \ { LEGACY_NUT_C_MIBS_LIST="`list_LEGACY_NUT_C_MIBS`" && \ - LEGACY_NUT_C_MIBS_LIST="`echo "$LEGACY_NUT_C_MIBS_LIST" | sort | uniq`"; } \ + LEGACY_NUT_C_MIBS_LIST="`echo \"$LEGACY_NUT_C_MIBS_LIST\" | sort | uniq`"; } \ || return $? [ -n "${LEGACY_NUT_C_MIBS_LIST}" ] || return $? echo "$LEGACY_NUT_C_MIBS_LIST" @@ -58,10 +58,10 @@ print_makefile_LEGACY_NUT_DMF_RULES() { for CMIBBASE in `sort_LEGACY_NUT_C_MIBS` ; do case "$CMIBBASE" in - */*) CMIBFILE="$CMIBBASE"; CMIBBASE="`basename "$CMIBBASE"`" ;; + */*) CMIBFILE="$CMIBBASE"; CMIBBASE="`basename \"$CMIBBASE\"`" ;; *) CMIBFILE='$(abs_top_srcdir)/drivers/'"$CMIBBASE" ;; esac - DMFBASE="`basename "$CMIBBASE" .c`".dmf + DMFBASE="`basename \"$CMIBBASE\" .c`".dmf DMFSUBDIR='$(DMFSNMP_RES_SUBDIR)/' DMFFILE="${DMFSUBDIR}${DMFBASE}" case "$DMFBASE" in From 7e5208d0556ec58fee8ed6bc1602493b01ef0a76 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Tue, 25 Nov 2025 12:36:33 +0100 Subject: [PATCH 793/805] scripts/subdriver/gen-snmp-subdriver.sh: generate_DMF(): revise shell script syntax with backticks and double-quotes; convert to use TOUPPER/TOLOWER detected methods [#3196] Signed-off-by: Jim Klimov --- scripts/subdriver/gen-snmp-subdriver.sh | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/scripts/subdriver/gen-snmp-subdriver.sh b/scripts/subdriver/gen-snmp-subdriver.sh index 16d2dd82fb..b2fb87294e 100755 --- a/scripts/subdriver/gen-snmp-subdriver.sh +++ b/scripts/subdriver/gen-snmp-subdriver.sh @@ -335,13 +335,13 @@ EOF generate_DMF() { # create file names - LDRIVER="`echo "$DRIVER" | tr A-Z a-z`" - UDRIVER="`echo "$DRIVER" | tr a-z A-Z`" + LDRIVER="`echo \"$DRIVER\" | $TOLOWER`" + UDRIVER="`echo \"$DRIVER\" | $TOUPPER`" DMFFILE="$LDRIVER-mib.dmf" # but replace with underscores for the structures and defines - LDRIVER="`echo "$LDRIVER" | tr - _`" - UDRIVER="`echo "$UDRIVER" | tr - _`" + LDRIVER="`echo \"$LDRIVER\" | tr - _`" + UDRIVER="`echo \"$UDRIVER\" | tr - _`" # generate DMF file echo "Creating $DMFFILE" @@ -398,13 +398,13 @@ generate_DMF() { printf "\t\t\t\n" >> "${DMFFILE}" printf "\t\t\t\n" >> "${DMFFILE}" printf "\t\t\n\t\t-->\n" >> "${DMFFILE}" - + # extract OID string paths, one by one LINENB="0" while IFS= read -r line; do LINENB="`expr $LINENB + 1`" FULL_STR_OID="$line" - STR_OID="`echo "$line" | cut -d'.' -f1`" + STR_OID="`echo \"$line\" | cut -d'.' -f1`" echo $line | grep STRING > /dev/null if [ $? -eq 0 ]; then ST_FLAG_TYPE="ST_FLAG_STRING" @@ -414,7 +414,7 @@ generate_DMF() { SU_INFOSIZE="1" fi # get the matching numeric OID - NUM_OID="`sed -n "${LINENB}p" "${NUMWALKFILE}" | cut -d' ' -f1`" + NUM_OID="`sed -n \"${LINENB}p\" \"${NUMWALKFILE}\" | cut -d' ' -f1`" printf "\t\t\n\t\t\n" done < "${STRWALKFILE}" >> "${DMFFILE}" From 78603d5d2ec6bad07897c6be2b00672398182d50 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Tue, 25 Nov 2025 12:43:31 +0100 Subject: [PATCH 794/805] scripts/DMF/Makefile.am: revise shell script syntax with backticks and double-quotes; single-quote Make variable expansions into shell [#3196] Signed-off-by: Jim Klimov --- scripts/DMF/Makefile.am | 58 ++++++++++++++++++++--------------------- 1 file changed, 29 insertions(+), 29 deletions(-) diff --git a/scripts/DMF/Makefile.am b/scripts/DMF/Makefile.am index c91065c4ce..de81fd1f7e 100644 --- a/scripts/DMF/Makefile.am +++ b/scripts/DMF/Makefile.am @@ -182,15 +182,15 @@ EXTRA_DIST += $(DMFTEST_SRC) # of dynamic vars, see e.g. https://man.omnios.org/man1/make#BUGS LINKED_SOURCE_FILES = dmfsnmp.c dmfsnmp.c : $(top_srcdir)/common/dmfsnmp.c - @test -s "$@" || ln -s -f "$(top_srcdir)/common/dmfsnmp.c" "$@" + @test -s '$@' || ln -s -f "$(top_srcdir)/common/dmfsnmp.c" '$@' LINKED_SOURCE_FILES += dmfcore.c dmfcore.c : $(top_srcdir)/common/dmfcore.c - @test -s "$@" || ln -s -f "$(top_srcdir)/common/dmfcore.c" "$@" + @test -s '$@' || ln -s -f "$(top_srcdir)/common/dmfcore.c" '$@' LINKED_SOURCE_FILES += alist.c alist.c : $(top_srcdir)/common/alist.c - @test -s "$@" || ln -s -f "$(top_srcdir)/common/alist.c" "$@" + @test -s '$@' || ln -s -f "$(top_srcdir)/common/alist.c" '$@' CLEANFILES += $(noinst_PROGRAMS) \ @@ -294,12 +294,12 @@ if WITH_REGENERATE_DMF_SNMP CPPFLAGS="$(DMFTOOLS_CPPFLAGS) $(CPPFLAGS_DMF) $(AM_CPPFLAGS)" \ ABS_BUILDDIR="$(abs_builddir)" \ DEBUG="$(V)" \ - $(abs_srcdir)/dmfify-mib.sh --skip-sanity-check "$$CMIBFILE" "$@" \ + $(abs_srcdir)/dmfify-mib.sh --skip-sanity-check "$$CMIBFILE" '$@' \ ) || exit; \ fi ; \ - if test ! -s "$@" -a ! -s "$(abs_top_builddir)/$@" -a ! -s "$(abs_top_srcdir)/$@"; then \ + if test ! -s '$@' -a ! -s "$(abs_top_builddir)/$@" -a ! -s "$(abs_top_srcdir)/$@"; then \ echo "ERROR: Generated file $@ is missing" >&2; \ - ls -la "$@" "$(abs_top_builddir)/$@" "$(abs_top_srcdir)/$@"; \ + ls -la '$@' "$(abs_top_builddir)/$@" "$(abs_top_srcdir)/$@"; \ exit 2; \ fi; \ ) @@ -324,7 +324,7 @@ else !WITH_REGENERATE_DMF_SNMP DMFGEN_CMD = ( \ echo " SKIP Generation of $@ from $$CMIBFILE not enabled by the configure script (--with-dmfsnmp-regenerate option)"; \ rm -f $(DMFGEN_SANITY_VALIDATED); \ - if test ! -s "$@" -a ! -s "$(abs_srcdir)/$@" -a ! -s "$(abs_top_builddir)/$@" -a ! -s "$(abs_top_srcdir)/$@"; then \ + if test ! -s '$@' -a ! -s "$(abs_srcdir)/$@" -a ! -s "$(abs_top_builddir)/$@" -a ! -s "$(abs_top_srcdir)/$@"; then \ echo "ERROR: Distributed file $@ is missing" >&2; exit 2; \ fi; \ ) @@ -354,7 +354,7 @@ DMFLNK_CMD = ( \ test -f "$$DMFFILE_DIR$$DMFFILE" || { echo "`date`: 2. File '$$DMFFILE_DIR$$DMFFILE' not found yet, sleeping a bit" >&2; sleep 10 ; sync; } ; \ test -f "$$DMFFILE_DIR$$DMFFILE" || { echo "`date`: 3. File '$$DMFFILE_DIR$$DMFFILE' not found yet, sleeping a bit" >&2; sleep 15 ; sync; } ; \ if [ x"$(V)" = x1 ] ; then echo "BEFORE:" ; ls -la "$$DMFFILE_DIR$$DMFFILE" "$$DMFLINK" || true; fi ; \ - DMFLINK_DIR="`dirname "$$DMFLINK"`"; \ + DMFLINK_DIR="`dirname \"$$DMFLINK\"`"; \ test -d "$$DMFLINK_DIR" -a -w "$$DMFLINK_DIR" || $(MKDIR_P) "$$DMFLINK_DIR" || exit ; \ test -f "$$DMFFILE_DIR$$DMFFILE" || { echo "File '$$DMFFILE_DIR$$DMFFILE' not found" >&2; exit 22; } ; \ if [ x"$(V)" = x1 ] ; then echo "$(LN_S_R) '$$DMFFILE_DIR$$DMFFILE' '$$DMFLINK' || exit"; fi ; \ @@ -384,7 +384,7 @@ $(abs_builddir)/$(DMFSNMP_RES_SUBDIR)/.uptodate: $(dmfsnmpres_DMFS) else \ echo "INFO: Build was done out-of-tree, so will copy files from source dir if needed (if nothing got generated)"; \ for F in "$(abs_srcdir)/$(DMFSNMP_RES_SUBDIR)/"*.dmf ; do \ - B="`basename "$$F"`"; \ + B="`basename \"$$F\"`"; \ case "$$B" in \ '*.dmf') exit 0 ;; \ S*|K*) ;; \ @@ -397,13 +397,13 @@ $(abs_builddir)/$(DMFSNMP_RES_SUBDIR)/.uptodate: $(dmfsnmpres_DMFS) esac ; \ done; \ fi - touch "$@" + touch '$@' $(DMFSNMP_SUBDIR)/.uptodate: +$(MAKE) $(AM_MAKEFLAGS) $(abs_builddir)/$(DMFSNMP_SUBDIR)/.uptodate $(abs_builddir)/$(DMFSNMP_SUBDIR)/.uptodate: $(LEGACY_NUT_DMF_SYMLINKS) - touch "$@" + touch '$@' # The recipe assumes we have separate opening and closing lines in the DMF file # just generated by reindexer (the "\n" and "" lines) and a @@ -428,21 +428,21 @@ $(abs_top_builddir)/scripts/DMF/$(DMFNUTSCAN_RES_SUBDIR)/dmfnutscan-snmp.dmf: $( grep ' "$@" + ) > '$@' @LANG=C; LC_ALL=C; TZ=UTC; export LANG LC_ALL TZ; \ sort "$@.tmp" | egrep -v '^$$' | uniq > "$@.tmp1" ; \ - sort "$@" | egrep -v '^$$' | uniq > "$@.tmp2" ; \ + sort '$@' | egrep -v '^$$' | uniq > "$@.tmp2" ; \ diff "$@.tmp1" "$@.tmp2" >/dev/null \ || { echo "FAILED to sort generated $@ without losses!" >&2; \ rm -f "$@.tmp"* ; exit 1; } ; exit 0 rm -f "$@.tmp"* - test -s "$@" + test -s '$@' else !WITH_REGENERATE_DMF_NUTSCAN $(abs_top_builddir)/scripts/DMF/$(DMFNUTSCAN_RES_SUBDIR)/dmfnutscan-snmp.dmf: $(DMFNUTSCAN_DEPS) @echo " SKIP Generation of $@ not enabled by the configure script (--with-dmfnutscan-regenerate option)" - @if test ! -s "$@" -a ! -s "$(abs_srcdir)/$(DMFNUTSCAN_RES_SUBDIR)/$(@F)"; then echo "ERROR: Distributed file $@ is missing" >&2; exit 2; fi; true + @if test ! -s '$@' -a ! -s "$(abs_srcdir)/$(DMFNUTSCAN_RES_SUBDIR)/$(@F)"; then echo "ERROR: Distributed file $@ is missing" >&2; exit 2; fi; true @test -d "$(@D)" -a -w "$(@D)" || $(MKDIR_P) "$(@D)" @if [ "`cd $(abs_builddir) && pwd`" != "`cd $(abs_srcdir) && pwd`" ]; then \ F="$(abs_srcdir)/$(DMFNUTSCAN_RES_SUBDIR)/$(@F)"; \ @@ -453,15 +453,15 @@ $(abs_top_builddir)/scripts/DMF/$(DMFNUTSCAN_RES_SUBDIR)/dmfnutscan-snmp.dmf: $( cp -f "$$F" "$$N" || { ls -la "$$F" "$$N" ; exit 1; } ; \ fi; \ fi - test -s "$@" + test -s '$@' endif !WITH_REGENERATE_DMF_NUTSCAN $(DMFNUTSCAN_SYMLINK): $(abs_top_builddir)/scripts/DMF/$(DMFNUTSCAN_RES_SUBDIR)/dmfnutscan-snmp.dmf - @DMFFILE="$(DMFNUTSCAN_RES_SUBDIR)/dmfnutscan-snmp.dmf"; DMFLINK="$@"; $(DMFLNK_CMD) + @DMFFILE="$(DMFNUTSCAN_RES_SUBDIR)/dmfnutscan-snmp.dmf"; DMFLINK='$@'; $(DMFLNK_CMD) $(INSTALL_NUT_DMFNUTSCAN_SYMLINK): $(INSTALL_NUT_DMFNUTSCAN_FILE) - @DMFFILE="$(INSTALL_NUT_DMFNUTSCAN_FILE)"; DMFLINK="$@"; $(DMFLNK_CMD) + @DMFFILE="$(INSTALL_NUT_DMFNUTSCAN_FILE)"; DMFLINK='$@'; $(DMFLNK_CMD) $(DMFNUTSCAN_RES_SUBDIR)/.uptodate: +$(MAKE) $(AM_MAKEFLAGS) $(abs_builddir)/$(DMFNUTSCAN_RES_SUBDIR)/.uptodate @@ -469,7 +469,7 @@ $(DMFNUTSCAN_RES_SUBDIR)/.uptodate: $(abs_builddir)/$(DMFNUTSCAN_RES_SUBDIR)/.uptodate: $(abs_top_builddir)/scripts/DMF/$(DMFNUTSCAN_RES_SUBDIR)/dmfnutscan-snmp.dmf @echo "DMFNUTSCAN_RES_SUBDIR is now up to date" >&2 @test -d "$(@D)" -a -w "$(@D)" || $(MKDIR_P) "$(@D)" - touch "$@" + touch '$@' $(DMFNUTSCAN_SUBDIR)/.uptodate: +$(MAKE) $(AM_MAKEFLAGS) $(abs_builddir)/$(DMFNUTSCAN_SUBDIR)/.uptodate @@ -477,7 +477,7 @@ $(DMFNUTSCAN_SUBDIR)/.uptodate: $(abs_builddir)/$(DMFNUTSCAN_SUBDIR)/.uptodate: $(DMFNUTSCAN_SYMLINK) @echo "DMFNUTSCAN_SUBDIR is now up to date" >&2 @test -d "$(@D)" -a -w "$(@D)" || $(MKDIR_P) "$(@D)" - touch "$@" + touch '$@' # Validation requires xmllint, which we have if we succeed with asciidoc usage # TODO: Maybe per-DMF *.dmf.validated files would be better? @@ -510,7 +510,7 @@ else !WITH_VALIDATE_DMF_SNMP DMFLINT_CMD = ( \ test -d "$(@D)" -a -w "$(@D)" || $(MKDIR_P) "$(@D)" || exit ; \ echo " SKIP Validation of $@ not enabled by the configure script ($$DMFLINT_OPTION option)" ; \ - echo "VALIDATION-SKIPPED" > "$@" ; \ + echo "VALIDATION-SKIPPED" > '$@' ; \ ) endif !WITH_VALIDATE_DMF_SNMP @@ -727,7 +727,7 @@ testdata-lua/.uptodate: $(abs_builddir)/testdata-lua/.uptodate: $(LUA_EXAMPLE_DMFS) @echo "testdata-lua is now up to date" >&2 @test -d "$(@D)" -a -w "$(@D)" || $(MKDIR_P) "$(@D)" - touch "$@" + touch '$@' testdata-fun/.uptodate: +$(MAKE) $(AM_MAKEFLAGS) $(abs_builddir)/testdata-fun/.uptodate @@ -735,7 +735,7 @@ testdata-fun/.uptodate: $(abs_builddir)/testdata-fun/.uptodate: $(FUN_EXAMPLE_DMFS) @echo "testdata-fun is now up to date" >&2 @test -d "$(@D)" -a -w "$(@D)" || $(MKDIR_P) "$(@D)" - touch "$@" + touch '$@' if WITH_VALIDATE_DMF_SNMP @@ -745,7 +745,7 @@ $(abs_builddir)/testdata-lua/.validated: $(abs_builddir)/testdata-lua/.uptodate echo " XMLLINT-LUA $$F"; \ $(XMLLINT) --noout --schema $(abs_srcdir)/dmfsnmp.xsd "$$F" || exit; \ done - touch "$@" + touch '$@' $(abs_builddir)/testdata-fun/.validated: $(abs_builddir)/testdata-fun/.uptodate test -d "$(@D)" -a -w "$(@D)" || $(MKDIR_P) "$(@D)" @@ -753,14 +753,14 @@ $(abs_builddir)/testdata-fun/.validated: $(abs_builddir)/testdata-fun/.uptodate echo " XMLLINT-LUA $$F"; \ $(XMLLINT) --noout --schema $(abs_srcdir)/dmfsnmp.xsd "$$F" || exit; \ done - touch "$@" + touch '$@' else !WITH_VALIDATE_DMF_SNMP $(abs_builddir)/testdata-lua/.validated $(abs_builddir)/testdata-fun/.validated: test -d "$(@D)" -a -w "$(@D)" || $(MKDIR_P) "$(@D)" @echo " SKIP Validation of $@ not enabled by the configure script (--with-dmfsnmp-validate option)" - @echo "VALIDATION-SKIPPED" > "$@" + @echo "VALIDATION-SKIPPED" > '$@' endif !WITH_VALIDATE_DMF_SNMP @@ -813,17 +813,17 @@ EXTRA_DIST += $(SPELLCHECK_SRC) # paths when parsing the other makefile (e.g. MKDIR_P that may be defined # via expanded $(top_builddir)/install-sh): #%-spellchecked: % Makefile.am $(top_srcdir)/docs/Makefile.am $(abs_srcdir)/$(NUT_SPELL_DICT) -# +$(MAKE) $(AM_MAKEFLAGS) -s -f $(top_builddir)/docs/Makefile MKDIR_P="$(MKDIR_P)" builddir="$(builddir)" srcdir="$(srcdir)" top_builddir="$(top_builddir)" top_srcdir="$(top_srcdir)" SPELLCHECK_SRC_ONE="$<" SPELLCHECK_SRCDIR="$(srcdir)" SPELLCHECK_BUILDDIR="$(builddir)" $@ +# +$(MAKE) $(AM_MAKEFLAGS) -s -f $(top_builddir)/docs/Makefile MKDIR_P="$(MKDIR_P)" builddir="$(builddir)" srcdir="$(srcdir)" top_builddir="$(top_builddir)" top_srcdir="$(top_srcdir)" SPELLCHECK_SRC_ONE='$<' SPELLCHECK_SRCDIR="$(srcdir)" SPELLCHECK_BUILDDIR="$(builddir)" $@ # NOTE: Portable suffix rules do not allow prerequisites, so we shim them here # by a wildcard target in case the make implementation can put the two together. *-spellchecked: Makefile.am $(top_srcdir)/docs/Makefile.am $(abs_srcdir)/$(NUT_SPELL_DICT) .sample.sample-spellchecked: - +$(MAKE) $(AM_MAKEFLAGS) -s -f $(top_builddir)/docs/Makefile MKDIR_P="$(MKDIR_P)" builddir="$(builddir)" srcdir="$(srcdir)" top_builddir="$(top_builddir)" top_srcdir="$(top_srcdir)" SPELLCHECK_SRC_ONE="$<" SPELLCHECK_SRCDIR="$(srcdir)" SPELLCHECK_BUILDDIR="$(builddir)" $@ + +$(MAKE) $(AM_MAKEFLAGS) -s -f $(top_builddir)/docs/Makefile MKDIR_P="$(MKDIR_P)" builddir="$(builddir)" srcdir="$(srcdir)" top_builddir="$(top_builddir)" top_srcdir="$(top_srcdir)" SPELLCHECK_SRC_ONE='$<' SPELLCHECK_SRCDIR="$(srcdir)" SPELLCHECK_BUILDDIR="$(builddir)" $@ .in.in-spellchecked: - +$(MAKE) $(AM_MAKEFLAGS) -s -f $(top_builddir)/docs/Makefile MKDIR_P="$(MKDIR_P)" builddir="$(builddir)" srcdir="$(srcdir)" top_builddir="$(top_builddir)" top_srcdir="$(top_srcdir)" SPELLCHECK_SRC_ONE="$<" SPELLCHECK_SRCDIR="$(srcdir)" SPELLCHECK_BUILDDIR="$(builddir)" $@ + +$(MAKE) $(AM_MAKEFLAGS) -s -f $(top_builddir)/docs/Makefile MKDIR_P="$(MKDIR_P)" builddir="$(builddir)" srcdir="$(srcdir)" top_builddir="$(top_builddir)" top_srcdir="$(top_srcdir)" SPELLCHECK_SRC_ONE='$<' SPELLCHECK_SRCDIR="$(srcdir)" SPELLCHECK_BUILDDIR="$(builddir)" $@ spellcheck spellcheck-interactive spellcheck-sortdict: +$(MAKE) $(AM_MAKEFLAGS) -f $(top_builddir)/docs/Makefile MKDIR_P="$(MKDIR_P)" builddir="$(builddir)" srcdir="$(srcdir)" top_builddir="$(top_builddir)" top_srcdir="$(top_srcdir)" SPELLCHECK_SRC="$(SPELLCHECK_SRC)" SPELLCHECK_SRCDIR="$(srcdir)" SPELLCHECK_BUILDDIR="$(builddir)" $@ From d102b723d4355875dd417a7f6cd6f51ec2d7846e Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Tue, 25 Nov 2025 12:55:45 +0100 Subject: [PATCH 795/805] drivers/snmp-ups.c: make use of upsdrv_tweak_prognames() to alias either "snmp-ups-dmf" or "snmp-ups-old" depending on binary build type [#3101] Signed-off-by: Jim Klimov --- drivers/snmp-ups.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/drivers/snmp-ups.c b/drivers/snmp-ups.c index a63a962210..21cba1e282 100644 --- a/drivers/snmp-ups.c +++ b/drivers/snmp-ups.c @@ -583,10 +583,16 @@ void upsdrv_help(void) /* optionally tweak prognames[] entries */ void upsdrv_tweak_prognames(void) { +#if WITH_DMFMIB + char *alias = "snmp-ups-dmf"; +#else + char *alias = "snmp-ups-old"; +#endif /* WITH_DMFMIB */ + upsdebugx(1, "entering %s", __func__); /* If executed via an accepted alias, move it down in prognames[] stack */ - if (!strcmp(prognames[0], "snmp-ups-old")) { + if (!strcmp(prognames[0], alias)) { upsdebugx(3, "%s: marking program name '%s' as an alias for '%s'", __func__, prognames[0], "snmp-ups"); @@ -602,11 +608,11 @@ void upsdrv_tweak_prognames(void) } else { if (!strcmp(prognames[0], "snmp-ups")) { upsdebugx(3, "%s: marking program name '%s' as an alias for '%s'", - __func__, "snmp-ups-old", prognames[0]); + __func__, alias, prognames[0]); if (prognames_should_free[1]) free((char*)prognames[1]); - prognames[1] = xstrdup("snmp-ups-old"); + prognames[1] = xstrdup(alias); prognames_should_free[1] = 1; } } From 7d6673f811efaadd0b2e83c12569064e711f3d16 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Tue, 25 Nov 2025 13:01:16 +0100 Subject: [PATCH 796/805] Drop legacy Jenkinsfile from FTY/DMF branch Signed-off-by: Jim Klimov --- Jenkinsfile | 700 ---------------------------------------------------- 1 file changed, 700 deletions(-) delete mode 100644 Jenkinsfile diff --git a/Jenkinsfile b/Jenkinsfile deleted file mode 100644 index 4516d92dbc..0000000000 --- a/Jenkinsfile +++ /dev/null @@ -1,700 +0,0 @@ -@Library('etn-ipm2-jenkins') _ - -pipeline { - agent { - label infra.getAgentLabels() - } - parameters { - // Use DEFAULT_DEPLOY_BRANCH_PATTERN and DEFAULT_DEPLOY_JOB_NAME if - // defined in this jenkins setup -- in Jenkins Management Web-GUI - // see Configure System / Global properties / Environment variables - // Default (if unset) is empty => no deployment attempt after good test - // See zproject Jenkinsfile-deploy.example for an example deploy job. - // TODO: Try to marry MultiBranchPipeline support with pre-set defaults - // directly in MultiBranchPipeline plugin, or mechanism like Credentials, - // or a config file uploaded to master for all jobs or this job, see - // https://jenkins.io/doc/pipeline/examples/#configfile-provider-plugin - string ( - defaultValue: '${DEFAULT_DEPLOY_BRANCH_PATTERN}', - description: 'Regular expression of branch names for which a deploy action would be attempted after a successful build and test; leave empty to not deploy. Reasonable value is ^(master|release/.*|feature/*)$', - name : 'DEPLOY_BRANCH_PATTERN') - string ( - defaultValue: '${DEFAULT_DEPLOY_JOB_NAME}', - description: 'Name of your job that handles deployments and should accept arguments: DEPLOY_GIT_URL DEPLOY_GIT_BRANCH DEPLOY_GIT_COMMIT -- and it is up to that job what to do with this knowledge (e.g. git archive + push to packaging); leave empty to not deploy', - name : 'DEPLOY_JOB_NAME') - booleanParam ( - defaultValue: true, - description: 'If the deployment is done, should THIS job wait for it to complete and include its success or failure as the build result (true), or should it schedule the job and exit quickly to free up the executor (false)', - name: 'DEPLOY_REPORT_RESULT') - booleanParam ( - defaultValue: true, - description: 'Publish as an archive a "dist" tarball from a build with docs in this run? (Note: corresponding tools are required in the build environment; enabling this enforces DO_BUILD_DOCS too)', - name: 'DO_DIST_DOCS') - booleanParam ( - defaultValue: true, - description: 'Attempt nut-driver-enumerator-test in this run?', - name: 'DO_TEST_NDE') - booleanParam ( - defaultValue: true, - description: 'Attempt "make check" in this run?', - name: 'DO_TEST_CHECK') - booleanParam ( - defaultValue: false, - description: 'Attempt "make memcheck" in this run?', - name: 'DO_TEST_MEMCHECK') - booleanParam ( - defaultValue: false, - description: 'Attempt "make distcheck" in this run?', - name: 'DO_TEST_DISTCHECK') - booleanParam ( - defaultValue: true, - description: 'Attempt "make distcheck-dmf-all-yes" in this run?', - name: 'DO_TEST_DISTCHECK_DMF_ALL_YES') - booleanParam ( - defaultValue: false, - description: 'Attempt a "make install" check in this run?', - name: 'DO_TEST_INSTALL') - string ( - defaultValue: "`pwd`/tmp/_inst", - description: 'If attempting a "make install" check in this run, what DESTDIR to specify? (absolute path, defaults to "BUILD_DIR/tmp/_inst")', - name: 'USE_TEST_INSTALL_DESTDIR') - booleanParam ( - defaultValue: true, - description: 'Attempt "cppcheck" analysis before this run? (Note: corresponding tools are required in the build environment)', - name: 'DO_CPPCHECK') - booleanParam ( - defaultValue: true, - description: 'Require that there are no files not discovered changed/untracked via .gitignore after builds and tests?', - name: 'CI_REQUIRE_GOOD_GITIGNORE') - booleanParam ( - defaultValue: true, - description: 'Run code analysis (applies for certain branches)?', - name: 'DO_COVERITY') - string ( - defaultValue: "30", - description: 'When running tests, use this timeout (in minutes; be sure to leave enough for double-job of a distcheck too)', - name: 'USE_TEST_TIMEOUT') - booleanParam ( - defaultValue: true, - description: 'When using temporary subdirs in build/test workspaces, wipe them after successful builds?', - name: 'DO_CLEANUP_AFTER_BUILD') - booleanParam ( - defaultValue: true, - description: 'When using temporary subdirs in build/test workspaces, wipe them after the whole job is done successfully?', - name: 'DO_CLEANUP_AFTER_JOB') - booleanParam ( - defaultValue: true, - description: 'When using temporary subdirs in build/test workspaces, wipe them after the whole job is done unsuccessfully (failed)? Note this would not allow postmortems on CI server, but would conserve its disk space.', - name: 'DO_CLEANUP_AFTER_FAILED_JOB') - } - triggers { - pollSCM 'H/5 * * * *' - } - - // Jenkins tends to reschedule jobs that have not yet completed if they took - // too long, maybe this happens in combination with polling. Either way, if - // the server gets into this situation, the snowball of same builds grows as - // the build system lags more and more. Let the devs avoid it in a few ways. - options { - disableConcurrentBuilds() - // Jenkins community suggested that instead of a default checkout, we can do - // an explicit step for that. It is expected that either way Jenkins "should" - // record that a particular commit is being processed, but the explicit ways - // might work better. In either case it honors SCM settings like refrepo if - // set up in the Pipeline or MultiBranchPipeline job. - skipDefaultCheckout() - } -// Note: your Jenkins setup may benefit from similar setup on side of agents: -// PATH="/usr/lib64/ccache:/usr/lib/ccache:/usr/bin:/bin:${PATH}" - - stages { - stage ('pre-clean') { - steps { - milestone ordinal: 20, label: "${env.JOB_NAME}@${env.BRANCH_NAME}" - dir("tmp") { - sh 'if [ -s Makefile ]; then make -k distclean || true ; fi' - sh 'chmod -R u+w .' - deleteDir() - } - sh 'rm -f ccache.log cppcheck.xml' - } - } - - stage ('git') { - steps { - retry(3) { - checkout scm - } - milestone ordinal: 30, label: "${env.JOB_NAME}@${env.BRANCH_NAME}" - } - } - - stage ('prepare') { - steps { - sh './autogen.sh' - stash (name: 'prepped', includes: '**/*', excludes: '**/cppcheck.xml') - milestone ordinal: 40, label: "${env.JOB_NAME}@${env.BRANCH_NAME}" - } - } - - stage ('configure') { - steps { - sh 'CCACHE_BASEDIR="`pwd`" ; export CCACHE_BASEDIR; ./configure --with-neon=yes --with-lua=yes --with-snmp=yes --with-snmp_dmf_lua=yes --with-dev --with-doc=html-single=auto,man=yes --with-dmfnutscan-regenerate=yes --with-dmfsnmp-regenerate=auto --with-dmfsnmp-validate=yes --with-dmfnutscan-validate=yes' - } - } - - stage ('compile') { - steps { - sh 'CCACHE_BASEDIR="`pwd`" ; export CCACHE_BASEDIR; make -k -j4 all || make all' - sh """ set +x -echo "Are GitIgnores good after make? (should have no output below)" -OUT="`git status -s`" && [ -z "\$OUT" ] \\ -|| { echo "\$OUT" >&2 - if [ "${params.CI_REQUIRE_GOOD_GITIGNORE}" = false ]; then - echo "WARNING GitIgnore tests found newly changed or untracked files:" >&2 - exit 0 - else - echo "FAILED GitIgnore tests" >&2 - git diff >&2 - exit 1 - fi -}""" - script { - if ( (params.DO_TEST_CHECK && params.DO_TEST_MEMCHECK) || (params.DO_TEST_CHECK && params.DO_TEST_DISTCHECK) || (params.DO_TEST_MEMCHECK && params.DO_TEST_DISTCHECK) || - (params.DO_TEST_INSTALL && params.DO_TEST_MEMCHECK) || (params.DO_TEST_INSTALL && params.DO_TEST_DISTCHECK) || (params.DO_TEST_INSTALL && params.DO_TEST_CHECK) - || (params.DO_TEST_CHECK && params.DO_TEST_DISTCHECK_DMF_ALL_YES) - || (params.DO_TEST_MEMCHECK && params.DO_TEST_DISTCHECK_DMF_ALL_YES) - || (params.DO_TEST_INSTALL && params.DO_TEST_DISTCHECK_DMF_ALL_YES) - ) { - stash (name: 'built', includes: '**/*') - } - } - } - } - - stage ('dist') { - when { expression { return ( params.DO_DIST_DOCS ) } } - steps { - sh 'CCACHE_BASEDIR="`pwd`" ; export CCACHE_BASEDIR; make dist-gzip || exit ; DISTFILE="`ls -1tc *.tar.gz | head -1`" && [ -n "$DISTFILE" ] && [ -s "$DISTFILE" ] || exit ; mv -f "$DISTFILE" __dist.tar.gz' - archiveArtifacts artifacts: '__dist.tar.gz' - sh "rm -f __dist.tar.gz" - } - } - - stage ('check') { - parallel { - stage ('cppcheck') { - when { expression { return ( params.DO_CPPCHECK ) } } - steps { - sh 'cppcheck --std=c++11 --enable=all --inconclusive --xml --xml-version=2 . 2>cppcheck.xml' - archiveArtifacts artifacts: '**/cppcheck.xml' - sh 'rm -f cppcheck.xml' - } - } - - stage ('nut-driver-enumerator-test') { - when { expression { return ( params.DO_TEST_NDE ) } } - steps { - dir("tmp/test-nde") { - deleteDir() - } - dir("tmp/test-nde") { - unstash 'prepped' - timeout (time: 5, unit: 'MINUTES') { - sh 'SHELL_PROGS="/bin/sh bash ash dash" ./tests/nut-driver-enumerator-test.sh' - } - script { - if ( params.DO_CLEANUP_AFTER_BUILD ) { - deleteDir() - } - } - } - } - } - - stage ('make check') { - when { expression { return ( params.DO_TEST_CHECK ) } } - steps { - script { - if ( (params.DO_TEST_CHECK && params.DO_TEST_MEMCHECK) || (params.DO_TEST_CHECK && params.DO_TEST_DISTCHECK) || (params.DO_TEST_MEMCHECK && params.DO_TEST_DISTCHECK) || - (params.DO_TEST_INSTALL && params.DO_TEST_MEMCHECK) || (params.DO_TEST_INSTALL && params.DO_TEST_DISTCHECK) || (params.DO_TEST_INSTALL && params.DO_TEST_CHECK) - || (params.DO_TEST_CHECK && params.DO_TEST_DISTCHECK_DMF_ALL_YES) - || (params.DO_TEST_MEMCHECK && params.DO_TEST_DISTCHECK_DMF_ALL_YES) - || (params.DO_TEST_INSTALL && params.DO_TEST_DISTCHECK_DMF_ALL_YES) - ) { - dir("tmp/test-check") { - deleteDir() - } - dir("tmp/test-check") { - unstash 'built' - timeout (time: "${params.USE_TEST_TIMEOUT}".toInteger(), unit: 'MINUTES') { - sh 'CCACHE_BASEDIR="`pwd`" ; export CCACHE_BASEDIR; make check' - } - sh """ set +x -echo "Are GitIgnores good after make check? (should have no output below)" -OUT="`git status -s`" && [ -z "\$OUT" ] \\ -|| { echo "\$OUT" >&2 - if [ "${params.CI_REQUIRE_GOOD_GITIGNORE}" = false ]; then - echo "WARNING GitIgnore tests found newly changed or untracked files:" >&2 - exit 0 - else - echo "FAILED GitIgnore tests" >&2 - git diff >&2 - exit 1 - fi -}""" - script { - if ( params.DO_CLEANUP_AFTER_BUILD ) { - deleteDir() - } - } - } - } else { - timeout (time: "${params.USE_TEST_TIMEOUT}".toInteger(), unit: 'MINUTES') { - sh 'CCACHE_BASEDIR="`pwd`" ; export CCACHE_BASEDIR; make check' - } - sh """ set +x -echo "Are GitIgnores good after make check? (should have no output below)" -OUT="`git status -s`" && [ -z "\$OUT" ] \\ -|| { echo "\$OUT" >&2 - if [ "${params.CI_REQUIRE_GOOD_GITIGNORE}" = false ]; then - echo "WARNING GitIgnore tests found newly changed or untracked files:" >&2 - exit 0 - else - echo "FAILED GitIgnore tests" >&2 - git diff >&2 - exit 1 - fi -}""" - } - } - } - } - - stage ('make memcheck') { - when { expression { return ( params.DO_TEST_MEMCHECK ) } } - steps { - script { - if ( (params.DO_TEST_CHECK && params.DO_TEST_MEMCHECK) || (params.DO_TEST_CHECK && params.DO_TEST_DISTCHECK) || (params.DO_TEST_MEMCHECK && params.DO_TEST_DISTCHECK) || - (params.DO_TEST_INSTALL && params.DO_TEST_MEMCHECK) || (params.DO_TEST_INSTALL && params.DO_TEST_DISTCHECK) || (params.DO_TEST_INSTALL && params.DO_TEST_CHECK) - || (params.DO_TEST_CHECK && params.DO_TEST_DISTCHECK_DMF_ALL_YES) - || (params.DO_TEST_MEMCHECK && params.DO_TEST_DISTCHECK_DMF_ALL_YES) - || (params.DO_TEST_INSTALL && params.DO_TEST_DISTCHECK_DMF_ALL_YES) - ) { - dir("tmp/test-memcheck") { - deleteDir() - } - dir("tmp/test-memcheck") { - unstash 'built' - timeout (time: "${params.USE_TEST_TIMEOUT}".toInteger(), unit: 'MINUTES') { - sh 'CCACHE_BASEDIR="`pwd`" ; export CCACHE_BASEDIR; make memcheck && exit 0 ; echo "Re-running failed ($?) memcheck with greater verbosity" >&2 ; make VERBOSE=1 memcheck-verbose' - } - sh """ set +x -echo "Are GitIgnores good after make memcheck? (should have no output below)" -OUT="`git status -s`" && [ -z "\$OUT" ] \\ -|| { echo "\$OUT" >&2 - if [ "${params.CI_REQUIRE_GOOD_GITIGNORE}" = false ]; then - echo "WARNING GitIgnore tests found newly changed or untracked files:" >&2 - exit 0 - else - echo "FAILED GitIgnore tests" >&2 - git diff >&2 - exit 1 - fi -}""" - script { - if ( params.DO_CLEANUP_AFTER_BUILD ) { - deleteDir() - } - } - } - } else { - timeout (time: "${params.USE_TEST_TIMEOUT}".toInteger(), unit: 'MINUTES') { - sh 'CCACHE_BASEDIR="`pwd`" ; export CCACHE_BASEDIR; make memcheck && exit 0 ; echo "Re-running failed ($?) memcheck with greater verbosity" >&2 ; make VERBOSE=1 memcheck-verbose' - } - sh """ set +x -echo "Are GitIgnores good after make memcheck? (should have no output below)" -OUT="`git status -s`" && [ -z "\$OUT" ] \\ -|| { echo "\$OUT" >&2 - if [ "${params.CI_REQUIRE_GOOD_GITIGNORE}" = false ]; then - echo "WARNING GitIgnore tests found newly changed or untracked files:" >&2 - exit 0 - else - echo "FAILED GitIgnore tests" >&2 - git diff >&2 - exit 1 - fi -}""" - } - } - } - } - - stage ('make distcheck') { - when { expression { return ( params.DO_TEST_DISTCHECK ) } } - steps { - script { - if ( (params.DO_TEST_CHECK && params.DO_TEST_MEMCHECK) || (params.DO_TEST_CHECK && params.DO_TEST_DISTCHECK) || (params.DO_TEST_MEMCHECK && params.DO_TEST_DISTCHECK) || - (params.DO_TEST_INSTALL && params.DO_TEST_MEMCHECK) || (params.DO_TEST_INSTALL && params.DO_TEST_DISTCHECK) || (params.DO_TEST_INSTALL && params.DO_TEST_CHECK) - || (params.DO_TEST_CHECK && params.DO_TEST_DISTCHECK_DMF_ALL_YES) - || (params.DO_TEST_MEMCHECK && params.DO_TEST_DISTCHECK_DMF_ALL_YES) - || (params.DO_TEST_INSTALL && params.DO_TEST_DISTCHECK_DMF_ALL_YES) - ) { - dir("tmp/test-distcheck") { - deleteDir() - } - dir("tmp/test-distcheck") { - unstash 'built' - timeout (time: "${params.USE_TEST_TIMEOUT}".toInteger(), unit: 'MINUTES') { - sh 'CCACHE_BASEDIR="`pwd`" ; export CCACHE_BASEDIR; make DISTCHECK_CONFIGURE_FLAGS="--with-neon=yes --with-lua=yes --with-snmp=yes --with-snmp_dmf_lua=yes --with-dev --with-doc=html-single=auto,man=yes --with-dmfnutscan-regenerate=yes --with-dmfsnmp-regenerate=auto --with-dmfsnmp-validate=yes --with-dmfnutscan-validate=yes" distcheck' - } - sh """ set +x -echo "Are GitIgnores good after make distcheck? (should have no output below)" -OUT="`git status -s`" && [ -z "\$OUT" ] \\ -|| { echo "\$OUT" >&2 - if [ "${params.CI_REQUIRE_GOOD_GITIGNORE}" = false ]; then - echo "WARNING GitIgnore tests found newly changed or untracked files:" >&2 - exit 0 - else - echo "FAILED GitIgnore tests" >&2 - git diff >&2 - exit 1 - fi -}""" - script { - if ( params.DO_CLEANUP_AFTER_BUILD ) { - deleteDir() - } - } - } - } else { - timeout (time: "${params.USE_TEST_TIMEOUT}".toInteger(), unit: 'MINUTES') { - sh 'CCACHE_BASEDIR="`pwd`" ; export CCACHE_BASEDIR; make DISTCHECK_CONFIGURE_FLAGS="--with-neon=yes --with-lua=yes --with-snmp=yes --with-snmp_dmf_lua=yes --with-dev --with-doc=html-single=auto,man=yes --with-dmfnutscan-regenerate=yes --with-dmfsnmp-regenerate=auto --with-dmfsnmp-validate=yes --with-dmfnutscan-validate=yes" distcheck' - } - sh """ set +x -echo "Are GitIgnores good after make distcheck? (should have no output below)" -OUT="`git status -s`" && [ -z "\$OUT" ] \\ -|| { echo "\$OUT" >&2 - if [ "${params.CI_REQUIRE_GOOD_GITIGNORE}" = false ]; then - echo "WARNING GitIgnore tests found newly changed or untracked files:" >&2 - exit 0 - else - echo "FAILED GitIgnore tests" >&2 - git diff >&2 - exit 1 - fi -}""" - } - } - } - } - - stage ('make distcheck-dmf-all-yes') { - when { expression { return ( params.DO_TEST_DISTCHECK_DMF_ALL_YES ) } } - steps { - script { - if ( (params.DO_TEST_CHECK && params.DO_TEST_MEMCHECK) || (params.DO_TEST_CHECK && params.DO_TEST_DISTCHECK) || (params.DO_TEST_MEMCHECK && params.DO_TEST_DISTCHECK) || - (params.DO_TEST_INSTALL && params.DO_TEST_MEMCHECK) || (params.DO_TEST_INSTALL && params.DO_TEST_DISTCHECK) || (params.DO_TEST_INSTALL && params.DO_TEST_CHECK) - || (params.DO_TEST_CHECK && params.DO_TEST_DISTCHECK_DMF_ALL_YES) - || (params.DO_TEST_MEMCHECK && params.DO_TEST_DISTCHECK_DMF_ALL_YES) - || (params.DO_TEST_INSTALL && params.DO_TEST_DISTCHECK_DMF_ALL_YES) - ) { - dir("tmp/test-distcheck-dmf-all-yes") { - deleteDir() - } - dir("tmp/test-distcheck-dmf-all-yes") { - unstash 'built' - timeout (time: "${params.USE_TEST_TIMEOUT}".toInteger(), unit: 'MINUTES') { - sh 'CCACHE_BASEDIR="`pwd`" ; export CCACHE_BASEDIR; make distcheck-dmf-all-yes' - } - sh """ set +x -echo "Are GitIgnores good after make distcheck-dmf-all-yes? (should have no output below)" -OUT="`git status -s`" && [ -z "\$OUT" ] \\ -|| { echo "\$OUT" >&2 - if [ "${params.CI_REQUIRE_GOOD_GITIGNORE}" = false ]; then - echo "WARNING GitIgnore tests found newly changed or untracked files:" >&2 - exit 0 - else - echo "FAILED GitIgnore tests" >&2 - git diff >&2 - exit 1 - fi -}""" - script { - if ( params.DO_CLEANUP_AFTER_BUILD ) { - deleteDir() - } - } - } - } else { - timeout (time: "${params.USE_TEST_TIMEOUT}".toInteger(), unit: 'MINUTES') { - sh 'CCACHE_BASEDIR="`pwd`" ; export CCACHE_BASEDIR; make distcheck-dmf-all-yes' - } - sh """ set +x -echo "Are GitIgnores good after make distcheck-dmf-all-yes? (should have no output below)" -OUT="`git status -s`" && [ -z "\$OUT" ] \\ -|| { echo "\$OUT" >&2 - if [ "${params.CI_REQUIRE_GOOD_GITIGNORE}" = false ]; then - echo "WARNING GitIgnore tests found newly changed or untracked files:" >&2 - exit 0 - else - echo "FAILED GitIgnore tests" >&2 - git diff >&2 - exit 1 - fi -}""" - } - } - } - } - - stage ('make install check') { - when { expression { return ( params.DO_TEST_INSTALL ) } } - steps { - script { - if ( (params.DO_TEST_CHECK && params.DO_TEST_MEMCHECK) || (params.DO_TEST_CHECK && params.DO_TEST_DISTCHECK) || (params.DO_TEST_MEMCHECK && params.DO_TEST_DISTCHECK) || - (params.DO_TEST_INSTALL && params.DO_TEST_MEMCHECK) || (params.DO_TEST_INSTALL && params.DO_TEST_DISTCHECK) || (params.DO_TEST_INSTALL && params.DO_TEST_CHECK) - || (params.DO_TEST_CHECK && params.DO_TEST_DISTCHECK_DMF_ALL_YES) - || (params.DO_TEST_MEMCHECK && params.DO_TEST_DISTCHECK_DMF_ALL_YES) - || (params.DO_TEST_INSTALL && params.DO_TEST_DISTCHECK_DMF_ALL_YES) - ) { - dir("tmp/test-install-check") { - deleteDir() - } - dir("tmp/test-install-check") { - unstash 'built' - timeout (time: "${params.USE_TEST_TIMEOUT}".toInteger(), unit: 'MINUTES') { - sh """CCACHE_BASEDIR="`pwd`" ; export CCACHE_BASEDIR; make DESTDIR="${params.USE_TEST_INSTALL_DESTDIR}" install""" - } - sh """ set +x -echo "Are GitIgnores good after make install? (should have no output below)" -OUT="`git status -s`" && [ -z "\$OUT" ] \\ -|| { echo "\$OUT" >&2 - if [ "${params.CI_REQUIRE_GOOD_GITIGNORE}" = false ]; then - echo "WARNING GitIgnore tests found newly changed or untracked files:" >&2 - exit 0 - else - echo "FAILED GitIgnore tests" >&2 - git diff >&2 - exit 1 - fi -}""" - script { - if ( params.DO_CLEANUP_AFTER_BUILD ) { - deleteDir() - } - } - } - } else { - timeout (time: "${params.USE_TEST_TIMEOUT}".toInteger(), unit: 'MINUTES') { - sh """CCACHE_BASEDIR="`pwd`" ; export CCACHE_BASEDIR; make DESTDIR="${params.USE_TEST_INSTALL_DESTDIR}" install""" - } - sh """ set +x -echo "Are GitIgnores good after make install? (should have no output below)" -OUT="`git status -s`" && [ -z "\$OUT" ] \\ -|| { echo "\$OUT" >&2 - if [ "${params.CI_REQUIRE_GOOD_GITIGNORE}" = false ]; then - echo "WARNING GitIgnore tests found newly changed or untracked files:" >&2 - exit 0 - else - echo "FAILED GitIgnore tests" >&2 - git diff >&2 - exit 1 - fi -}""" - } - } - } - } - - stage('Analyse with Coverity') { - when { - beforeAgent true - allOf { - expression { return ("true" == "${params.DO_COVERITY}") } - anyOf { - branch 'master' - branch "release/*" - branch 'FTY' - branch '*-FTY-master' - branch '*-FTY' - changeRequest() - } - } - } - - stages { - stage('Compile Coverity') { - steps { - dir("tmp/build-coverity") { - deleteDir() - } - dir("tmp/build-coverity") { - unstash 'prepped' - } - script { - // Autogen is currently part of "prepped" archive - //compile.autogen("tmp/build-coverity") - compile.configure("tmp/build-coverity", "--enable-Werror=yes --with-docs=no") - compile.make("tmp/build-coverity", "clean") - coverity.compile("tmp/build-coverity") - } - } - } - - stage('Analyse Coverity') { - steps { - script { - coverity.analyse("tmp/build-coverity") - } - } - } - - /* Committing the result - that happens below */ - } - - // TODO: Use coverity steps from lib below for the post{} - post { - always { - script { - dir("tmp/build-coverity") { - coverity.postAnalysis() - } - } - } - } - } // Analyze with Coverity - - } - } - - stage('Ready to push') { - steps { - script { - manager.addShortText("Build, analysis and tests passed okay") - } - milestone ordinal: 100, label: "${env.JOB_NAME}@${env.BRANCH_NAME}" - } - } - - stage ('Upload results') { - parallel { - - stage('Commit Coverity') { - when { - beforeAgent true - allOf { - expression { return ("true" == "${params.DO_COVERITY}") } - anyOf { - branch 'master' - branch 'release/*' - branch 'FTY' - branch '*-FTY-master' - branch '*-FTY' - } - } - } - steps { - catchError(buildResult: 'UNSTABLE', stageResult: 'FAILURE') { - script { - /* Many components upload in 2-5 minutes; but some - * seem to require complex processing on server side */ - //coverity.commitResults("tmp/build-coverity", parameters.coverityUploadTimeoutLen, parameters.coverityUploadTimeoutUnit) - coverity.commitResults("tmp/build-coverity") - manager.addShortText("Coverity upload completed") - } - } - } - post { - unsuccessful { - script { - manager.addShortText("Coverity upload failed") - } - } - } - } // Commit Coverity - - stage ('deploy if appropriate') { - steps { - script { - def myDEPLOY_JOB_NAME = sh(returnStdout: true, script: """echo "${params["DEPLOY_JOB_NAME"]}" """).trim(); - def myDEPLOY_BRANCH_PATTERN = sh(returnStdout: true, script: """echo "${params["DEPLOY_BRANCH_PATTERN"]}" """).trim(); - def myDEPLOY_REPORT_RESULT = sh(returnStdout: true, script: """echo "${params["DEPLOY_REPORT_RESULT"]}" """).trim().toBoolean(); - echo "Original: DEPLOY_JOB_NAME : ${params["DEPLOY_JOB_NAME"]} DEPLOY_BRANCH_PATTERN : ${params["DEPLOY_BRANCH_PATTERN"]} DEPLOY_REPORT_RESULT : ${params["DEPLOY_REPORT_RESULT"]}" - echo "Used: myDEPLOY_JOB_NAME:${myDEPLOY_JOB_NAME} myDEPLOY_BRANCH_PATTERN:${myDEPLOY_BRANCH_PATTERN} myDEPLOY_REPORT_RESULT:${myDEPLOY_REPORT_RESULT}" - if ( (myDEPLOY_JOB_NAME != "") && (myDEPLOY_BRANCH_PATTERN != "") ) { - if ( env.BRANCH_NAME =~ myDEPLOY_BRANCH_PATTERN ) { - def GIT_URL = sh(returnStdout: true, script: """git remote -v | egrep '^origin' | awk '{print \$2}' | head -1""").trim() - def GIT_COMMIT = sh(returnStdout: true, script: 'git rev-parse --verify HEAD').trim() - def DIST_ARCHIVE = "" - def msg = "Would deploy ${GIT_URL} ${GIT_COMMIT} because tested branch '${env.BRANCH_NAME}' matches filter '${myDEPLOY_BRANCH_PATTERN}'" - if ( params.DO_DIST_DOCS ) { - DIST_ARCHIVE = env.BUILD_URL + "artifact/__dist.tar.gz" - msg += ", using dist archive '${DIST_ARCHIVE}' to speed up deployment" - } - echo msg - //milestone ordinal: 100, label: "${env.JOB_NAME}@${env.BRANCH_NAME}" - build job: "${myDEPLOY_JOB_NAME}", parameters: [ - string(name: 'DEPLOY_GIT_URL', value: "${GIT_URL}"), - string(name: 'DEPLOY_GIT_BRANCH', value: env.BRANCH_NAME), - string(name: 'DEPLOY_GIT_COMMIT', value: "${GIT_COMMIT}"), - string(name: 'DEPLOY_DIST_ARCHIVE', value: "${DIST_ARCHIVE}") - ], quietPeriod: 0, wait: myDEPLOY_REPORT_RESULT, propagate: myDEPLOY_REPORT_RESULT - } else { - echo "Not deploying because branch '${env.BRANCH_NAME}' did not match filter '${myDEPLOY_BRANCH_PATTERN}'" - } - } else { - echo "Not deploying because deploy-job parameters are not set" - } - - manager.addShortText("Processing of push to packaging completed") - } - } - } - } - - } - - stage ('cleanup') { - when { expression { return ( params.DO_CLEANUP_AFTER_BUILD ) } } - steps { - deleteDir() - } - } - } - - post { - success { - script { - if (currentBuild.getPreviousBuild()?.result != 'SUCCESS') { - // Uncomment desired notification - - //slackSend (color: "#008800", message: "Build ${env.JOB_NAME} is back to normal.") - //emailext (to: "qa@example.com", subject: "Build ${env.JOB_NAME} is back to normal.", body: "Build ${env.JOB_NAME} is back to normal.") - } - if ( params.DO_CLEANUP_AFTER_JOB ) { - dir("tmp") { - deleteDir() - } - } - } - } - failure { - // Uncomment desired notification - // Section must not be empty, you can delete the sleep once you set notification - sleep 1 - //slackSend (color: "#AA0000", message: "Build ${env.BUILD_NUMBER} of ${env.JOB_NAME} ${currentBuild.result} (<${env.BUILD_URL}|Open>)") - //emailext (to: "qa@example.com", subject: "Build ${env.JOB_NAME} failed!", body: "Build ${env.BUILD_NUMBER} of ${env.JOB_NAME} ${currentBuild.result}\nSee ${env.BUILD_URL}") - - dir("tmp") { - script { - if ( params.DO_CLEANUP_AFTER_FAILED_JOB ) { - deleteDir() - } else { - sh """ echo "NOTE: BUILD AREA OF WORKSPACE `pwd` REMAINS FOR POST-MORTEMS ON `hostname` AND CONSUMES `du -hs . | awk '{print \$1}'` !" """ - } - } - } - } - } -} From 87a7905ad9fa8b541237ef7fc5b7df295764d76a Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Tue, 25 Nov 2025 13:16:02 +0100 Subject: [PATCH 797/805] configure.ac: reconcile comments and markup with master branch Signed-off-by: Jim Klimov --- configure.ac | 71 ++++++++++++++++++++++++++-------------------------- 1 file changed, 36 insertions(+), 35 deletions(-) diff --git a/configure.ac b/configure.ac index 1174107f13..54cc05e4d0 100644 --- a/configure.ac +++ b/configure.ac @@ -251,7 +251,7 @@ AS_IF([test x"${nut_enable_configure_debug}" = xyes], [ AC_MSG_CHECKING(for autoconf macro to enable system extensions) m4_version_prereq(2.61, [ AC_MSG_RESULT(yes) - dnl Causes calls to ac_prog stuff, so dittoed below if "no" + dnl Causes calls to ac_prog stuff, so dittoed below if "no" AC_USE_SYSTEM_EXTENSIONS ], [ AC_MSG_RESULT(no) @@ -4385,9 +4385,9 @@ case "${nut_with_docs_changelog_start}" in GITLOG_START_POINT=master ], [ GITLOG_START_POINT=v"`echo \"${NUT_SOURCE_GITREV_NUMERIC}\" | sed -e 's/^\(@<:@0-9@:>@*\.@<:@0-9@:>@*\.@<:@0-9@:>@*\)@<:@^0-9@:>@*.*$/\1/'`" \ - && test x"${GITLOG_START_POINT}" != xv \ - || GITLOG_START_POINT="master" - ]) + && test x"${GITLOG_START_POINT}" != xv \ + || GITLOG_START_POINT="master" + ]) ]) ;; *) dnl # Else assume this is a git hash/tag/branch... @@ -4535,6 +4535,7 @@ m4_ifdef([AM_PROG_AR], [AM_PROG_AR]) dnl # NOTE: This also initializes `hardcode_libdir_flag_spec` and dnl # `hardcode_libdir_flag_spec_CXX` that we use in LDFLAGS_NUT_RPATH LT_INIT + AC_SUBST([LIBTOOL_DEPS]) GCC="$SAVED_GCC" CC="$SAVED_CC" @@ -4786,11 +4787,11 @@ NUT_ARG_ENABLE([force-nut-version-header], [Force nut_version.h generation for e AS_CASE([${nut_enable_force_nut_version_header}], [no], [ AC_MSG_RESULT(no) - FORCE_NUT_VERSION="" -], [ + FORCE_NUT_VERSION="" + ], [ AC_MSG_RESULT(yes) FORCE_NUT_VERSION="FORCE" -]) + ]) dnl --------------------------------------------------------------------- @@ -5170,8 +5171,8 @@ EOF if (echo "$myOUT" | ${GREP} "Failed to parse service type, ignoring") ; then true else - SYSTEMD_SUPPORTS_DAEMON_TYPE_NOTIFY=yes - fi + SYSTEMD_SUPPORTS_DAEMON_TYPE_NOTIFY=yes + fi fi rm -f "$myFILE" AC_MSG_RESULT([${SYSTEMD_SUPPORTS_DAEMON_TYPE_NOTIFY}]) @@ -5192,8 +5193,8 @@ EOF if (echo "$myOUT" | ${GREP} "Failed to parse service type, ignoring") ; then true else - SYSTEMD_SUPPORTS_DAEMON_TYPE_NOTIFY_RELOAD=yes - fi + SYSTEMD_SUPPORTS_DAEMON_TYPE_NOTIFY_RELOAD=yes + fi fi rm -f "$myFILE" AC_MSG_RESULT([${SYSTEMD_SUPPORTS_DAEMON_TYPE_NOTIFY_RELOAD}]) @@ -5420,12 +5421,12 @@ dnl # By default keep the originally detected have_cppunit value AC_MSG_CHECKING(for impact from --enable-cppunit option - should we build cppunit tests?) NUT_ARG_ENABLE([cppunit], [(yes|no|force|auto)], [Enable CPPUNIT tests for C++ bindings], [auto]) AS_CASE(["${nut_enable_cppunit}"], - ["force"], [AS_IF([test x"${have_cppunit}" = xyes], [], [ - AC_MSG_WARN([--enable-cppunit=yes can not be satisfied, but developer asked for it]) - have_cppunit=yes - ])], - ["yes"], [AS_IF([test x"${have_cppunit}" = xyes], [], [AC_MSG_ERROR([--enable-cppunit=yes can not be satisfied])])], - ["no"], [have_cppunit=no] + ["force"], [AS_IF([test x"${have_cppunit}" = xyes], [], [ + AC_MSG_WARN([--enable-cppunit=yes can not be satisfied, but developer asked for it]) + have_cppunit=yes + ])], + ["yes"], [AS_IF([test x"${have_cppunit}" = xyes], [], [AC_MSG_ERROR([--enable-cppunit=yes can not be satisfied])])], + ["no"], [have_cppunit=no] dnl # "auto" and other values keep what was detected (or not) ) AC_MSG_RESULT(${have_cppunit}) @@ -5493,16 +5494,16 @@ AS_CASE([${nut_with_augeas_lenses_dir}], [yes], [if test -z "${auglensdir}"; then AC_MSG_RESULT(no) AC_MSG_ERROR([augeas lenses directory requested but not found in default location]) - fi + fi if test ! -s scripts/augeas/nutupsconf.aug.in ; then AC_MSG_RESULT(no) AC_MSG_ERROR([augeas lenses directory requested but a non-trivial scripts/augeas/nutupsconf.aug.in was not provided by autogen.sh or dist archive]) - fi + fi ], [auto], [if test ! -s scripts/augeas/nutupsconf.aug.in ; then AC_MSG_WARN([augeas lenses directory skipped because a non-trivial scripts/augeas/nutupsconf.aug.in was not provided by autogen.sh or dist archive]) auglensdir="" - fi + fi ], [no], [auglensdir=""], [auglensdir="${nut_with_augeas_lenses_dir}"] @@ -5563,17 +5564,17 @@ AS_CASE([${nut_with_udev_dir}], [if test -z "${udevdir}"; then AC_MSG_RESULT(no) AC_MSG_ERROR([udev directory requested but not found]) - fi + fi if test "${nut_with_usb}" = yes && test ! -s scripts/udev/nut-usbups.rules.in ; then AC_MSG_RESULT(no) AC_MSG_ERROR([udev directory and USB driver support requested but a non-trivial scripts/udev/nut-usbups.rules.in was not provided by autogen.sh or dist archive]) - fi + fi ], [auto], [if test "${nut_with_usb}" = yes && test ! -s scripts/udev/nut-usbups.rules.in ; then AC_MSG_WARN([udev directory skipped because a non-trivial scripts/udev/nut-usbups.rules.in was not provided by autogen.sh or dist archive]) udevdir="" - fi + fi ], [no], [udevdir=""], [udevdir="${nut_with_udev_dir}"] @@ -5597,17 +5598,17 @@ AS_CASE([${nut_with_devd_dir}], [if test -z "${devddir}"; then AC_MSG_RESULT(no) AC_MSG_ERROR([devd directory requested but not found]) - fi + fi if test "${nut_with_usb}" = yes && test ! -s scripts/devd/nut-usb.conf.in ; then AC_MSG_RESULT(no) AC_MSG_ERROR([devd directory and USB driver support requested but non-trivial scripts/devd/nut-usb.conf.in was not provided by autogen.sh or dist archive]) - fi + fi ], [auto], [if test "${nut_with_usb}" = yes && test ! -s scripts/devd/nut-usb.conf.in ; then AC_MSG_WARN([devd directory skipped because non-trivial scripts/devd/nut-usb.conf.in was not provided by autogen.sh or dist archive]) devddir="" - fi + fi ], [no], [devddir=""], [devddir="${nut_with_devd_dir}"] @@ -5632,11 +5633,11 @@ AS_CASE([${nut_with_freebsd_quirks_dir}], [auto], dnl Are we building for FreeBSD with such customizations? [if test -s /boot/loader.conf.local ; then freebsdquirksdir="${datadir}" - fi + fi if test "${nut_with_usb}" = yes && test ! -s scripts/devd/nut-usb.quirks ; then AC_MSG_WARN([freebsd-quirks-dir directory skipped because a non-trivial scripts/devd/nut-usb.quirks was not provided by autogen.sh or dist archive]) freebsdquirksdir="" - fi + fi ], [no], [freebsdquirksdir=""], [freebsdquirksdir="${nut_with_freebsd_quirks_dir}"] @@ -5684,11 +5685,11 @@ AS_CASE([${nut_with_valgrind}], [auto], [with_valgrind="auto"], [no], [with_valgrind="no"], [AC_PATH_PROGS([VALGRIND], ["${nut_with_valgrind}"], [none]) - if test "x$VALGRIND" = "xnone"; then + if test "x$VALGRIND" = "xnone"; then AC_MSG_RESULT(no) AC_MSG_ERROR([valgrind requested but not found]) - fi - with_valgrind="yes" + fi + with_valgrind="yes" ] ) @@ -6614,8 +6615,8 @@ NUT_ARG_WITH_CUSTOM_DEFAULT_HELP([user], [USERNAME], [(Unprivileged) user for pr AS_CASE([${nut_with_user}], [yes|no], [AC_MSG_ERROR(invalid option --with(out)-user - see docs/configure.txt)], ["${RUN_AS_USER}"], [ - nut_user_given=no - AC_MSG_RESULT([default]) + nut_user_given=no + AC_MSG_RESULT([default]) ], [RUN_AS_USER="${nut_with_user}" nut_user_given=yes @@ -6633,8 +6634,8 @@ NUT_ARG_WITH_CUSTOM_DEFAULT_HELP([group], [GROUPNAME], [(Unprivileged) group mem AS_CASE([${nut_with_group}], [yes|no], [AC_MSG_ERROR(invalid option --with(out)-group - see docs/configure.txt)], ["${RUN_AS_GROUP}"], [ - nut_group_given=no - AC_MSG_RESULT([default]) + nut_group_given=no + AC_MSG_RESULT([default]) ], [RUN_AS_GROUP="${nut_with_group}" nut_group_given=yes From 5a80e87d243dfd878dd647f023cf98dc2092acc8 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Tue, 25 Nov 2025 15:31:11 +0100 Subject: [PATCH 798/805] drivers/Makefile.am, docs/packager-guide.txt: comment on delivery of snmp-ups{,-old,-dmf} Signed-off-by: Jim Klimov --- docs/packager-guide.txt | 8 ++++++++ drivers/Makefile.am | 4 ++++ 2 files changed, 12 insertions(+) diff --git a/docs/packager-guide.txt b/docs/packager-guide.txt index 7af43e60d5..8c5efc3e0b 100644 --- a/docs/packager-guide.txt +++ b/docs/packager-guide.txt @@ -284,6 +284,14 @@ nut-snmp - Size: - Deps: +NOTE: With DMF capability merged, two variants of the `snmp-ups` driver can +be built: a legacy-style "monolithic" program with a fixed set of built-in +mapping tables, and `snmp-ups-dmf` with a parsing engine that can load chosen +only the relevant mappings at run-time (and mapping files can be delivered or +modified in the field). Distributions may deliver the legacy driver program +file named as `snmp-ups-old`, and symlink the well-known `snmp-ups` program +name pointing to a preferred implementation (legacy or DMF). + [[pkg-nut-xml]] nut-xml ^^^^^^^ diff --git a/drivers/Makefile.am b/drivers/Makefile.am index b6ffeffeed..1ec3db984c 100644 --- a/drivers/Makefile.am +++ b/drivers/Makefile.am @@ -82,10 +82,14 @@ if HAVE_LINUX_SERIAL_H # Temporary, until ported to more OSes SERIAL_DRIVERLIST += nhs_ser endif HAVE_LINUX_SERIAL_H + +# Note: distributions may deliver this "monolithic" driver program file named +# "snmp-ups-old", and symlink "snmp-ups" pointing to a preferred implementation: SNMP_DRIVERLIST = snmp-ups if WITH_DMFMIB SNMP_DRIVERLIST += snmp-ups-dmf endif + USB_LIBUSB_DRIVERLIST = usbhid-ups bcmxcp_usb tripplite_usb \ blazer_usb richcomm_usb riello_usb powervar_cx_usb \ nutdrv_atcl_usb From 253c01a15135e5cdabbdb84f11d15a8f2976c50c Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Tue, 25 Nov 2025 15:46:23 +0100 Subject: [PATCH 799/805] drivers/snmp-ups.{c,h}: align DMF codebase with upstream/master Signed-off-by: Jim Klimov --- drivers/snmp-ups.c | 4 ++-- drivers/snmp-ups.h | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/snmp-ups.c b/drivers/snmp-ups.c index 21cba1e282..590c0238b3 100644 --- a/drivers/snmp-ups.c +++ b/drivers/snmp-ups.c @@ -503,8 +503,8 @@ void upsdrv_updateinfo(void) * a new firmware got installed or modules added? */ analyze_mapping_usage(); - comm_status = COMM_OK; - } + comm_status = COMM_OK; + } } else { upsdebugx(1, "%s: pollfreq: Data STALE", __func__); diff --git a/drivers/snmp-ups.h b/drivers/snmp-ups.h index 2aa6c479df..0b954ff58e 100644 --- a/drivers/snmp-ups.h +++ b/drivers/snmp-ups.h @@ -229,6 +229,8 @@ typedef int bool_t; # else # define WITH_SNMP_LKP_FUN 1 # endif +#else +# define WITH_SNMP_LKP_FUN 0 #endif #ifndef WITH_SNMP_LKP_FUN_DUMMY From 0a4c968c9d7b255bf1eca732b2995e74f50fb7ac Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Tue, 25 Nov 2025 15:51:05 +0100 Subject: [PATCH 800/805] Move obs/ to scripts/obs/ in FTY branch to re-alignt with upstream/master Signed-off-by: Jim Klimov --- {obs => scripts/obs}/control | 0 {obs => scripts/obs}/debian.Makefile.am | 0 {obs => scripts/obs}/debian.NEWS | 0 {obs => scripts/obs}/debian.changelog | 0 {obs => scripts/obs}/debian.compat | 0 {obs => scripts/obs}/debian.control | 0 {obs => scripts/obs}/debian.copyright | 0 {obs => scripts/obs}/debian.description.subst | 0 {obs => scripts/obs}/debian.gbp.conf | 0 {obs => scripts/obs}/debian.hotplug | 0 {obs => scripts/obs}/debian.libnutclient-dev.install | 0 {obs => scripts/obs}/debian.libnutclient-dev.manpages | 0 {obs => scripts/obs}/debian.libnutclient1.install | 0 {obs => scripts/obs}/debian.libnutclient1.lintian-overrides | 0 {obs => scripts/obs}/debian.libnutclientstub-dev.install | 0 {obs => scripts/obs}/debian.libnutclientstub1.install | 0 {obs => scripts/obs}/debian.libnutclientstub1.lintian-overrides | 0 {obs => scripts/obs}/debian.libnutscan-dev.install | 0 {obs => scripts/obs}/debian.libnutscan1.install | 0 {obs => scripts/obs}/debian.libups-nut-perl.install | 0 {obs => scripts/obs}/debian.libupsclient-dev.install | 0 {obs => scripts/obs}/debian.libupsclient-dev.manpages | 0 {obs => scripts/obs}/debian.libupsclient4.install | 0 {obs => scripts/obs}/debian.nut-cgi.README.Debian | 0 {obs => scripts/obs}/debian.nut-cgi.docs | 0 {obs => scripts/obs}/debian.nut-cgi.install | 0 {obs => scripts/obs}/debian.nut-cgi.manpages | 0 {obs => scripts/obs}/debian.nut-cgi.postinst | 0 {obs => scripts/obs}/debian.nut-cgi.postrm | 0 {obs => scripts/obs}/debian.nut-client.init.in | 0 {obs => scripts/obs}/debian.nut-client.install | 0 {obs => scripts/obs}/debian.nut-client.links | 0 {obs => scripts/obs}/debian.nut-client.lintian-overrides | 0 {obs => scripts/obs}/debian.nut-client.maintscript | 0 {obs => scripts/obs}/debian.nut-client.manpages | 0 {obs => scripts/obs}/debian.nut-client.postinst | 0 {obs => scripts/obs}/debian.nut-client.preinst | 0 {obs => scripts/obs}/debian.nut-client.prerm | 0 {obs => scripts/obs}/debian.nut-common.install | 0 {obs => scripts/obs}/debian.nut-common.postinst.in | 0 {obs => scripts/obs}/debian.nut-common.prerm.in | 0 {obs => scripts/obs}/debian.nut-common.tmpfiles.in | 0 {obs => scripts/obs}/debian.nut-doc.doc-base.nut-developer-guide | 0 {obs => scripts/obs}/debian.nut-doc.doc-base.nut-faq | 0 {obs => scripts/obs}/debian.nut-doc.doc-base.nut-packager-guide | 0 {obs => scripts/obs}/debian.nut-doc.doc-base.nut-user-manual | 0 {obs => scripts/obs}/debian.nut-doc.install | 0 {obs => scripts/obs}/debian.nut-ipmi.install | 0 {obs => scripts/obs}/debian.nut-ipmi.manpages | 0 {obs => scripts/obs}/debian.nut-monitor.install | 0 {obs => scripts/obs}/debian.nut-monitor.menu | 0 {obs => scripts/obs}/debian.nut-monitor.xpm | 0 {obs => scripts/obs}/debian.nut-powerman-pdu.install | 0 {obs => scripts/obs}/debian.nut-powerman-pdu.manpages | 0 {obs => scripts/obs}/debian.nut-server.dirs | 0 {obs => scripts/obs}/debian.nut-server.init.in | 0 {obs => scripts/obs}/debian.nut-server.install | 0 {obs => scripts/obs}/debian.nut-server.manpages | 0 {obs => scripts/obs}/debian.nut-server.postinst | 0 {obs => scripts/obs}/debian.nut-server.postrm | 0 {obs => scripts/obs}/debian.nut-server.preinst | 0 {obs => scripts/obs}/debian.nut-server.prerm.in | 0 {obs => scripts/obs}/debian.nut-snmp.docs | 0 {obs => scripts/obs}/debian.nut-snmp.install | 0 {obs => scripts/obs}/debian.nut-snmp.manpages | 0 {obs => scripts/obs}/debian.nut-xml.install | 0 {obs => scripts/obs}/debian.nut-xml.manpages | 0 {obs => scripts/obs}/debian.nut.README.Debian | 0 {obs => scripts/obs}/debian.nut.TODO.Debian | 0 {obs => scripts/obs}/debian.nut.docs | 0 {obs => scripts/obs}/debian.python-nut.install | 0 {obs => scripts/obs}/debian.rules | 0 {obs => scripts/obs}/debian.series | 0 {obs => scripts/obs}/debian.watch | 0 {obs => scripts/obs}/nut-linux-i2c.install | 0 {obs => scripts/obs}/nut-linux-i2c.manpages | 0 {obs => scripts/obs}/nut-modbus.install | 0 {obs => scripts/obs}/nut-modbus.manpages | 0 {obs => scripts/obs}/nut.changes | 0 {obs => scripts/obs}/nut.dsc | 0 {obs => scripts/obs}/nut.spec | 0 {obs => scripts/obs}/pkgsrc.obs | 0 82 files changed, 0 insertions(+), 0 deletions(-) rename {obs => scripts/obs}/control (100%) rename {obs => scripts/obs}/debian.Makefile.am (100%) rename {obs => scripts/obs}/debian.NEWS (100%) rename {obs => scripts/obs}/debian.changelog (100%) rename {obs => scripts/obs}/debian.compat (100%) rename {obs => scripts/obs}/debian.control (100%) rename {obs => scripts/obs}/debian.copyright (100%) rename {obs => scripts/obs}/debian.description.subst (100%) rename {obs => scripts/obs}/debian.gbp.conf (100%) rename {obs => scripts/obs}/debian.hotplug (100%) rename {obs => scripts/obs}/debian.libnutclient-dev.install (100%) rename {obs => scripts/obs}/debian.libnutclient-dev.manpages (100%) rename {obs => scripts/obs}/debian.libnutclient1.install (100%) rename {obs => scripts/obs}/debian.libnutclient1.lintian-overrides (100%) rename {obs => scripts/obs}/debian.libnutclientstub-dev.install (100%) rename {obs => scripts/obs}/debian.libnutclientstub1.install (100%) rename {obs => scripts/obs}/debian.libnutclientstub1.lintian-overrides (100%) rename {obs => scripts/obs}/debian.libnutscan-dev.install (100%) rename {obs => scripts/obs}/debian.libnutscan1.install (100%) rename {obs => scripts/obs}/debian.libups-nut-perl.install (100%) rename {obs => scripts/obs}/debian.libupsclient-dev.install (100%) rename {obs => scripts/obs}/debian.libupsclient-dev.manpages (100%) rename {obs => scripts/obs}/debian.libupsclient4.install (100%) rename {obs => scripts/obs}/debian.nut-cgi.README.Debian (100%) rename {obs => scripts/obs}/debian.nut-cgi.docs (100%) rename {obs => scripts/obs}/debian.nut-cgi.install (100%) rename {obs => scripts/obs}/debian.nut-cgi.manpages (100%) rename {obs => scripts/obs}/debian.nut-cgi.postinst (100%) rename {obs => scripts/obs}/debian.nut-cgi.postrm (100%) rename {obs => scripts/obs}/debian.nut-client.init.in (100%) rename {obs => scripts/obs}/debian.nut-client.install (100%) rename {obs => scripts/obs}/debian.nut-client.links (100%) rename {obs => scripts/obs}/debian.nut-client.lintian-overrides (100%) rename {obs => scripts/obs}/debian.nut-client.maintscript (100%) rename {obs => scripts/obs}/debian.nut-client.manpages (100%) rename {obs => scripts/obs}/debian.nut-client.postinst (100%) rename {obs => scripts/obs}/debian.nut-client.preinst (100%) rename {obs => scripts/obs}/debian.nut-client.prerm (100%) rename {obs => scripts/obs}/debian.nut-common.install (100%) rename {obs => scripts/obs}/debian.nut-common.postinst.in (100%) rename {obs => scripts/obs}/debian.nut-common.prerm.in (100%) rename {obs => scripts/obs}/debian.nut-common.tmpfiles.in (100%) rename {obs => scripts/obs}/debian.nut-doc.doc-base.nut-developer-guide (100%) rename {obs => scripts/obs}/debian.nut-doc.doc-base.nut-faq (100%) rename {obs => scripts/obs}/debian.nut-doc.doc-base.nut-packager-guide (100%) rename {obs => scripts/obs}/debian.nut-doc.doc-base.nut-user-manual (100%) rename {obs => scripts/obs}/debian.nut-doc.install (100%) rename {obs => scripts/obs}/debian.nut-ipmi.install (100%) rename {obs => scripts/obs}/debian.nut-ipmi.manpages (100%) rename {obs => scripts/obs}/debian.nut-monitor.install (100%) rename {obs => scripts/obs}/debian.nut-monitor.menu (100%) rename {obs => scripts/obs}/debian.nut-monitor.xpm (100%) rename {obs => scripts/obs}/debian.nut-powerman-pdu.install (100%) rename {obs => scripts/obs}/debian.nut-powerman-pdu.manpages (100%) rename {obs => scripts/obs}/debian.nut-server.dirs (100%) rename {obs => scripts/obs}/debian.nut-server.init.in (100%) rename {obs => scripts/obs}/debian.nut-server.install (100%) rename {obs => scripts/obs}/debian.nut-server.manpages (100%) rename {obs => scripts/obs}/debian.nut-server.postinst (100%) rename {obs => scripts/obs}/debian.nut-server.postrm (100%) rename {obs => scripts/obs}/debian.nut-server.preinst (100%) rename {obs => scripts/obs}/debian.nut-server.prerm.in (100%) rename {obs => scripts/obs}/debian.nut-snmp.docs (100%) rename {obs => scripts/obs}/debian.nut-snmp.install (100%) rename {obs => scripts/obs}/debian.nut-snmp.manpages (100%) rename {obs => scripts/obs}/debian.nut-xml.install (100%) rename {obs => scripts/obs}/debian.nut-xml.manpages (100%) rename {obs => scripts/obs}/debian.nut.README.Debian (100%) rename {obs => scripts/obs}/debian.nut.TODO.Debian (100%) rename {obs => scripts/obs}/debian.nut.docs (100%) rename {obs => scripts/obs}/debian.python-nut.install (100%) rename {obs => scripts/obs}/debian.rules (100%) rename {obs => scripts/obs}/debian.series (100%) rename {obs => scripts/obs}/debian.watch (100%) rename {obs => scripts/obs}/nut-linux-i2c.install (100%) rename {obs => scripts/obs}/nut-linux-i2c.manpages (100%) rename {obs => scripts/obs}/nut-modbus.install (100%) rename {obs => scripts/obs}/nut-modbus.manpages (100%) rename {obs => scripts/obs}/nut.changes (100%) rename {obs => scripts/obs}/nut.dsc (100%) rename {obs => scripts/obs}/nut.spec (100%) rename {obs => scripts/obs}/pkgsrc.obs (100%) diff --git a/obs/control b/scripts/obs/control similarity index 100% rename from obs/control rename to scripts/obs/control diff --git a/obs/debian.Makefile.am b/scripts/obs/debian.Makefile.am similarity index 100% rename from obs/debian.Makefile.am rename to scripts/obs/debian.Makefile.am diff --git a/obs/debian.NEWS b/scripts/obs/debian.NEWS similarity index 100% rename from obs/debian.NEWS rename to scripts/obs/debian.NEWS diff --git a/obs/debian.changelog b/scripts/obs/debian.changelog similarity index 100% rename from obs/debian.changelog rename to scripts/obs/debian.changelog diff --git a/obs/debian.compat b/scripts/obs/debian.compat similarity index 100% rename from obs/debian.compat rename to scripts/obs/debian.compat diff --git a/obs/debian.control b/scripts/obs/debian.control similarity index 100% rename from obs/debian.control rename to scripts/obs/debian.control diff --git a/obs/debian.copyright b/scripts/obs/debian.copyright similarity index 100% rename from obs/debian.copyright rename to scripts/obs/debian.copyright diff --git a/obs/debian.description.subst b/scripts/obs/debian.description.subst similarity index 100% rename from obs/debian.description.subst rename to scripts/obs/debian.description.subst diff --git a/obs/debian.gbp.conf b/scripts/obs/debian.gbp.conf similarity index 100% rename from obs/debian.gbp.conf rename to scripts/obs/debian.gbp.conf diff --git a/obs/debian.hotplug b/scripts/obs/debian.hotplug similarity index 100% rename from obs/debian.hotplug rename to scripts/obs/debian.hotplug diff --git a/obs/debian.libnutclient-dev.install b/scripts/obs/debian.libnutclient-dev.install similarity index 100% rename from obs/debian.libnutclient-dev.install rename to scripts/obs/debian.libnutclient-dev.install diff --git a/obs/debian.libnutclient-dev.manpages b/scripts/obs/debian.libnutclient-dev.manpages similarity index 100% rename from obs/debian.libnutclient-dev.manpages rename to scripts/obs/debian.libnutclient-dev.manpages diff --git a/obs/debian.libnutclient1.install b/scripts/obs/debian.libnutclient1.install similarity index 100% rename from obs/debian.libnutclient1.install rename to scripts/obs/debian.libnutclient1.install diff --git a/obs/debian.libnutclient1.lintian-overrides b/scripts/obs/debian.libnutclient1.lintian-overrides similarity index 100% rename from obs/debian.libnutclient1.lintian-overrides rename to scripts/obs/debian.libnutclient1.lintian-overrides diff --git a/obs/debian.libnutclientstub-dev.install b/scripts/obs/debian.libnutclientstub-dev.install similarity index 100% rename from obs/debian.libnutclientstub-dev.install rename to scripts/obs/debian.libnutclientstub-dev.install diff --git a/obs/debian.libnutclientstub1.install b/scripts/obs/debian.libnutclientstub1.install similarity index 100% rename from obs/debian.libnutclientstub1.install rename to scripts/obs/debian.libnutclientstub1.install diff --git a/obs/debian.libnutclientstub1.lintian-overrides b/scripts/obs/debian.libnutclientstub1.lintian-overrides similarity index 100% rename from obs/debian.libnutclientstub1.lintian-overrides rename to scripts/obs/debian.libnutclientstub1.lintian-overrides diff --git a/obs/debian.libnutscan-dev.install b/scripts/obs/debian.libnutscan-dev.install similarity index 100% rename from obs/debian.libnutscan-dev.install rename to scripts/obs/debian.libnutscan-dev.install diff --git a/obs/debian.libnutscan1.install b/scripts/obs/debian.libnutscan1.install similarity index 100% rename from obs/debian.libnutscan1.install rename to scripts/obs/debian.libnutscan1.install diff --git a/obs/debian.libups-nut-perl.install b/scripts/obs/debian.libups-nut-perl.install similarity index 100% rename from obs/debian.libups-nut-perl.install rename to scripts/obs/debian.libups-nut-perl.install diff --git a/obs/debian.libupsclient-dev.install b/scripts/obs/debian.libupsclient-dev.install similarity index 100% rename from obs/debian.libupsclient-dev.install rename to scripts/obs/debian.libupsclient-dev.install diff --git a/obs/debian.libupsclient-dev.manpages b/scripts/obs/debian.libupsclient-dev.manpages similarity index 100% rename from obs/debian.libupsclient-dev.manpages rename to scripts/obs/debian.libupsclient-dev.manpages diff --git a/obs/debian.libupsclient4.install b/scripts/obs/debian.libupsclient4.install similarity index 100% rename from obs/debian.libupsclient4.install rename to scripts/obs/debian.libupsclient4.install diff --git a/obs/debian.nut-cgi.README.Debian b/scripts/obs/debian.nut-cgi.README.Debian similarity index 100% rename from obs/debian.nut-cgi.README.Debian rename to scripts/obs/debian.nut-cgi.README.Debian diff --git a/obs/debian.nut-cgi.docs b/scripts/obs/debian.nut-cgi.docs similarity index 100% rename from obs/debian.nut-cgi.docs rename to scripts/obs/debian.nut-cgi.docs diff --git a/obs/debian.nut-cgi.install b/scripts/obs/debian.nut-cgi.install similarity index 100% rename from obs/debian.nut-cgi.install rename to scripts/obs/debian.nut-cgi.install diff --git a/obs/debian.nut-cgi.manpages b/scripts/obs/debian.nut-cgi.manpages similarity index 100% rename from obs/debian.nut-cgi.manpages rename to scripts/obs/debian.nut-cgi.manpages diff --git a/obs/debian.nut-cgi.postinst b/scripts/obs/debian.nut-cgi.postinst similarity index 100% rename from obs/debian.nut-cgi.postinst rename to scripts/obs/debian.nut-cgi.postinst diff --git a/obs/debian.nut-cgi.postrm b/scripts/obs/debian.nut-cgi.postrm similarity index 100% rename from obs/debian.nut-cgi.postrm rename to scripts/obs/debian.nut-cgi.postrm diff --git a/obs/debian.nut-client.init.in b/scripts/obs/debian.nut-client.init.in similarity index 100% rename from obs/debian.nut-client.init.in rename to scripts/obs/debian.nut-client.init.in diff --git a/obs/debian.nut-client.install b/scripts/obs/debian.nut-client.install similarity index 100% rename from obs/debian.nut-client.install rename to scripts/obs/debian.nut-client.install diff --git a/obs/debian.nut-client.links b/scripts/obs/debian.nut-client.links similarity index 100% rename from obs/debian.nut-client.links rename to scripts/obs/debian.nut-client.links diff --git a/obs/debian.nut-client.lintian-overrides b/scripts/obs/debian.nut-client.lintian-overrides similarity index 100% rename from obs/debian.nut-client.lintian-overrides rename to scripts/obs/debian.nut-client.lintian-overrides diff --git a/obs/debian.nut-client.maintscript b/scripts/obs/debian.nut-client.maintscript similarity index 100% rename from obs/debian.nut-client.maintscript rename to scripts/obs/debian.nut-client.maintscript diff --git a/obs/debian.nut-client.manpages b/scripts/obs/debian.nut-client.manpages similarity index 100% rename from obs/debian.nut-client.manpages rename to scripts/obs/debian.nut-client.manpages diff --git a/obs/debian.nut-client.postinst b/scripts/obs/debian.nut-client.postinst similarity index 100% rename from obs/debian.nut-client.postinst rename to scripts/obs/debian.nut-client.postinst diff --git a/obs/debian.nut-client.preinst b/scripts/obs/debian.nut-client.preinst similarity index 100% rename from obs/debian.nut-client.preinst rename to scripts/obs/debian.nut-client.preinst diff --git a/obs/debian.nut-client.prerm b/scripts/obs/debian.nut-client.prerm similarity index 100% rename from obs/debian.nut-client.prerm rename to scripts/obs/debian.nut-client.prerm diff --git a/obs/debian.nut-common.install b/scripts/obs/debian.nut-common.install similarity index 100% rename from obs/debian.nut-common.install rename to scripts/obs/debian.nut-common.install diff --git a/obs/debian.nut-common.postinst.in b/scripts/obs/debian.nut-common.postinst.in similarity index 100% rename from obs/debian.nut-common.postinst.in rename to scripts/obs/debian.nut-common.postinst.in diff --git a/obs/debian.nut-common.prerm.in b/scripts/obs/debian.nut-common.prerm.in similarity index 100% rename from obs/debian.nut-common.prerm.in rename to scripts/obs/debian.nut-common.prerm.in diff --git a/obs/debian.nut-common.tmpfiles.in b/scripts/obs/debian.nut-common.tmpfiles.in similarity index 100% rename from obs/debian.nut-common.tmpfiles.in rename to scripts/obs/debian.nut-common.tmpfiles.in diff --git a/obs/debian.nut-doc.doc-base.nut-developer-guide b/scripts/obs/debian.nut-doc.doc-base.nut-developer-guide similarity index 100% rename from obs/debian.nut-doc.doc-base.nut-developer-guide rename to scripts/obs/debian.nut-doc.doc-base.nut-developer-guide diff --git a/obs/debian.nut-doc.doc-base.nut-faq b/scripts/obs/debian.nut-doc.doc-base.nut-faq similarity index 100% rename from obs/debian.nut-doc.doc-base.nut-faq rename to scripts/obs/debian.nut-doc.doc-base.nut-faq diff --git a/obs/debian.nut-doc.doc-base.nut-packager-guide b/scripts/obs/debian.nut-doc.doc-base.nut-packager-guide similarity index 100% rename from obs/debian.nut-doc.doc-base.nut-packager-guide rename to scripts/obs/debian.nut-doc.doc-base.nut-packager-guide diff --git a/obs/debian.nut-doc.doc-base.nut-user-manual b/scripts/obs/debian.nut-doc.doc-base.nut-user-manual similarity index 100% rename from obs/debian.nut-doc.doc-base.nut-user-manual rename to scripts/obs/debian.nut-doc.doc-base.nut-user-manual diff --git a/obs/debian.nut-doc.install b/scripts/obs/debian.nut-doc.install similarity index 100% rename from obs/debian.nut-doc.install rename to scripts/obs/debian.nut-doc.install diff --git a/obs/debian.nut-ipmi.install b/scripts/obs/debian.nut-ipmi.install similarity index 100% rename from obs/debian.nut-ipmi.install rename to scripts/obs/debian.nut-ipmi.install diff --git a/obs/debian.nut-ipmi.manpages b/scripts/obs/debian.nut-ipmi.manpages similarity index 100% rename from obs/debian.nut-ipmi.manpages rename to scripts/obs/debian.nut-ipmi.manpages diff --git a/obs/debian.nut-monitor.install b/scripts/obs/debian.nut-monitor.install similarity index 100% rename from obs/debian.nut-monitor.install rename to scripts/obs/debian.nut-monitor.install diff --git a/obs/debian.nut-monitor.menu b/scripts/obs/debian.nut-monitor.menu similarity index 100% rename from obs/debian.nut-monitor.menu rename to scripts/obs/debian.nut-monitor.menu diff --git a/obs/debian.nut-monitor.xpm b/scripts/obs/debian.nut-monitor.xpm similarity index 100% rename from obs/debian.nut-monitor.xpm rename to scripts/obs/debian.nut-monitor.xpm diff --git a/obs/debian.nut-powerman-pdu.install b/scripts/obs/debian.nut-powerman-pdu.install similarity index 100% rename from obs/debian.nut-powerman-pdu.install rename to scripts/obs/debian.nut-powerman-pdu.install diff --git a/obs/debian.nut-powerman-pdu.manpages b/scripts/obs/debian.nut-powerman-pdu.manpages similarity index 100% rename from obs/debian.nut-powerman-pdu.manpages rename to scripts/obs/debian.nut-powerman-pdu.manpages diff --git a/obs/debian.nut-server.dirs b/scripts/obs/debian.nut-server.dirs similarity index 100% rename from obs/debian.nut-server.dirs rename to scripts/obs/debian.nut-server.dirs diff --git a/obs/debian.nut-server.init.in b/scripts/obs/debian.nut-server.init.in similarity index 100% rename from obs/debian.nut-server.init.in rename to scripts/obs/debian.nut-server.init.in diff --git a/obs/debian.nut-server.install b/scripts/obs/debian.nut-server.install similarity index 100% rename from obs/debian.nut-server.install rename to scripts/obs/debian.nut-server.install diff --git a/obs/debian.nut-server.manpages b/scripts/obs/debian.nut-server.manpages similarity index 100% rename from obs/debian.nut-server.manpages rename to scripts/obs/debian.nut-server.manpages diff --git a/obs/debian.nut-server.postinst b/scripts/obs/debian.nut-server.postinst similarity index 100% rename from obs/debian.nut-server.postinst rename to scripts/obs/debian.nut-server.postinst diff --git a/obs/debian.nut-server.postrm b/scripts/obs/debian.nut-server.postrm similarity index 100% rename from obs/debian.nut-server.postrm rename to scripts/obs/debian.nut-server.postrm diff --git a/obs/debian.nut-server.preinst b/scripts/obs/debian.nut-server.preinst similarity index 100% rename from obs/debian.nut-server.preinst rename to scripts/obs/debian.nut-server.preinst diff --git a/obs/debian.nut-server.prerm.in b/scripts/obs/debian.nut-server.prerm.in similarity index 100% rename from obs/debian.nut-server.prerm.in rename to scripts/obs/debian.nut-server.prerm.in diff --git a/obs/debian.nut-snmp.docs b/scripts/obs/debian.nut-snmp.docs similarity index 100% rename from obs/debian.nut-snmp.docs rename to scripts/obs/debian.nut-snmp.docs diff --git a/obs/debian.nut-snmp.install b/scripts/obs/debian.nut-snmp.install similarity index 100% rename from obs/debian.nut-snmp.install rename to scripts/obs/debian.nut-snmp.install diff --git a/obs/debian.nut-snmp.manpages b/scripts/obs/debian.nut-snmp.manpages similarity index 100% rename from obs/debian.nut-snmp.manpages rename to scripts/obs/debian.nut-snmp.manpages diff --git a/obs/debian.nut-xml.install b/scripts/obs/debian.nut-xml.install similarity index 100% rename from obs/debian.nut-xml.install rename to scripts/obs/debian.nut-xml.install diff --git a/obs/debian.nut-xml.manpages b/scripts/obs/debian.nut-xml.manpages similarity index 100% rename from obs/debian.nut-xml.manpages rename to scripts/obs/debian.nut-xml.manpages diff --git a/obs/debian.nut.README.Debian b/scripts/obs/debian.nut.README.Debian similarity index 100% rename from obs/debian.nut.README.Debian rename to scripts/obs/debian.nut.README.Debian diff --git a/obs/debian.nut.TODO.Debian b/scripts/obs/debian.nut.TODO.Debian similarity index 100% rename from obs/debian.nut.TODO.Debian rename to scripts/obs/debian.nut.TODO.Debian diff --git a/obs/debian.nut.docs b/scripts/obs/debian.nut.docs similarity index 100% rename from obs/debian.nut.docs rename to scripts/obs/debian.nut.docs diff --git a/obs/debian.python-nut.install b/scripts/obs/debian.python-nut.install similarity index 100% rename from obs/debian.python-nut.install rename to scripts/obs/debian.python-nut.install diff --git a/obs/debian.rules b/scripts/obs/debian.rules similarity index 100% rename from obs/debian.rules rename to scripts/obs/debian.rules diff --git a/obs/debian.series b/scripts/obs/debian.series similarity index 100% rename from obs/debian.series rename to scripts/obs/debian.series diff --git a/obs/debian.watch b/scripts/obs/debian.watch similarity index 100% rename from obs/debian.watch rename to scripts/obs/debian.watch diff --git a/obs/nut-linux-i2c.install b/scripts/obs/nut-linux-i2c.install similarity index 100% rename from obs/nut-linux-i2c.install rename to scripts/obs/nut-linux-i2c.install diff --git a/obs/nut-linux-i2c.manpages b/scripts/obs/nut-linux-i2c.manpages similarity index 100% rename from obs/nut-linux-i2c.manpages rename to scripts/obs/nut-linux-i2c.manpages diff --git a/obs/nut-modbus.install b/scripts/obs/nut-modbus.install similarity index 100% rename from obs/nut-modbus.install rename to scripts/obs/nut-modbus.install diff --git a/obs/nut-modbus.manpages b/scripts/obs/nut-modbus.manpages similarity index 100% rename from obs/nut-modbus.manpages rename to scripts/obs/nut-modbus.manpages diff --git a/obs/nut.changes b/scripts/obs/nut.changes similarity index 100% rename from obs/nut.changes rename to scripts/obs/nut.changes diff --git a/obs/nut.dsc b/scripts/obs/nut.dsc similarity index 100% rename from obs/nut.dsc rename to scripts/obs/nut.dsc diff --git a/obs/nut.spec b/scripts/obs/nut.spec similarity index 100% rename from obs/nut.spec rename to scripts/obs/nut.spec diff --git a/obs/pkgsrc.obs b/scripts/obs/pkgsrc.obs similarity index 100% rename from obs/pkgsrc.obs rename to scripts/obs/pkgsrc.obs From 4142b457fc339e5b9037faaf6c216c82030ad466 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Tue, 25 Nov 2025 18:01:04 +0100 Subject: [PATCH 801/805] docs/packager-guide.txt: fix copy-paste typo Signed-off-by: Jim Klimov --- docs/packager-guide.txt | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/docs/packager-guide.txt b/docs/packager-guide.txt index 8c5efc3e0b..cf44a1a46d 100644 --- a/docs/packager-guide.txt +++ b/docs/packager-guide.txt @@ -286,11 +286,11 @@ nut-snmp NOTE: With DMF capability merged, two variants of the `snmp-ups` driver can be built: a legacy-style "monolithic" program with a fixed set of built-in -mapping tables, and `snmp-ups-dmf` with a parsing engine that can load chosen -only the relevant mappings at run-time (and mapping files can be delivered or -modified in the field). Distributions may deliver the legacy driver program -file named as `snmp-ups-old`, and symlink the well-known `snmp-ups` program -name pointing to a preferred implementation (legacy or DMF). +mapping tables, and `snmp-ups-dmf` with a parsing engine that can load only +the chosen relevant mappings at run-time (and dynamic mapping data files can +be delivered or modified in the field). Distributions may deliver the legacy +driver program file named as `snmp-ups-old`, and symlink the well-known +`snmp-ups` program name pointing to a preferred implementation (legacy or DMF). [[pkg-nut-xml]] nut-xml From 58225b74f9246d8b38226d459b176b2d27409341 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Tue, 25 Nov 2025 18:06:28 +0100 Subject: [PATCH 802/805] Drop obsolete OBS recipe files from FTY branch (renamed on master) Signed-off-by: Jim Klimov --- scripts/obs/control | 1 - scripts/obs/nut-linux-i2c.install | 2 -- scripts/obs/nut-linux-i2c.manpages | 2 -- scripts/obs/nut-modbus.install | 3 --- scripts/obs/nut-modbus.manpages | 3 --- 5 files changed, 11 deletions(-) delete mode 120000 scripts/obs/control delete mode 100644 scripts/obs/nut-linux-i2c.install delete mode 100644 scripts/obs/nut-linux-i2c.manpages delete mode 100644 scripts/obs/nut-modbus.install delete mode 100644 scripts/obs/nut-modbus.manpages diff --git a/scripts/obs/control b/scripts/obs/control deleted file mode 120000 index 467d6decea..0000000000 --- a/scripts/obs/control +++ /dev/null @@ -1 +0,0 @@ -debian.control \ No newline at end of file diff --git a/scripts/obs/nut-linux-i2c.install b/scripts/obs/nut-linux-i2c.install deleted file mode 100644 index 9122412c6f..0000000000 --- a/scripts/obs/nut-linux-i2c.install +++ /dev/null @@ -1,2 +0,0 @@ -debian/tmp/lib/nut/asem -debian/tmp/lib/nut/pijuice diff --git a/scripts/obs/nut-linux-i2c.manpages b/scripts/obs/nut-linux-i2c.manpages deleted file mode 100644 index 9c85e7bb49..0000000000 --- a/scripts/obs/nut-linux-i2c.manpages +++ /dev/null @@ -1,2 +0,0 @@ -debian/tmp/usr/share/man/man8/asem.8 -debian/tmp/usr/share/man/man8/pijuice.8 diff --git a/scripts/obs/nut-modbus.install b/scripts/obs/nut-modbus.install deleted file mode 100644 index 957282d838..0000000000 --- a/scripts/obs/nut-modbus.install +++ /dev/null @@ -1,3 +0,0 @@ -debian/tmp/lib/nut/phoenixcontact_modbus -debian/tmp/lib/nut/generic_modbus -debian/tmp/lib/nut/huawei-ups2000 \ No newline at end of file diff --git a/scripts/obs/nut-modbus.manpages b/scripts/obs/nut-modbus.manpages deleted file mode 100644 index 447aac81dc..0000000000 --- a/scripts/obs/nut-modbus.manpages +++ /dev/null @@ -1,3 +0,0 @@ -debian/tmp/usr/share/man/man8/phoenixcontact_modbus.8 -debian/tmp/usr/share/man/man8/generic_modbus.8 -debian/tmp/usr/share/man/man8/huawei-ups2000.8 From 9ef9f92bdec22ae53c5199f7aabda50690aa26ac Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Wed, 26 Nov 2025 00:22:43 +0100 Subject: [PATCH 803/805] drivers/snmp-ups.h: rollback a wrong fix Signed-off-by: Jim Klimov --- drivers/snmp-ups.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/snmp-ups.h b/drivers/snmp-ups.h index 0b954ff58e..2aa6c479df 100644 --- a/drivers/snmp-ups.h +++ b/drivers/snmp-ups.h @@ -229,8 +229,6 @@ typedef int bool_t; # else # define WITH_SNMP_LKP_FUN 1 # endif -#else -# define WITH_SNMP_LKP_FUN 0 #endif #ifndef WITH_SNMP_LKP_FUN_DUMMY From 4dd9e852af4a0bf29dfe81059f798d7758f30a4a Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Sat, 29 Nov 2025 13:23:57 +0100 Subject: [PATCH 804/805] docs/config-prereqs.txt: revise instructions for (now older) Debian 12 Signed-off-by: Jim Klimov --- docs/config-prereqs.txt | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/docs/config-prereqs.txt b/docs/config-prereqs.txt index 05cf3ba8c0..e9ed793021 100644 --- a/docs/config-prereqs.txt +++ b/docs/config-prereqs.txt @@ -238,7 +238,8 @@ metadata about recently published package revisions: # service unit files in a separate development package; earlier distro # releases did not seem to require it explicitly: :; apt-get install \ - systemd-dev + systemd-dev \ + || true # Optionally for sd_notify integration: :; apt-get install \ @@ -300,7 +301,8 @@ complete environments): qemu-user-static ------ -NOTE: For Jenkins agents, also need to `apt-get install openjdk-21-jdk-headless`. +NOTE: For Jenkins agents, also need to `apt-get install openjdk-21-jdk-headless` +(or `apt-get install openjdk-17-jdk-headless` on Debian 12 and older). You may have to ensure that `/proc` is mounted in the target chroot (or do this from the running container). From ece1056252154dc62c3b3b8a6e537a75aeacd5a7 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Sat, 29 Nov 2025 13:41:12 +0100 Subject: [PATCH 805/805] docs/config-prereqs.txt: refer also to "Building NUT for in-place upgrades or non-disruptive tests" from "Prerequisites for building NUT on different OSes" as the two chapters are closely coupled Signed-off-by: Jim Klimov --- docs/config-prereqs.txt | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/docs/config-prereqs.txt b/docs/config-prereqs.txt index e9ed793021..b2b63991a1 100644 --- a/docs/config-prereqs.txt +++ b/docs/config-prereqs.txt @@ -21,6 +21,12 @@ of new releases. * For Linux systems, we have notes on linkdoc:qa-guide[Custom NUT CI farm build agents: LXC multi-arch containers,CI_LXC,docs/ci-farm-lxc-setup.txt] +* After installing the build prerequisites needed on your platform as listed + below, you might want to follow up with + linkdoc:user-manual[Building NUT for in-place upgrades or non-disruptive tests,Installing_inplace,INSTALL.nut.adoc,_installation_instructions] +////////////////////////////////////////////////////////////////////////////// +// https://networkupstools.org/docs/user-manual.chunked/_installation_instructions.html#5-2-building-nut-for-in-place-upgrades-or-non-disruptive-tests +////////////////////////////////////////////////////////////////////////////// Some of the below are alternatives, e.g. compiler toolkits (gcc vs. clang) or SSL implementations (OpenSSL vs. Mozilla NSS) -- no problem installing