Skip to content

Instantly share code, notes, and snippets.

@onlurking
Created June 28, 2016 12:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save onlurking/b8b0f528a76fea11496af52be01fac91 to your computer and use it in GitHub Desktop.
Save onlurking/b8b0f528a76fea11496af52be01fac91 to your computer and use it in GitHub Desktop.
DevEnv Shellscript - Draft
#!/usr/bin/env bash
function exists { hash $1 2>/dev/null; }
function !exists { hash $1 >/dev/null 2>&1; }
function elevate{
if [ $EUID != 0 ]; then
sudo "$0" "$@"
exit $?
fi
}
function quit {
unset -f exists;
unset -f !exists;
}
function install_rvm{
gpg --keyserver hkp://keys.gnupg.net \
--recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3;
curl -sSL https://get.rvm.io | \
bash -s stable --ruby --auto-dotfiles;
}
function install_docker
{
usermod -a -G docker $(whoami);
}
if exists pacman; then
!exists git || { pacman -S --noconfirm git; }
!exists zsh || { pacman -S --noconfirm zsh; }
!exists pip2 || { pacman -S --noconfirm python2-pip; }
!exists pip || { pacman -S --noconfirm python-pip; }
!exists htop || { pacman -S --noconfirm htop; }
elif exists apt-get; then
apt-get update && apt-get upgrade -y;
!exists git || { apt-get install -y git; }
!exists zsh || { apt-get install -y zsh; }
!exists pip || { apt-get install -y pip; }
elif exists brew; then
!exists git || { brew install git; }
!exists zsh || { brew install zsh; }
!exists pip || { brew install python; }
else
echo "No."
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment