more on required packages

John Arrowwood John.Arrowwood at merant.com
Tue Sep 5 10:34:11 PDT 2000


This took some finaggling to make it work, but here it is...

$LFS/bin/log-exec
-------------------
#!/usr/local/temp/bin/bash

# we might be called in any of the following ways:
#   /bin/(name)
#   ./(name)
#   (name)
# strip the path from how we were called
EXECUTABLE=`/usr/local/temp/bin/basename $0`

# log the call
echo $EXECUTABLE $@ >> /tmp/exec.log

# re-build the parameter list
PARAMETERS=""
while [ -n "$1" ]; do
  PARAMETERS="$PARAMETERS\"$1\" "
  shift
done

# execute the real command
eval exec /usr/local/temp/bin/$EXECUTABLE $PARAMETERS
--------------------

Then, for every executable in /usr/local/temp/bin, you create a symlink of
the same name in /bin that points to log-exec, which will in turn exec the
appropriate binary in /usr/local/temp/bin.  So, the only thing in the PATH
would be /bin.  When something looks for an executable, it looks in /bin.
When it tries to run it, it will actually be executing the one in
/usr/local/temp/bin, but the execution will be logged.

There is a small risk that something will try to find the executable by
looking for a non-symlinked binary with specific permissions.  If that
happens, I can copy the log-exec script to the name of the executable, so it
will work the same, but not include symbolic links.

I have no idea how to track dynamic library accesses, or filesystem writes.
If anybody has suggestions, let me know!

-----Original Message-----
From: Gerard Beekmans [mailto:gerard at linuxfromscratch.org]
Sent: Friday, September 01, 2000 4:29 PM
To: lfs-discuss at linuxfromscratch.org
Subject: Re: more on required packages


On Fri, 01 Sep 2000, you wrote:

> > Right now, the list of "universally required" packages (for compiling)
>   $LFS/bin# ln -s log-executable gcc

but how is gcc called than?
or does your log-executable script fire-up gcc in the end.
If not, then the installation doesn't go far and just dies.
If your log-executable starts gcc when it's requested, it should also start 
'ls', 'mv', 'install', 'flex' and countless others. I see a long case 
statement in that file. Or am I overseeing something. 

-- 
Gerard Beekmans
www.linuxfromscratch.org

-*- If Linux doesn't have the solution, you have the wrong problem -*-

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.linuxfromscratch.org/pipermail/lfs-dev/attachments/20000905/59c06a6f/attachment.html>


More information about the lfs-dev mailing list