tree: full update

Signed-off-by: AuxXxilium <info@auxxxilium.tech>
This commit is contained in:
AuxXxilium
2024-04-13 21:24:04 +02:00
parent 75c5a6d4e3
commit 45d7d0dad3
18 changed files with 1346 additions and 1172 deletions

View File

@@ -31,12 +31,10 @@ jobs:
# -*- coding: utf-8 -*-
import json, subprocess
def set_output(name, value):
subprocess.call("echo '{}={}' >> $GITHUB_ENV".format(name, value), shell=True)
subprocess.call(["echo '{}={}' >> $GITHUB_ENV".format(name, value)], shell=True)
issuetitle = ${{ toJSON(github.event.issue.title) }};
issuebody = ${{ toJSON(github.event.issue.body) }};
iscustom = 'false'
MODEL = ''
PRODUCTVER = ''
@@ -44,18 +42,14 @@ jobs:
MACSYS = ''
FORMAT = ''
try:
if issuetitle.lower().startswith('custom'):
jsonbody = json.loads(issuebody)
iscustom = 'true'
MODEL = jsonbody.get('model', '')
PRODUCTVER = jsonbody.get('version', '')
ADDONS = jsonbody.get('addons', '')
MACSYS = jsonbody.get('macsys', '')
FORMAT = jsonbody.get('format', '')
jsonbody = json.loads(issuebody)
MODEL = jsonbody.get('model', '')
PRODUCTVER = jsonbody.get('version', '')
ADDONS = jsonbody.get('addons', '')
MACSYS = jsonbody.get('macsys', '')
FORMAT = jsonbody.get('format', '')
except ValueError as e:
pass
set_output("iscustom", iscustom)
set_output("MODEL", MODEL)
set_output("PRODUCTVER", PRODUCTVER)
@@ -80,7 +74,6 @@ jobs:
fi
- name: Update Comment Building
if: env.iscustom == 'true'
id: comment
uses: actions-cool/issues-helper@v3
with:
@@ -95,7 +88,6 @@ jobs:
# Get extractor, LKM, Addons, Modules and Configs
- name: Get extractor, LKM, Addons, Extensions, Modules and Configs
if: env.iscustom == 'true'
run: |
sudo apt update
sudo apt install -y jq gawk cpio gettext libelf-dev qemu-utils busybox dialog curl sed
@@ -114,10 +106,13 @@ jobs:
# Build incremental
- name: Build image
if: env.iscustom == 'true'
run: |
. scripts/func.sh
function writeConfigKey() {
[ "${2}" = "{}" ] && sudo yq eval '.'${1}' = {}' --inplace "${3}" 2>/dev/null || sudo yq eval '.'${1}' = "'"${2}"'"' --inplace "${3}" 2>/dev/null
}
echo "Create Arc Image"
IMAGE_FILE="arc.img"
gzip -dc "files/initrd/opt/arc/grub.img.gz" >"${IMAGE_FILE}"
@@ -141,18 +136,22 @@ jobs:
repackInitrd "br/initrd-arc" "files/initrd" "files/p3/initrd-arc"
echo "Set Custom Config"
echo "model: ${{ env.MODEL }}" >"files/p1/preset-config.yml"
echo "model: ${{ env.MODEL }}"
echo "productver: ${{ env.PRODUCTVER }}" >>"files/p1/preset-config.yml"
echo "productver: ${{ env.PRODUCTVER }}"
echo "arc:" >>"files/p1/preset-config.yml"
echo "macsys: ${{ env.MACSYS }}" >>"files/p1/preset-config.yml"
echo " macsys: ${{ env.MACSYS }}"
echo "addons:" >>"files/p1/preset-config.yml"
for ADDON in ${{ env.ADDONS }}; do
echo " ${ADDON}: \"\"" | sed 's/,//g' | sed 's/\[//g' | sed 's/\]//g' >>"files/p1/preset-config.yml"
done
echo "addons: ${{ env.ADDONS }}"
PRESET_CONFIG_FILE="files/p1/user-config.yml"
touch "${PRESET_CONFIG_FILE}"
writeConfigKey "model" "${{ env.MODEL }}" "${PRESET_CONFIG_FILE}"
writeConfigKey "productver" "${{ env.PRODUCTVER }}" "${PRESET_CONFIG_FILE}"
writeConfigKey "arc" "{}" "${PRESET_CONFIG_FILE}"
writeConfigKey "arc.macsys" "${{ env.MACSYS }}" "${PRESET_CONFIG_FILE}"
writeConfigKey "arc.custom" "true" "${PRESET_CONFIG_FILE}"
writeConfigKey "addons" "{}" "${PRESET_CONFIG_FILE}"
if [ -n "${{ env.ADDONS }}" ]; then
writeConfigKey "addons" "{}" "${PRESET_CONFIG_FILE}"
for A in $(echo "${{ env.ADDONS }}" | tr ',' ' ' | sed 's/\[//g' | sed 's/\]//g'); do
VALUE=""
writeConfigKey "addons.\"${A}\"" "${VALUE}" "${PRESET_CONFIG_FILE}"
done
fi
echo "$(cat "${PRESET_CONFIG_FILE}")"
echo "arc-${{ env.MODEL }}-${{ env.PRODUCTVER }}-${{ env.VERSION }}" >"files/p3/automated"
echo "Copying files"
sudo cp -Rf "files/p1/"* "/tmp/p1"
@@ -177,7 +176,6 @@ jobs:
# Zip image and generate checksum
- name: Pack
if: env.iscustom == 'true'
run: |
if [ "${{ env.FORMAT }}" = "img" ]; then
zip -9 "arc-${{ env.MODEL }}-${{ env.PRODUCTVER }}-${{ env.VERSION }}.img.zip" arc.img
@@ -208,7 +206,7 @@ jobs:
echo "FIOURL=${FIOURL}" >> $GITHUB_ENV
- name: Send mail
if: env.iscustom == 'true' && success() && env.EMAIL != 'null'
if: success() && env.EMAIL != 'null'
uses: dawidd6/action-send-mail@v3
with:
server_address: smtp.gmail.com
@@ -222,7 +220,7 @@ jobs:
${{ env.FIOURL }}
- name: Update Comment Success
if: env.iscustom == 'true' && success()
if: success()
uses: actions-cool/issues-helper@v3
with:
actions: 'update-comment'
@@ -236,7 +234,7 @@ jobs:
----
- name: Close Issues
if: env.iscustom == 'true' && success()
if: success()
uses: actions-cool/issues-helper@v3
with:
actions: 'close-issue'
@@ -244,7 +242,7 @@ jobs:
issue-number: ${{ github.event.issue.number }}
- name: Update Comment Fail
if: env.iscustom == 'true' && failure()
if: failure()
uses: actions-cool/issues-helper@v3
with:
actions: 'update-comment'

View File

@@ -32,18 +32,18 @@ jobs:
. scripts/func.sh
models="{"
WORK_PATH="files/p3"
mkdir -p "${WORK_PATH}/autoconfigs"
getConfigs "${WORK_PATH}/autoconfigs"
for M in $(find "${WORK_PATH}/autoconfigs" -maxdepth 1 -name \*.yml 2>/dev/null | sed 's/.*\///; s/\.yml//'); do
mkdir -p "${WORK_PATH}/configs"
getConfigs "${WORK_PATH}/configs"
for M in $(find "${WORK_PATH}/configs" -maxdepth 1 -name \*.yml 2>/dev/null | sed 's/.*\///; s/\.yml//'); do
models+="\"${M}\":["
for V in $(yq eval '.productvers | explode(.) | to_entries | map([.key])[] | .[]' "${WORK_PATH}/autoconfigs/${M}.yml" 2>/dev/null | sort -r); do
for V in $(yq eval '.productvers | explode(.) | to_entries | map([.key])[] | .[]' "${WORK_PATH}/configs/${M}.yml" 2>/dev/null | sort -r); do
models+="\"${V}\","
done
models="${models%,}],"
done
models="${models%,}}"
echo "${models}" >docs/models.json
rm -rf "${WORK_PATH}/autoconfigs"
rm -rf "${WORK_PATH}/configs"
- name: Check and Push
if: success() && inputs.push == true