mirror of
https://github.com/AuxXxilium/arc.git
synced 2026-09-03 06:36:32 +08:00
6
.github/workflows/build.yml
vendored
6
.github/workflows/build.yml
vendored
@@ -52,7 +52,11 @@ jobs:
|
||||
sudo apt install -y locales busybox dialog gettext sed gawk jq curl
|
||||
sudo apt install -y python-is-python3 python3-pip libelf-dev qemu-utils cpio xz-utils lz4 lzma bzip2 gzip zstd
|
||||
if ! command -v yq &>/dev/null || ! yq --version 2>/dev/null | grep -q "v4."; then
|
||||
sudo curl -kL https://github.com/mikefarah/yq/releases/latest/download/yq_linux_amd64 -o /usr/bin/yq && sudo chmod a+x /usr/bin/yq
|
||||
sudo rm -f /usr/bin/yq.part
|
||||
sudo curl -fsSL --connect-timeout 10 --retry 5 --retry-delay 2 --retry-all-errors https://github.com/mikefarah/yq/releases/latest/download/yq_linux_amd64 -o /usr/bin/yq.part
|
||||
sudo test -s /usr/bin/yq.part
|
||||
sudo mv -f /usr/bin/yq.part /usr/bin/yq
|
||||
sudo chmod a+x /usr/bin/yq
|
||||
fi
|
||||
|
||||
- name: Get Dependencies
|
||||
|
||||
15
.github/workflows/custom.yml
vendored
15
.github/workflows/custom.yml
vendored
@@ -90,15 +90,20 @@ jobs:
|
||||
# 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="$(curl -m 5 -kL https://api.github.com/repos/AuxXxilium/arc/releases/latest | grep "tag_name" | awk '{print substr($2, 2, length($2)-3)}')"
|
||||
curl -kL "https://github.com/AuxXxilium/arc/releases/download/${TAG}/arc-${TAG}.img.zip" -o "/tmp/arc.img.zip"
|
||||
unzip -o "/tmp/arc.img.zip" -d "/tmp"
|
||||
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"
|
||||
@@ -140,8 +145,8 @@ jobs:
|
||||
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 -skL "${DSM_URL}" -o "/tmp/${DSM_FILE}"
|
||||
[ -f "/tmp/${DSM_FILE}" ] && echo "dsm: download successful" || exit 1
|
||||
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"
|
||||
|
||||
39
.github/workflows/data.yml
vendored
39
.github/workflows/data.yml
vendored
@@ -34,31 +34,37 @@ jobs:
|
||||
|
||||
YQ=$(command -v yq)
|
||||
if [ -z "${YQ}" ] || ! ${YQ} --version 2>/dev/null | grep -q "v4."; then
|
||||
wget https://github.com/mikefarah/yq/releases/latest/download/yq_linux_amd64 -O "${YQ:-"/usr/bin/yq"}" && chmod +x "${YQ:-"/usr/bin/yq"}"
|
||||
YQ_BIN="${YQ:-"/usr/bin/yq"}"
|
||||
TMP_YQ_BIN="${YQ_BIN}.part"
|
||||
rm -f "${TMP_YQ_BIN}"
|
||||
curl -fsSL --connect-timeout 10 --retry 5 --retry-delay 2 --retry-all-errors https://github.com/mikefarah/yq/releases/latest/download/yq_linux_amd64 -o "${TMP_YQ_BIN}"
|
||||
[ -s "${TMP_YQ_BIN}" ] || exit 1
|
||||
mv -f "${TMP_YQ_BIN}" "${YQ_BIN}"
|
||||
chmod +x "${YQ_BIN}"
|
||||
fi
|
||||
|
||||
- name: Get Addon Data for Arc
|
||||
run: |
|
||||
REPO="https://github.com/AuxXxilium/arc-addons"
|
||||
set -euo pipefail
|
||||
. scripts/github_release.sh
|
||||
|
||||
REPO_WEB="https://github.com/AuxXxilium/arc-addons"
|
||||
REPO_API="https://api.github.com/repos/AuxXxilium/arc-addons/releases"
|
||||
PRERELEASE="true"
|
||||
|
||||
TAG=""
|
||||
if [ "${PRERELEASE}" = "true" ]; then
|
||||
TAG="$(curl -skL --connect-timeout 10 "${REPO}/tags" | grep /refs/tags/.*\.zip | sed -r 's/.*\/refs\/tags\/(.*)\.zip.*$/\1/' | sort -rV | head -1)"
|
||||
TAG="$(github_latest_tag "${REPO_API}")"
|
||||
else
|
||||
LATESTURL="$(curl -skL --connect-timeout 10 -w %{url_effective} -o /dev/null "${REPO}/releases/latest")"
|
||||
LATESTURL="$(curl -fsSL --connect-timeout 10 --retry 3 --retry-delay 1 --retry-all-errors -w %{url_effective} -o /dev/null "${REPO_WEB}/releases/latest")"
|
||||
TAG="${LATESTURL##*/}"
|
||||
fi
|
||||
[ "${TAG:0:1}" = "v" ] && TAG="${TAG:1}"
|
||||
rm -f addons.zip
|
||||
STATUS=$(curl -kL --connect-timeout 10 -w "%{http_code}" "${REPO}/releases/download/${TAG}/addons-${TAG}.zip" -o "addons.zip")
|
||||
if [ $? -ne 0 -o ${STATUS:-0} -ne 200 ]; then
|
||||
echo "Download failed"
|
||||
exit 1
|
||||
fi
|
||||
download_validated_zip "${REPO_WEB}/releases/download/${TAG}/addons-${TAG}.zip" "addons.zip" 1024
|
||||
|
||||
mkdir -p "mnt/p3/addons"
|
||||
unzip addons.zip -d "mnt/p3/addons"
|
||||
unzip -oq addons.zip -d "mnt/p3/addons"
|
||||
for i in $(find "mnt/p3/addons" -type f -name "*.addon"); do
|
||||
if [ -f "${i}" ]; then
|
||||
mkdir -p "mnt/p3/addons/$(basename "${i}" .addon)"
|
||||
@@ -69,19 +75,18 @@ jobs:
|
||||
|
||||
- name: Get Config Data for Arc
|
||||
run: |
|
||||
set -euo pipefail
|
||||
. scripts/github_release.sh
|
||||
|
||||
REPO="https://github.com/AuxXxilium/arc-configs"
|
||||
LATESTURL="$(curl -skL --connect-timeout 10 -w %{url_effective} -o /dev/null "${REPO}/releases/latest")"
|
||||
LATESTURL="$(curl -fsSL --connect-timeout 10 --retry 3 --retry-delay 1 --retry-all-errors -w %{url_effective} -o /dev/null "${REPO}/releases/latest")"
|
||||
TAG="${LATESTURL##*/}"
|
||||
[ "${TAG:0:1}" = "v" ] && TAG="${TAG:1}"
|
||||
rm -f configs.zip
|
||||
STATUS=$(curl -kL --connect-timeout 10 -w "%{http_code}" "${REPO}/releases/download/${TAG}/configs-${TAG}.zip" -o "configs.zip")
|
||||
if [ $? -ne 0 -o ${STATUS:-0} -ne 200 ]; then
|
||||
echo "Download failed"
|
||||
exit 1
|
||||
fi
|
||||
download_validated_zip "${REPO}/releases/download/${TAG}/configs-${TAG}.zip" "configs.zip" 1024
|
||||
|
||||
mkdir -p "mnt/p3/configs"
|
||||
unzip configs.zip -d "mnt/p3/configs"
|
||||
unzip -oq configs.zip -d "mnt/p3/configs"
|
||||
rm -f configs.zip
|
||||
|
||||
- name: Get data
|
||||
|
||||
@@ -161,9 +161,12 @@ chmod +x "${RAMDISK_PATH}/addons/addons.sh"
|
||||
[ "${ARC_MODE}" != "dsm" ] && echo -e ">> Ramdisk: install addons"
|
||||
NETFIX="$(readConfigKey "arc.netfix" "${USER_CONFIG_FILE}")"
|
||||
if [ "${NETFIX}" = "true" ]; then
|
||||
SYSADDONS="redpill revert misc eudev disks netfix localrss notify mountloader"
|
||||
SYSADDONS="revert misc eudev disks netfix localrss notify mountloader"
|
||||
else
|
||||
SYSADDONS="redpill revert misc eudev disks localrss notify mountloader"
|
||||
SYSADDONS="revert misc eudev disks localrss notify mountloader"
|
||||
fi
|
||||
if [ "${KVER:0:1}" = "5" ]; then
|
||||
SYSADDONS="redpill ${SYSADDONS}"
|
||||
fi
|
||||
|
||||
for ADDON in ${SYSADDONS}; do
|
||||
|
||||
53
scripts/github_release.sh
Executable file
53
scripts/github_release.sh
Executable file
@@ -0,0 +1,53 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Shared CI helpers for release metadata and archive downloads.
|
||||
|
||||
github_api_json_retry() {
|
||||
local url="${1}"
|
||||
local tries="${2:-6}"
|
||||
local sleep_s="${3:-2}"
|
||||
local i=0
|
||||
local resp=""
|
||||
|
||||
while [ "${i}" -lt "${tries}" ]; do
|
||||
resp="$(curl -fsSL --connect-timeout 10 --retry 3 --retry-delay 1 --retry-all-errors "${url}" 2>/dev/null || true)"
|
||||
if [ -n "${resp}" ] && echo "${resp}" | jq -e . >/dev/null 2>&1; then
|
||||
printf '%s\n' "${resp}"
|
||||
return 0
|
||||
fi
|
||||
i=$((i + 1))
|
||||
sleep "${sleep_s}"
|
||||
done
|
||||
|
||||
return 1
|
||||
}
|
||||
|
||||
github_latest_tag() {
|
||||
local api_url="${1}"
|
||||
local exclude_dev="${2:-false}"
|
||||
local tag=""
|
||||
|
||||
if [ "${exclude_dev}" = "true" ]; then
|
||||
tag="$(github_api_json_retry "${api_url}" | jq -r 'if type=="array" then .[].tag_name // empty else empty end' | grep -v "dev" | sort -rV | head -1)"
|
||||
else
|
||||
tag="$(github_api_json_retry "${api_url}" | jq -r 'if type=="array" then .[].tag_name // empty else empty end' | sort -rV | head -1)"
|
||||
fi
|
||||
|
||||
tag="${tag#v}"
|
||||
[ -n "${tag}" ] || return 1
|
||||
printf '%s\n' "${tag}"
|
||||
}
|
||||
|
||||
download_validated_zip() {
|
||||
local url="${1}"
|
||||
local out="${2}"
|
||||
local min_size="${3:-1024}"
|
||||
local tmp="${out}.part"
|
||||
|
||||
rm -f "${out}" "${tmp}"
|
||||
curl -fL --connect-timeout 10 --retry 5 --retry-delay 2 --retry-all-errors "${url}" -o "${tmp}"
|
||||
[ -s "${tmp}" ] || return 1
|
||||
[ "$(stat -c%s "${tmp}")" -ge "${min_size}" ] || return 1
|
||||
unzip -tqq "${tmp}" >/dev/null 2>&1 || return 1
|
||||
mv -f "${tmp}" "${out}"
|
||||
}
|
||||
Reference in New Issue
Block a user