aboutsummarylogtreecommitdiffstats
path: root/readme.install
blob: df9c1ef140c81bf55c31bc253701df0e55aa1805 (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
post_install() {
	getent group steam > /dev/null || groupadd -g 540 steam
	if ! getent passwd steam > /dev/null; then
		useradd -c 'Steam user' -u 540 -g steam -G audio,video,network,optical \
			-d /var/lib/steam -s /usr/bin/nologin steam
		passwd -l steam > /dev/null
	fi
}

post_upgrade() {
	post_install $1
	if ! getent group steam | cut -d: -f3 | grep 540 > /dev/null 2>&1; then
		groupmod -g 540 steam > /dev/null 2>&1
	fi
	if ! id -u steam | grep 540 > /dev/null 2>&1; then
		usermod -u 420 steam > /dev/null 2>&1
		if [[ $? -ne 0 ]]; then
			echo "Changing uid of user steam failed."
			echo "It is recommended that the uid is changed."
			echo "Stop all processes running under the steam user and reinstall steam"
			echo "or change the uid manually. (usermod -u 420 steam)"
		fi
		chown -R steam:steam /var/lib/steam
	fi
}

post_remove() {
	getent passwd steam > /dev/null 2>&1 && userdel steam
	getent group steam > /dev/null 2>&1 && groupdel steam
}