forked from hashicorp/puppet-bootstrap
-
Notifications
You must be signed in to change notification settings - Fork 2
/
debian.sh
executable file
·51 lines (39 loc) · 1.47 KB
/
debian.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#!/usr/bin/env sh
# This bootstraps Puppet on Debian
set -e
# Do the initial apt-get update
echo "Initial apt-get update..."
apt-get update >/dev/null
# Older versions of Debian don't have lsb_release by default, so
# install that if we have to.
which lsb_release || apt-get --yes install lsb-release
# Load up the release information
DISTRIB_CODENAME=$(lsb_release -c -s)
PUPPET_COLLECTION=${PUPPET_COLLECTION:-"6"}
case "${PUPPET_COLLECTION}" in
6|7) PUPPETLABS_RELEASE_DEB="https://apt.puppet.com/puppet${PUPPET_COLLECTION}-release-${DISTRIB_CODENAME}.deb" ;;
*)
echo "Unknown/Unsupported PUPPET_COLLECTION." >&2
exit 1
esac
#--------------------------------------------------------------------
# NO TUNABLES BELOW THIS POINT
#--------------------------------------------------------------------
if [ "$(id -u)" != "0" ]; then
echo "This script must be run as root." >&2
exit 1
fi
# Install wget if we have to (some older Debian versions)
echo "Installing wget..."
apt-get --yes install wget >/dev/null
# Install the PuppetLabs repo
echo "Configuring PuppetLabs repo..."
repo_deb_path=$(mktemp)
wget --output-document="${repo_deb_path}" "${PUPPETLABS_RELEASE_DEB}" 2>/dev/null
dpkg -i "${repo_deb_path}" >/dev/null
rm "${repo_deb_path}"
apt-get update >/dev/null
# Install Puppet
echo "Installing Puppet..."
DEBIAN_FRONTEND=noninteractive apt-get -y -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" install puppet-agent >/dev/null
echo "Puppet installed!"