mirror of
https://github.com/kasmtech/KasmVNC.git
synced 2026-01-23 02:14:29 +00:00
KASM-3747 Deb: stop all user systemd sessions on upgrade
This commit is contained in:
parent
74404318dd
commit
c43cefd13e
4 changed files with 46 additions and 8 deletions
1
debian/Makefile.to_fakebuild_tar_package
vendored
1
debian/Makefile.to_fakebuild_tar_package
vendored
|
|
@ -21,6 +21,7 @@ install: unpack_tarball
|
|||
cp $(SRC_BIN)/kasmvncpasswd $(DESTDIR)/usr/bin/
|
||||
cp $(SRC_BIN)/kasmxproxy $(DESTDIR)/usr/bin/
|
||||
cp -r $(SRC)/lib/kasmvnc/ $(DESTDIR)/usr/lib/kasmvncserver
|
||||
cp -r $(SRC)/lib/systemd/ $(DESTDIR)/usr/lib/
|
||||
cp -r $(SRC)/share/doc/kasmvnc*/* $(DESTDIR)/usr/share/doc/kasmvncserver/
|
||||
rsync -r --links --safe-links --exclude '.git*' --exclude po2js \
|
||||
--exclude xgettext-html --exclude www/utils/ --exclude .eslintrc \
|
||||
|
|
|
|||
51
debian/prerm
vendored
51
debian/prerm
vendored
|
|
@ -16,20 +16,55 @@ set -e
|
|||
# for details, see https://www.debian.org/doc/debian-policy/ or
|
||||
# the debian-policy package
|
||||
|
||||
stop_vncserver_systemd_services_for_all_logged_in_users() {
|
||||
for session in $(list_user_sessions); do
|
||||
stop_user_services "$session"
|
||||
done
|
||||
}
|
||||
|
||||
list_user_sessions() {
|
||||
loginctl list-sessions --no-legend | awk '{print $1}'
|
||||
}
|
||||
|
||||
stop_user_services() {
|
||||
local session="$1"
|
||||
|
||||
for service in $(list_active_services); do
|
||||
systemctl --user --machine=$(systemd_user_from_session "$session") stop "$service" || true
|
||||
done
|
||||
}
|
||||
|
||||
systemd_user_from_session() {
|
||||
local session="$1"
|
||||
|
||||
echo $(loginctl show-session "$session" -p Name --value)@
|
||||
}
|
||||
|
||||
list_active_services() {
|
||||
systemctl --user --machine=$(systemd_user_from_session "$session") \
|
||||
list-units --type=service --state=active --plain --no-legend | \
|
||||
awk '{ print $1 }' | grep kasmvncserver
|
||||
}
|
||||
|
||||
remove_vncserver_and_other_alternatives_from_bin() {
|
||||
bindir=/usr/bin
|
||||
mandir=/usr/share/man
|
||||
commands="kasmvncserver kasmvncpasswd kasmvncconfig Xkasmvnc kasmxproxy"
|
||||
|
||||
for kasm_command in $commands; do
|
||||
generic_command=`echo "$kasm_command" | sed -e 's/kasm//'`;
|
||||
update-alternatives --remove "$generic_command" "$bindir/$kasm_command"
|
||||
done
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
remove)
|
||||
bindir=/usr/bin
|
||||
mandir=/usr/share/man
|
||||
commands="kasmvncserver kasmvncpasswd kasmvncconfig Xkasmvnc kasmxproxy"
|
||||
|
||||
for kasm_command in $commands; do
|
||||
generic_command=`echo "$kasm_command" | sed -e 's/kasm//'`;
|
||||
update-alternatives --remove "$generic_command" "$bindir/$kasm_command"
|
||||
done
|
||||
stop_vncserver_systemd_services_for_all_logged_in_users
|
||||
remove_vncserver_and_other_alternatives_from_bin
|
||||
;;
|
||||
|
||||
remove|upgrade|deconfigure)
|
||||
stop_vncserver_systemd_services_for_all_logged_in_users
|
||||
;;
|
||||
|
||||
failed-upgrade)
|
||||
|
|
|
|||
|
|
@ -53,6 +53,8 @@ if [ $SERVER = 1 ]; then
|
|||
install -m 755 ./xorg.build/lib/dri/swrast_dri.so $OUTDIR/lib/dri/
|
||||
mkdir -p $OUTDIR/lib/kasmvnc
|
||||
install -m 755 $SRCDIR/builder/startup/deb/select-de.sh $OUTDIR/lib/kasmvnc
|
||||
mkdir -p $OUTDIR/lib/systemd/user
|
||||
install -m 644 ./unix/kasmvncserver@.service $OUTDIR/lib/systemd/user
|
||||
mkdir -p $OUTDIR/share/kasmvnc
|
||||
|
||||
cp -r $SRCDIR/unix/KasmVNC/ $OUTDIR/bin/
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue