summaryrefslogtreecommitdiff
path: root/bin/itzks-goodbye-user-session
blob: 754ecf4bdf3ae0669dcf8bd5691aaf401e28a17d (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
#!/bin/bash

# Copyright (C) 2017 Mike Gabriel <mike.gabriel@das-netzwerkteam.de>
# Copyright (C) 2017 Benjamin Schlüter <bschlueter@posteo.de>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.


if [ -x /usr/share/debian-edu-config/tools/goodbye-user-session ]; then

	# Use Debian Edu implementation, if we have it already...
	/usr/share/debian-edu-config/tools/goodbye-user-session ${@}

else

	# FIXME: Drop this section for bookworm. Upstreamed as
	# /usr/share/debian-edu-config/tools/goodbye-user-session
	if [ $EUID -ge 500 ]; then

		# safety net for well-known browsers
		pkill -TERM -u "${LOGNAME}" x-www-browser
		pkill -TERM -u "${LOGNAME}" firefox-esr
		pkill -TERM -u "${LOGNAME}" firefox
		pkill -TERM -u "${LOGNAME}" iceweasel
		pkill -TERM -u "${LOGNAME}" chromium
		pkill -TERM -u "${LOGNAME}" chrome
		pkill -TERM -u "${LOGNAME}" konqueror
		pkill -TERM -u "${LOGNAME}" midori
		pkill -TERM -u "${LOGNAME}" opera
		sleep 1

		# dump all other processes the hard way...
		pkill -KILL -u "${LOGNAME}"

	else

		echo "$(basename $0): System accounts are not allowed to be terminated by this script."

	fi

fi

exit 0