summaryrefslogtreecommitdiff
path: root/social/puppet/puppet.install
blob: 928df566beef0e153f1a440d278ac66fdbc83273 (plain)
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
# Puppet: Installer: Arch
# Maintainer: Thomas S Hatch <thatch45 (at) Gmail (dot) com>
# Contributor: Xavion <Xavion (dot) 0 (at) Gmail (dot) com>
# Contributor: Miah Johnson <Miah (at) chia-pet dot org>

pre_install() {
  getent group puppet &>/dev/null || groupadd -r puppet -g 52 &>/dev/null
  getent passwd puppet &>/dev/null || useradd -r -u 52 -g puppet -d /var/lib/puppet -s /sbin/nologin -c "Puppet" puppet &>/dev/null || :
}

pre_upgrade() {
  pre_install
  usermod -d /var/lib/puppet puppet &>/dev/null || :
}

post_install() {
    :
}

pre_remove() {
if [ -f /var/run/puppetmasterd.pid ]; then
	PIDOF=$(pidof -xo %PPID puppetmasterd)
	PIDFILE=$(cat /var/run/puppetmasterd.pid)
	if [ $PIDOF -eq $PIDFILE ]; then
		/etc/rc.d/puppetmaster stop
	fi
fi

if [ -f /var/run/puppetd.pid ]; then
	PIDOF=$(pidof -xo %PPID puppetd)
	PIDFILE=$(cat /var/run/puppetd.pid)
	if [ $PIDOF -eq $PIDFILE ]; then
		/etc/rc.d/puppet stop
	fi
fi
}

post_remove() {
	# Remove user and group
	userdel puppet
}

op=$1
shift

$op "$@"