Skip to content

Instantly share code, notes, and snippets.

@s0r00t
Last active February 4, 2020 14:42
Show Gist options
  • Save s0r00t/58b7587beea1bbe3284c to your computer and use it in GitHub Desktop.
Save s0r00t/58b7587beea1bbe3284c to your computer and use it in GitHub Desktop.
Easily set up devkitARM and ctrulib on systems supporting Bash. Git and Curl are required. `curl -sL https://git.io/vs2SL|sudo -E bash` to run the script, remove sudo to set up environment variables. Thanks to https://github.com/profi200 for the original script.
#!/bin/bash
UPDATE=0
echo "devkitARM and ctrulib installer"
echo "script by s0r00t, original script by profi200"
if ! hash git 2>/dev/null; then
echo "ERROR : Git is not installed. Please install Git."
exit 1
fi
if ! hash gcc 2>/dev/null; then
echo "ERROR : The GNU Compiler Collection is not installed. Please install GCC."
exit 1
fi
if ! hash make 2>/dev/null; then
echo "ERROR : GNU Make is not installed. Please install Make."
exit 1
fi
echo "Running the Perl script..."
export DEVKITPRO=/opt/devkitpro
export DEVKITARM=$DEVKITPRO/devkitARM
curl -sL http://sourceforge.net/projects/devkitpro/files/Automated%20Installer/devkitARMupdate.pl/download | perl
cd /opt/devkitpro
if [ -d "ctrulib/libctru" ]; then
UPDATE=1
cd ctrulib/libctru
echo "Updating libctru..."
git pull
echo "Done!"
else
echo "Cloning libctru..."
git clone https://github.com/smealum/ctrulib.git
echo "Done!"
fi
cd ctrulib/libctru
echo "Building libctru..."
make
make install
echo "Done!"
if [ $UPDATE == 0 ]; then
echo "devkitARM and ctrulib are now installed into /opt/devkitpro."
if [[ $SHELL == *"bash"* ]]; then
echo "Setting up environment variables for Bash..."
echo "export DEVKITPRO=/opt/devkitpro" >> ~/.bashrc
echo "export DEVKITARM=\$DEVKITPRO/devkitARM" >> ~/.bashrc
echo "export PATH=\$PATH:\$DEVKITARM/bin" >> ~/.bashrc
echo "Done!"
exit
fi
if [[ $SHELL == *"fish"* ]]; then
echo "Setting up environment variables for Fish..."
echo "set -x DEVKITPRO /opt/devkitpro" >> ~/.config/fish/config.fish
echo "set -x DEVKITARM \$DEVKITPRO/devkitARM" >> ~/.config/fish/config.fish
echo "set -x PATH \$PATH \$DEVKITARM/bin" >> ~/.config/fish/config.fish
echo "Done!"
exit
fi
echo "Shell not recognized. Please set those environment variables for compilation to work :"
echo "DEVKITPRO=/opt/devkitpro"
echo "DEVKITARM=\$DEVKITPRO/devkitARM"
echo "PATH=\$PATH:\$DEVKITARM/bin"
exit
fi
echo "devkitARM and ctrulib are now updated."
@urherenow
Copy link

is there another one of these for devkitPPC?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment