Here's what I was talking about...  this is the core engine, obviously
it should take some command arguments, and make some intelligent guesses
about where .lrp files exist (stealing from apkg/lrcfg), but I wanted
to show actual working code to make this a non-academic pitch.

Even if folks don't like the idea of dynamic modules extraction at start,
this is a useful tool in its current condition for building up your
modules on demand and saving them with lrcfg.

Regards,

Paul
#!/bin/sh
#
# Build /lib/modules based upon the contents of /etc/modules and a
# defined modules repository
#
MODLIST=/etc/modules
MODREPO=/mnt/mod2433.tgz

LIBMOD=/lib/modules
MODLIST=/tmp/build-modules-list.$$
MODTEMP=/tmp/build-modules-extract.$$

modules=`sed -e 's/#.*//' -e 's/ .*//' -e '/^ *$/d' /etc/modules | sort`
missing=""

for mod in $modules ; do
   if [ ! -f $LIBMOD/${mod}.o ] ; then
       if [ -z "$missing" ] ; then
          echo -n "Missing kernel modules:"
       fi          
       echo -n " ${mod}"
       missing="${mod}.o ${missing}"
   fi 
done

# Nothing missing...
if [ -z "$missing" ] ; then
    exit 0
fi 

echo "."
echo "Extracting modules..."

#
# Ugly -- get absolute path of all modules since we don't have tar -X
#
trap "rm -f $MODLIST" 0 1 2
tar tzf $MODREPO > $MODLIST

for mod in $missing ; do
    findmod="`grep -F ${mod} $MODLIST` ${findmod}"
done    

rm -f $MODLIST
trap '' 0 1 2

#
# Now do the actual module extraction to a temporary area and then
# move the modules to /lib/modules
#
trap "rm -rf $MODTEMP" 0 1 2
mkdir $MODTEMP

tar -xzf $MODREPO -C $MODTEMP $findmod

echo
echo "Installing modules:"
for mod in $findmod ; do
    echo -n " `basename $mod .o`"
    mv $mod $LIBMOD/`basename $mod`
done
echo

rm -rf $MODTEMP
trap '' 0 1 2
-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
leaf-devel mailing list
leaf-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/leaf-devel

Reply via email to