From 3ecae691933e240cc987289ff730d019a966e977 Mon Sep 17 00:00:00 2001 From: zenobit Date: Wed, 19 Feb 2025 15:32:28 +0100 Subject: [PATCH] action --- action | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/action b/action index 313cb58..8d2a8b1 100755 --- a/action +++ b/action @@ -1,9 +1,22 @@ #!/usr/bin/env bash #shellcheck disable=SC1090 # + function write_output() { . "actions/${OS}" + # Load the list of RELEASES RELEASES=$(cut -d: -f1 < "public/tmp_${OS}" | cut -d' ' -f2 | sort -ur | paste -sd ' ') + # Check if 'edition' function exists and load it if present + if grep -q 'GUEST=' "actions/${OS}"; then + GUEST=$(printf 'GUEST="%s"\n') + else + GUEST=$(echo -e "\n") + fi + if grep -q 'IMAGE_TYPE=' "actions/${OS}"; then + IMAGE_TYPE=$(printf 'IMAGE_TYPE="%s"\n') + else + IMAGE_TYPE=$(echo -e "\n") + fi if grep -q 'function edition' "actions/${OS}"; then . "actions/${OS}" EDITIONS=$(printf 'EDITIONS="%s"\n' "$(cut -d: -f1 < "public/tmp_${OS}" | cut -d' ' -f3 | sort -ur | paste -sd ' ')") @@ -11,6 +24,8 @@ function write_output() { EDITIONS=$(echo -e "\n") fi echo + REST=$(sed -n '/^function releases_()/,$p' "actions/${OS}") + # Create and save the template with all collected information printf '# Template file for '\''%s'\'' OSNAME="%s" PRETTY="%s" @@ -18,9 +33,15 @@ BASEDOF="%s" DESCRIPTION="%s" HOMEPAGE="%s" CREDENTIALS="%s" +%s +%s RELEASES="%s" %s -' "$OS" "$OSNAME" "$PRETTY" "$BASEDOF" "$DESCRIPTION" "$HOMEPAGE" "$CREDENTIALS" "$RELEASES" "$EDITIONS" | tee -a "public/${OS}" + +%s + +' "$OS" "$OSNAME" "$PRETTY" "$BASEDOF" "$DESCRIPTION" "$HOMEPAGE" "$CREDENTIALS" "$GUEST" "$IMAGE_TYPE" "$RELEASES" "$EDITIONS" "$REST" | tee -a "public/${OS}" + # Append content from tmp_${OS} to TODO/all and remove the temporary file cat "public/tmp_${OS}" >> TODO/all rm "public/tmp_${OS}" echo