Aaron,

Slowly coming back to this...
On 16 April 2008 at 14:52, Aaron M. Ucko wrote:
| Dirk Eddelbuettel <[EMAIL PROTECTED]> writes:
| 
| > Thanks for the bug report.  This is indeed suboptimal right now.
| 
| Thanks for the quick response!  Having taken a closer look at the
| situation, I see that R parses Renviron files internally, whereas I
| had incorrectly assumed that a wrapper script was sourcing them.  As
| such, I will have to withdraw most of my suggestions, leaving only the
| ucf approach; please forgive my earlier naïvety.
| 
| Anyway, I've never used ucf myself, so you might want to ask
| debian-devel for a sanity check, but it does at least have pretty
| generous documentation.  I don't have time to do too much with this
| (have you ever met a fellow DD who *wasn't* insanely busy? ;-), but I
| believe the requisite postinst logic would be more or less as follows:
| (NB: COMPLETELY UNTESTED!)
| 
|     if [ -x /usr/bin/paperconf ]; then
|       ## get the value we want from Debian's paperconf utility
|       papersize=`/usr/bin/paperconf`
|       ## have perl subst. second expression with $papersize for first
|       ## uses the x mod. and curlies to denote the usual s|1st|2nd|
|       perlexp="s{^R_PAPERSIZE_USER=\\$\{R_PAPERSIZE\}}
|                 {R_PAPERSIZE_USER=\\$\{R_PAPERSIZE-'$papersize'\}}x"
|       ## location of generated Renviron file
|       genenv=/var/cache/R/Renviron

That directory does not (yet) exist. So I'd have to add it to the package ?

|       perl -pe "$perlexp" /usr/lib/R/Renviron.unsubstituted > $genenv

Renviron is in a different location...

|       echo "Setting R_PAPERSIZE_USER default to '$papersize'"
|       ## supply historic md5sums to help ucf figure out whether the user
|       ## made any actual modifications
|       if [ ! -d $genenv.md5sum.d ]; then
|         mkdir -p $genenv.md5sum.d
|         for x in /usr/lib/R/Renviron.historic/*; do
|           perl -pe "$perlexp" $x | md5sum > $genenv.md5sum.d/`basename $x`
|         done
|         if [ -f /etc/R/Renviron.dpkg-dist ]; then
|           perl -pe "$perlexp" /etc/R/Renviron.dpkg-dist | md5sum \
|             > $genenv.md5sum.d/default
|         fi
|       fi

This md5sum business is very confusing.  Do you know of postinst example that
use it?

Also, how do I unregister ucf file in case I need to wipe the slate in
testing?

Dirk

|       ## let ucf reconcile any differences; three-way merging is optional.
|       ucf --three-way $genenv /etc/R/Renviron
|       ucfr r-base-core /etc/R/Renviron
|     fi
| 
| BTW, it looks like libpaper1 runs the contents of /etc/libpaper.d when
| the system's default paper size changes, so you could even put the
| relevant logic there and invoke it from your postinst.
| 
| -- 
| Aaron M. Ucko, KB1CJC (amu at alum.mit.edu, ucko at debian.org)
| http://www.mit.edu/~amu/ | http://stuff.mit.edu/cgi/finger/[EMAIL PROTECTED]
| 
| 

-- 
Three out of two people have difficulties with fractions.



--
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to