File: puppet-common.postinst

package info (click to toggle)
puppet 3.7.2-4%2Bdeb8u1
  • links: PTS, VCS
  • area: main
  • in suites: jessie
  • size: 18,912 kB
  • ctags: 13,168
  • sloc: ruby: 210,410; sh: 2,050; xml: 1,554; lisp: 300; makefile: 142; python: 108; sql: 103; yacc: 72
file content (42 lines) | stat: -rw-r--r-- 1,317 bytes parent folder | download | duplicates (4)
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
#!/bin/sh

set -e

if [ "$1" = "configure" ]; then

	# Create the "puppet" user
	if ! getent passwd puppet > /dev/null; then
		adduser --quiet --system --group --home /var/lib/puppet  \
			--no-create-home                                 \
			--gecos "Puppet configuration management daemon" \
			puppet
	fi

        # Create the "puppet" group, if it is missing, and set the
        # primary group of the "puppet" user to this group.
        if ! getent group puppet > /dev/null; then
            addgroup --quiet --system puppet
            usermod -g puppet puppet
        fi

	# Set correct permissions and ownership for puppet directories
	if ! dpkg-statoverride --list /var/log/puppet >/dev/null 2>&1; then
		dpkg-statoverride --update --add puppet puppet 0750 /var/log/puppet
	fi

	if ! dpkg-statoverride --list /var/lib/puppet >/dev/null 2>&1; then
		dpkg-statoverride --update --add puppet puppet 0750 /var/lib/puppet
	fi

	# Create folders common to "puppet" and "puppetmaster", which need
	# to be owned by the "puppet" user
	install --owner puppet --group puppet --directory \
		/var/lib/puppet/state
	
	# Handle 
	if [ -d /etc/puppet/ssl ] && [ ! -e /var/lib/puppet/ssl ] && grep -q 'ssldir=/var/lib/puppet/ssl' /etc/puppet/puppet.conf; then
		mv /etc/puppet/ssl /var/lib/puppet/ssl
	fi
fi

#DEBHELPER#