[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: dpkg logging



> > > Regardless of whether packages are using debconf, I have wondered for *years*
> > > why we didn't at least have the option of logging stdout and stderr from
> > > everything in the install/update process.  I think it's a good idea.
> > >
> > > Bdale
> >
> > I have proposed this two years ago and implemented it in my automatic
> > installer for slink. The idea is to start a script session from an
> > initscript hook for vt1 and have all the debian installation started
> > automagically by the shell run by script with all output logged into
> > a logfile.
> >
> > Since all can be done with shell script hacks this solution is very
> > easy to implement and requires very few changes to the installation
> > program. A simple shell wrapper should work.
> 
> Yes please. Where can I find it?

Here it is my script-wrapper hack:

#!/bin/bash
# Usage: script-wrapper command args...
if ! grep -q "SCRIPT_CMD=" ~/.bashrc; then
    cat >> ~/.bashrc <<- EOF
	# Added by `script-wrapper' hack
	if [ "$SCRIPT_CMD" ]; then
	    test "$VERBOSE" && echo "/bin/bash -c '$SCRIPT_CMD'"
	    SCRIPT_CMD="" /bin/bash -c "$SCRIPT_CMD"
	    exit $?
	fi
EOF
fi
SCRIPT_CMD="$*" script

Since script doesn't take a -c "command" option you need this hack which
unfortunately is bash-specific. A better solution would be to add the -c
option to the script command.
You can try my script with: "script-wrapper ls -l" or whatever command
you need.

-- 
Massimo Dal Zotto

+----------------------------------------------------------------------+
|  Massimo Dal Zotto               email: dz@cs.unitn.it               |
|  Via Marconi, 141                phone: ++39-0461534251              |
|  38057 Pergine Valsugana (TN)      www: http://www.cs.unitn.it/~dz/  |
|  Italy                             pgp: see my www home page         |
+----------------------------------------------------------------------+



Reply to: