prerm 798 B

12345678910111213141516171819202122232425262728
  1. #!/bin/bash
  2. set -e
  3. case $1 in
  4. remove|upgrade)
  5. INITSYS=$(ls -al /proc/1/exe | awk -F' ' '{print $NF}' | awk -F'/' '{print $NF}')
  6. rm /usr/bin/rustdesk
  7. if [ "systemd" == "${INITSYS}" ]; then
  8. systemctl stop rustdesk || true
  9. systemctl disable rustdesk || true
  10. rm /etc/systemd/system/rustdesk.service /usr/lib/systemd/system/rustdesk.service || true
  11. # workaround temp dev build between 1.1.9 and 1.2.0
  12. serverUser=$(ps -ef | grep -E 'rustdesk +--server' | grep -v 'sudo ' | awk '{print $1}' | head -1)
  13. if [ "$serverUser" != "" ] && [ "$serverUser" != "root" ]
  14. then
  15. systemctl --machine=${serverUser}@.host --user stop rustdesk >/dev/null 2>&1 || true
  16. fi
  17. rm /usr/lib/systemd/user/rustdesk.service >/dev/null 2>&1 || true
  18. fi
  19. ;;
  20. esac
  21. exit 0