#!/bin/bash

status "Adding GPG key..."
wget -qO- https://download.sublimetext.com/sublimehq-pub.gpg | sudo tee /etc/apt/trusted.gpg.d/sublimehq.asc || error "Failed to add GPG key for sublime-text repository!"
echo "deb https://download.sublimetext.com/ apt/stable/" | sudo tee /etc/apt/sources.list.d/sublime-text.list

(install_packages sublime-text)
if [ $? != 0 ];then
  #if install_packages fails, remove repository
  sudo rm -f /etc/apt/sources.list.d/sublime-text.list
  exit 1
fi
