-
Notifications
You must be signed in to change notification settings - Fork 50
/
install_puppet.sh
executable file
·63 lines (54 loc) · 1.22 KB
/
install_puppet.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
#!/bin/sh
#
# 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}"
}
# 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
}
# Helper eol text
report_eol() {
critical "Puppet 3 is no longer hosted as a repo by Puppet"
critical "More details here: https://groups.google.com/forum/#!topic/puppet-users/cCsGWKunBe4"
critical ""
critical "Puppet 3 has been EOL since December 2016"
critical ""
critical "You may download Puppet 3 manually from the archive repos"
critical "eg. 'wget http://release-archives.puppet.com/yum/el/7/products/x86_64/puppet-3.8.7-1.el7.noarch.rpm && rpm -ivh puppet-3.8.7-1.el7.noarch.rpm'"
}
report_eol
exit 1