Skip to content

Instantly share code, notes, and snippets.

@dpanter
Last active January 30, 2024 13:36
Show Gist options
  • Save dpanter/972f1559f91c8347a6b39e2ea96d0786 to your computer and use it in GitHub Desktop.
Save dpanter/972f1559f91c8347a6b39e2ea96d0786 to your computer and use it in GitHub Desktop.
git-dolphin.sh - Easily download, build and install latest dolphin emulator master from Github
#!/bin/bash
# git-dolphin.sh
# Easily download, build and install latest dolphin emulator master from Github
# Created 2023-05-27 - updated 2024-01-30
# Written for Siduction (Debian sid based distro)
# By dpanter https://gist.github.com/dpanter
# make install requires elevated privileges
PROJECT="dolphin"
RUNDATE="`date +%Y%m%d`"
COMMIT="`curl -v --silent https://github.com/dolphin-emu/dolphin/commits/master 2>&1 | grep -m 1 'href="/dolphin-emu/dolphin/commit/' | awk -F"/commit/" '{print $2}' | cut -c 1-7`"
#check if project/commit dir already exists, wildcarded rundate. print message and quit
echo "Checking directories..."
if [ -n "$(/bin/ls -d $PROJECT-*-$COMMIT 2>/dev/null)" ]; then
echo "Directory for latest commit already exists: $(/bin/ls -d $PROJECT-*-$COMMIT)"
echo "No actions taken this run."
exit 0
# project dir exists with old commit, rename to new commit, update and rebuild
elif [ -n "$(/bin/ls -d $PROJECT-*-*)" ]; then
echo "Directory exists, checking commit..."
mv "$(/bin/ls -d $PROJECT-*-*)" $PROJECT-$RUNDATE-$COMMIT
cd $PROJECT-$RUNDATE-$COMMIT
if [ "`git pull origin`" == "Already up to date." ]; then
echo "Directory for latest commit already exists: $(/bin/ls -d ../$PROJECT*)"
echo "'git pull origin' response: Already up to date."
echo "No actions taken this run."
else
git pull origin
rm -rf build
mkdir build && cd build
cmake ..
make -j$(nproc)
sudo make install
fi
# no project dir exists, download/build project fresh
else
echo "No directory found, starting fresh..."
git clone https://github.com/dolphin-emu/dolphin.git $PROJECT-$RUNDATE-$COMMIT
cd $PROJECT-$RUNDATE-$COMMIT
git submodule update --init --recursive
mkdir build && cd build
cmake ..
make -j$(nproc)
sudo make install
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment