-
-
Notifications
You must be signed in to change notification settings - Fork 14
/
modprobe
24 lines (19 loc) · 795 Bytes
/
modprobe
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#!/bin/sh
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at https://mozilla.org/MPL/2.0/.
set -e -u
# "modprobe" without modprobe
# https://twitter.com/lucabruno/status/902934379835662336
# This isn't 100% fool-proof, but will have a much higher success rate than simply using the "real" modprobe
# Docker often uses "modprobe -va a b c"
# so we ignore modules that start with "-"
for module; do
if [ "${module#-}" = "${module}" ]; then
ip link show "${module}" || true
lsmod | grep "${module}" || true
fi
done
# remove /usr/local/... from PATH so we can exec the real modprobe as a last resort
export PATH="/usr/sbin:/usr/bin:/sbin:/bin"
exec modprobe "$@"