This commit is contained in:
zenobit 2025-02-19 15:32:28 +01:00
parent b3312f8eb4
commit 3ecae69193
1 changed files with 22 additions and 1 deletions

23
action
View File

@ -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