Skip to content

Instantly share code, notes, and snippets.

@Brianetta
Last active June 28, 2025 16:28
Show Gist options
  • Save Brianetta/52ba0f9e99d29aaedfb2d66fe997d592 to your computer and use it in GitHub Desktop.
Save Brianetta/52ba0f9e99d29aaedfb2d66fe997d592 to your computer and use it in GitHub Desktop.
Commands used to get MDK2 runing on Ubuntu 24.04
#!/bin/bash
# NO CHECKING, NO WARRANTY.
# Don't run this blindly, that would be moronic. Check nuget package versions and Steam paths.
# Also, don't check in any of the changes to Git. Malware will glare at you.
# Install Rider and .NET
sudo snap install rider --classic
sudo add-apt-repository ppa:dotnet/backports
sudo apt-get update && sudo apt-get install -y dotnet-sdk-9.0
# I didn't do this, but Mdk.CheckDotNet did look like it would need it. Weird.
#sudo apt-get install -y dotnet-sdk-8.0
# Get the MDK2 source
mkdir ~/RiderProjects/
pushd ~/RiderProjects/
git clone [email protected]:malforge/mdk2.git
cd mdk2/Source
# Overwrite the template .mdk.local.ini
# If you're copying and pasting into shell line by line, these next five are all one command.
cat > ScriptTemplates/content/0_Script/PbScript.mdk.local.ini <<'INI'
[mdk]
binarypath = ~/.local/share/Steam/steamapps/common/SpaceEngineers/Bin64/
output = ~/.local/share/Steam/steamapps/compatdata/244850/pfx/drive_c/users/steamuser/AppData/Roaming/SpaceEngineers/IngameScripts/local/
INI
# Re-use it
cp ScriptTemplates/content/0_Script/PbScript.mdk.local.ini Mdk.Extractor/Mdk.Extractor.mdk.local.ini
# Don't build Mdk.Notification.Windows (unless you like red)
sed -i '/{773839C9-AF61-4A22-A41C-9493E1D25C7E}.Debug|x64.Build.0 = Debug|x64/d' MDK-Complete.sln
# Build all the packages! Haha, ignore the broken ones. This should get the dependent nuget things installed.
dotnet build MDK-Complete.sln
# Build CheckDotNet for Linux
pushd Mdk.CheckDotNet
dotnet publish "Mdk.CheckDotNet.csproj" -c Release --self-contained false -r linux-x64 /p:PublishSingleFile=true /p:IncludeNativeLibrariesForSelfExtract=true -o "*Undefined*Binaries"
# and install, the ugly way
cp \*Undefined\*Binaries/checkdotnet ~/.nuget/packages/mal.mdk2.pbpackager/2.1.5/tools/checkdotnet.exe
popd
# Build CommandLine for Linux
pushd Mdk.CommandLine
dotnet publish "Mdk.CommandLine.csproj" -c Release --self-contained false -r linux-x64 /p:IncludeNativeLibrariesForSelfExtract=true -o "*Undefined*Binaries"
# and install, the ugly way
cp -a \*Undefined\*Binaries/* ~/.nuget/packages/mal.mdk2.pbpackager/2.1.5/tools/
popd
# Rebuild! This might not be necessary, but it was fun to see the green
dotnet build MDK-Complete.sln
dotnet new install Mal.Mdk2.ScriptTemplates
popd
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment