-
Notifications
You must be signed in to change notification settings - Fork 146
/
Copy pathpostinstall-extras
54 lines (47 loc) · 1.55 KB
/
postinstall-extras
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
function set_answers(){
if [ -z "${HOME}" ] ; then
HOME="/var/root"
fi
if [ -z "${answers_dir}" ] ; then
answers_dir="${HOME}/Library/Caches/puppet-agent-installer"
fi
if [ -z "${answers}" ] ; then
answers="${answers_dir}/PuppetagentInterviewConfiguration.txt"
fi
}
function remove_answers(){
if [ -d "${answers_dir}" ] ; then
/bin/rm -rf "${answers_dir}"
fi
}
function setup_puppet(){
if [ -f "${answers}" ] && [ -r "${answers}" ] ; then
echo "Setting up puppet"
source "${answers}"
if [ -n "${PUPPET_MASTER_HOSTNAME}" ] ; then
/opt/puppetlabs/bin/puppet config set server "${PUPPET_MASTER_HOSTNAME}"
else
echo "No value to set for Puppet Master (server)...skipping. This is default on first time command line installs."
fi
if [ -n "${PUPPET_AGENT_CERTNAME}" ] ; then
/opt/puppetlabs/bin/puppet config set certname "${PUPPET_AGENT_CERTNAME}"
else
echo "No value to set for Puppet Agent Certname (certname)...skipping. This is the default on first time command line installs."
fi
else
echo "No interview configuration file found, skipping initial setup of puppet.conf. This is the default on first time command line installs."
fi
}
function reload_services(){
for service in "puppet" "pxp-agent" ; do
if [ -f "/tmp/.puppet-agent.upgrade/${service}" ] ; then
/bin/launchctl load -F "/Library/LaunchDaemons/com.puppetlabs.${service}.plist"
fi
done
}
if [ -d "/tmp/.puppet-agent.upgrade" ]; then
set_answers
setup_puppet
remove_answers
reload_services
fi