Black Mesa

Black Mesa

Black Mesa: HECU
How to install Black Mesa: HECU in the Linux
1 - You will need to create a file names bmhecu_installer.sh in the directory ~/.steam/steam/steamapps/workshop/content/362890/3372585826

2 - Place it in the script below in the file.

Important: You just need to change the ***your_user***in the GAME_DIR by the user, or to change your entire directory for its.

#!/bin/bash

# -------------------------------------
# BM:HECU Installer for Linux
# -------------------------------------

set -euo pipefail
IFS=$'\n\t'

clear
echo "🛠️ Welcome to the BM: HECU installer for Linux."
echo
echo "This script will:"
echo "- Delete old files"
echo "- Install the mod"
echo "- Optionally create desktop shortcuts"
echo
read -rp "Press ENTER to begin..."

# Black Mesa Game Dir
GAME_DIR="/home/***your_user***/.steam/steam/steamapps/common/Black Mesa"
MOD_DIR="$(dirname "$(readlink -f "$0")")"

if [[ ! -d "$GAME_DIR" ]]; then
echo "❌ Could not find Black Mesa directory at:"
echo " $GAME_DIR"
exit 1
fi

cd "$GAME_DIR"

# -------------------------------
# Remove old files
# -------------------------------
echo
echo "🗑️ Deleting old BMHECU files..."
rm -f ./BMHECU.bat ./BMHECU_OLDUI.bat ./BMHECU_uninstall.bat
rm -rf ./bmhecu
echo "✅ Old files removed."

read -rp "Press ENTER to continue to installation..."

# -------------------------------
# Copia os arquivos do mod
# -------------------------------
echo
echo "📦 Installing mod files (this may take a moment)..."
cp -r "$MOD_DIR/"* ./
echo "✅ Mod files copied."

# -------------------------------
# Installer remover
# -------------------------------
rm -f ./bmhecu_installer.sh 2>/dev/null || true

# -------------------------------
# Desktop Shortcut .desktop
# -------------------------------
echo
read -rp "Do you want to create desktop shortcuts? [Y/n] " answer
answer=${answer,,}

if [[ "$answer" != "n" ]]; then
DESKTOP_DIR="$HOME/Desktop"
mkdir -p "$DESKTOP_DIR"

echo "🔧 Creating shortcuts..."

EXEC_PATH="$GAME_DIR/bms.exe"
ICON_PATH="$GAME_DIR/bmhecu/icon.ico"

if [[ ! -f "$EXEC_PATH" ]]; then
echo "⚠️ Warning: bms.exe not found at $EXEC_PATH"
echo " The shortcut may not work until you adjust the path."
fi

if ! command -v steam-run &>/dev/null; then
echo "⚠️ steam-run not found. Install it if the shortcut fails to launch."
fi

cat <<EOF > "$DESKTOP_DIR/BMHECU.desktop"
[Desktop Entry]
Name=BMHECU
Exec=env STEAM_COMPAT_DATA_PATH="\$HOME/.steam/steam/steamapps/compatdata/362890" steam-run "$EXEC_PATH" -game bmhecu
Icon=$ICON_PATH
Type=Application
Categories=Game;
Terminal=false
EOF

cat <<EOF > "$DESKTOP_DIR/BMHECU (Old UI).desktop"
[Desktop Entry]
Name=BMHECU (Old UI)
Exec=env STEAM_COMPAT_DATA_PATH="\$HOME/.steam/steam/steamapps/compatdata/362890" steam-run "$EXEC_PATH" -game bmhecu -oldgameui
Icon=$ICON_PATH
Type=Application
Categories=Game;
Terminal=false
EOF

chmod +x "$DESKTOP_DIR"/BMHECU*.desktop
echo "✅ Shortcuts created on your desktop."
fi

# -------------------------------
# End
# -------------------------------
echo
echo "✅ Installation complete!"
echo
echo "💡 You can now launch BMHECU from your desktop or add:"
echo " -game bmhecu"
echo "to the launch options in Steam."
echo
echo "🎮 Enjoy!"
read -rp "Press ENTER to finish..."
exit 0
Last edited by Schmchr; 28 Jul @ 4:46pm