Blame SOURCES/mod-extra.sh

fa4e14
#! /bin/bash
fa4e14
c34d21
Rpmdir=$1
c34d21
Dir=$Rpmdir/$2
c34d21
List=$3
fa4e14
fa4e14
pushd $Dir
fa4e14
rm -rf modnames
fa4e14
find . -name "*.ko" -type f > modnames
fa4e14
# Look through all of the modules, and throw any that have a dependency in
fa4e14
# our list into the list as well.
c34d21
rm -rf dep.list
fa4e14
rm -rf req.list req2.list
fa4e14
touch dep.list req.list
c34d21
cp $List .
fa4e14
fa4e14
for dep in `cat modnames`
fa4e14
do
fa4e14
  depends=`modinfo $dep | grep depends| cut -f2 -d":" | sed -e 's/^[ \t]*//'`
fa4e14
  [ -z "$depends" ] && continue;
fa4e14
  for mod in `echo $depends | sed -e 's/,/ /g'`
fa4e14
  do
fa4e14
    match=`grep "^$mod.ko" mod-extra.list` ||:
fa4e14
    if [ -z "$match" ]
fa4e14
    then
fa4e14
      continue
fa4e14
    else
fa4e14
      # check if the module we're looking at is in mod-extra too.  if so
fa4e14
      # we don't need to mark the dep as required
fa4e14
      mod2=`basename $dep`
fa4e14
      match2=`grep "^$mod2" mod-extra.list` ||:
fa4e14
      if [ -n "$match2" ]
fa4e14
      then
fa4e14
        continue
fa4e14
          #echo $mod2 >> notreq.list
fa4e14
        else
fa4e14
          echo $mod.ko >> req.list
fa4e14
      fi
fa4e14
    fi
fa4e14
  done
fa4e14
done
fa4e14
fa4e14
sort -u req.list > req2.list
fa4e14
sort -u mod-extra.list > mod-extra2.list
fa4e14
join -v 1 mod-extra2.list req2.list > mod-extra3.list
fa4e14
fa4e14
for mod in `cat mod-extra3.list`
fa4e14
do
fa4e14
  # get the path for the module
fa4e14
  modpath=`grep /$mod modnames` ||:
fa4e14
  [ -z "$modpath" ]  && continue;
c34d21
  echo /lib/modules/$(basename $Dir)/${modpath#"./"} >> dep.list
fa4e14
done
fa4e14
c34d21
sort -u dep.list > $Rpmdir/modules-extra.list
c34d21
rm modnames dep.list req.list req2.list
fa4e14
rm mod-extra.list mod-extra2.list mod-extra3.list
fa4e14
popd
c34d21
c34d21
sed -i "s|^\/||g" $Rpmdir/modules-extra.list