2022-04-18 15:37:35 +08:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
set -e
|
|
|
|
|
|
|
|
case $1 in
|
|
|
|
remove|upgrade)
|
|
|
|
INITSYS=$(ls -al /proc/1/exe | awk -F' ' '{print $NF}' | awk -F'/' '{print $NF}')
|
2023-11-23 21:56:36 +08:00
|
|
|
rm /usr/bin/rustdesk
|
2022-09-13 14:27:07 +08:00
|
|
|
|
2022-04-18 15:37:35 +08:00
|
|
|
if [ "systemd" == "${INITSYS}" ]; then
|
2022-09-13 14:27:07 +08:00
|
|
|
|
2022-04-18 15:37:35 +08:00
|
|
|
systemctl stop rustdesk || true
|
|
|
|
systemctl disable rustdesk || true
|
2022-10-17 18:06:06 +08:00
|
|
|
rm /etc/systemd/system/rustdesk.service /usr/lib/systemd/system/rustdesk.service || true
|
2022-07-07 01:27:21 +08:00
|
|
|
|
2022-10-17 18:06:06 +08:00
|
|
|
# workaround temp dev build between 1.1.9 and 1.2.0
|
2022-09-13 14:27:07 +08:00
|
|
|
ubuntuVersion=$(grep -oP 'VERSION_ID="\K[\d]+' /etc/os-release | bc -l)
|
|
|
|
waylandSupportVersion=21
|
2022-10-18 09:27:14 +08:00
|
|
|
if [ "$ubuntuVersion" != "" ] && [ "$ubuntuVersion" -ge "$waylandSupportVersion" ]
|
2022-07-07 01:27:21 +08:00
|
|
|
then
|
2022-10-18 09:27:14 +08:00
|
|
|
serverUser=$(ps -ef | grep -E 'rustdesk +--server' | grep -v 'sudo ' | awk '{print $1}' | head -1)
|
|
|
|
if [ "$serverUser" != "" ] && [ "$serverUser" != "root" ]
|
|
|
|
then
|
|
|
|
systemctl --machine=${serverUser}@.host --user stop rustdesk >/dev/null 2>&1 || true
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
rm /usr/lib/systemd/user/rustdesk.service >/dev/null 2>&1 || true
|
2022-04-18 15:37:35 +08:00
|
|
|
fi
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
exit 0
|