summarylogtreecommitdiffstats
path: root/windscribe-v2-bin.install
blob: e6ea5c97037060220d599e4813fcb9e15f11d983 (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
56
57
58
59
60
61
62
63
pre_install() {
        end=$((SECONDS+10))

        while :
        do
          if [ -z "$(ps -eo args | grep WindscribeEngine | grep -v grep)" ]; then
            break
          fi

          if [ $SECONDS -gt $end ]; then
            echo 'Error during Windscribe installation. WindscribeEngine is running. Please re-launch Windscribe. And try to update again.'
            exit 1
          fi
        done

        systemctl stop windscribe-helper > /dev/null 2>&1
        systemctl disable windscribe-helper > /dev/null 2>&1

        # Stop and disable firewalld service if it is active, otherwise it will conflict with iptables on OS reboot
        # Relevant for Fedora distributions
        systemctl is-active --quiet firewalld
        if [ $? -eq 0 ]
        then
           echo "Firewalld service is running. It will be stopped and disabled to avoid conflicts with the Windscribe iptables firewall."
           sudo systemctl stop firewalld
           sudo systemctl disable firewalld
        fi

        echo "Finish pre-install script"
}

post_install() {
        systemctl preset windscribe-helper
        systemctl enable windscribe-helper
        systemctl start windscribe-helper
        systemctl enable systemd-resolved
        systemctl start systemd-resolved
        ln -s /opt/windscribe/Windscribe /usr/bin/windscribe
        update-desktop-database
        echo linux_zst_x64 > ../etc/windscribe/platform
}

pre_upgrade() {
        set -e
        systemctl stop windscribe-helper
        systemctl disable windscribe-helper
        userdel -f windscribe || true
        groupdel -f windscribe || true
}

post_upgrade() {
        post_install
}

pre_remove() {
        systemctl stop windscribe-helper
        systemctl disable windscribe-helper
        userdel -f windscribe || true
        groupdel -f windscribe || true
        rm -rf /etc/windscribe
        rm -f /opt/windscribe/helper_log.txt
        rm -f /usr/bin/windscribe
}