Skip to content

Commit

Permalink
build xinetd for centos 9
Browse files Browse the repository at this point in the history
  • Loading branch information
sni committed Nov 9, 2022
1 parent 01fbe36 commit 3fc4068
Show file tree
Hide file tree
Showing 8 changed files with 33 additions and 20 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ PACKAGES=freetds \
grafana-thruk-datasource \
sakuli\
victoriametrics \
xinetd
xinetd

include Makefile.omd

Expand Down
3 changes: 2 additions & 1 deletion Makefile.omd
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ DISTRO_VERSION = $(word 2, $(DISTRO_INFO))
# specific variables. Here the same problem appears again.
# Maybe anyone has a simpler solution?

include $(ROOT_DIR)/distros/Makefile.$(DISTRO_NAME)_$(DISTRO_VERSION)
DISTRO_FILE = $(ROOT_DIR)/distros/Makefile.$(DISTRO_NAME)_$(DISTRO_VERSION)
include $(DISTRO_FILE)

# Net result -> all Makefiles have now access to the linux distribution
# specific settings
Expand Down
2 changes: 2 additions & 0 deletions distros/Makefile.ROCKY_9
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ BUILD_PACKAGES += libsmbclient-devel
BUILD_PACKAGES += libsqlite3x-devel # needed for gearmand retention
BUILD_PACKAGES += libstdc++-devel
BUILD_PACKAGES += libstdc++-static # required by livestatus
BUILD_PACKAGES += libtirpc-devel # xinetd
BUILD_PACKAGES += libtool
BUILD_PACKAGES += libtool-ltdl-devel # RHEL Server Optional
BUILD_PACKAGES += libtool-ltdl # needed by libtool-ltdl-devel
Expand Down Expand Up @@ -88,6 +89,7 @@ OS_PACKAGES += libicu
OS_PACKAGES += libmcrypt
OS_PACKAGES += libsmbclient
OS_PACKAGES += libsqlite3x
OS_PACKAGES += libtirpc # xinetd
OS_PACKAGES += libtool-ltdl
OS_PACKAGES += logrotate
OS_PACKAGES += mariadb-server
Expand Down
2 changes: 1 addition & 1 deletion distros/Makefile.SLES_15SP3
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ BUILD_PACKAGES += sqlite3-devel
BUILD_PACKAGES += systemd-devel # grafana-loki
BUILD_PACKAGES += tar # needed for "make rpm"
BUILD_PACKAGES += unzip # unpack src files of packages
BUILD_PACKAGES += libtirpc-devel # xinetd
OS_PACKAGES =
OS_PACKAGES += apache2
OS_PACKAGES += bind-utils
Expand All @@ -92,6 +91,7 @@ OS_PACKAGES += libpng16-16
OS_PACKAGES += libreadline7
OS_PACKAGES += libsmbclient0
OS_PACKAGES += libsqlite3-0
OS_PACKAGES += libtirpc # xinetd
OS_PACKAGES += libuuid1
OS_PACKAGES += mysql
OS_PACKAGES += net-snmp
Expand Down
20 changes: 11 additions & 9 deletions packages/xinetd/Makefile
Original file line number Diff line number Diff line change
@@ -1,26 +1,28 @@
include ../../Makefile.omd

XINETD=2-3-15
SLES15 = $(shell echo $(DISTRO_INFO) | grep -c 'SLES 15' )
SLES15SP3 = $(shell echo $(DISTRO_INFO) | grep -c 'SLES 15SP3' )
HAS_XINETD=$(shell grep -c "= xinetd" $(DISTRO_FILE) )
USE_TIRPC = $(shell grep -c 'tirpc' $(DISTRO_FILE) )

ifeq ($(SLES15SP3), 1)
LDFLAGS = "-ltirpc"
ifneq ($(USE_TIRPC), 0)
LDFLAGS=$(shell pkg-config --libs libtirpc)
CFLAGS=$(shell pkg-config --cflags libtirpc)
else
LDFLAGS = ""
LDFLAGS=
C_INCLUDE_PATH=
endif

build:
ifeq ($(SLES15), 1)
ifeq ($(HAS_XINETD), 0)
tar xvzf xinetd-$(XINETD).tar.gz
cd xinetd-xinetd-$(XINETD) && \
./configure; \
make LDFLAGS=$(LDFLAGS); \
make LDFLAGS=$(LDFLAGS) CFLAGS=$(CFLAGS); \
strip xinetd/xinetd
endif

install:
ifeq ($(SLES15), 1)
ifeq ($(HAS_XINETD), 0)
mkdir -p $(DESTDIR)$(OMD_ROOT)/bin
cp xinetd-xinetd-$(XINETD)/xinetd/xinetd \
$(DESTDIR)$(OMD_ROOT)/bin
Expand All @@ -29,6 +31,6 @@ endif
skel:

clean:
ifeq ($(SLES15), 1)
ifeq ($(HAS_XINETD), 0)
rm -rf xinetd-xinetd-$(XINETD)
endif
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@
# Start only if at least on xinetd based service
# is activated

test "$(ls -A ###ROOT###/etc/xinetd.d/)" || exit 5
test "$(ls -A $OMD_ROOT/etc/xinetd.d/)" || exit 5

PIDFILE=###ROOT###/tmp/run/xinetd.pid
if [ -x ###ROOT###/bin/xinetd ]; then
DAEMON=###ROOT###/bin/xinetd
PIDFILE=$OMD_ROOT/tmp/run/xinetd.pid
if [ -x $OMD_ROOT/bin/xinetd ]; then
DAEMON=$OMD_ROOT/bin/xinetd
else
DAEMON=/usr/sbin/xinetd
fi
OPTS="-pidfile ###ROOT###/tmp/run/xinetd.pid -filelog ###ROOT###/var/log/xinetd.log -f ###ROOT###/etc/xinetd.conf"
OPTS="-pidfile $OMD_ROOT/tmp/run/xinetd.pid -filelog $OMD_ROOT/var/log/xinetd.log -f $OMD_ROOT/etc/xinetd.conf"

case "$1" in
start)
Expand Down
2 changes: 0 additions & 2 deletions t/03-distro-makefiles.t
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,6 @@ for my $file (glob("distros/Makefile.*")) {
for my $file (keys %{$all_confs}) {
for my $key (keys %{$all_keys}) {
next if $key eq 'ARCH'; # arch is debian specific
next if $key eq 'CONFIG_SITE'; # CONFIG_SITE is OpenSuSE specific
next if $key eq 'SKIP_PACKAGES'; # SKIP_PACKAGES is optional
ok(exists($all_confs->{$file}->{$key}), "$file: $key");
}
}
Expand Down
12 changes: 11 additions & 1 deletion t/20-package_naemon.t
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ BEGIN {
use lib "$FindBin::Bin/lib/lib/perl5";
}

plan( tests => 86 );
plan( tests => 107 );

##################################################
# create our test site
Expand Down Expand Up @@ -53,6 +53,16 @@ my $tests = [
{ cmd => "/bin/su - $site -c 'grep \"vault module loaded\" var/log/naemon.log'", like => '/vault module loaded/' },

{ cmd => $omd_bin." stop $site" },

# test tcp/xinetd
{ cmd => $omd_bin." config $site set LIVESTATUS_TCP on" },
{ cmd => $omd_bin." config $site set LIVESTATUS_TCP_PORT 9999" },
{ cmd => $omd_bin." start $site", like => '/Starting xinetd\.+\s*OK/' },
{ cmd => $omd_bin." status $site", like => '/xinetd:\s+running/' },
{ cmd => "/bin/su - $site -c './lib/monitoring-plugins/check_tcp -H 127.0.0.1 -p 9999 -E -s \"GET status\n\n\" -e \";program_version;\"'", like => '/TCP OK/' },

{ cmd => $omd_bin." stop $site" },

];
for my $test (@{$tests}) {
TestUtils::test_command($test);
Expand Down

0 comments on commit 3fc4068

Please sign in to comment.