Skip to content

Commit

Permalink
core: tools: mavlink_server: Add first version
Browse files Browse the repository at this point in the history
Signed-off-by: Patrick José Pereira <patrickelectric@gmail.com>
  • Loading branch information
patrickelectric committed Sep 27, 2024
1 parent e54fa7d commit f7cc5f0
Showing 1 changed file with 57 additions and 0 deletions.
57 changes: 57 additions & 0 deletions core/tools/mavlink_server/bootstrap.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
#!/usr/bin/env bash

# Immediately exit on errors
set -e

VERSION="master"
PROJECT_NAME="mavlink-server"
REPOSITORY_ORG="bluerobotics"
REPOSITORY_NAME="$PROJECT_NAME"
REPOSITORY_URL="https://github.com/$REPOSITORY_ORG/$REPOSITORY_NAME"

echo "Installing project $PROJECT_NAME version $VERSION"

# Step 1: Prepare the download URL

ARCH="$(uname -m)"
case "$ARCH" in
x86_64 | amd64)
BUILD_NAME="x86_64-unknown-linux-musl"
;;
armv7l | armhf)
BUILD_NAME="armv7-unknown-linux-musleabihf"
;;
aarch64 | arm64)
BUILD_NAME="aarch64-unknown-linux-musl"
;;
*)
echo "Architecture: $ARCH is unsupported, please create a new issue on https://github.com/bluerobotics/BlueOS/issues"
exit 1
;;
esac
ARTIFACT_NAME="$PROJECT_NAME-$BUILD_NAME"
echo "For architecture $ARCH, using build $BUILD_NAME"

REMOTE_URL="$REPOSITORY_URL/releases/download/$VERSION/$ARTIFACT_NAME"
echo "Remote URL is $REMOTE_URL"

# Step 2: Prepare the installation path

if [ -n "$VIRTUAL_ENV" ]; then
BIN_DIR="$VIRTUAL_ENV/bin"
else
BIN_DIR="/usr/bin"
fi
mkdir -p "$BIN_DIR"

BINARY_PATH="$BIN_DIR/$PROJECT_NAME"
echo "Installing to $BINARY_PATH"

# Step 3: Download and install

wget -q "$REMOTE_URL" -O "$BINARY_PATH"
chmod +x "$BINARY_PATH"

echo "Installed binary type: $(file "$(which "$BINARY_PATH")")"

echo "Finished installing $PROJECT_NAME"

0 comments on commit f7cc5f0

Please sign in to comment.