Last active
December 10, 2019 19:29
-
-
Save Ocawesome101/08efd852a9177505005bfb7d05288214 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 | |
# | |
# Install Gamax92's OCEmu, as well as dependencies. | |
distro="unknown" | |
getDeps() { | |
echo "-> Installing dependencies..." | |
echo "-> Detecting distribution..." | |
if [ -e "/usr/bin/apt" ]; then | |
echo "-> You appear to be using Debian or a derivative" | |
sudo apt install git make lua5.2 liblua5.2-dev libsdl2-dev subversion wget | |
distro="debian" | |
elif [ -e "/usr/bin/pacman" ]; then | |
echo "-> You appear to be using Arch Linux or a derivative" | |
sudo pacman -S lua52 lua52-filesystem lua52-sec lua52-socket wget | |
distro="arch" | |
elif [ -e "/usr/local/bin/brew" ]; then | |
echo "-> You appear to be using macOS with Homebrew installed" | |
brew install lua | |
brew install sdl2 | |
brew install wget | |
distro="darwin" | |
else | |
echo "-> Could not detect your distribution." | |
exit -1 | |
fi | |
} | |
instLuarocks() { | |
if [ "$distro" = "darwin" ]; then | |
return 0 | |
fi | |
echo "-> Downloading Luarocks..." | |
mkdir -p "$HOME/.tmp" | |
wget -c "https://luarocks.org/releases/luarocks-3.2.1.tar.gz" -O "$HOME/.tmp/luarocks.tar.gz" | |
cd "$HOME/.tmp/" | |
echo "-> Removing .tar.gz..." | |
tar zxpf luarocks.tar.gz | |
echo "-> Configuring Luarocks-5.2" | |
cd "$HOME/.tmp/luarocks-3.2.1" | |
"$HOME/.tmp/luarocks-3.2.1/configure" --lua-version=5.2 --lua-suffix=5.2 --versioned-rocks-dir | |
echo "-> Building Luarocks..." | |
make build | |
echo "-> Installing Luarocks..." | |
sudo make install | |
} | |
instLuaDeps() { | |
echo "-> Installing most remaining dependencies with Luarocks..." | |
sudo luarocks install luasec | |
sudo luarocks install luasocket | |
sudo luarocks install luafilesystem | |
sudo luarocks install luautf8 | |
sudo ln -s /usr/local/lib/lua/5.2/ffi* /usr/lib/lua/5.2/ | |
sudo ln -s /usr/local/lib/lua/5.2/lua-utf8.so /usr/lib/lua/5.2/ | |
} | |
echo "Installing dependencies..." | |
getDeps | |
instLuarocks | |
instLuaDeps | |
echo "Downloading OCEmu..." | |
git clone --recursive "https://github.com/gamax92/ocemu" "$HOME/.local/share/ocemu/" | |
echo "Building included luaffifb..." | |
cd "$HOME/.local/share/ocemu/luaffifb" | |
sudo luarocks make | |
cd .. | |
echo "Downloading OpenComputers' Lua source code..." | |
make | |
echo "Adding alias in ~/.bash_aliases" | |
echo "alias oc='cd ~/.ocemu/src/; lua5.2 boot.lua'" >> "$HOME/.bash_aliases" | |
echo "Done. Run 'oc' to launch the emulator." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment