Fix setcap issues between distros
This commit is contained in:
@@ -108,6 +108,7 @@ CentOS:
|
|||||||
Debian/Ubuntu:
|
Debian/Ubuntu:
|
||||||
- apt-transport-https
|
- apt-transport-https
|
||||||
- ca-certificates
|
- ca-certificates
|
||||||
|
- libcap2-bin
|
||||||
- curl
|
- curl
|
||||||
- yarn
|
- yarn
|
||||||
- nodejs (v8)
|
- nodejs (v8)
|
||||||
|
@@ -271,14 +271,19 @@ function InstallXO {
|
|||||||
echo "Adding user to systemd config"
|
echo "Adding user to systemd config"
|
||||||
sed -i "/SyslogIdentifier=.*/a User=$XOUSER" $INSTALLDIR/xo-builds/xen-orchestra-$TIME/packages/xo-server/xo-server.service
|
sed -i "/SyslogIdentifier=.*/a User=$XOUSER" $INSTALLDIR/xo-builds/xen-orchestra-$TIME/packages/xo-server/xo-server.service
|
||||||
|
|
||||||
if [ $OSNAME == "CentOS" ]; then
|
if [ "$PORT" -le "1024" ]; then
|
||||||
echo -n "Attempting to set cap_net_bind_service permission for /usr/bin/node..."
|
NODEBINARY="$(which node)"
|
||||||
setcap 'cap_net_bind_service=+ep' /usr/bin/node >/dev/null \
|
if [[ -L "$NODEBINARY" ]]; then
|
||||||
&& echo "Success" || echo "Failed. Non-privileged user might not be able to bind to <1024 port"
|
NODEBINARY="$(readlink -e $NODEBINARY)"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ ! -z $NODEBINARY ]]; then
|
||||||
|
echo -n "Attempting to set cap_net_bind_service permission for $NODEBINARY..."
|
||||||
|
setcap 'cap_net_bind_service=+ep' $NODEBINARY >/dev/null \
|
||||||
|
&& echo "Success" || echo "Failed. Non-privileged user might not be able to bind to <1024 port. xo-server won't start most likely"
|
||||||
else
|
else
|
||||||
echo -n "Attempting to set cap_net_bind_service permission for /usr/bin/nodejs..."
|
echo "Can't find node executable, or it's a symlink to non existing file. Not trying to setcap. xo-server won't start most likely"
|
||||||
setcap 'cap_net_bind_service=+ep' /usr/bin/nodejs >/dev/null \
|
fi
|
||||||
&& echo "Success" || echo "Failed. Non-privileged user might not be able to bind to <1024 port"
|
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user