Last active
November 28, 2020 05:59
-
-
Save strycore/4759105 to your computer and use it in GitHub Desktop.
Setup script for installing Terraria on Ubuntu
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# installing dependencies | |
dependencies="libmonogame-cil ffmpeg mmv libopenal1 zenity" | |
install_deps=0 | |
for package in $dependencies; do | |
echo $package | |
dpkg -s $package | grep installed | |
if [ $? == 0 ]; then | |
install_deps=1 | |
fi | |
done | |
if [ install_deps == 1 ]; then | |
gksu "apt-get install -y $dependencies" | |
fi | |
# libopenal symlinking | |
libopenal_path=$(find /usr/lib -maxdepth 2 -name libopenal.so.1) | |
if [ ! -f $libopenal_path ]; then | |
echo "libopenal.so.1 missing" | |
exit 2 | |
fi | |
local_libopenal=/usr/local/lib/libopenal.so.0 | |
if [ ! -f $local_libopenal ]; then | |
gksu cp $libopenal_path $local_libopenal | |
gksu ldconfig | |
fi | |
# get Terraria data | |
steam_path=$(zenity --file-selection --directory --title "Please select your Windows Steam directory") | |
terraria_path=$(find "$steam_path" -iname terraria -type d) | |
if [ ! -d "$terraria_path" ]; then | |
echo "Terraria data not found" | |
exit 2 | |
fi | |
cp -r "$terraria_path/Content" . | |
# convert audio | |
cp sound-convert/* Content/ | |
cd Content | |
perl xactxtract2.pl -x "Wave Bank.xwb" | |
./convertmusic.sh | |
python makeXwb.py "Wave Bank.xwb" | |
rm xa*.pm xa*.pl convertmusic.sh makeXwb.py | |
rm -r "Wave Bank" | |
cd .. | |
# setup launcher and icon | |
mkdir -p ~/.icons/ | |
cp terraria.png ~/.icons | |
desktop_file="$HOME/.local/share/applications/Terraria.desktop" | |
rm -f $desktop_file | |
sed -e "s#%GAMEDIR%#"$PWD"#" Terraria.desktop > $desktop_file | |
zenity --question --text "Terraria setup is complete, launch game?" | |
if [ $? == 0 ]; then | |
mono Terraria.exe | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment