aboutsummarylogtreecommitdiffstats
path: root/nordlayer.install
diff options
context:
space:
mode:
authorRoland Kiraly2024-06-05 21:43:07 +0100
committerRoland Kiraly2024-06-05 21:43:07 +0100
commit03019ea02d0b0f244b5455bb14f3b09a96be1a85 (patch)
tree8caf6d708b51daf56613479193794f599a688728 /nordlayer.install
parent3f5b0fc9ddde6f9ee7d5f3284289330d97e14dce (diff)
downloadaur-03019ea02d0b0f244b5455bb14f3b09a96be1a85.tar.gz
Update nordlayer package to version 3.2.2
Diffstat (limited to 'nordlayer.install')
-rw-r--r--nordlayer.install92
1 files changed, 49 insertions, 43 deletions
diff --git a/nordlayer.install b/nordlayer.install
index 187e966d4040..18d381b92c9b 100644
--- a/nordlayer.install
+++ b/nordlayer.install
@@ -2,54 +2,60 @@ VAR_LIB=/var/lib/nordlayer
NORDLAYER_RESOLVCONF=/usr/libexec/nordlayer/nordlayer-resolvconf
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
- groupadd -r -f nordlayer-resolve
-
- 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
-
- usermod -a -G nordlayer-resolve nordlayer
-
- mkdir -p ${VAR_LIB}
- chmod 0770 -R ${VAR_LIB}
- chown nordlayer:nordlayer -R ${VAR_LIB}
-
- chown root:nordlayer-resolve ${NORDLAYER_RESOLVCONF}
- chmod 4750 ${NORDLAYER_RESOLVCONF}
- # Ensure nordlayer-resolvconf has execute permissions
- chmod +x ${NORDLAYER_RESOLVCONF}
- # Reload config
- systemctl daemon-reload
-
- # Create tmpfiles
- systemd-tmpfiles --create
-
- # Start service on boot
- systemctl enable nordlayer.socket
- systemctl enable nordlayer.service
-
- # Restart service now
- systemctl start nordlayer.socket
- systemctl start nordlayer.service
-
+ # 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/libexec/nordlayer/nordlayer-openvpn
+
+ groupadd -r -f nordlayer
+ groupadd -r -f nordlayer-resolve
+
+ 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
+
+ usermod -a -G nordlayer-resolve nordlayer
+
+ mkdir -p ${VAR_LIB}
+ chmod 0770 -R ${VAR_LIB}
+ chown nordlayer:nordlayer -R ${VAR_LIB}
+
+ chown root:nordlayer-resolve ${NORDLAYER_RESOLVCONF}
+ chmod 4750 ${NORDLAYER_RESOLVCONF}
+ # Ensure nordlayer-resolvconf has execute permissions
+ chmod +x ${NORDLAYER_RESOLVCONF}
+ # Reload config
+ systemctl daemon-reload
+
+ # Create tmpfiles
+ systemd-tmpfiles --create
+
+ # Start service on boot
+ systemctl enable nordlayer.socket
+ systemctl enable nordlayer.service
+
+ # Restart service now
+ systemctl start nordlayer.socket
+ systemctl start nordlayer.service
+
+ # Add current user to nordlayer group
+ current_user=$(logname)
+ if [ -n "$current_user" ]; then
+ usermod -a -G nordlayer "$current_user"
+ echo "User $current_user has been added to the 'nordlayer' group. Please log out and log back in for changes to take effect."
+ else
+ echo "Could not determine the current user. Please manually add the user to the 'nordlayer' group."
+ fi
}
post_upgrade() {
- post_install
+ post_install
}
pre_remove() {
+ rm -rf ${VAR_LIB}
+ systemctl disable nordlayer.service
+ systemctl disable nordlayer.socket
- rm -rf ${VAR_LIB}
- systemctl disable nordlayer.service
- systemctl disable nordlayer.socket
-
- systemctl stop nordlayer.service
- systemctl stop nordlayer.socket
+ systemctl stop nordlayer.service
+ systemctl stop nordlayer.socket
}