Hi
Perhaps someone on sage devel can help. Specifically this is called:
0 jan@snapperkob:~/src/sagemath-optional/sagemath-optional-6.1/debian$grep -A1 SPKG postinst
for SPKG in /usr/lib/sagemath/upstream/*; do
HOME=/root/ DOT_SAGE=/root/.sage /usr/bin/sage -i ${SPKG#/usr/lib/sagemath/upstream/}|cut -d\- -f1,1;
done;
Can another variable besides HOME and DOT_SAGE be set for where the optional packages put things?
Of course postinst runs as root, and usually sage -i should NOT be run as root. sagemath-optional was really for personal use, and I might discontinue it if this is not cleanly solvable. Perhaps that can be changed to su - but it would probably require adding a sagemath user which is a whole bunch of extra work. Installing sagemath-upstream-binary does not compile anything as root, it copies the compiled binaries into standard places, with files owned by root., which is normal for many binaries.
It will not solve the problem that once the sagemath-upstream-binary is installed, and a user runs sage -i as root, then the same problem might follow, unless sage -i was patched to need a --force and to have a warning when run as root.