OSDN Git Service

Add MS7619SE
[uclinux-h8/uClinux-dist.git] / tools / modules-alias.sh
1 #!/bin/sh
2 #
3 # quick and dirty generation of a modules.alias file for 2.6 kernels
4 # david_mccullough@securecomputing.com
5
6 alias_file="$1"
7 modinfo="`which modinfo`"
8 [ -z "$modinfo" ] && modinfo="`which /sbin/modinfo`"
9
10 if [ -z "$alias_file" ]
11 then
12         echo "usage: $0 <alias-file>" >&2
13         echo "reads module files names on stdin, puts aliases into alias-file" >&2
14         exit 1
15 fi
16
17 if [ -z "$modinfo" ]
18 then
19         echo "You need modinfo installed for create modules.alias" >&2
20         exit 1
21 fi
22
23 while read module
24 do
25         realname="`basename $module | sed -e 's/\.[k]o$//'`"
26         $modinfo $module | grep "alias: " | sed -e 's/alias:[   ]*//' | while read t
27         do
28                 echo "alias $t $realname"
29         done
30 done > $alias_file
31
32 exit 0