summarylogtreecommitdiffstats
path: root/post.install
blob: 133d9f78ff48aca810170cc2107271b38604206d (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
pre_install() {
  groupadd -r -f nordvpnteams
  useradd -s /usr/sbin/nologin -c "Used for running NordVPN Teams" \
    -r -M -d /run/nordvpnteams -g nordvpnteams nordvpnteams
}

post_install() {
setcap CAP_NET_BIND_SERVICE,CAP_NET_ADMIN,CAP_NET_RAW+eip /usr/sbin/nordvpnteamsd

VAR_LIB=/var/lib/nordvpnteams
chmod 0770 -R ${VAR_LIB}
chown nordvpnteams:nordvpnteams -R ${VAR_LIB}

# Reload config
systemctl daemon-reload

# Create tmpfiles
systemd-tmpfiles --create

cat <<"EOF"
# Run the following to complete installation:
# In order to enable nordvpn you have to start the following service:
$ systemctl enable --now nordvpnteams.socket
$ systemctl enable --now nordvpnteams.service

# To login run
sudo --user=nordvpnteams nordvpnteams login

# If you want to be able to run without sudo
sudo usermod -a -G nordvpnteams $(whoami)
sudo chmod 0770 /var/run/nordvpnteams/nordvpnteams.sock
EOF
}