|
| 1 | +#!/bin/bash |
| 2 | + |
| 3 | +# --- Configuration --- |
| 4 | +DEST="/opt/MateEngineX" |
| 5 | +DESKTOP_FILE="/usr/share/applications/mateengine.desktop" |
| 6 | +ICON_FILE="/usr/share/pixmaps/mateengine.png" |
| 7 | + |
| 8 | +# --- Uninstall Logic --- |
| 9 | +if [[ "$1" == "--uninstall" ]]; then |
| 10 | + echo "Uninstalling MateEngine..." |
| 11 | + |
| 12 | + [ -d "$DEST" ] && sudo rm -rf "$DEST" && echo "Removed $DEST" |
| 13 | + [ -f "$DESKTOP_FILE" ] && sudo rm "$DESKTOP_FILE" && echo "Removed $DESKTOP_FILE" |
| 14 | + [ -f "$ICON_FILE" ] && sudo rm "$ICON_FILE" && echo "Removed $ICON_FILE" |
| 15 | + sudo rm "/usr/bin/mateengine" && echo "Removed /usr/bin/mateengine" |
| 16 | + |
| 17 | + echo "Uninstallation complete." |
| 18 | + exit 0 |
| 19 | +fi |
| 20 | + |
| 21 | +# --- Installation Logic --- |
| 22 | + |
| 23 | +if grep -qE "arch|artix" /etc/os-release || { [ -f /etc/os-release ] && . /etc/os-release && [[ "$ID_LIKE" == *"arch"* ]]; }; then |
| 24 | + echo "This system is Arch-based."; |
| 25 | + echo "Please use the following command to install MateEngine:"; |
| 26 | + echo "sudo yay -S mateengine"; |
| 27 | + exit; |
| 28 | +fi |
| 29 | + |
| 30 | +DEBIAN_DEPS=("libpulse0" "libgtk-3-0t64" "libglib2.0-0t64" "libayatana-appindicator3-1" "libx11-6" "libxext6" "libxrender1" "libxdamage1" "libxcursor1" "libxrandr2" "libxcomposite1") |
| 31 | +missing=() |
| 32 | + |
| 33 | +if grep -qE "debian" /etc/os-release || { [ -f /etc/os-release ] && . /etc/os-release && [[ "$ID_LIKE" == *"debian"* ]]; }; then |
| 34 | + echo "This system is Debian-based."; |
| 35 | + echo "Installing requirements..."; |
| 36 | + for pkg in "${DEBIAN_DEPS[@]}"; do |
| 37 | + if dpkg -s "$pkg" &> /dev/null; then |
| 38 | + echo "$pkg is already installed" |
| 39 | + else |
| 40 | + missing+=("$pkg") |
| 41 | + fi |
| 42 | + done |
| 43 | + if [ ${#missing[@]} -gt 0 ]; then |
| 44 | + echo "Installing packages: ${missing[*]}" |
| 45 | + sudo apt install -y "${missing[@]}" |
| 46 | + fi |
| 47 | +fi |
| 48 | + |
| 49 | +if grep -qE "fedora" /etc/os-release || { [ -f /etc/os-release ] && . /etc/os-release && [[ "$ID_LIKE" == *"fedora"* ]]; }; then |
| 50 | + echo "This system is Fedora-based."; |
| 51 | + echo "Installing requirements..."; |
| 52 | + sudo dnf install -y pulseaudio-libs gtk3 glib2 libX11 libXext libXrender libXrandr libXdamage libXcursor libXcomposite libayatana-appindicator-gtk3 |
| 53 | +fi |
| 54 | + |
| 55 | +SOURCE="$(dirname "$(realpath "${BASH_SOURCE[0]}")")/Payload" |
| 56 | + |
| 57 | +if [ -d "$DEST" ]; then |
| 58 | + echo "Directory $DEST exists. Removing old version..." |
| 59 | + sudo rm -rf "$DEST" |
| 60 | +fi |
| 61 | + |
| 62 | +echo "Installing to $DEST" |
| 63 | + |
| 64 | +sudo mkdir -p "$DEST" |
| 65 | +sudo cp -R "$SOURCE/." "$DEST" |
| 66 | + |
| 67 | +sudo ln -s "$DEST/launch.sh" "/usr/bin/mateengine" |
| 68 | + |
| 69 | +# Create Desktop Entry |
| 70 | +cat <<EOF | sudo tee "$DESKTOP_FILE" > /dev/null |
| 71 | +[Desktop Entry] |
| 72 | +Name=Mate Engine |
| 73 | +Comment=A free Desktop Mate alternative with custom VRM support |
| 74 | +Exec=mateengine |
| 75 | +Icon=mateengine |
| 76 | +Terminal=false |
| 77 | +Type=Application |
| 78 | +Categories=Game; |
| 79 | +Keywords=desktop;pet;anime;vrm; |
| 80 | +EOF |
| 81 | + |
| 82 | +# Install Icon |
| 83 | +sudo cp "$DEST/MateEngineX_Data/Resources/UnityPlayer.png" "$ICON_FILE" |
| 84 | + |
| 85 | +# Set permissions |
| 86 | +sudo chmod +x "$DESKTOP_FILE" |
| 87 | + |
| 88 | +echo "OK - Installation Complete." |
| 89 | +echo "To uninstall, simply add --uninstall parameter before running this script." |
0 commit comments