This commit is contained in:
2024-12-25 12:27:58 +01:00
parent 29fa39955e
commit 4614c12819
21 changed files with 28 additions and 75 deletions

View File

@@ -30,7 +30,7 @@ if additional_args.len > 0 {
}
// Change to the hero directory
hero_dir := os.join_path(os.home_dir(), 'code/github/freeflowuniverse/crystallib/cli/hero')
hero_dir := os.join_path(os.home_dir(), 'code/github/freeflowuniverse/herolib/cli/hero')
os.chdir(hero_dir) or { panic('Failed to change directory to ${hero_dir}: ${err}') }
// Set HEROPATH based on OS

View File

@@ -1,47 +0,0 @@
function s3_configure {
SECRET_FILE="/${HOME}/code/git.ourworld.tf/despiegk/hero_secrets/mysecrets.sh"
if [ -f "$SECRET_FILE" ]; then
echo get secrets
source "$SECRET_FILE"
fi
# Check if environment variables are set
if [ -z "$S3KEYID" ] || [ -z "$S3APPID" ]; then
echo "Error: S3KEYID or S3APPID is not set"
exit 1
fi
# Create rclone config file
mkdir -p "${HOME}/.config/rclone"
cat > "${HOME}/.config/rclone/rclone.conf" <<EOL
[b2]
type = b2
account = $S3KEYID
key = $S3APPID
hard_delete = true
EOL
echo "made S3 config on: ${HOME}/.config/rclone/rclone.conf"
cat ${HOME}/.config/rclone/rclone.conf
}
function hero_upload {
set -e
hero_path=$(which hero 2>/dev/null)
if [ -z "$hero_path" ]; then
echo "Error: 'hero' command not found in PATH" >&2
exit 1
fi
set -x
s3_configure
# rclone_config=$(get_rclone_config) || { echo "$rclone_config"; exit 1; }
rclone --config="${HOME}/.config/rclone/rclone.conf" lsl b2:threefold/$MYPLATFORMID/
rclone --config="${HOME}/.config/rclone/rclone.conf" copy "$hero_path" b2:threefold/$MYPLATFORMID/
}