brick-hill-linux/brick-hill-installer.sh

329 lines
11 KiB
Bash
Executable file

#!/bin/bash
mkdir -p $HOME/.local/share/polygon-prefix
WINEPREFIXX=$HOME/.local/share/polygon-prefix
# To change what WINE that is used, specify the path. An example would be wine-tkg/bin/wine
WINEBIN=Default
# Variables for known Polygon install locations
POLYGONPATHPROGRAM=$WINEPREFIXX/drive_c/Program\ Files\ \(x86\)/Project\ Polygon
POLYGONPATHAPPDATA=$WINEPREFIXX/drive_c/users/$USER/AppData/Local/Project\ Polygon
if [[ ($WINEBIN == Default) ]]; then
WINEBIN=$(which wine)
else
echo "Warning: using custom wine binary"
fi
#Dependencies
fedora_install () {
sudo dnf install wine winetricks
}
ubuntu_install () {
sudo apt install wine winetricks
}
debian_install () {
sudo apt install wine-development winetricks
}
arch_install () {
sudo pacman -S --needed wine winetricks
}
check_dependencies () {
if [[ $(cat /etc/*-release | grep "Fedora") ]]; then
echo "Detected Fedora!"
fedora_install
else
if [[ $(cat /etc/*-release | grep "Ubuntu") ]] || [[ $(cat /etc/*-release | grep "LinuxMint") ]] || [[ $(cat /etc/*-release | grep "Pop") ]]; then
echo "Detected Ubuntu or derivative!"
ubuntu_install
else
if [[ $(cat /etc/*-release | grep "Debian") ]]; then
echo "Detected Debian!"
debian_install
else
if [[ $(cat /etc/*-release | grep "Arch Linux") ]] || [[ $(cat /etc/*-release | grep "SteamOS") ]]; then
echo "Detected Arch Linux or derivative!"
arch_install
else
echo "You're on an unsupported distro. Please manually install the required dependencies from the README.md or make a pull request adding support for your distro"
exit
fi
fi
fi
fi
}
#Downloads Polygon
download_game_base () {
if [ $WINEPREFIXX ]; then
echo "Prefix already exists, removing"
rm -rf $WINEPREFIXX
mkdir -p $WINEPREFIXX
else
echo "No prefix exists, creating one"
mkdir -p $WINEPREFIXX
fi
}
download_game_10 () {
rm -f "Polygon2010.exe"
wget "https://setup2010.pizzaboxer.xyz/Polygon2010.exe"
env WINEPREFIX=$WINEPREFIXX $WINEBIN "Polygon2010.exe"
echo "2010 downloaded and installed!"
}
download_game_11 () {
rm -f "Polygon2011.exe"
wget "https://setup2011.pizzaboxer.xyz/Polygon2011.exe"
env WINEPREFIX=$WINEPREFIXX $WINEBIN "Polygon2011.exe"
echo "2011 downloaded and installed!"
}
download_game_12 () {
rm -f "Polygon2012.exe"
wget "https://setup2012.pizzaboxer.xyz/Polygon2012.exe"
env WINEPREFIX=$WINEPREFIXX $WINEBIN "Polygon2012.exe"
echo "2012 downloaded and installed!"
}
check_install_path () {
if [ -d "$POLYGONPATH"]; then
echo "Polygon is installed in Program Files x86"
POLYGONPATH=$POLYGONPATHPROGRAM
else
if [ -d "$POLYGONPATHAPPDATA"]; then
echo "Polygon is installed in AppData"
POLYGONPATH=$POLYGONPATHAPPDATA
else
echo "Polygon is not installed in a recognized path, report this problem in issues or on the Discord server"
exit
fi
fi
}
download_game_10_postsetup () {
cp -r $POLYGONPATH/Versions/version-386164ab165b55af/Microsoft.VC90.CRT/msvcm90.dll $POLYGONPATH/Versions/version-386164ab165b55af/Microsoft.VC90.CRT/msvcp90.dll $POLYGONPATH/Versions/version-386164ab165b55af/
cp -r $POLYGONPATH/Versions/version-386164ab165b55af/Microsoft.VC90.OPENMP/vcomp90.dll $POLYGONPATH/Versions/version-386164ab165b55af/
cp -r $POLYGONPATH/Versions/version-386164ab165b55af/Microsoft.VC90.MFC/* $POLYGONPATH/Versions/version-386164ab165b55af/
download_game_11_postsetup () {
cp -r $POLYGONPATH/Versions/version-9512c515176f9859/Microsoft.VC90.CRT/msvcm90.dll $POLYGONPATH/Versions/version-9512c515176f9859/Microsoft.VC90.CRT/msvcp90.dll $POLYGONPATH/Versions/version-9512c515176f9859/
cp -r $POLYGONPATH/Versions/version-9512c515176f9859/Microsoft.VC90.OPENMP/vcomp90.dll $POLYGONPATH/Versions/version-9512c515176f9859/
cp -r $POLYGONPATH/Versions/version-9512c515176f9859/Microsoft.VC90.MFC/* $POLYGONPATH/Versions/version-9512c515176f9859/
download_game_12_postsetup () {
cp -r $POLYGONPATH/Versions/version-f9324578ab26456f/Microsoft.VC90.CRT/msvcr90.dll $POLYGONPATH/Versions/version-f9324578ab26456f/Microsoft.VC90.CRT/msvcp90.dll $POLYGONPATH/Versions/version-f9324578ab26456f/
cp -r $POLYGONPATH/Versions/version-f9324578ab26456f/Microsoft.VC90.OPENMP/vcomp90.dll $POLYGONPATH/Versions/version-f9324578ab26456f/
#Creates .desktop files
desktop_file_10 () {
#Roblox 2010
DESKTOPFILE10=$HOME/.local/share/applications/PolygonURL10.desktop
MIMETYPE10=x-scheme-handler/polygon-ten
echo "[Desktop Entry]" > $DESKTOPFILE10
echo "Version=1.0" >> $DESKTOPFILE10
echo "Type=Application" >> $DESKTOPFILE10
echo "Name=Polygon URL 10" >> $DESKTOPFILE10
echo "Comment=Play Polygon games!" >> $DESKTOPFILE10
echo "Exec=env WINEPREFIX=$WINEPREFIXX $WINEBIN '$POLYGONPATH/Versions/version-386164ab165b55af/Polygon.exe' %u" >> $DESKTOPFILE10
echo "Categories=Game;" >> $DESKTOPFILE10
echo "MimeType=$MIMETYPE10;" >> $DESKTOPFILE10
echo "Created 2010 desktop file!"
}
desktop_file_11 () {
#Roblox 2011
DESKTOPFILE11=$HOME/.local/share/applications/PolygonURL11.desktop
MIMETYPE11=x-scheme-handler/polygon-eleven
echo "[Desktop Entry]" > $DESKTOPFILE11
echo "Version=1.0" >> $DESKTOPFILE11
echo "Type=Application" >> $DESKTOPFILE11
echo "Name=Polygon URL 11" >> $DESKTOPFILE11
echo "Comment=Play Polygon games!" >> $DESKTOPFILE11
echo "Exec=env WINEPREFIX=$WINEPREFIXX $WINEBIN '$POLYGONPATH/Versions/version-9512c515176f9859/Polygon.exe' %u" >> $DESKTOPFILE11
echo "Categories=Game;" >> $DESKTOPFILE11
echo "MimeType=$MIMETYPE11;" >> $DESKTOPFILE11
echo "Created 2011 desktop file!"
}
desktop_file_12 () {
#Roblox 2012
DESKTOPFILE12=$HOME/.local/share/applications/PolygonURL12.desktop
MIMETYPE12=x-scheme-handler/polygon-twelve
echo "[Desktop Entry]" > $DESKTOPFILE12
echo "Version=1.0" >> $DESKTOPFILE12
echo "Type=Application" >> $DESKTOPFILE12
echo "Name=Polygon URL 12" >> $DESKTOPFILE12
echo "Comment=Play Polygon games!" >> $DESKTOPFILE12
echo "Exec=env WINEPREFIX=$WINEPREFIXX $WINEBIN '$POLYGONPATH/Versions/version-f9324578ab26456f/Polygon.exe' %u" >> $DESKTOPFILE12
echo "Categories=Game;" >> $DESKTOPFILE12
echo "MimeType=$MIMETYPE12;" >> $DESKTOPFILE12
echo "Created 2012 desktop file!"
}
url_handler_base () {
#Add entries for URL handlers
MIMEAPPS=$HOME/.local/share/applications/mimeapps.list
MIMEAPPSBAK=$HOME/.local/share/applications/mimeapps.list.bak
if [ -f "$MIMEAPPS" ]; then
echo "$MIMEAPPS already exists"
echo "Making a backup as mimeapps.list.bak"
echo "In case the script messes it up"
cp $MIMEAPPS $MIMEAPPSBAK
else
echo "[Default Applications]" > $MIMEAPPS
fi
}
url_handler_10 () {
MIMEENTRY10="$MIMETYPE10=$(basename "$DESKTOPFILE10")"
if grep -Fxq "$MIMEENTRY10" "$MIMEAPPS"
then
echo "URL handler for 10 is already created! Skipping..."
else
echo $MIMEENTRY10 >> $MIMEAPPS
echo "Created URL handler for Polygon 10!"
fi
}
url_handler_11 () {
MIMEENTRY11="$MIMETYPE11=$(basename "$DESKTOPFILE11")"
if grep -Fxq "$MIMEENTRY11" "$MIMEAPPS"
then
echo "URL handler for 11 is already created! Skipping..."
else
echo $MIMEENTRY11 >> $MIMEAPPS
echo "Created URL handler for Polygon 11!"
fi
}
url_handler_12 () {
MIMEENTRY12="$MIMETYPE12=$(basename "$DESKTOPFILE12")"
if grep -Fxq "$MIMEENTRY12" "$MIMEAPPS"
then
echo "URL handler for 12 is already created! Skipping..."
else
echo $MIMEENTRY12 >> $MIMEAPPS
echo "Created URL handler for Polygon 12!"
fi
}
install_winetricks_dependencies () {
env WINEPREFIX=$WINEPREFIXX winetricks --unattended vcrun2008 vcrun2015 mfc90
}
resync_databases () {
update-desktop-database "$HOME/.local/share/applications"
update-mime-database "$HOME/.local/share/mime"
echo "Synced desktop and mime databases"
}
kill_processes () {
env WINEPREFIX=$WINEPREFIXX "$WINEBIN"server -k
}
echo "Welcome to Winegon! (for Project Polygon)"
echo "type 1 to install every client"
echo "type 2 to install 2010"
echo "type 3 to install 2011"
echo "type 4 to install 2012"
echo "type 5 to start 2010 Studio"
echo "type 6 to start 2011 Studio"
echo "type 7 to start 2012 Studio"
echo "type 8 to kill processes in prefix"
echo "then press enter"
read what
if [[ $what == 1 ]]; then
echo "Selected to install every client"
check_dependencies
download_game_base
check_install_path
download_game_10
download_game_10_postsetup
download_game_11
download_game_11_postsetup
download_game_12
download_game_12_postsetup
desktop_file_10
desktop_file_11
desktop_file_12
url_handler_base
url_handler_10
url_handler_11
url_handler_12
resync_databases
install_winetricks_dependencies
else
if [[ $what == 2 ]]; then
echo "Selected to install 2010"
check_dependencies
download_game_base
check_install_path
download_game_10
download_game_10_postsetup
desktop_file_10
url_handler_base
url_handler_10
resync_databases
install_winetricks_dependencies
else
if [[ $what == 3 ]]; then
echo "Selected to install 2011"
check_dependencies
download_game_base
check_install_path
download_game_11
download_game_11_postsetup
desktop_file_11
url_handler_base
url_handler_11
resync_databases
install_winetricks_dependencies
else
if [[ $what == 4 ]]; then
echo "Selected to install 2012"
check_dependencies
download_game_base
check_install_path
download_game_12
download_game_12_postsetup
desktop_file_12
url_handler_base
url_handler_12
resync_databases
install_winetricks_dependencies
else
if [[ $what == 5 ]]; then
echo "Selected to start 2010 Studio"
env WINEPREFIX=$WINEPREFIXX wine "$POLYGONPATH/Versions/version-386164ab165b55af/PolygonStudio.exe"
else
if [[ $what == 6 ]]; then
echo "Selected to start 2011 Studio"
env WINEPREFIX=$WINEPREFIXX wine "$POLYGONPATH/Versions/version-9512c515176f9859/PolygonStudio.exe"
else
if [[ $what == 7 ]]; then
echo "Selected to start 2012 Studio"
env WINEPREFIX=$WINEPREFIXX wine "$POLYGONPATH/Versions/version-f9324578ab26456f/PolygonStudio.exe"
else
if [[ $what == 8 ]]; then
echo "Killed wine processes in prefix"
kill_processes
else
echo "No valid option specified"
exit
fi
fi
fi
fi
fi
fi
fi
fi