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

Re: Proposing debugging aid in scripts



Christian Hammers wrote:
> Since I begun using debconf I had very much problems because my scripts 
> suddenly were completely silent as I removed all the nice "echo"
> commands that before told me what was going on.
> 
> To solve this problem (verbose for me, no output for users), I started 
> inserting the following line in all my postinst/preinst etc. scripts:
> 
> $DEBIAN_SCRIPT_DEBUG || set -v -x
> 
> This helped me very much. Does anybody has similar tricks, too ? 

Well I assume you know about DEBCONF_DEBUG. Here's a trick I thought of:

debug () {
	echo "# $*" >&3
}
debug testing the debug mechanism

Then call debug whereever. If you have DEBCONF_DEBUG set, you see something
like this:

debconf: trying frontend Text
debconf: <-- # testing the debug mechanism
debconf: <-- VERSION 2.0
debconf: --> 0 2.0

etc, etc. (Debconf ignores lines starting with "#".)

-- 
see shy jo


Reply to: