Files
arc/.github/workflows/custom.yml
AuxXxilium 421c82e46d Fix loader clone resize, harden resizeImg
cloneLoader grew partition 3 of the target disk but never ran e2fsck
first. Right after the raw dd the filesystem is dirty, so resize2fs
refused it and the clone silently stayed at the source image's size.
Prefer parted resizepart over the fdisk delete/recreate trick, falling
back for loaders built before parted was added to buildroot.

hdparm -z speaks ATA, so skip it for eMMC/NVMe/loop/nbd targets.

resizeImg hardcoded p3 and swallowed fdisk errors. Find the last
partition with parted instead, fail loudly, and reject shrinking, which
never worked: the image is truncated before the partition table is
touched, so it would cut off partition data.
2026-09-06 16:36:40 +02:00

279 lines
10 KiB
YAML

#
# Copyright (C) 2025 AuxXxilium <https://github.com/AuxXxilium>
#
# 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 = ''
KERNEL = ''
FORMAT = ''
try:
jsonbody = json.loads(issuebody)
MODEL = jsonbody.get('model', '')
PRODUCTVER = jsonbody.get('version', '')
ADDONS = jsonbody.get('addons', '')
KERNEL = jsonbody.get('kernel', '')
FORMAT = jsonbody.get('format', '')
except ValueError as e:
pass
set_output("MODEL", MODEL)
set_output("PRODUCTVER", PRODUCTVER)
set_output("ADDONS", ADDONS)
set_output("KERNEL", KERNEL)
set_output("FORMAT", FORMAT)
# 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 }}.
building arc-${{ env.MODEL }}-${{ env.VERSION }}, it will be uploaded to..
> ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
----
# Install dependencies
- name: Install Dependencies
run: |
sudo apt update
sudo apt install -y jq gawk cpio gettext libelf-dev qemu-utils parted busybox dialog curl sed
sudo pip install -r scripts/requirements.txt
sudo snap install yq
# Build incremental
- name: Build image
run: |
set -euo pipefail
. scripts/github_release.sh
. scripts/functions.sh
function writeConfigKey() {
[ "${2}" = "{}" ] && sudo yq eval '.'${1}' = {}' --inplace "${3}" 2>/dev/null || sudo yq eval '.'${1}' = "'"${2}"'"' --inplace "${3}" 2>/dev/null
}
TAG="$(github_api_json_retry "https://api.github.com/repos/AuxXxilium/arc/releases/latest" | jq -r '.tag_name // empty' | sed 's/^v//')"
[ -n "${TAG}" ] || exit 1
download_validated_zip "https://github.com/AuxXxilium/arc/releases/download/${TAG}/arc-${TAG}.img.zip" "/tmp/arc.img.zip" 1048576
unzip -oq "/tmp/arc.img.zip" -d "/tmp"
[ -f "/tmp/arc.img" ] || exit 1
echo "Modify Arc Image"
IMAGE_FILE="/tmp/arc.img"
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"
PRESET_CONFIG_FILE="/tmp/p1/user-config.yml"
sudo touch "${PRESET_CONFIG_FILE}"
MODEL="${{ env.MODEL }}"
writeConfigKey "model" "${MODEL}" "${PRESET_CONFIG_FILE}"
PRODUCTVER="${{ env.PRODUCTVER }}"
PJ="$(python scripts/functions.py getpats4mv -m "${MODEL}" -v "${PRODUCTVER}")"
PAT_URL="$(echo "${PJ}" | jq -r ".\"${PRODUCTVER}\".url")"
PAT_HASH="$(echo "${PJ}" | jq -r ".\"${PRODUCTVER}\".sum")"
writeConfigKey "productver" "${PRODUCTVER:0:3}" "${PRESET_CONFIG_FILE}"
writeConfigKey "paturl" "${PAT_URL}" "${PRESET_CONFIG_FILE}"
writeConfigKey "pathash" "${PAT_HASH}" "${PRESET_CONFIG_FILE}"
if [ "${{ env.MODEL }}" = "SA6400" ]; then
writeConfigKey "kernel" "${{ env.KERNEL }}" "${PRESET_CONFIG_FILE}"
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
echo "$(cat "${PRESET_CONFIG_FILE}")"
sudo echo "arc-${MODEL}-${PRODUCTVER:0:3}-${TAG}" >"/tmp/automated"
sudo mv -f "/tmp/automated" "/tmp/p3/automated"
DSM_FILE="${PAT_HASH}.tar"
DSM_URL="https://raw.githubusercontent.com/AuxXxilium/arc-dsm/main/files/${MODEL/+/%2B}/${PRODUCTVER:0:3}/${PAT_HASH}.tar"
sudo curl -fsSL --connect-timeout 10 --retry 5 --retry-delay 2 --retry-all-errors "${DSM_URL}" -o "/tmp/${DSM_FILE}"
[ -s "/tmp/${DSM_FILE}" ] && echo "dsm: download successful" || exit 1
sudo mkdir -p "/tmp/p3/users"
sudo mv -f "/tmp/${DSM_FILE}" "/tmp/p3/users/${DSM_FILE}"
echo "Syncing files"
sync
echo "Unmount image file"
sudo umount "/tmp/p1"
sudo umount "/tmp/p3"
rmdir "/tmp/p1"
rmdir "/tmp/p3"
sudo losetup --detach ${LOOPX}
cp -f "${IMAGE_FILE}" "arc.img"
# Zip image and generate checksum
- name: Convert & Pack
run: |
rm -rf arc-*.zip 2>/dev/null
if [ "${{ env.FORMAT }}" = "img" ]; then
zip -9 "arc-${{ env.MODEL }}-${{ env.VERSION }}.img.zip" arc.img
elif [ "${{ env.FORMAT }}" = "dyn" ]; then
echo "Image Converter -> dyn"
qemu-img convert arc.img -O vmdk -o adapter_type=lsilogic,compat6 arc-dyn.vmdk
zip -9 "arc-${{ env.MODEL }}-${{ env.VERSION }}.vmdk-dyn.zip" arc-dyn.vmdk
elif [ "${{ env.FORMAT }}" = "flat" ]; then
echo "Image Converter -> flat"
qemu-img convert arc.img -O vmdk -o adapter_type=lsilogic,subformat=monolithicFlat,compat6 arc.vmdk
zip -9 "arc-${{ env.MODEL }}-${{ env.VERSION }}.vmdk-flat.zip" arc.vmdk arc-flat.vmdk
elif [ "${{ env.FORMAT }}" = "vhdx" ]; then
echo "Image Converter -> vhdx"
qemu-img convert arc.img -O vhdx -o subformat=dynamic arc.vhdx
zip -9 "arc-${{ env.MODEL }}-${{ env.VERSION }}.vhdx.zip" arc.vhdx
elif [ "${{ env.FORMAT }}" = "ova" ]; then
echo "Image Converter -> ova"
convertova "arc.img" "arc.ova"
zip -9 "arc-${{ env.MODEL }}-${{ env.VERSION }}.ova.zip" arc.ova
fi
# Upload artifact
- name: Upload to Artifacts
uses: actions/upload-artifact@v4
with:
name: arc-${{ env.MODEL }}-${{ env.VERSION }}-${{ github.run_id }}
path: |
arc-*.zip
retention-days: 1
- 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 }}.
arc-${{ env.MODEL }}-${{ env.VERSION }} is ready to download at:
> ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
If this isn't working, do not use customized Versions!
----
- 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 later.
----
- name: Close Issues
if: success()
uses: actions-cool/issues-helper@v3
with:
actions: 'close-issue'
token: ${{ secrets.GITHUB_TOKEN }}
issue-number: ${{ github.event.issue.number }}
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
env:
ISSUE_BODY: ${{ github.event.issue.body }}
run: |
if echo "$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 }}
issue-number: ${{ github.event.issue.number }}