From 18a55b85191cdbdf521d7964fbcb95956ad7b7e0 Mon Sep 17 00:00:00 2001 From: Arjun Suresh Date: Wed, 18 Sep 2024 15:03:13 +0100 Subject: [PATCH] Added get-rclone-config script for mlc-inference #172 --- script/get-rclone-config/_cm.yaml | 13 +++++++++++++ script/get-rclone-config/customize.py | 25 +++++++++++++++++++++++++ script/get-rclone-config/run.bat | 1 + script/get-rclone-config/run.sh | 17 +++++++++++++++++ 4 files changed, 56 insertions(+) create mode 100644 script/get-rclone-config/_cm.yaml create mode 100644 script/get-rclone-config/customize.py create mode 100644 script/get-rclone-config/run.bat create mode 100644 script/get-rclone-config/run.sh diff --git a/script/get-rclone-config/_cm.yaml b/script/get-rclone-config/_cm.yaml new file mode 100644 index 000000000..a8fa32218 --- /dev/null +++ b/script/get-rclone-config/_cm.yaml @@ -0,0 +1,13 @@ +alias: get-rclone-config +automation_alias: script +automation_uid: 5b4e0237da074764 +cache: false #keeping cache off as rerunning the command is safe +can_force_cache: true +tags: +- get +- rclone-config +uid: 6c59ddbc6cd046e3 +variations: + mlc-inference: + env: + CM_RCLONE_CONFIG_CMD: 'rclone config create mlc-inference s3 provider=Cloudflare access_key_id=f65ba5eef400db161ea49967de89f47b secret_access_key=fbea333914c292b854f14d3fe232bad6c5407bf0ab1bebf78833c2b359bdfd2b endpoint=https://c2686074cb2caf5cbaf6d134bdba8b47.r2.cloudflarestorage.com' diff --git a/script/get-rclone-config/customize.py b/script/get-rclone-config/customize.py new file mode 100644 index 000000000..92ac95147 --- /dev/null +++ b/script/get-rclone-config/customize.py @@ -0,0 +1,25 @@ +from cmind import utils +import os + +def preprocess(i): + + os_info = i['os_info'] + + env = i['env'] + + meta = i['meta'] + + automation = i['automation'] + + quiet = (env.get('CM_QUIET', False) == 'yes') + + if env.get('CM_RCLONE_CONFIG_CMD', '') != '': + env['CM_RUN_CMD'] = env['CM_RCLONE_CONFIG_CMD'] + + return {'return':0} + +def postprocess(i): + + env = i['env'] + + return {'return':0} diff --git a/script/get-rclone-config/run.bat b/script/get-rclone-config/run.bat new file mode 100644 index 000000000..648302ca7 --- /dev/null +++ b/script/get-rclone-config/run.bat @@ -0,0 +1 @@ +rem native script diff --git a/script/get-rclone-config/run.sh b/script/get-rclone-config/run.sh new file mode 100644 index 000000000..4c23c380e --- /dev/null +++ b/script/get-rclone-config/run.sh @@ -0,0 +1,17 @@ +#!/bin/bash + +#CM Script location: ${CM_TMP_CURRENT_SCRIPT_PATH} + +#To export any variable +#echo "VARIABLE_NAME=VARIABLE_VALUE" >>tmp-run-env.out + +#${CM_PYTHON_BIN_WITH_PATH} contains the path to python binary if "get,python" is added as a dependency + +echo "Running: " +echo "${CM_RUN_CMD}" +echo "" + +if [[ ${CM_FAKE_RUN} != "yes" ]]; then + eval "${CM_RUN_CMD}" + test $? -eq 0 || exit 1 +fi