Last active
September 1, 2022 21:17
-
-
Save WillNilges/99817a94b93bf3b5b6b1642f93b6b5a1 to your computer and use it in GitHub Desktop.
How 2 run matlab w/o installing it :)
This file contains hidden or 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
#!/bin/bash | |
# Put this script in a directory _somewhere._ I'm using `/home/wilnil/Documents/4-2-RIT/CMPE 480/matlab_dingus/` | |
# To run this, cd into your `matlab_dingus` directory, and then `./run_matlab.sh` | |
# Oh, you'll also need podman installed. | |
MATLAB_DINGUS="$PWD" # Wherever you store your matlab files | |
xauth_path=/tmp/matthew-xauth # Where on the host you want to copy your xauth | |
# Run MATLAB in a native X window :) | |
if [ "$(pwd)" == "$HOME" ]; then | |
echo "DON'T FUCKING RUN THIS SCRIPT FROM YOUR FUCKING HOMEDIR" | |
echo "Place it in a directory LITERALLY ANYWHERE ELSE where it can't hurt you :)" | |
exit 1 | |
fi | |
rm -rf "$xauth_path" | |
mkdir -p "$xauth_path" | |
cp $HOME/.Xauthority "$xauth_path" | |
chmod g+rwx "$xauth_path"/.Xauthority | |
podman run --rm -it \ | |
-u root \ | |
-e DISPLAY=$DISPLAY \ | |
-v /tmp/.X11-unix:/tmp/.X11-unix:Z \ | |
-v "$xauth_path"/.Xauthority:/root/.Xauthority:Z \ | |
--name matthew \ | |
--network=host \ | |
--shm-size=512M \ | |
-v "$MATLAB_DINGUS":/home/matlab/Documents/MATLAB:Z \ | |
mathworks/matlab \ | |
bash | |
rm -rf "$xauth_path" | |
# If you need to install a thing, I might recommend doing so in the container, then running | |
# podman commit {id} matthew | |
# and changing the image name from mathworks/matlab to matthew |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment