brick-hill-linux/Winegon.sh

235 lines
7 KiB
Bash
Raw Normal View History

2022-07-03 14:57:21 -06:00
#!/bin/bash
2022-07-16 21:49:06 -06:00
mkdir -p $HOME/.local/share/polygon-prefix
WINEPREFIXX=$HOME/.local/share/polygon-prefix
#Dependencies
fedora_install () {
sudo dnf install wine winetricks
}
ubuntu_install () {
sudo apt install wine winetricks
}
debian_install () {
sudo apt install wine 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") ]]; then
echo "Detected Ubuntu!"
ubuntu_install
else
if [[ $(cat /etc/*-release | grep "Debian") ]]; then
echo "Detected Debian!"
debian_install
else
if [[ $(cat /etc/*-release | grep "Arch Linux") ]]; then
echo "Detected Arch Linux!"
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_10 () {
rm -f "Polygon2010.exe"
wget "https://setup2010.pizzaboxer.xyz/Polygon2010.exe"
env WINEPREFIX=$WINEPREFIXX wine "Polygon2010.exe"
echo "2010 downloaded and installed!"
}
download_game_11 () {
rm -f "Polygon2011.exe"
wget "https://setup2011.pizzaboxer.xyz/Polygon2011.exe"
env WINEPREFIX=$WINEPREFIXX wine "Polygon2011.exe"
echo "2011 downloaded and installed!"
}
download_game_12 () {
rm -f "Polygon2012.exe"
wget "https://setup2012.pizzaboxer.xyz/Polygon2012.exe"
env WINEPREFIX=$WINEPREFIXX wine "Polygon2012.exe"
echo "2012 downloaded and installed!"
}
#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 wine $HOME/.wine/drive_c/users/$USER/AppData/Local/Project\ Polygon/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 wine $HOME/.wine/drive_c/users/$USER/AppData/Local/Project\ Polygon/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 wine $HOME/.wine/drive_c/users/$USER/AppData/Local/Project\ Polygon/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 vcrun2003 vcrun2005 vcrun2008 vcrun2010 vcrun2012 vcrun2013 vcrun2019 d3dcompiler_43 d3dcompiler_46 d3dcompiler_47 d3drm d3dx10 d3dx11_42 d3dx11_43 d3dx9
}
resync_databases () {
update-desktop-database "$HOME/.local/share/applications"
update-mime-database "$HOME/.local/share/mime"
echo "Synced desktop and mime databases"
}
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 "then press enter"
read what
if [[ $what == 1 ]]; then
echo "Selected to install every client"
check_dependencies
download_game_10
download_game_11
download_game_12
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
2022-07-03 14:57:21 -06:00
else
2022-07-16 21:49:06 -06:00
if [[ $what == 2 ]]; then
echo "Selected to install 2010"
check_dependencies
download_game_10
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_11
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_12
desktop_file_12
url_handler_base
url_handler_12
resync_databases
install_winetricks_dependencies
else
echo "No valid option specified"
exit
fi
fi
fi
2022-07-03 14:57:21 -06:00
fi