aboutsummaryrefslogtreecommitdiff
path: root/windscribe-helper.initd
blob: a2fecdb0930ec92d86a2ec36fd48047c7ee1837d (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
#!/sbin/openrc-run
# Windscribe helper daemon

description="Windscribe VPN helper daemon"
command="/opt/windscribe/helper"
command_background="yes"
pidfile="/run/windscribe/helper.pid"

# Ensure /run/windscribe exists before starting
start_stop_daemon_args="--make-pidfile"

depend() {
    # Upstream systemd unit: Before=network-pre.target
    # OpenRC equivalent: start before network mounts so helper can manage routes/firewall
    before netmount
}

start_pre() {
    # Ensure runtime directories exist with correct perms
    checkpath -d -m 0755 -o root:windscribe /run/windscribe
    checkpath -d -m 0755 -o root:windscribe /var/log/windscribe
    checkpath -d -m 0755 -o root:windscribe /var/tmp/windscribe
    checkpath -d -m 0755 -o root:windscribe /var/lib/windscribe
}

stop_post() {
    # Clean up cgroup routing tables if helper created them
    if [ -x /opt/windscribe/scripts/cgroups-down ]; then
        /opt/windscribe/scripts/cgroups-down >/dev/null 2>&1 || true
    fi
}