Bug#228926: /var/lib/dpkg/info/tetex-bin.postinst: line 209: 5576: Permission denied
Matt Zimmerman <mdz@debian.org> schrieb:
> On Thu, Jan 22, 2004 at 06:43:57PM +0100, Frank K?ster wrote:
>
>> --- tetex-bin-2.0.2/debian/postinst.orig Thu Jan 22 18:37:25 2004
>> +++ tetex-bin-2.0.2/debian/postinst Thu Jan 22 18:36:51 2004
>> @@ -200,23 +200,24 @@
>> (cd ${LDATD} ; ln -s ${LDAT} .)
>> fi
>> db_get tetex-bin/hyphen || true
>> + TMP_LDAT=`tempfile`
>> IFS=' ,'
>> lang="$RET"
>> for l in $lang; do
>> case $l in
>> none) cp -f $DFLT $LDAT ;;
>> - british) sed -e "s/%! british ukhyphen.tex/british ukhyphen.tex/" $LDAT | sed -e "s/%! =UKenglish/=UKenglish/" > $LDAT_$$; mv $LDAT_$$ $LDAT ;;
>> - french\[=patois\]) sed -e "s/%! french/french/" $LDAT | sed -e "s/%! =patois/=patois/" > $LDAT_$$; mv $LDAT_$$ $LDAT ;;
>
> Note that the line above must be inside the for loop, not ahead of
> it.
Why can't I use the same tempfile for all replacements? This was what I
intended by putting it outside the for loop.
>> I would prefer to write a function "uncomment_once" and "uncomment_twice"
>> that gets the filenames and patterns, but I fear that doesn't work in
>> sed (s/$pattern/$newpattern/ gives an "unterminated s command"). perl
>> would do, I think.
>
> There's no reason why your idea shouldn't work with sed, unless the quoting
> or pattern is messed up somehow:
You're right. But one has to be careful with the amount of whitespace.
> This whole thing could probably be simplified a great deal, though, by
> generalizing that case statement so that it doesn't need to explicitly
> handle every possible $lang value. For example:
>
> langpat=$(echo "$RET" | sed -e 's/, */\|/g')
> sed -e "s/^%! \($langpat\)/\1/" < $LDAT > $TMP_LDAT
> chown --reference=$LDAT $TMP_LDAT
> chmod --reference=$LDAT $TMP_LDAT
> mv $TMP_LDAT $LDAT
It's not so easy as that. Notice that the text in debconf's return
value, i.e. what is now in the cases statements, is not the same as what
we want to replace.
Regards, Frank
--
Frank Küster, Biozentrum der Univ. Basel
Abt. Biophysikalische Chemie
Reply to: