ctdb-scripts: Update detect_init_style to use /etc/os-release
commit9313731e96c29ac2fa41f5ca4f5ccd2a75d17dc9
authorMartin Schwenke <mschwenke@ddn.com>
Tue, 19 Sep 2023 07:34:55 +0000 (19 17:34 +1000)
committerAmitay Isaacs <amitay@samba.org>
Mon, 30 Oct 2023 09:19:11 +0000 (30 09:19 +0000)
tree03224fea4b3c34d58166250bf406fac53f8b74ab
parent952d6c2cf48b19807e96a49b95c19c224bd6e732
ctdb-scripts: Update detect_init_style to use /etc/os-release

/etc/os-release is quite universal.  It can be found on most Linux
distros and on FreeBSD.

Attempt to use /etc/os-release to detect Red Hat, SUSE and Debian
based distros.  If /etc/os-release exists but distro is unknown then
$ID is printed as the detected distro, which will probably result in
sub-optimal behaviour, but when tracing it will at least indicate that
a new distro needs to be handled.

The only way to handle missing /etc/os-release is to set
CTDB_INIT_STYLE - see ctdb.sysconfig(5) for details.

The event script unit tests are updated to use /etc/os-release so
the new logic is exercised.

Signed-off-by: Martin Schwenke <mschwenke@ddn.com>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
Autobuild-User(master): Amitay Isaacs <amitay@samba.org>
Autobuild-Date(master): Mon Oct 30 09:19:11 UTC 2023 on atb-devel-224
ctdb/config/functions
ctdb/tests/UNIT/eventscripts/etc-ctdb/rc.local
ctdb/tests/UNIT/eventscripts/etc/os-release [new file with mode: 0644]