forked from petems/puppet-install-shell
-
Notifications
You must be signed in to change notification settings - Fork 0
/
install_puppet_agent.sh
executable file
·73 lines (63 loc) · 1.5 KB
/
install_puppet_agent.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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#!/bin/sh
# WARNING: REQUIRES /bin/sh
#
# Install puppet-agent with shell... how hard can it be?
#
# 0.0.1a - Here Be Dragons
#
# Set up colours
if tty -s;then
RED=${RED:-$(tput setaf 1)}
GREEN=${GREEN:-$(tput setaf 2)}
YLW=${YLW:-$(tput setaf 3)}
BLUE=${BLUE:-$(tput setaf 4)}
RESET=${RESET:-$(tput sgr0)}
else
RED=
GREEN=
YLW=
BLUE=
RESET=
fi
# Timestamp
now () {
date +'%H:%M:%S %z'
}
# Logging functions instead of echo
log () {
echo "${BLUE}`now`${RESET} ${1}"
}
info () {
log "${GREEN}INFO${RESET}: ${1}"
}
warn () {
log "${YLW}WARN${RESET}: ${1}"
}
critical () {
log "${RED}CRIT${RESET}: ${1}"
}
utopic () {
warn "There is no utopic release yet, see https://tickets.puppetlabs.com/browse/CPR-92 for progress";
warn "We'll use the trusty package for now";
deb_codename="trusty";
}
# Check whether a command exists - returns 0 if it does, 1 if it does not
exists() {
if command -v $1 >/dev/null 2>&1
then
return 0
else
return 1
fi
}
# Report EOL
report_eol() {
critical "Puppet 4 is no longer hosted as a repo by Puppet"
critical "More details here: https://groups.google.com/forum/#!topic/puppet-users/cCsGWKunBe4"
critical ""
critical ""
critical "You may download Puppet manually from the archive repos http://release-archives.puppet.com"
critical "eg. 'wget http://release-archives.puppet.com/yum/el/7/PC1/x86_64/puppet-agent-1.10.9-1.el7.x86_64.rpm && rpm -ivh puppet-agent-1.10.9-1.el7.x86_64.rpm'"
}
report_eol
exit 1