Re: The /tmp and modules_install saga

Peter T. Breuer (ptb@it.uc3m.es)
Wed, 7 Oct 1998 00:27:42 +0200 (MET DST)


"A month of sundays ago Adam Sulmicki wrote:"
>
> ->was about use of tmp in /install_modules/, not make modules and (b)
> ->I offered shell snippets to show that you don't need temporary files
> ->at all. You don't.
>
> do you mean something among the lines of
>
> MY_VAR='ls /foo' ?

Yes. I.e. use shell variables to hold the info.

> Care to show us this example? If it is good it could go into the kernel.
> Even while idea of using /lib/modules is good, I still have not-so-good
> felling about using it for tmp files.

inst_mod() { # NOW target dir first, list of module names follows
TheDirs=$1 # WAS name of file with module names first, dir second
mkdir -p $MODLIB/$TheDir; shift
These="$*"; MODULES="$MODULES $These"
if [ -n "$These" ]; then
cp -p $These $MODLIB/$TheDir
echo Installing modules under $MODLIB/$1
fi
}
... # NOW reverse args and expand file contents
... # WAS first file name, target dir second
if [ -f BLOCK_MODULES ]; then inst_mod block `cat BLOCK_MODULES` ; fi
... # NOW calculate modules we missed using a shell function
... # WAS muck arround with tmp files
diff(){ # list members of arg2 that aren't in arg 1
for j in $2; do
for i in $1; do
case $i in
$j) continue 2 ;; *) ;;
esac
done
echo $j
done
}
... # NOW finish off using the diff() instead of tmp scripts.
ALLOBJS="`ls *.o`"
inst_mod misc `diff "$MODULES" "$ALLOBJS"`

It may be better to separate the two sets of args for diff with a "--", and
let them be themselves, rather than fight with quoting. I'll do that, but
I'm sure everybody else here can too.

> Adam

Peter

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/