hashicorp/puppet-bootstrap — pull request #34 by schkovich (2014-09-10 16:18:33+00:00)
Title: More reliable way to test if Puppet is installed on Ubuntu

Current script will fail to detect that Puppet from the default Ubuntu repositories is installed.
```bash
vagrant@localhost:~$ puppet --version
3.4.3
vagrant@localhost:~$ if which puppet > /dev/null 2>&1 -a apt-cache policy | grep --quiet apt.puppetlabs.com; then echo "Puppet is already installed."; else echo "Puppet is NOT installed"; fi
Puppet is NOT installed
vagrant@localhost:~$ pkg=puppet
vagrant@localhost:~$ if dpkg --get-selections | grep -q "^$pkg[[:space:]]*install$" >/dev/null; then echo "Puppet is already installed."; else echo "Puppet is NOT installed"; fi
Puppet is already installed.
vagrant@localhost:~$ exit
logout
Connection to 127.0.0.1 closed.
```

I used a more reliable way to determine if a package is installed or not. Solution is based on [the answer](http://askubuntu.com/questions/319307/reliably-check-if-a-package-is-installed-or-not) [enzotib](http://askubuntu.com/users/2647/enzotib) provided on Ask Ubuntu.