public
Last active

Setup script for installing Terraria on Ubuntu

  • Download Gist
setup.sh
Shell
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58
#!/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

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.