summarylogtreecommitdiffstats
path: root/aws-session-manager-plugin.install
blob: 6d93a6275b8fe089341337c030e5b70725793d57 (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
47
48
49
50
51
52
53
54
55
56
57
pre_install() {
	echo "Preparing for install"
	if [ $(cat /proc/1/comm) = init ]
	then
	    stop session-manager-plugin || true
	elif [ $(cat /proc/1/comm) = systemd ]
	then
	    systemctl stop session-manager-plugin
	    systemctl daemon-reload
	fi
}

post_install() {
	echo "Starting session-manager-plugin"
	if [ $(cat /proc/1/comm) = init ]
	then
	    start session-manager-plugin || true
	elif [ $(cat /proc/1/comm) = systemd ]
	then
	    systemctl enable session-manager-plugin
	    systemctl start session-manager-plugin
	    systemctl daemon-reload
	fi
	if [ -f /usr/bin/session-manager-plugin ]
	then
	    rm /usr/bin/session-manager-plugin
	fi
	ln -s /usr/sessionmanagerplugin/bin/session-manager-plugin /usr/bin/session-manager-plugin
}

pre_upgrade() {
	pre_install
}

post_upgrade() {
	post_install
}

pre_remove() {
	echo "Stopping session-manager-plugin"
	if [ $(cat /proc/1/comm) = init ]
	then
	    stop session-manager-plugin || true
	elif [ $(cat /proc/1/comm) = systemd ]
	then
	    systemctl stop session-manager-plugin
	    systemctl disable session-manager-plugin
	    systemctl daemon-reload
	fi
}

post_remove() {
	if [ -f /usr/bin/session-manager-plugin ]
	then
	    rm /usr/bin/session-manager-plugin
	fi
}