ap_tools/ap-check: use new mdevctl install location

mdevctl has been updated to use /usr/lib/mdevctl/scripts.d/callouts/
instead of /etc/mdevctl.d/scripts.d/callouts/.  The /etc location
is considered deprecated, meaning mdevctl will also look at that
location for now but might eventually stop looking in /etc for
callout scripts.
Based on that, update the installation location for the ap-check
callout.  However, because older versions of mdevctl will still
only look in /etc, let's also put a wrapper script in /etc for now
to provide backward compatibility, and plan to remove it at a
later time.

Link: df6bb57429
Fixes: https://github.com/ibm-s390-linux/s390-tools/issues/139
Signed-off-by: Matthew Rosato <mjrosato@linux.ibm.com>
Reviewed-by: Jan Hoeppner <hoeppner@linux.ibm.com>
Reviewed-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
This commit is contained in:
Matthew Rosato
2022-11-15 12:40:35 -05:00
committed by Jan Höppner
parent 8d8d5e9746
commit 4b5937f142
2 changed files with 32 additions and 3 deletions

View File

@@ -1,8 +1,11 @@
include ../common.mak
MDEVCTL_DIR = /etc/mdevctl.d/
MDEVCTL_SCRIPTS = /etc/mdevctl.d/scripts.d/
MDEVCTL_CALLOUTS = /etc/mdevctl.d/scripts.d/callouts/
MDEVCTL_DIR = /usr/lib/mdevctl/
MDEVCTL_SCRIPTS = /usr/lib/mdevctl/scripts.d/
MDEVCTL_CALLOUTS = /usr/lib/mdevctl/scripts.d/callouts/
MDEVCTL_DEP_DIR = /etc/mdevctl.d/
MDEVCTL_DEP_SCRIPTS = /etc/mdevctl.d/scripts.d/
MDEVCTL_DEP_CALLOUTS = /etc/mdevctl.d/scripts.d/callouts/
libs = $(rootdir)/libap/libap.a \
$(rootdir)/libutil/libutil.a
@@ -32,6 +35,17 @@ install: all
fi; \
$(INSTALL) -g $(GROUP) -o $(OWNER) -m 755 ap-check \
$(DESTDIR)$(MDEVCTL_CALLOUTS)
@if [ ! -d $(DESTDIR)$(MDEVCTL_DEP_CALLOUTS) ]; then \
mkdir -p $(DESTDIR)$(MDEVCTL_DEP_CALLOUTS); \
chown $(OWNER).$(GROUP) $(DESTDIR)$(MDEVCTL_DEP_DIR); \
chown $(OWNER).$(GROUP) $(DESTDIR)$(MDEVCTL_DEP_SCRIPTS); \
chown $(OWNER).$(GROUP) $(DESTDIR)$(MDEVCTL_DEP_CALLOUTS); \
chmod 755 $(DESTDIR)$(MDEVCTL_DEP_DIR); \
chmod 755 $(DESTDIR)$(MDEVCTL_DEP_SCRIPTS); \
chmod 755 $(DESTDIR)$(MDEVCTL_DEP_CALLOUTS); \
fi; \
$(INSTALL) -g $(GROUP) -o $(OWNER) -m 755 ap-check.sh \
$(DESTDIR)$(MDEVCTL_DEP_CALLOUTS)
endif
clean:

15
ap_tools/ap-check.sh Normal file
View File

@@ -0,0 +1,15 @@
#!/bin/sh
#
# ap-check.sh - Wrapper script for 'ap-check' binary
#
# mdevctl has deprecated the /etc/mdevctl.d/scripts.d/callouts/ location in
# newer releases. This wrapper ensures that mdevctl 1.2.0 and older can
# still access 'ap-check' for now, and will be removed at a later time.
#
# Copyright 2022 IBM Corp.
#
# s390-tools is free software; you can redistribute it and/or modify
# it under the terms of the MIT license. See LICENSE for details.
#
[ -e /usr/lib/mdevctl/scripts.d/callouts/ap-check ] && /usr/lib/mdevctl/scripts.d/callouts/ap-check "$@"