ctdb-scripts: Update detect_init_style to use /etc/os-release master
authorMartin Schwenke <mschwenke@ddn.com>
Tue, 19 Sep 2023 07:34:55 +0000 (17:34 +1000)
committerAmitay Isaacs <amitay@gmail.com>
Mon, 30 Oct 2023 08:14:24 +0000 (19:14 +1100)
commit4736f3b848639f3709120338b56f74c12ffe5ba3
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>
ctdb/config/functions
ctdb/tests/UNIT/eventscripts/etc-ctdb/rc.local
ctdb/tests/UNIT/eventscripts/etc/os-release [new file with mode: 0644]