forked from bluerobotics/BlueOS
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
kraken: Add default extensions setup in install
- Loading branch information
1 parent
0629b3c
commit 8d467c3
Showing
2 changed files
with
86 additions
and
3 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
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,77 @@ | ||
#!/usr/bin/env bash | ||
|
||
# Extensions data fetch, use for Extensions that are synced by some online source | ||
|
||
COCKPIT_RELEASE_URL="https://api.github.com/repos/bluerobotics/cockpit/releases/latest" | ||
MAJOR_TOM_RELEASE_URL="https://kipulwyil1.execute-api.us-east-1.amazonaws.com/api/blueos/install" | ||
|
||
response=$(curl -fsSL $COCKPIT_RELEASE_URL) | ||
|
||
if [[ $response =~ \"tag_name\":\ *\"([^\"]+)\" ]]; then | ||
cockpit_tag_name="${BASH_REMATCH[1]}" | ||
echo "Using cockpit tag: $cockpit_tag_name" | ||
else | ||
echo "Could not find the latest release tag of Cockpit." | ||
exit 1 | ||
fi | ||
|
||
major_tom_install_data=$(curl -fsSL $MAJOR_TOM_RELEASE_URL) | ||
|
||
if [[ $major_tom_install_data =~ \"docker\":\ *\"([^\"]+)\" ]]; then | ||
major_tom_docker="${BASH_REMATCH[1]}" | ||
else | ||
echo "Could not find the latest release docker value of Major Tom." | ||
exit 1 | ||
fi | ||
|
||
if [[ $major_tom_install_data =~ \"tag\":\ *\"([^\"]+)\" ]]; then | ||
major_tom_tag="${BASH_REMATCH[1]}" | ||
else | ||
echo "Could not find the latest release tag value of Major Tom." | ||
exit 1 | ||
fi | ||
|
||
echo "Using major tom: $major_tom_docker:$major_tom_tag" | ||
|
||
# Images pulling | ||
|
||
BLUEROBOTICS_COCKPIT_EXT="bluerobotics/cockpit:$cockpit_tag_name" | ||
BLUEROBOTICS_MAJOR_TOM_EXT="$major_tom_docker:$major_tom_tag" | ||
|
||
docker pull $BLUEROBOTICS_COCKPIT_EXT | ||
docker pull $BLUEROBOTICS_MAJOR_TOM_EXT | ||
|
||
# Settings creation | ||
|
||
SETTINGS_BASE_DIR="/root/.config/blueos/kraken" | ||
|
||
mkdir -p "${SETTINGS_BASE_DIR}" | ||
|
||
# Check if the directory creation was successful | ||
if [[ ! -d "${SETTINGS_BASE_DIR}" ]]; then | ||
echo "Failed to create directory ${SETTINGS_BASE_DIR}" | ||
exit 1 | ||
fi | ||
|
||
# Creates kraken V2 settings with default extensions | ||
|
||
cat > "${SETTINGS_BASE_DIR}/settings-2.json" <<EOF | ||
{ | ||
"VERSION": 2, | ||
"extensions": [ | ||
{ | ||
"docker": "bluerobotics/cockpit", | ||
"enabled": true, | ||
"identifier": "bluerobotics.cockpit", | ||
"name": "Cockpit", | ||
"permissions": "{\"ExposedPorts\":{\"8000/tcp\":{}},\"HostConfig\":{\"PortBindings\":{\"8000/tcp\":[{\"HostPort\":\"\"}]}}}", | ||
"tag": "$cockpit_tag_name", | ||
"user_permissions": "" | ||
}, | ||
$major_tom_install_data | ||
], | ||
"manifests": [] | ||
} | ||
EOF | ||
|
||
echo "Default extensions settings configured successfully." |