-
Notifications
You must be signed in to change notification settings - Fork 87
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
core: tools: mavlink_server: Add first version
Signed-off-by: Patrick José Pereira <patrickelectric@gmail.com>
- Loading branch information
1 parent
e54fa7d
commit f7cc5f0
Showing
1 changed file
with
57 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" |