-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #197 from mariux64/add-prebuild-rstudio-2022.02.3-492
Add prebuild rstudio 2022.02.3 492
- Loading branch information
Showing
1 changed file
with
71 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
#! /bin/bash | ||
|
||
# use the debian build from rstudio site (Ubuntu 18+/Debian 10+) | ||
|
||
PKG=rstudio | ||
VERSION=2022.02.3-492 | ||
VERSIONP=${VERSION/-/+} # just brilliant ! | ||
BUILD=0 | ||
|
||
PREFIX=/pkg/$PKG-$VERSION-$BUILD | ||
if [ -n "$TESTING" ]; then PREFIX=/dev/shm/$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/desktop/bionic/amd64/rstudio-2022.02.3-492-amd64-debian.tar.gz | ||
BEEHIVE=https://beehive.molgen.mpg.de/f68c6713864cc12967a7414ab6040e1f/rstudio-2022.02.3-492-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 | ||
|
||
mv -v rstudio-$VERSIONP/* .. | ||
|
||
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 |