Files
webmin/logrotate/install_check.pl
Ilia Ross 466f499e65 Fix openSUSE logrotate vendor overlay handling
This PR updates the Log File Rotation module for openSUSE Leap 16's split `/usr/etc` and `/etc` configuration model.

- Select the local main configuration when present, otherwise use the vendor configuration.

- Recursively merge vendor and local drop-ins using the same precedence as `logrotate-all`.

- Display vendor configurations while keeping `/usr/etc` read-only.

- Copy vendor files into matching `/etc` overrides before editing or deleting them.

- Preserve empty overrides so deleted vendor rotations remain disabled.

- Use the openSUSE wrapper for scheduled rotation and the effective configuration set for forced rotation.

- Keep behavior unchanged on distributions that do not enable the vendor overlay.

Includes regression coverage for selection, precedence, copy-on-write, deletion, scheduling, backups, and protection against direct vendor writes.

Closes [#2682](https://github.com/webmin/webmin/issues/2682).
2026-08-03 02:36:05 +02:00

16 lines
423 B
Perl
Executable File

do 'logrotate-lib.pl';
# is_installed(mode)
# For mode 1, returns 2 if Logrotate is installed, or 0 otherwise.
# For mode 0, returns 1 if installed, 0 if not.
sub is_installed
{
# Accept the vendor main config when the optional local override is absent.
my $main = &get_main_config_file();
return 0 if (!-r $main && !-r $config{'sample_conf'});
return 0 if (!&has_command($config{'logrotate'}));
return $_[0] ? 2 : 1;
}