entrypoint: Don't download headers when kheaders mod is available
@@ -61,8 +61,11 @@ fi
# In the gadget image, /usr/src is a symlink to /host/usr/src (see gadget-*.Dockerfile).
# If the kernel headers are already available on the gadget pod via the symlink,
-# no need to download them.
+# or the kheaders module is available no need to download them.
if [ "$ID" = "rhcos" ] && [ ! -d "/usr/src/kernels/$KERNEL" ]; then
+ if grep -q '^kheaders ' /proc/modules || (modprobe kheaders && rmmod kheaders); then
+ echo "kheaders module available, kernel headers won't be downloaded"
+ else
# Using Centos RPMs because RHCOS ones are not publicly available (they are the same).
echo "Fetching kernel-devel from CentOS Vault Mirror..."
@@ -108,7 +111,7 @@ if [ "$ID" = "rhcos" ] && [ ! -d "/usr/src/kernels/$KERNEL" ]; then
rpm2cpio $RPM | cpio --quiet -i
popd
- # In the gadget image, /usr/src is a symlink to /host/usr/src (see gadget-*.Dockerfile).
+ # In the gadget image, /usr/src is a symlink to /host/usr/src (see gadget.Dockerfile).
# But in the case of RHCOS, remove the symlink and install files in the container.
test ! -L /usr/src || rm -f /usr/src
mkdir -p /usr/src/kernels/
@@ -120,6 +123,7 @@ if [ "$ID" = "rhcos" ] && [ ! -d "/usr/src/kernels/$KERNEL" ]; then
rm -rf $RPMDIR
fi
fi
+fi
## Hooks Begins ##
