Move modprobes into post-start script

There's an issue with running modprobe during buildtime.
Not only is it semantically not valid, you don't have capabilities
activated and seccomp disabled during build time, so running modprobe
will crash the entire build.
This commit is contained in:
2023-07-06 18:25:32 +02:00
parent df8b59d815
commit 3cf0075520
2 changed files with 13 additions and 4 deletions

View File

@@ -11,6 +11,8 @@
"capAdd": [ "SYS_MODULE" ], "capAdd": [ "SYS_MODULE" ],
"securityOpt": [ "seccomp=unconfined" ], "securityOpt": [ "seccomp=unconfined" ],
"postStartCommand": "/opt/usbip-dkms/post-start.sh",
"options": { "options": {
"kernelVersion": { "kernelVersion": {
"description": "Kernel version to use for the source code of the USBIP modules. If not specified, the feature will try to determine the kernel version automatically, but this is not guaranteed to work.", "description": "Kernel version to use for the source code of the USBIP modules. If not specified, the feature will try to determine the kernel version automatically, but this is not guaranteed to work.",

View File

@@ -48,11 +48,18 @@ fi
dkms install -m usbip -v "${KERNEL_VERSION}" dkms install -m usbip -v "${KERNEL_VERSION}"
mkdir -p /opt/usbip-dkms
echo "#!/usr/bin/env bash" > /opt/usbip-dkms/post-start.sh
chmod +x /opt/usbip-dkms/post-start.sh
if [ "$AUTO_MODPROBE" != "false" ]; then if [ "$AUTO_MODPROBE" != "false" ]; then
modprobe usbip-core {
modprobe usbip-host echo "modprobe usbip-core"
modprobe vhci-hcd echo "modprobe usbip-host"
echo "modprobe vhci-hcd"
} >> /opt/usbip-dkms/post-start.sh
if [ "$ENABLE_VUDC" != "false" ]; then if [ "$ENABLE_VUDC" != "false" ]; then
modprobe usbip-vudc echo "modprobe usbip-vudc" >> /opt/usbip-dkms/post-start.sh
fi fi
fi fi