summarylogtreecommitdiffstats
path: root/p2.install
blob: eaaaf5f1fbd9a090f1804c704741eee2cab8f9f2 (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
_user="p2"

post_install() {
	getent group "${_user}" &>/dev/null
	if [ $? -ne 0 ]; then
		echo -e "\e[34;1m==>\e[39;1m Adding ${_user} system group... \e[0m"
		groupadd -r ${_user} 1>/dev/null
	fi

	getent passwd "${_user}" &>/dev/null
	if [ $? -ne 0 ]; then
		echo -e "\e[34;1m==>\e[39;1m Adding ${_user} system user... \e[0m"
		useradd -r -g ${_user} -d /var/lib/p2 ${_user} 1>/dev/null
	fi

	post_upgrade
}

post_upgrade() {
	chown -R ${_user}:${_user} /var/lib/p2
}

post_remove() {
	# Notifying the user of kept dirs
	echo -e "\e[34;1m==>\e[39;1m NOTE: The ${_user} user was preserved on your system. \e[0m"
}