Skip to content

Commit f034827

Browse files
committed
fix(install.sh): check for setcap command availability
Ensure that `setcap` is available before attempting to use it during installation. This prevents potential errors on Linux systems where `setcap` is not installed by skipping the capability setting step. - Added a check for `setcap` command availability - Updated both root and non-root execution paths accordingly
1 parent 304ec06 commit f034827

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

install.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,11 +125,11 @@ main() {
125125
# Run using sudo if not root
126126
if [ "$(id -u)" -ne 0 ]; then
127127
sudo sh <<EOF
128-
[ "$(uname -s)" = "Linux" ] && setcap cap_net_admin=eip "$BINARY_PATH"
128+
[ "$(uname -s)" = "Linux" ] && command -v setcap >/dev/null 2>&1 && setcap cap_net_admin=eip "$BINARY_PATH"
129129
mv "$BINARY_PATH" "$INSTALL_DIR/$BINARY_NAME"
130130
EOF
131131
else
132-
[ "$(uname -s)" = "Linux" ] && setcap cap_net_admin=eip "$BINARY_PATH"
132+
[ "$(uname -s)" = "Linux" ] && command -v setcap >/dev/null 2>&1 && setcap cap_net_admin=eip "$BINARY_PATH"
133133
mv "$BINARY_PATH" "$INSTALL_DIR/$BINARY_NAME"
134134
fi
135135
fi

0 commit comments

Comments
 (0)