mirror of
https://github.com/dotnet/MQTTnet.git
synced 2026-10-15 00:15:15 +08:00
Added check for availability of setcap
This commit is contained in:
@@ -25,8 +25,13 @@ if [ ! -f "$INSTALLPATH/appsettings.json" ]; then
|
||||
cp $INSTALLPATH/appsettings.template.json $INSTALLPATH/appsettings.json
|
||||
fi
|
||||
|
||||
# Enable MQTTServer.NET to bind to IP interface
|
||||
setcap CAP_NET_BIND_SERVICE=+eip $INSTALLPATH/MQTTnet.Server
|
||||
|
||||
# Check if setcap exists, does not exist in docker containers
|
||||
SCAP=$(which setcap >/dev/null; echo $?)
|
||||
if [ "$SCAP" -eq "0" ]; then
|
||||
# Enable MQTTServer.NET to bind to IP interface
|
||||
setcap CAP_NET_BIND_SERVICE=+eip $INSTALLPATH/MQTTnet.Server
|
||||
fi
|
||||
|
||||
chmod 644 /etc/systemd/system/mqttnet-server.service
|
||||
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
|
||||
# Check if systemctl exists, does not exist in docker containers
|
||||
SCTL=$(which systemctl >/dev/null; echo $?)
|
||||
|
||||
if [ "$SCTL" -eq "0" ]; then
|
||||
# Reload systemd because of new service file
|
||||
systemctl daemon-reload
|
||||
|
||||
@@ -5,11 +5,14 @@ INSTALLPATH=$BASEPATH/MQTTnetServer
|
||||
|
||||
# Check if systemctl exists, does not exist in docker containers
|
||||
SCTL=$(which systemctl >/dev/null; echo $?)
|
||||
|
||||
if [ "$SCTL" -eq "0" ]; then
|
||||
# Stop service before uninstalling
|
||||
systemctl stop mqttnet-server
|
||||
fi
|
||||
|
||||
# Remove permission to open ports
|
||||
setcap CAP_NET_BIND_SERVICE=-eip $INSTALLPATH/MQTTnet.Server
|
||||
# Check if setcap exists, does not exist in docker containers
|
||||
SCAP=$(which setcap >/dev/null; echo $?)
|
||||
if [ "$SCAP" -eq "0" ]; then
|
||||
# Remove permission to open ports
|
||||
setcap CAP_NET_BIND_SERVICE=-eip $INSTALLPATH/MQTTnet.Server
|
||||
fi
|
||||
Reference in New Issue
Block a user