xref: /linux/scripts/depmod.sh (revision c532de5a67a70f8533d495f8f2aaa9a0491c3ad0)
1#!/bin/sh
2# SPDX-License-Identifier: GPL-2.0
3#
4# A depmod wrapper
5
6if test $# -ne 1; then
7	echo "Usage: $0 <kernelrelease>" >&2
8	exit 1
9fi
10
11KERNELRELEASE=$1
12
13: ${DEPMOD:=depmod}
14
15if ! test -r System.map ; then
16	echo "Warning: modules_install: missing 'System.map' file. Skipping depmod." >&2
17	exit 0
18fi
19
20# legacy behavior: "depmod" in /sbin, no /sbin in PATH
21PATH="$PATH:/sbin"
22if [ -z $(command -v $DEPMOD) ]; then
23	echo "Warning: 'make modules_install' requires $DEPMOD. Please install it." >&2
24	echo "This is probably in the kmod package." >&2
25	exit 0
26fi
27
28set -- -ae -F System.map
29if test -n "$INSTALL_MOD_PATH"; then
30	set -- "$@" -b "$INSTALL_MOD_PATH"
31fi
32exec "$DEPMOD" "$@" "$KERNELRELEASE"
33