aboutsummaryrefslogtreecommitdiffstats
path: root/linux_service_scripts/uninstaller.sh
blob: a1f19e46b7e9179ec8720d0efd69d4326297b561 (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
#!/usr/bin/env bash
# Copyright (C) 2022 The Qt Company Ltd.
#
# SPDX-License-Identifier: GPL-3.0-only WITH Qt-GPL-exception-1.0

name=licd

function stop_daemon {
    running=true

    retries=0
    while [ $running != "false" ]
    do
        running=false
        systemctl is-active --quiet $name && running=true;
        if [ $running != "false" ]
        then
            systemctl stop $name
            sleep 2
            retries=$((retries+1))
            if [ $retries -gt 2 ]
            then
                exit_fail "Tried to stop qtlicenser service for $retries times already"
            fi
        fi
    done
    echo "Stopped $name.service"
}

stop_daemon

systemctl disable ${name}
rm -rf /opt/${name}
rm /usr/bin/qtlongterm
rm /etc/systemd/system/${name}.service
systemctl daemon-reload