diff options
author | Mearaj Bhagad | 2022-02-10 03:11:49 +0530 |
---|---|---|
committer | Mearaj Bhagad | 2022-02-10 03:11:49 +0530 |
commit | 7d137fbdd60064ce4033cfd190aeff1a7a7f9310 (patch) | |
tree | 6e1ab49781a70a67d466126a664c9c5892ea049c /nordlayer.install | |
download | aur-7d137fbdd60064ce4033cfd190aeff1a7a7f9310.tar.gz |
initial commit for nordlayer vpn
Diffstat (limited to 'nordlayer.install')
-rw-r--r-- | nordlayer.install | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/nordlayer.install b/nordlayer.install new file mode 100644 index 000000000000..82105b3aa698 --- /dev/null +++ b/nordlayer.install @@ -0,0 +1,47 @@ +VAR_LIB=/var/lib/nordlayer + +post_install() { + + # Allow the daemon executable to bind to port 500 and administer network + setcap CAP_NET_BIND_SERVICE,CAP_NET_ADMIN,CAP_NET_RAW+eip /usr/bin/nordlayerd + setcap CAP_NET_BIND_SERVICE,CAP_NET_ADMIN,CAP_NET_RAW+eip /usr/bin/nordlayer-openvpn + + groupadd -r -f nordlayer + + if ! id "nordlayer" >/dev/null 2>&1; then + useradd -s /usr/bin/nologin -c "Used for running NordLayer" -r -M -d /run/nordlayer -g nordlayer nordlayer + fi + + mkdir -p ${VAR_LIB} + chmod 0770 -R ${VAR_LIB} + chown nordlayer:nordlayer -R ${VAR_LIB} + + # Reload config + systemctl daemon-reload + + # Create tmpfiles + systemd-tmpfiles --create + + # Start service on boot + systemctl enable nordlayer.socket + systemctl enable nordlayer.service + + # Start service now + systemctl start nordlayer.socket + systemctl start nordlayer.service + +} + +post_upgrade() { + post_install +} + +pre_remove() { + + rm -rf ${VAR_LIB} + systemctl disable nordlayer.service + systemctl disable nordlayer.socket + + systemctl stop nordlayer.service + systemctl stop nordlayer.socket +} |