mirror of
https://github.com/dotnet/MQTTnet.git
synced 2026-10-27 00:40:01 +08:00
Merge pull request #3 from asymetrixs/deb-packaging
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
|
cp $INSTALLPATH/appsettings.template.json $INSTALLPATH/appsettings.json
|
||||||
fi
|
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
|
chmod 644 /etc/systemd/system/mqttnet-server.service
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,6 @@
|
|||||||
|
|
||||||
# Check if systemctl exists, does not exist in docker containers
|
# Check if systemctl exists, does not exist in docker containers
|
||||||
SCTL=$(which systemctl >/dev/null; echo $?)
|
SCTL=$(which systemctl >/dev/null; echo $?)
|
||||||
|
|
||||||
if [ "$SCTL" -eq "0" ]; then
|
if [ "$SCTL" -eq "0" ]; then
|
||||||
# Reload systemd because of new service file
|
# Reload systemd because of new service file
|
||||||
systemctl daemon-reload
|
systemctl daemon-reload
|
||||||
|
|||||||
@@ -5,11 +5,14 @@ INSTALLPATH=$BASEPATH/MQTTnetServer
|
|||||||
|
|
||||||
# Check if systemctl exists, does not exist in docker containers
|
# Check if systemctl exists, does not exist in docker containers
|
||||||
SCTL=$(which systemctl >/dev/null; echo $?)
|
SCTL=$(which systemctl >/dev/null; echo $?)
|
||||||
|
|
||||||
if [ "$SCTL" -eq "0" ]; then
|
if [ "$SCTL" -eq "0" ]; then
|
||||||
# Stop service before uninstalling
|
# Stop service before uninstalling
|
||||||
systemctl stop mqttnet-server
|
systemctl stop mqttnet-server
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Remove permission to open ports
|
# Check if setcap exists, does not exist in docker containers
|
||||||
setcap CAP_NET_BIND_SERVICE=-eip $INSTALLPATH/MQTTnet.Server
|
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