Skip to content

Instantly share code, notes, and snippets.

@h-s-l
Last active July 6, 2016 14:55
Show Gist options
  • Save h-s-l/72cb11ba5721e745b7de40ad1739c9d3 to your computer and use it in GitHub Desktop.
Save h-s-l/72cb11ba5721e745b7de40ad1739c9d3 to your computer and use it in GitHub Desktop.
Ubuntu (and derivatives) installation script for DJMcMayhem's V ESOLANG.
#!/usr/bin/env bash
#AUTHOR: harry (aHNs) <aHNs@tuta.io> FC5A 6DAE AD7C F721 561A C059 D376 6497 DD9F F961
#DESCRIPTION: Self deleting install script for V by DJMcMayhem https://github.com/DJMcMayhem/V
#checks user is root, exits if not
if [[ $(id -u) != "0" ]]; then
echo "This script must be run as root" 1>&2
exit 1
fi
function v_installer {
if [[ ! $(grep "neovim-ppa/unstable" /etc/apt/sources.list /etc/apt/sources.list.d/*) ]]; then
add-apt-repository ppa:neovim-ppa/unstable && apt-get update
fi
#checks if dependencies are installed or not and installs if necessary
read -r pip dev neo <<< $(echo $(apt-cache policy python-pip python-dev neovim | sed -n -e 's/^.*Installed: //p'))
if [[ $neo = "(none)" ]]; then
yes | aptdcon --hide-terminal --install neovim
elif [[ $dev = "(none)" ]]; then
yes | aptdcon --hide-terminal --install python-dev
elif [[ $pip = "(none)" ]]; then
yes | aptdcon --hide-terminal --install python-pip
pip install neovim && pip install docopts
fi
#cleans up after itself
apt-get -y autoremove && apt-get -y autoclean
#gets directory and appends to .bashrc
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
echo -e "V=$DIR\nexport V\nalias v='python \$V/main.py'\nexport NVIM_LISTEN_ADDRESS=/tmp/nvim" >> ~/.bashrc
echo "Done Installing, shreding script" && shred -u "$0"
}
read -r -p "Do you want to install V and it's dependencies? [Y/n] " reply
case "$reply" in
[yY] ) trap v_installer EXIT;;
[nN] ) exit 1;;
* ) echo -e "Invalid Response.";;
esac
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment