Skip to content

Commit

Permalink
Merge pull request #273 from mariux64/update-rstudio
Browse files Browse the repository at this point in the history
Update rstudio
  • Loading branch information
david authored Feb 28, 2024
2 parents cf60eaf + 5a21b27 commit 85b1c32
Showing 1 changed file with 73 additions and 0 deletions.
73 changes: 73 additions & 0 deletions rstudio-2023.12.1-402-0.build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
#! /bin/bash

# use the debian build from rstudio site (Ubuntu 20+/Debian 11+)

PKG=rstudio
VERSION=2023.12.1-402
VERSIONP=${VERSION/-/+} # just brilliant !
BUILD=0

PREFIX=/pkg/$PKG-$VERSION-$BUILD
if [ -n "$TESTING" ]; then PREFIX=/scratch/local2/$PKG-$VERSION-$BUILD ; fi

set -xe
umask 022

BUILD_TMPDIR=/dev/shm/$PKG-$VERSION-$BUILD.$USER.build.tmp
test -d $BUILD_TMPDIR && ( chmod -R u+rwx $BUILD_TMPDIR || true ; rm -rf $BUILD_TMPDIR )
mkdir -p $BUILD_TMPDIR/home
export TMPDIR=$BUILD_TMPDIR
export HOME=$BUILD_TMPDIR/home

# mind the PATH ...
# ----------------------------
# it should work with:
# prun R4 rstudio
# xfce launcher
# own R on the path

mkdir -p $PREFIX
cat >$PREFIX/profile <<-EOF
PATH=$PREFIX/bin:\$PATH:/usr/local/package/bin
if [ -d $PREFIX/.compatlibs ]; then export LD_LIBRARY_PATH=$PREFIX/.compatlibs\${LD_LIBRARY_PATH:+:}\$LD_LIBRARY_PATH ; fi
EOF
. $PREFIX/profile

BUILD=$PREFIX/build

mkdir -p $BUILD
cd $BUILD

# orig: https://download1.rstudio.org/electron/focal/amd64/rstudio-2023.12.1-402-amd64-debian.tar.gz
BEEHIVE=https://beehive.molgen.mpg.de/205ead7b954470207e8cdb6614d68172/rstudio-2023.12.1-402-amd64-debian.tar.gz

test -e rstudio-$VERSION-amd64-debian.tar.gz || wget -nv $BEEHIVE
test -d rstudio-$VERSIONP || tar -xf rstudio-$VERSION-amd64-debian.tar.gz

mkdir ${PREFIX}/bin

mv -v rstudio-$VERSIONP/* ../bin

cat >$PREFIX/bin/rstudio-nv <<-'EOF'
#! /bin/bash
# This allows using rstudio on a compute server, when the users machine
# has the nvidia driver loaded and rstudio gets confused.
# Drawback, this only works if not part of a ssh hopp along chain.
if [ -n "$SSH_CLIENT" ]; then
REMOTEIP=${SSH_CLIENT%% *}
MXGFX=$(ssh $REMOTEIP readlink -f /node/usr_share_mxgfx | grep nvidia)
if [ -n "$MXGFX" ]; then
echo "# offering $MXGFX to desktop client..."
LD_LIBRARY_PATH=$MXGFX/lib${LD_LIBRARY_PATH:+:}$LD_LIBRARY_PATH
export LD_LIBRARY_PATH
fi
fi
exec rstudio "${@+$@}"
EOF

chmod +x $PREFIX/bin/rstudio-nv

exit

0 comments on commit 85b1c32

Please sign in to comment.