2024-05-05 06:13:00 +07:00
|
|
|
#
|
2024-08-03 17:17:13 +07:00
|
|
|
# Copyright (C) 2023 AuxXxilium <https://github.com/AuxXxilium>
|
2024-05-05 06:13:00 +07:00
|
|
|
#
|
|
|
|
# This is free software, licensed under the MIT License.
|
|
|
|
# See /LICENSE for more information.
|
|
|
|
#
|
|
|
|
|
|
|
|
name: Custom Build
|
|
|
|
on:
|
|
|
|
issues:
|
|
|
|
types:
|
|
|
|
- labeled
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
build:
|
|
|
|
if: github.event.label.name == 'custom'
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- name: Checkout
|
|
|
|
uses: actions/checkout@main
|
|
|
|
|
|
|
|
- name: Init Env
|
|
|
|
run: |
|
|
|
|
git config --global user.email "info@auxxxilium.tech"
|
|
|
|
git config --global user.name "AuxXxilium"
|
|
|
|
sudo timedatectl set-timezone "Europe/Berlin"
|
|
|
|
|
|
|
|
- name: Check Custom
|
|
|
|
shell: python
|
|
|
|
run: |
|
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
import json, subprocess
|
|
|
|
def set_output(name, value):
|
|
|
|
subprocess.call(["echo '{}={}' >> $GITHUB_ENV".format(name, value)], shell=True)
|
|
|
|
|
|
|
|
issuetitle = ${{ toJSON(github.event.issue.title) }};
|
|
|
|
issuebody = ${{ toJSON(github.event.issue.body) }};
|
|
|
|
|
|
|
|
MODEL = ''
|
|
|
|
PRODUCTVER = ''
|
|
|
|
ADDONS = ''
|
2024-08-18 08:05:54 +07:00
|
|
|
KERNEL = ''
|
2024-05-05 06:13:00 +07:00
|
|
|
FORMAT = ''
|
2024-10-25 01:17:24 +07:00
|
|
|
BRANCH = ''
|
2024-05-05 06:13:00 +07:00
|
|
|
try:
|
|
|
|
jsonbody = json.loads(issuebody)
|
|
|
|
MODEL = jsonbody.get('model', '')
|
|
|
|
PRODUCTVER = jsonbody.get('version', '')
|
|
|
|
ADDONS = jsonbody.get('addons', '')
|
2024-08-18 08:05:54 +07:00
|
|
|
KERNEL = jsonbody.get('kernel', '')
|
2024-05-05 06:13:00 +07:00
|
|
|
FORMAT = jsonbody.get('format', '')
|
2024-10-25 01:17:24 +07:00
|
|
|
BRANCH = jsonbody.get('branch', '')
|
2024-05-05 06:13:00 +07:00
|
|
|
except ValueError as e:
|
|
|
|
pass
|
|
|
|
|
|
|
|
set_output("MODEL", MODEL)
|
|
|
|
set_output("PRODUCTVER", PRODUCTVER)
|
|
|
|
set_output("ADDONS", ADDONS)
|
2024-08-18 08:05:54 +07:00
|
|
|
set_output("KERNEL", KERNEL)
|
2024-05-05 06:13:00 +07:00
|
|
|
set_output("FORMAT", FORMAT)
|
2024-10-25 01:17:24 +07:00
|
|
|
set_output("BRANCH", BRANCH)
|
2024-05-05 06:13:00 +07:00
|
|
|
|
|
|
|
# calculates the version number and push
|
|
|
|
- name: Calculate Version
|
|
|
|
run: |
|
|
|
|
# Calculate Version
|
|
|
|
VERSION="`date +'%y.%-m.%-d'`-custom"
|
|
|
|
|
|
|
|
echo "Version: ${VERSION}"
|
|
|
|
echo "VERSION=${VERSION}" >> $GITHUB_ENV
|
|
|
|
|
|
|
|
- name: Update Comment Building
|
|
|
|
id: comment
|
|
|
|
uses: actions-cool/issues-helper@v3
|
|
|
|
with:
|
|
|
|
actions: 'create-comment'
|
|
|
|
token: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
issue-number: ${{ github.event.issue.number }}
|
|
|
|
body: |
|
|
|
|
Hi @${{ github.event.issue.user.login }}.
|
2024-11-09 19:45:54 +07:00
|
|
|
building arc-${{ env.MODEL }}-${{ env.VERSION }}, it will be uploaded here and sent to your email later..
|
2024-05-05 06:13:00 +07:00
|
|
|
> ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
|
|
|
|
----
|
|
|
|
|
2024-06-02 15:35:26 +07:00
|
|
|
# Install dependencies
|
|
|
|
- name: Install Dependencies
|
2024-05-05 06:13:00 +07:00
|
|
|
run: |
|
|
|
|
sudo apt update
|
2024-09-01 20:10:52 +07:00
|
|
|
sudo apt install -y jq gawk cpio gettext libelf-dev qemu-utils busybox dialog curl sed
|
|
|
|
sudo pip install -r scripts/requirements.txt
|
2024-05-05 06:13:00 +07:00
|
|
|
sudo snap install yq
|
|
|
|
|
|
|
|
# Build incremental
|
|
|
|
- name: Build image
|
|
|
|
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
|
|
|
|
}
|
|
|
|
|
2024-06-02 15:35:26 +07:00
|
|
|
TAG="$(curl -m 5 -kL https://api.github.com/repos/AuxXxilium/arc/releases/latest | grep "tag_name" | awk '{print substr($2, 2, length($2)-3)}')"
|
2024-10-25 01:17:24 +07:00
|
|
|
curl -kL "https://github.com/AuxXxilium/arc/releases/download/${TAG}/arc-${TAG}-${{ env.BRANCH }}.img.zip" -o "/tmp/arc.img.zip"
|
2024-06-02 15:35:26 +07:00
|
|
|
unzip -o "/tmp/arc.img.zip" -d "/tmp"
|
|
|
|
|
|
|
|
echo "Modify Arc Image"
|
|
|
|
IMAGE_FILE="/tmp/arc.img"
|
2024-05-05 06:13:00 +07:00
|
|
|
fdisk -l "${IMAGE_FILE}"
|
|
|
|
|
|
|
|
LOOPX=$(sudo losetup -f)
|
|
|
|
sudo losetup -P "${LOOPX}" "${IMAGE_FILE}"
|
|
|
|
|
|
|
|
echo "Mounting image file"
|
|
|
|
mkdir -p "/tmp/p1"
|
|
|
|
mkdir -p "/tmp/p3"
|
|
|
|
sudo mount ${LOOPX}p1 "/tmp/p1"
|
|
|
|
sudo mount ${LOOPX}p3 "/tmp/p3"
|
|
|
|
|
|
|
|
echo "Set Custom Config"
|
2024-06-02 15:35:26 +07:00
|
|
|
PRESET_CONFIG_FILE="/tmp/p1/user-config.yml"
|
|
|
|
sudo touch "${PRESET_CONFIG_FILE}"
|
2024-08-30 00:54:27 +07:00
|
|
|
MODEL="${{ env.MODEL }}"
|
|
|
|
writeConfigKey "model" "${MODEL}" "${PRESET_CONFIG_FILE}"
|
|
|
|
PRODUCTVER="${{ env.PRODUCTVER }}"
|
2024-09-01 20:10:52 +07:00
|
|
|
PJ="$(python scripts/functions.py getpats4mv -m "${MODEL}" -v "${PRODUCTVER:0:3}")"
|
|
|
|
PAT_URL=$(echo "${PJ}" | jq -r ".\"${PRODUCTVER}\".url")
|
|
|
|
PAT_HASH=$(echo "${PJ}" | jq -r ".\"${PRODUCTVER}\".sum")
|
2024-08-30 00:54:27 +07:00
|
|
|
writeConfigKey "productver" "${PRODUCTVER:0:3}" "${PRESET_CONFIG_FILE}"
|
|
|
|
writeConfigKey "paturl" "${PAT_URL}" "${PRESET_CONFIG_FILE}"
|
|
|
|
writeConfigKey "pathash" "${PAT_HASH}" "${PRESET_CONFIG_FILE}"
|
2024-05-05 06:13:00 +07:00
|
|
|
if [ "${{ env.MODEL }}" = "SA6400" ]; then
|
2024-07-13 02:13:50 +07:00
|
|
|
writeConfigKey "kernel" "${{ env.KERNEL }}" "${PRESET_CONFIG_FILE}"
|
2024-05-05 06:13:00 +07:00
|
|
|
fi
|
|
|
|
writeConfigKey "addons" "{}" "${PRESET_CONFIG_FILE}"
|
|
|
|
if [ -n "${{ env.ADDONS }}" ]; then
|
|
|
|
for A in $(echo "${{ env.ADDONS }}" | tr ',' ' ' | sed 's/\[//g' | sed 's/\]//g'); do
|
|
|
|
VALUE=""
|
|
|
|
writeConfigKey "addons.\"${A}\"" "${VALUE}" "${PRESET_CONFIG_FILE}"
|
|
|
|
done
|
|
|
|
fi
|
2024-08-30 00:54:27 +07:00
|
|
|
writeConfigKey "automated" "true" "${PRESET_CONFIG_FILE}"
|
2024-05-05 06:13:00 +07:00
|
|
|
echo "$(cat "${PRESET_CONFIG_FILE}")"
|
2024-08-30 01:20:00 +07:00
|
|
|
sudo echo "arc-${MODEL}-${PRODUCTVER:0:3}-${TAG}" >"/tmp/automated"
|
2024-08-25 18:58:48 +07:00
|
|
|
sudo mv -f "/tmp/automated" "/tmp/p3/automated"
|
2024-08-30 00:54:27 +07:00
|
|
|
DSM_FILE="${PAT_HASH}.tar"
|
2024-08-30 01:20:00 +07:00
|
|
|
DSM_URL="https://raw.githubusercontent.com/AuxXxilium/arc-dsm/main/files/${MODEL/+/%2B}/${PRODUCTVER:0:3}/${PAT_HASH}.tar"
|
2024-08-30 00:54:27 +07:00
|
|
|
sudo curl -skL "${DSM_URL}" -o "/tmp/${DSM_FILE}"
|
2024-09-01 20:38:42 +07:00
|
|
|
[ -f "/tmp/${DSM_FILE}" ] && echo "dsm: download successful" || exit 1
|
2024-09-01 20:25:49 +07:00
|
|
|
sudo mkdir -p "/tmp/p3/users"
|
|
|
|
sudo mv -f "/tmp/${DSM_FILE}" "/tmp/p3/users/${DSM_FILE}"
|
2024-06-19 22:51:20 +07:00
|
|
|
echo "Syncing files"
|
2024-05-05 06:13:00 +07:00
|
|
|
sync
|
|
|
|
|
|
|
|
echo "Unmount image file"
|
|
|
|
sudo umount "/tmp/p1"
|
|
|
|
sudo umount "/tmp/p3"
|
|
|
|
rmdir "/tmp/p1"
|
|
|
|
rmdir "/tmp/p3"
|
|
|
|
|
|
|
|
sudo losetup --detach ${LOOPX}
|
|
|
|
|
2024-06-02 15:35:26 +07:00
|
|
|
cp -f "${IMAGE_FILE}" "arc.img"
|
|
|
|
|
2024-05-05 06:13:00 +07:00
|
|
|
if [ "${{ env.FORMAT }}" = "dyn" ]; then
|
|
|
|
echo "Image Converter -> dyn"
|
2024-06-30 01:25:08 +07:00
|
|
|
qemu-img convert arc.img -O vmdk -o adapter_type=lsilogic,compat6 arc-dyn.vmdk
|
2024-05-05 06:13:00 +07:00
|
|
|
elif [ "${{ env.FORMAT }}" = "flat" ]; then
|
|
|
|
echo "Image Converter -> flat"
|
2024-06-30 01:25:08 +07:00
|
|
|
qemu-img convert arc.img -O vmdk -o adapter_type=lsilogic,subformat=monolithicFlat,compat6 arc.vmdk
|
|
|
|
elif [ "${{ env.FORMAT }}" = "vhdx" ]; then
|
|
|
|
echo "Image Converter -> vhdx"
|
|
|
|
qemu-img convert arc.img -O vhdx -o subformat=dynamic arc.vhdx
|
2024-08-18 08:05:54 +07:00
|
|
|
elif [ "${{ env.FORMAT }}" = "ova" ]; then
|
|
|
|
echo "Image Converter -> ova"
|
|
|
|
convertova "arc.img" "arc.ova"
|
2024-05-05 06:13:00 +07:00
|
|
|
fi
|
|
|
|
|
|
|
|
# Zip image and generate checksum
|
|
|
|
- name: Pack
|
|
|
|
run: |
|
|
|
|
if [ "${{ env.FORMAT }}" = "img" ]; then
|
2024-11-09 19:45:54 +07:00
|
|
|
zip -9 "arc-${{ env.MODEL }}-${{ env.VERSION }}.img.zip" arc.img
|
|
|
|
UPLOAD="$(curl -k -F "file=@arc-${{ env.MODEL }}-${{ env.VERSION }}.img.zip" "https://file.io")"
|
2024-05-05 06:13:00 +07:00
|
|
|
if ! echo "${UPLOAD}" | grep -oP '"link":\s*"\K[^"]+'; then
|
|
|
|
echo "Upload failed"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
elif [ "${{ env.FORMAT }}" = "dyn" ]; then
|
2024-11-09 19:45:54 +07:00
|
|
|
zip -9 "arc-${{ env.MODEL }}-${{ env.VERSION }}.vmdk-dyn.zip" arc-dyn.vmdk
|
|
|
|
UPLOAD="$(curl -k -F "file=@arc-${{ env.MODEL }}-${{ env.VERSION }}.vmdk-dyn.zip" "https://file.io")"
|
2024-05-05 06:13:00 +07:00
|
|
|
if ! echo "${UPLOAD}" | grep -oP '"link":\s*"\K[^"]+'; then
|
|
|
|
echo "Upload failed"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
elif [ "${{ env.FORMAT }}" = "flat" ]; then
|
2024-11-09 19:45:54 +07:00
|
|
|
zip -9 "arc-${{ env.MODEL }}-${{ env.VERSION }}.vmdk-flat.zip" arc.vmdk arc-flat.vmdk
|
|
|
|
UPLOAD="$(curl -k -F "file=@arc-${{ env.MODEL }}-${{ env.VERSION }}.vmdk-flat.zip" "https://file.io")"
|
2024-05-05 06:13:00 +07:00
|
|
|
if ! echo "${UPLOAD}" | grep -oP '"link":\s*"\K[^"]+'; then
|
|
|
|
echo "Upload failed"
|
|
|
|
exit 1
|
|
|
|
fi
|
2024-06-30 01:25:08 +07:00
|
|
|
elif [ "${{ env.FORMAT }}" = "vhdx" ]; then
|
2024-11-09 19:45:54 +07:00
|
|
|
zip -9 "arc-${{ env.MODEL }}-${{ env.VERSION }}.vhdx.zip" arc.vhdx
|
|
|
|
UPLOAD="$(curl -k -F "file=@arc-${{ env.MODEL }}-${{ env.VERSION }}.vhdx.zip" "https://file.io")"
|
2024-06-30 01:25:08 +07:00
|
|
|
if ! echo "${UPLOAD}" | grep -oP '"link":\s*"\K[^"]+'; then
|
|
|
|
echo "Upload failed"
|
|
|
|
exit 1
|
|
|
|
fi
|
2024-08-18 08:05:54 +07:00
|
|
|
elif [ "${{ env.FORMAT }}" = "ova" ]; then
|
2024-11-09 19:45:54 +07:00
|
|
|
zip -9 "arc-${{ env.MODEL }}-${{ env.VERSION }}.ova.zip" arc.ova
|
|
|
|
UPLOAD="$(curl -k -F "file=@arc-${{ env.MODEL }}-${{ env.VERSION }}.ova.zip" "https://file.io")"
|
2024-08-18 08:05:54 +07:00
|
|
|
if ! echo "${UPLOAD}" | grep -oP '"link":\s*"\K[^"]+'; then
|
|
|
|
echo "Upload failed"
|
|
|
|
exit 1
|
|
|
|
fi
|
2024-05-05 06:13:00 +07:00
|
|
|
fi
|
|
|
|
|
|
|
|
EMAIL=$(curl -s -H "Authorization: token ${{ secrets.ACTION }}" "https://api.github.com/users/${{ github.event.issue.user.login }}" | jq -r '.email')
|
|
|
|
FIOURL="$(echo "${UPLOAD}" | grep -oP '"link":\s*"\K[^"]+')"
|
|
|
|
echo "EMAIL=${EMAIL}" >> $GITHUB_ENV
|
|
|
|
echo "FIOURL=${FIOURL}" >> $GITHUB_ENV
|
|
|
|
|
|
|
|
- name: Send mail
|
|
|
|
if: success() && env.EMAIL != 'null'
|
|
|
|
uses: dawidd6/action-send-mail@v3
|
|
|
|
with:
|
|
|
|
server_address: smtp.gmail.com
|
|
|
|
server_port: 587
|
|
|
|
username: ${{ secrets.MAIL_USERNAME }}
|
|
|
|
password: ${{ secrets.MAIL_PASSWORD }}
|
2024-11-09 19:45:54 +07:00
|
|
|
subject: arc-${{ env.model }}-${{ env.VERSION }}
|
2024-05-05 06:13:00 +07:00
|
|
|
to: ${{ env.EMAIL }}
|
|
|
|
from: ${{ secrets.MAIL_USERNAME }}
|
|
|
|
body: |
|
|
|
|
${{ env.FIOURL }}
|
|
|
|
|
|
|
|
- name: Update Comment Success
|
|
|
|
if: success()
|
|
|
|
uses: actions-cool/issues-helper@v3
|
|
|
|
with:
|
|
|
|
actions: 'update-comment'
|
|
|
|
token: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
comment-id: ${{ steps.comment.outputs.comment-id }}
|
|
|
|
update-mode: replace
|
|
|
|
body: |
|
|
|
|
Hi @${{ github.event.issue.user.login }}.
|
2024-11-09 19:45:54 +07:00
|
|
|
arc-${{ env.MODEL }}-${{ env.VERSION }} is ready to download: ${{ env.FIOURL }}
|
2024-06-23 21:28:05 +07:00
|
|
|
> ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
|
|
|
|
|
|
|
|
If this will not work, do not use customized Versions!
|
2024-05-05 06:13:00 +07:00
|
|
|
----
|
|
|
|
|
|
|
|
- name: Update Comment Fail
|
|
|
|
if: failure()
|
|
|
|
uses: actions-cool/issues-helper@v3
|
|
|
|
with:
|
|
|
|
actions: 'update-comment'
|
|
|
|
token: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
comment-id: ${{ steps.comment.outputs.comment-id }}
|
|
|
|
update-mode: replace
|
|
|
|
body: |
|
|
|
|
Hi @${{ github.event.issue.user.login }}.
|
|
|
|
arc-${{ env.MODEL }}-${{ env.PRODUCTVER }}-${{ env.VERSION }} failed to build and package, please try again.
|
2024-07-29 01:05:42 +07:00
|
|
|
> ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
|
|
|
|
|
|
|
|
If this will not work, do not use customized Versions!
|
2024-05-05 06:13:00 +07:00
|
|
|
----
|
|
|
|
|
2024-09-01 20:28:38 +07:00
|
|
|
- name: Close Issues
|
2024-09-01 20:38:42 +07:00
|
|
|
if: success()
|
2024-09-01 20:28:38 +07:00
|
|
|
uses: actions-cool/issues-helper@v3
|
|
|
|
with:
|
|
|
|
actions: 'close-issue'
|
|
|
|
token: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
issue-number: ${{ github.event.issue.number }}
|
|
|
|
|
2024-05-05 06:13:00 +07:00
|
|
|
comment:
|
|
|
|
if: github.event.label.name == 'bug'
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- name: Init Env
|
|
|
|
run: |
|
|
|
|
git config --global user.email "info@auxxxilium.tech"
|
|
|
|
git config --global user.name "AuxXxilium"
|
|
|
|
sudo timedatectl set-timezone "Europe/Berlin"
|
|
|
|
|
|
|
|
- name: Check Issues
|
|
|
|
run: |
|
|
|
|
if echo "${{ github.event.issue.body }}" | grep -q "Screenshots"; then
|
|
|
|
echo "FALG=true" >> $GITHUB_ENV
|
|
|
|
else
|
|
|
|
echo "FALG=false" >> $GITHUB_ENV
|
|
|
|
fi
|
|
|
|
|
|
|
|
- name: Create Issues comment
|
|
|
|
if: env.FALG == 'false'
|
|
|
|
uses: actions-cool/issues-helper@v3
|
|
|
|
with:
|
|
|
|
actions: "create-comment"
|
|
|
|
token: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
issue-number: ${{ github.event.issue.number }}
|
|
|
|
body: |
|
|
|
|
**Describe the Bug**
|
|
|
|
A clear and concise description of what the bug is.
|
|
|
|
|
|
|
|
**Screenshots**
|
|
|
|
Screenshot the Systeminfo (Arc - Sysinfo) or use new "Full Sysinfo - Upload" Function provide the Code!!! <- IMPORTANT
|
|
|
|
|
|
|
|
**Hardware**
|
|
|
|
Add your Hardware Informations here. CPU / Board / Networkcontroller / Storagecontroller / ...
|
|
|
|
|
|
|
|
- name: Close Issues
|
|
|
|
if: env.FALG == 'false'
|
|
|
|
uses: actions-cool/issues-helper@v3
|
|
|
|
with:
|
|
|
|
actions: 'close-issue'
|
|
|
|
token: ${{ secrets.GITHUB_TOKEN }}
|
2024-08-18 08:05:54 +07:00
|
|
|
issue-number: ${{ github.event.issue.number }}
|