Last active
December 14, 2015 03:39
-
-
Save wolfeidau/5022967 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| BNAME=`basename $0` | |
| # assert we are on ubuntu | |
| LSB_DESC=`lsb_release -d` | |
| if [[ $LSB_DESC =~ 'Ubuntu' ]]; then | |
| echo "Check for OS detected Ubuntu" | |
| CODENAME=`lsb_release -c -s` | |
| # Disable recommended | |
| APTTMPFILE=`mktemp -t ${BNAME}.XXXXXX` || exit 1 | |
| cat <<EOF >> $APTTMPFILE | |
| APT | |
| { | |
| Install-Recommends “false”; | |
| }; | |
| EOF | |
| APT_CONFIG=/etc/apt/apt.conf.d/01disablerecommends | |
| echo "Disabling recommended package installation in apt" | |
| sudo bash -c "cp -f $APTTMPFILE $APT_CONFIG; chmod 644 $APT_CONFIG" | |
| if [ $? -ne 0 ]; then | |
| echo "$0: Can't create apt configuration file, exiting..." | |
| exit 1 | |
| fi | |
| # cleanup | |
| rm $APTTMPFILE | |
| DEBTMPFILE=`mktemp -t ${BNAME}.XXXXXX` || exit 1 | |
| # todo deal with releases of ubuntu | |
| wget http://apt.puppetlabs.com/puppetlabs-release-${CODENAME}.deb -O $DEBTMPFILE | |
| if [ $? -ne 0 ]; then | |
| echo "$0: Can't download puppet labs package file, exiting..." | |
| exit 1 | |
| fi | |
| echo "Installing puppet labs deb file containing repository information" | |
| sudo dpkg -i $DEBTMPFILE | |
| if [ $? -ne 0 ]; then | |
| echo "$0: Can't install puppet labs package file, exiting..." | |
| exit 1 | |
| fi | |
| # cleanup | |
| rm $DEBTMPFILE | |
| echo "Updating the OS prior to installation of packages." | |
| sudo bash -c "apt-get update && apt-get -y upgrade" | |
| if [ $? -ne 0 ]; then | |
| echo "$0: System update failed, exiting..." | |
| exit 1 | |
| fi | |
| echo "Installing puppet and git" | |
| sudo apt-get install puppet git puppet-lint vim-puppet rubygems build-essential ruby-dev | |
| if [ $? -ne 0 ]; then | |
| echo "$0: Installation of packages failed, exiting..." | |
| exit 1 | |
| fi | |
| sudo gem install librarian-puppet | |
| if [ $? -ne 0 ]; then | |
| echo "$0: Installation of gems failed, exiting..." | |
| exit 1 | |
| fi | |
| else | |
| echo "This script is designed to ONLY run on Ubuntu Linux" | |
| exit 1 | |
| fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment