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

Re: Is redirecting stdout/stderr in postinst allowed?



Joey Hess <joeyh@debian.org> schrieb:

> Frank Küster wrote:
>> 
>> db_get mypackage/someinfo
>> 
>> VAR=`process $RET | mangle with $WHATEVER`
>> 
>> exec 3>&1 >> $someconffile
>> echo "#added by postinst"
>> echo $VAR
>> exec >&3
>> 
>> Of course in this case, a here-document would be sufficient, but not
>> generally. 
>
> Generally sure, this is ok. You need to be a little bit careful with
> debconf and filehandle swapping later, since it always swaps them around
> as follows, and takes over stdin and stdout:
>
> exec 3>&1 1>&2
>
> Since you apparently understand exec file handle switching 

As far as I understand, knowing this it even gets simpler: I just do

exec >> $someconffile
commands
exec >&3

since 3>&1 has yet been done. 

Bye, Frank
-- 
Frank Küster, Biozentrum der Univ. Basel
Abt. Biophysikalische Chemie



Reply to: