Skip to content

Instantly share code, notes, and snippets.

@JackTYM
Last active July 10, 2024 05:19
Show Gist options
  • Select an option

  • Save JackTYM/45da99e85194f94db1ab883b10e308fe to your computer and use it in GitHub Desktop.

Select an option

Save JackTYM/45da99e85194f94db1ab883b10e308fe to your computer and use it in GitHub Desktop.
MarketShark Auto Setup Script
#!/bin/bash
# Function to check if the last command succeeded
check_success() {
if [ $? -ne 0 ]; then
echo "Error: $1"
exit 1
fi
}
# Function to check if the last command succeeded
check_success_mc() {
if [ $? -ne 0 ]; then
sudo apt --fix-broken install -y
fi
}
# Update and upgrade the system
echo "Updating and upgrading the system..."
sudo apt update && sudo apt upgrade -y
check_success "Failed to update and upgrade the system."
# Install Ubuntu desktop environment
echo "Installing Ubuntu desktop environment..."
sudo apt install ubuntu-desktop -y
check_success "Failed to install Ubuntu desktop environment."
# Install XRDP for remote desktop access
echo "Installing XRDP..."
sudo apt install xrdp -y
check_success "Failed to install XRDP."
# Add XRDP user to ssl-cert group
echo "Adding XRDP user to ssl-cert group..."
sudo adduser xrdp ssl-cert
check_success "Failed to add XRDP user to ssl-cert group."
# Configure firewall to allow XRDP
echo "Configuring firewall to allow XRDP..."
sudo ufw allow 3389
sudo ufw reload
sudo ufw status
check_success "Failed to configure firewall."
# Install Minecraft libraries
echo "Installing Minecraft libraries..."
sudo apt install default-jre libgdk-pixbuf2.0-0 -y
check_success "Failed to install Minecraft libraries."
# Download and install Minecraft
echo "Downloading and installing Minecraft..."
wget https://launcher.mojang.com/download/Minecraft.deb
check_success "Failed to download Minecraft.deb."
sudo dpkg -i Minecraft.deb
check_success_mc "Failed to install Minecraft."
rm Minecraft.deb
# Fixing broken installs
echo "Fixing broken installs..."
sudo apt --fix-broken install -y
check_success_mc
# Download and unzip Minecraft tar.gz
echo "Downloading and extracting Minecraft tar.gz..."
wget -O minecraft.tar.gz "https://jacktym.dev/minecraft.tar.gz"
check_success "Failed to download minecraft.tar.gz."
tar -xzvf minecraft.tar.gz -C ~
check_success "Failed to extract minecraft.tar.gz."
rm minecraft.tar.gz
# Print out the final instructions
echo "Finished Install! To change your password, run"
echo "sudo passwd root"
echo "and type in your new password"
echo "*You will not be able to read what you type!*"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment