xref: /openbmc/linux/scripts/modules-check.sh (revision 1a998be6)
13a48a919SMasahiro Yamada#!/bin/sh
23a48a919SMasahiro Yamada# SPDX-License-Identifier: GPL-2.0
33a48a919SMasahiro Yamada
43a48a919SMasahiro Yamadaset -e
53a48a919SMasahiro Yamada
68451791dSMasahiro Yamadaif [ $# != 1 ]; then
78451791dSMasahiro Yamada	echo "Usage: $0 <modules.order>" >& 2
88451791dSMasahiro Yamada	exit 1
98451791dSMasahiro Yamadafi
108451791dSMasahiro Yamada
118451791dSMasahiro Yamadaexit_code=0
128451791dSMasahiro Yamada
133a48a919SMasahiro Yamada# Check uniqueness of module names
143a48a919SMasahiro Yamadacheck_same_name_modules()
153a48a919SMasahiro Yamada{
16*1a998be6SMasahiro Yamada	for m in $(sed 's:.*/::' "$1" | sort | uniq -d)
173a48a919SMasahiro Yamada	do
188451791dSMasahiro Yamada		echo "error: the following would cause module name conflict:" >&2
19*1a998be6SMasahiro Yamada		sed -n "/\/$m/s:^:  :p" "$1" >&2
208451791dSMasahiro Yamada		exit_code=1
213a48a919SMasahiro Yamada	done
223a48a919SMasahiro Yamada}
233a48a919SMasahiro Yamada
248451791dSMasahiro Yamadacheck_same_name_modules "$1"
258451791dSMasahiro Yamada
268451791dSMasahiro Yamadaexit $exit_code
27