Skip to content

Instantly share code, notes, and snippets.

@jaxxibae
Created August 4, 2019 10:41
Show Gist options
  • Save jaxxibae/fdd0e7c2f0aa1d961590dcecf1bd5b5d to your computer and use it in GitHub Desktop.
Save jaxxibae/fdd0e7c2f0aa1d961590dcecf1bd5b5d to your computer and use it in GitHub Desktop.
#!/bin/bash
# Let's first check if all dependencies we need exist...
if ! type "git" > /dev/null; then
echo >&2 "This shell script requires the package 'git', but it's not installed. Aborting...";
exit 1;
fi
if ! type "node" > /dev/null; then
echo >&2 "This shell script requires the package 'node', but it's not installed. Aborting..."
exit 1;
fi
if ! type "npm" > /dev/null; then
echo >&2 "This shell script requires the package 'npm', but it's not installed. Aborting..."
exit 1;
fi
# They all exist? Great, let's install PreMiD!
# Let's first check what branch the user will install...
branch=""
if [ "$1" ]; then
branch=$1
else
branch="stable"
fi
echo >&2 "This shell script will install PreMiD from its official repository over at https://github.com/PreMiD/PreMiD to $HOME/.premid"
# Alright, let's start the action!
mkdir $HOME/.premid
cd $HOME/.premid
git clone https://github.com/PreMiD/PreMiD application
# After the program is cloned, let's change to the branch the user set, or to stable...
cd application
git checkout $branch
# ..and let's install it!
cd src/
npm install
# Final step: creating a Desktop entry...
cd $HOME/Desktop
echo "[Desktop Entry]\n" \
"Encoding=UTF-8\n" \
"Name=PreMiD\n" \
"Comment=PreMiD adds Discord Rich Presence integration, media controls and much more to your beloved services.\n" \
"Exec=bash -c \"cd $HOME/.premid/application/src && npm start ; $SHELL\"\n" \
"Icon=$HOME/.premid/application/gitassets/icon.png\n" \
"Type=Application" >> premid.desktop
echo >&2 "PreMiD was installed successfully! Start using PreMiD by double-clicking the PreMiD shortcut on your desktop."
# and done!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment