-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
supporting tfrobot version passed to flist and multiple ssh support
- Loading branch information
1 parent
2fa5282
commit 2e12bb7
Showing
4 changed files
with
37 additions
and
8 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,26 @@ | ||
#!/bin/bash | ||
|
||
# Script to download the latest version of tfrobot if version was not passed as env variable | ||
|
||
download_latest_tfrobot() { | ||
echo "No version provided, downloading the latest version..." | ||
tf_v=$(curl -s https://api.github.com/repos/threefoldtech/tfgrid-sdk-go/releases/latest | grep 'tag_name' | cut -d '"' -f 4) | ||
echo "Downloading latest version: $tf_v" | ||
wget -O "Latest.tar.gz" "https://github.com/threefoldtech/tfgrid-sdk-go/releases/download/${tf_v}/tfgrid-sdk-go_Linux_x86_64.tar.gz" | ||
tar -xzf Latest.tar.gz -C /usr/local/bin/ | ||
rm -rf /Latest.tar.gz | ||
echo "tfrobot version ${tf_v} installed successfully." | ||
} | ||
|
||
# Check if a version was provided as an argument | ||
if [ -z "$1" ]; then | ||
echo "No version argument provided." | ||
download_latest_tfrobot | ||
else | ||
tf_v=$1 | ||
echo "Downloading specified version: ${tf_v}..." | ||
wget -O "tfrobot_version.tar.gz" "https://github.com/threefoldtech/tfgrid-sdk-go/releases/download/${tf_v}/tfgrid-sdk-go_Linux_x86_64.tar.gz" | ||
tar -xzf tfrobot_version.tar.gz -C /usr/local/bin/ | ||
rm -rf /tfrobot_version.tar.gz | ||
echo "tfrobot version ${tf_v} installed successfully." | ||
fi |
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,8 @@ | ||
exec: /bin/sh -eux -c " | ||
chmod +x /usr/local/bin/tfrobot.sh; | ||
if [ -z ${tfrobot_version:-} ]; then | ||
bash tfrobot.sh; | ||
else | ||
bash tfrobot.sh $tfrobot_version; | ||
fi" | ||
oneshot: true |