fix(installer): Improve Node.js binary detection, dependency management, and SNMPv3 fallback logic
This commit is contained in:
55
bin/nupst
55
bin/nupst
@ -22,16 +22,63 @@ fi
|
||||
# For debugging
|
||||
# echo "Project root: $PROJECT_ROOT"
|
||||
|
||||
# Set Node.js binary path directly
|
||||
NODE_BIN="$PROJECT_ROOT/vendor/node-linux-x64/bin/node"
|
||||
# Detect architecture and OS
|
||||
ARCH=$(uname -m)
|
||||
OS=$(uname -s)
|
||||
|
||||
# Determine Node.js binary location based on architecture and OS
|
||||
NODE_BIN=""
|
||||
case "$OS" in
|
||||
Linux)
|
||||
case "$ARCH" in
|
||||
x86_64)
|
||||
NODE_BIN="$PROJECT_ROOT/vendor/node-linux-x64/bin/node"
|
||||
;;
|
||||
aarch64|arm64)
|
||||
NODE_BIN="$PROJECT_ROOT/vendor/node-linux-arm64/bin/node"
|
||||
;;
|
||||
*)
|
||||
# Use system Node as fallback for other architectures
|
||||
if command -v node &> /dev/null; then
|
||||
NODE_BIN="node"
|
||||
echo "Using system Node.js installation for unsupported architecture: $ARCH"
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
Darwin)
|
||||
case "$ARCH" in
|
||||
x86_64)
|
||||
NODE_BIN="$PROJECT_ROOT/vendor/node-darwin-x64/bin/node"
|
||||
;;
|
||||
arm64)
|
||||
NODE_BIN="$PROJECT_ROOT/vendor/node-darwin-arm64/bin/node"
|
||||
;;
|
||||
*)
|
||||
# Use system Node as fallback for other architectures
|
||||
if command -v node &> /dev/null; then
|
||||
NODE_BIN="node"
|
||||
echo "Using system Node.js installation for unsupported architecture: $ARCH"
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
*)
|
||||
# Use system Node as fallback for other operating systems
|
||||
if command -v node &> /dev/null; then
|
||||
NODE_BIN="node"
|
||||
echo "Using system Node.js installation for unsupported OS: $OS"
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
# If binary doesn't exist, try system Node as fallback
|
||||
if [ ! -f "$NODE_BIN" ]; then
|
||||
if [ -z "$NODE_BIN" ] || [ ! -f "$NODE_BIN" ]; then
|
||||
if command -v node &> /dev/null; then
|
||||
NODE_BIN="node"
|
||||
echo "Using system Node.js installation"
|
||||
else
|
||||
echo "Error: Node.js binary not found at $NODE_BIN"
|
||||
echo "Error: Node.js binary not found for $OS-$ARCH"
|
||||
echo "Please run the setup script or install Node.js manually."
|
||||
exit 1
|
||||
fi
|
||||
|
Reference in New Issue
Block a user