On 6 February 2021 at 14:57, Sébastien Villemot wrote:
| Le samedi 06 février 2021 à 07:49 -0600, Dirk Eddelbuettel a écrit :
| > So I now have this.  Or do I need to protect /usr/local/lib/R/site-
| > library too?
| 
| You need to protect both.
| 
| In order to simplify the code, you can take inspiration from what has
| been done for python3.9:
| 
https://salsa.debian.org/cpython-team/python3/-/commit/3dc168097f89306558ce3ee17a7a0190fe93d594

Good pointer, thank you!

The two blocks could even be a loop as in

   for d in /usr/local/lib/R /usr/local/lib/R/site-library; do

Now it is:

    # edd 03 Apr 2003  cf Section 10.1.2 of Debian Policy
    # edd 06 Feb 2021  #982069, with a nod to Python's 
debian/PVER-minimal.postinst.in
    if [ -e /etc/staff-group-for-usr-local ]; then
        perm=2775
        group=staff
    else
        perm=775
        group=root
    fi
    if [ ! -e /usr/local/lib/R ]; then
        mkdir -p /usr/local/lib/R 2> /dev/null || true
        chmod 2775 /usr/local/lib/R 2> /dev/null || true
        chown root:staff /usr/local/lib/R 2> /dev/null || true
        chmod $perm /usr/local/lib/R 2> /dev/null || true
        chown root:$group /usr/local/lib/R 2> /dev/null || true
    fi
    localsitelibrary=/usr/local/lib/R/site-library
    if [ ! -e $localsitelibrary ]; then
        mkdir -p $localsitelibrary 2> /dev/null || true
        chmod 2775 $localsitelibrary 2> /dev/null || true
        chown root:staff $localsitelibrary 2> /dev/null || true
        chmod $perm $localsitelibrary 2> /dev/null || true
        chown root:$group $localsitelibrary 2> /dev/null || true
    fi

Dirk

-- 
https://dirk.eddelbuettel.com | @eddelbuettel | e...@debian.org

Reply via email to