From ba02405eb28cb04575ccc80cc6b361337c9b0cc8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martynas=20Petu=C5=A1ka?= Date: Fri, 25 Mar 2022 01:08:36 +0000 Subject: [PATCH] install script json schema --- schema/ymlToJson.sh | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/schema/ymlToJson.sh b/schema/ymlToJson.sh index 53843f1ba..16a904138 100755 --- a/schema/ymlToJson.sh +++ b/schema/ymlToJson.sh @@ -1,8 +1,14 @@ #!/usr/bin/env bash SELF_DIR="$(dirname "$0")" - -curl -d "$(cat "$SELF_DIR/installer.schema.yml")" \ +if [[ -z "$1" ]]; then + echo "ERROR: No YAML file passed in!" + exit 1 +fi +base="$(basename "$1")" +target="${base%.*}.json" +echo "INFO: $1 > $target" +curl -d "$(cat "$SELF_DIR/$1")" \ -H "Content-Type: text/plain" \ -H 'Accept: application/json' \ - -o "$SELF_DIR/installer.schema.json" \ - https://www.anyjson.in/api/v2/data/yamltojson + -o "$SELF_DIR/$target" \ + https://www.anyjson.in/api/v2/data/yamltojson &> /dev/null