tree: optimize code

Signed-off-by: AuxXxilium <info@auxxxilium.tech>
This commit is contained in:
AuxXxilium
2025-01-15 19:54:15 +01:00
parent e084f9c225
commit d8db7bbbab
10 changed files with 209 additions and 324 deletions

View File

@@ -64,7 +64,7 @@ jobs:
releases_keep_latest: 1
delete_workflows: false
delete_tags: true
gh_token: ${{ secrets.GITHUB_TOKEN }}
gh_token: ${{ secrets.BUILD_TOKEN }}
# Install Dependencies
- name: Install Dependencies
@@ -98,9 +98,15 @@ jobs:
getOffline "files/p3/configs"
getLKMs "files/p3/lkms"
getTheme "files/p1/boot/grub"
getBuildrootx "brx"
getBuildroots "brs"
getBuildrootm "brm"
if [ "${{ inputs.extended }}" = "true" ]; then
getBuildroot "ext" "brx"
fi
if [ "${{ inputs.minimal }}" = "true" ]; then
getBuildroot "min" "brs"
fi
if [ "${{ inputs.microcode }}" = "true" ]; then
getBuildroot "micro" "brm"
fi
# Export Dependencies Version to env
echo "ADDONTAG=${ADDONTAG}" >> $GITHUB_ENV
@@ -124,15 +130,13 @@ jobs:
. scripts/func.sh
# Modify Source File
ARC_BUILD="`date +'%y%m%d'`"
ARC_BUILD="$(date +'%y%m%d')"
ARC_VERSION="${{ inputs.version }}"
ARC_BRANCH="extended"
echo "${ARC_BUILD}" >files/p1/ARC-BUILD
echo "${ARC_VERSION}" >files/p1/ARC-VERSION
echo "${ARC_BRANCH}" >files/p1/ARC-BRANCH
echo "ARC_BUILD=${ARC_BUILD}" >> $GITHUB_ENV
echo "ARC_VERSION=${ARC_VERSION}" >> $GITHUB_ENV
echo "ARC_BRANCH=${ARC_BRANCH}" >> $GITHUB_ENV
for file in ARC-BUILD ARC-VERSION ARC-BRANCH; do
echo "${!file}" > "files/p1/${file}"
echo "${file}=${!file}" >> $GITHUB_ENV
done
echo "Create Arc Image"
IMAGE_FILE="arc.img"
@@ -205,15 +209,13 @@ jobs:
. scripts/func.sh
# Modify Source File
ARC_BUILD="`date +'%y%m%d'`"
ARC_BUILD="$(date +'%y%m%d')"
ARC_VERSION="${{ inputs.version }}"
ARC_BRANCH="minimal"
echo "${ARC_BUILD}" >files/p1/ARC-BUILD
echo "${ARC_VERSION}" >files/p1/ARC-VERSION
echo "${ARC_BRANCH}" >files/p1/ARC-BRANCH
echo "ARC_BUILD=${ARC_BUILD}" >> $GITHUB_ENV
echo "ARC_VERSION=${ARC_VERSION}" >> $GITHUB_ENV
echo "ARC_BRANCH=${ARC_BRANCH}" >> $GITHUB_ENV
for file in ARC-BUILD ARC-VERSION ARC-BRANCH; do
echo "${!file}" > "files/p1/${file}"
echo "${file}=${!file}" >> $GITHUB_ENV
done
echo "Create Arc Image"
IMAGE_FILE="arc.img"
@@ -286,15 +288,13 @@ jobs:
. scripts/func.sh
# Modify Source File
ARC_BUILD="`date +'%y%m%d'`"
ARC_BUILD="$(date +'%y%m%d')"
ARC_VERSION="${{ inputs.version }}"
ARC_BRANCH="microcode"
echo "${ARC_BUILD}" >files/p1/ARC-BUILD
echo "${ARC_VERSION}" >files/p1/ARC-VERSION
echo "${ARC_BRANCH}" >files/p1/ARC-BRANCH
echo "ARC_BUILD=${ARC_BUILD}" >> $GITHUB_ENV
echo "ARC_VERSION=${ARC_VERSION}" >> $GITHUB_ENV
echo "ARC_BRANCH=${ARC_BRANCH}" >> $GITHUB_ENV
for file in ARC-BUILD ARC-VERSION ARC-BRANCH; do
echo "${!file}" > "files/p1/${file}"
echo "${file}=${!file}" >> $GITHUB_ENV
done
echo "Create Arc Image"
IMAGE_FILE="arc.img"

View File

@@ -40,7 +40,7 @@ jobs:
if: success() && inputs.push == true
run: |
if [ -f "grub.img.gz" ]; then
cp -f "grub.img.gz" "files/initrd/opt/arc/grub.img.gz"
mv -f "grub.img.gz" "files/initrd/opt/arc/grub.img.gz"
echo "Git push ..."
git pull
status=$(git status -s | grep -E 'grub.img.gz' | awk '{printf " %s", $2}')

View File

@@ -7,13 +7,19 @@ tasks:
cmds:
- git reset --hard
- git pull
- ./img-ext.sh
- ./img-gen.sh ext
build-min:
cmds:
- git reset --hard
- git pull
- ./img-min.sh
- ./img-gen.sh min
build-micro:
cmds:
- git reset --hard
- git pull
- ./img-gen.sh micro
compile-kpatch:
dir: kpatch

View File

@@ -39,53 +39,41 @@ function addonSelection() {
PRODUCTVER="$(readConfigKey "productver" "${USER_CONFIG_FILE}")"
PLATFORM="$(readConfigKey "platform" "${USER_CONFIG_FILE}")"
ARCCONF="$(readConfigKey "${MODEL}.serial" "${S_FILE}")"
# read addons from user config
unset ADDONS
declare -A ADDONS
while IFS=': ' read -r KEY VALUE; do
[ -n "${KEY}" ] && ADDONS["${KEY}"]="${VALUE}"
done < <(readConfigMap "addons" "${USER_CONFIG_FILE}")
rm -f "${TMP_PATH}/opts" >/dev/null
rm -f "${TMP_PATH}/opts"
touch "${TMP_PATH}/opts"
while read -r ADDON DESC; do
arrayExistItem "${ADDON}" "${!ADDONS[@]}" && ACT="on" || ACT="off"
if [[ "${ADDON}" = "amepatch" || "${ADDON}" = "arcdns" ]] && [ -z "${ARCCONF}" ]; then
continue
elif [ "${ADDON}" = "codecpatch" ] && [ -n "${ARCCONF}" ]; then
if { [[ "${ADDON}" = "amepatch" || "${ADDON}" = "arcdns" ]] && [ -z "${ARCCONF}" ]; } || { [ "${ADDON}" = "codecpatch" ] && [ -n "${ARCCONF}" ]; }; then
continue
else
echo -e "${ADDON} \"${DESC}\" ${ACT}" >>"${TMP_PATH}/opts"
fi
done < <(availableAddons "${PLATFORM}")
if [ "${STEP}" = "addons" ]; then
dialog --backtitle "$(backtitlep)" --title "Addons" --colors --aspect 18 \
--checklist "Select Addons to include.\nAddons: \Z1System Addon\Zn | \Z4App Addon\Zn\nSelect with SPACE, Confirm with ENTER!" 0 0 0 \
--file "${TMP_PATH}/opts" 2>"${TMP_PATH}/resp"
[ $? -ne 0 ] && return 1
resp=$(cat ${TMP_PATH}/resp)
else
dialog --backtitle "$(backtitle)" --title "Addons" --colors --aspect 18 \
--checklist "Select Addons to include.\nAddons: \Z1System Addon\Zn | \Z4App Addon\Zn\nSelect with SPACE, Confirm with ENTER!" 0 0 0 \
--file "${TMP_PATH}/opts" 2>"${TMP_PATH}/resp"
[ $? -ne 0 ] && return 1
resp=$(cat ${TMP_PATH}/resp)
fi
unset ADDONS
dialog --backtitle "$(backtitle)" --title "Addons" --colors --aspect 18 \
--checklist "Select Addons to include.\nAddons: \Z1System Addon\Zn | \Z4App Addon\Zn\nSelect with SPACE, Confirm with ENTER!" 0 0 0 \
--file "${TMP_PATH}/opts" 2>"${TMP_PATH}/resp"
[ $? -ne 0 ] && return 1
resp=$(cat "${TMP_PATH}/resp")
declare -A ADDONS
writeConfigKey "addons" "{}" "${USER_CONFIG_FILE}"
for ADDON in ${resp}; do
ADDONS["${ADDON}"]=""
writeConfigKey "addons.\"${ADDON}\"" "" "${USER_CONFIG_FILE}"
done
ADDONSINFO="$(readConfigEntriesArray "addons" "${USER_CONFIG_FILE}")"
if [ "${STEP}" = "addons" ]; then
dialog --backtitle "$(backtitlep)" --title "Addons" \
--msgbox "Addons selected:\n${ADDONSINFO}" 7 70
else
dialog --backtitle "$(backtitle)" --title "Addons" \
--msgbox "Addons selected:\n${ADDONSINFO}" 7 70
fi
return
dialog --backtitle "$(backtitle)" --title "Addons" \
--msgbox "Addons selected:\n${ADDONSINFO}" 7 70
}
###############################################################################
@@ -2371,7 +2359,7 @@ function getpatfiles() {
VALID="false"
if [ ! -f "${DSM_FILE}" ] && [ "${ARCOFFLINE}" = "false" ]; then
rm -f ${USER_UP_PATH}/*.tar
dialog --backtitle "$(backtitlep)" --colors --title "DSM Boot Files" \
dialog --backtitle "$(backtitle)" --colors --title "DSM Boot Files" \
--infobox "Downloading DSM Boot Files..." 3 40
# Get new Files
DSM_URL="https://raw.githubusercontent.com/AuxXxilium/arc-dsm/main/files/${MODEL/+/%2B}/${PRODUCTVER}/${PAT_HASH}.tar"
@@ -2380,7 +2368,7 @@ function getpatfiles() {
fi
elif [ ! -f "${DSM_FILE}" ] && [ "${ARCOFFLINE}" = "true" ]; then
rm -f ${USER_UP_PATH}/*.tar
dialog --backtitle "$(backtitlep)" --colors --title "DSM Boot Files" \
dialog --backtitle "$(backtitle)" --colors --title "DSM Boot Files" \
--msgbox "Please upload the DSM Boot File to ${USER_UP_PATH}.\nUse ${IPCON}:7304 to upload and press OK after it's finished.\nLink: https://github.com/AuxXxilium/arc-dsm/blob/main/files/${MODEL}/${PRODUCTVER}/${PAT_HASH}.tar" 8 120
[ $? -ne 0 ] && VALID="false"
if [ -f "${DSM_FILE}" ]; then
@@ -2391,7 +2379,7 @@ function getpatfiles() {
fi
mkdir -p "${UNTAR_PAT_PATH}"
if [ "${VALID}" = "true" ]; then
dialog --backtitle "$(backtitlep)" --title "DSM Boot Files" --aspect 18 \
dialog --backtitle "$(backtitle)" --title "DSM Boot Files" --aspect 18 \
--infobox "Copying DSM Boot Files..." 3 40
tar -xf "${DSM_FILE}" -C "${UNTAR_PAT_PATH}" 2>/dev/null
copyDSMFiles "${UNTAR_PAT_PATH}" 2>/dev/null

View File

@@ -71,24 +71,11 @@ function backtitle() {
echo "${BACKTITLE}"
}
function backtitlep() {
[ "${STEP}" = "model" ] && BACKTITLEP="CHOOSE MODEL >>> " || BACKTITLEP="Choose Model >>> "
[ "${STEP}" = "version" ] && BACKTITLEP+="CHOOSE VERSION >>> " || BACKTITLEP+="Choose Version >>> "
[ "${STEP}" = "snmac" ] && BACKTITLEP+="SET SN/MAC >>> " || BACKTITLEP+="Set SN/Mac >>> "
[ "${STEP}" = "network" ] && BACKTITLEP+="SET NETWORK >>> " || BACKTITLEP+="Set Network >>> "
[ "${STEP}" = "storagemap" ] && BACKTITLEP+="SET STORAGEMAP >>> " || BACKTITLEP+="Set StorageMap >>> "
[ "${STEP}" = "addons" ] && BACKTITLEP+="SET ADDONS >>> " || BACKTITLEP+="Set Addons >>> "
[ "${STEP}" = "build" ] && BACKTITLEP+="BUILD LOADER >>> " || BACKTITLEP+="Build Loader >>> "
[ "${STEP}" = "boot" ] && BACKTITLEP+="BOOT DSM" || BACKTITLEP+="Boot DSM"
echo "${BACKTITLEP}"
}
###############################################################################
# Model Selection
function arcModel() {
STEP="model"
[ "${ARCOFFLINE}" != "true" ] && checkHardwareID || true
dialog --backtitle "$(backtitlep)" --title "Model" \
dialog --backtitle "$(backtitle)" --title "Model" \
--infobox "Reading Models..." 3 25
ARCCONF="$(readConfigKey "${MODEL:-SA6400}.serial" "${S_FILE}")"
# Loop menu
@@ -165,7 +152,7 @@ function arcModel() {
ARCCONF="$(readConfigKey "${MODEL:-SA6400}.serial" "${S_FILE}")"
[ -n "${ARCCONF}" ] && MSG="Supported Models for your Hardware (x = supported / + = need Addons)\n$(printf "\Zb%-16s\Zn \Zb%-15s\Zn \Zb%-5s\Zn \Zb%-5s\Zn \Zb%-5s\Zn \Zb%-5s\Zn \Zb%-10s\Zn \Zb%-12s\Zn \Zb%-10s\Zn \Zb%-10s\Zn" "Model" "Platform" "DT" "Arc" "iGPU" "HBA" "M.2 Cache" "M.2 Volume" "USB Mount" "Source")" || MSG="Supported Models for your Hardware (x = supported / + = need Addons) | Syno Models can have faulty Values.\n$(printf "\Zb%-16s\Zn \Zb%-15s\Zn \Zb%-5s\Zn \Zb%-5s\Zn \Zb%-5s\Zn \Zb%-10s\Zn \Zb%-12s\Zn \Zb%-10s\Zn \Zb%-10s\Zn" "Model" "Platform" "DT" "iGPU" "HBA" "M.2 Cache" "M.2 Volume" "USB Mount" "Source")"
[ -n "${ARCCONF}" ] && TITLEMSG="Arc Model" || TITLEMSG="Model"
dialog --backtitle "$(backtitlep)" --title "${TITLEMSG}" --colors \
dialog --backtitle "$(backtitle)" --title "${TITLEMSG}" --colors \
--cancel-label "Show all" --help-button --help-label "Exit" \
--extra-button --extra-label "Info" \
--menu "${MSG}" 0 115 0 \
@@ -183,7 +170,7 @@ function arcModel() {
3)
resp=$(cat ${TMP_PATH}/resp)
PLATFORM="$(grep -w "${resp}" "${TMP_PATH}/modellist" | awk '{print $2}' | head -n 1)"
dialog --backtitle "$(backtitlep)" --colors \
dialog --backtitle "$(backtitle)" --colors \
--title "Platform Info" --textbox "./informations/${PLATFORM}.yml" 70 80
;;
*)
@@ -233,7 +220,6 @@ function arcModel() {
###############################################################################
# Arc Version Section
function arcVersion() {
STEP="version"
# Read Model Config
MODEL="$(readConfigKey "model" "${USER_CONFIG_FILE}")"
PLATFORM="$(readConfigKey "platform" "${USER_CONFIG_FILE}")"
@@ -246,7 +232,7 @@ function arcVersion() {
if [ "${ARCMODE}" = "config" ] && [ "${ARCRESTORE}" != "true" ]; then
# Select Build for DSM
ITEMS="$(readConfigEntriesArray "platforms.${PLATFORM}.productvers" "${P_FILE}" | sort -r)"
dialog --clear --no-items --nocancel --title "DSM Version" --backtitle "$(backtitlep)" \
dialog --clear --no-items --nocancel --title "DSM Version" --backtitle "$(backtitle)" \
--no-items --menu "Select DSM Version" 7 30 0 ${ITEMS} \
2>"${TMP_PATH}/resp"
[ $? -ne 0 ] && return
@@ -263,7 +249,7 @@ function arcVersion() {
writeConfigKey "smallnum" "" "${USER_CONFIG_FILE}"
writeConfigKey "zimage-hash" "" "${USER_CONFIG_FILE}"
fi
dialog --backtitle "$(backtitlep)" --title "Version" \
dialog --backtitle "$(backtitle)" --title "Version" \
--infobox "Reading DSM Build..." 3 25
PAT_URL=""
PAT_HASH=""
@@ -280,7 +266,7 @@ function arcVersion() {
PREV="${V}"
done < <(echo "${PVS}")
DSMPVS="$(cat ${TMP_PATH}/versions)"
dialog --backtitle "$(backtitlep)" --colors --title "DSM Build" \
dialog --backtitle "$(backtitle)" --colors --title "DSM Build" \
--no-items --menu "Select DSM Build" 0 0 0 ${DSMPVS} \
2>${TMP_PATH}/resp
RET=$?
@@ -299,7 +285,7 @@ function arcVersion() {
MSG="Failed to get PAT Data.\n"
MSG+="Please manually fill in the URL and Hash of PAT.\n"
MSG+="You will find these Data at: https://github.com/AuxXxilium/arc-dsm/blob/main/webdata.txt"
dialog --backtitle "$(backtitlep)" --colors --title "Arc Build" --default-button "OK" \
dialog --backtitle "$(backtitle)" --colors --title "Arc Build" --default-button "OK" \
--form "${MSG}" 11 120 2 "Url" 1 1 "${PAT_URL}" 1 8 110 0 "Hash" 2 1 "${PAT_HASH}" 2 8 110 0 \
2>"${TMP_PATH}/resp"
RET=$?
@@ -318,7 +304,7 @@ function arcVersion() {
fi
if [ "${ONLYVERSION}" != "true" ]; then
MSG="Do you want to try Automated Mode?\nIf yes, Loader will configure, build and boot DSM."
dialog --backtitle "$(backtitlep)" --colors --title "Automated Mode" \
dialog --backtitle "$(backtitle)" --colors --title "Automated Mode" \
--yesno "${MSG}" 6 55
if [ $? -eq 0 ]; then
writeConfigKey "arc.mode" "automated" "${USER_CONFIG_FILE}"
@@ -332,7 +318,7 @@ function arcVersion() {
fi
# Change Config if Files are valid
if [ "${VALID}" = "true" ]; then
dialog --backtitle "$(backtitlep)" --title "Arc Config" \
dialog --backtitle "$(backtitle)" --title "Arc Config" \
--infobox "Reconfiguring Addons, Cmdline, Modules and Synoinfo" 3 60
# Reset Synoinfo
writeConfigKey "synoinfo" "{}" "${USER_CONFIG_FILE}"
@@ -400,7 +386,7 @@ function arcVersion() {
arcPatch
fi
else
dialog --backtitle "$(backtitlep)" --title "Arc Config" --aspect 18 \
dialog --backtitle "$(backtitle)" --title "Arc Config" --aspect 18 \
--infobox "Arc Config failed!\nExit." 4 40
writeConfigKey "arc.confdone" "false" "${USER_CONFIG_FILE}"
CONFDONE="$(readConfigKey "arc.confdone" "${USER_CONFIG_FILE}")"
@@ -412,7 +398,6 @@ function arcVersion() {
###############################################################################
# Arc Patch Section
function arcPatch() {
STEP="snmac"
# Read Model Values
PLATFORM="$(readConfigKey "platform" "${USER_CONFIG_FILE}")"
MODEL="$(readConfigKey "model" "${USER_CONFIG_FILE}")"
@@ -426,7 +411,7 @@ function arcPatch() {
fi
elif [ "${ARCMODE}" = "config" ]; then
if [ -n "${ARCCONF}" ]; then
dialog --clear --backtitle "$(backtitlep)" \
dialog --clear --backtitle "$(backtitle)" \
--nocancel --title "SN/Mac Options" \
--menu "Choose an Option" 7 60 0 \
1 "Use Arc Patch (AME, QC, Push Notify and more)" \
@@ -434,7 +419,7 @@ function arcPatch() {
3 "Use my own SN/Mac (Be sure your Data is valid)" \
2>"${TMP_PATH}/resp"
else
dialog --clear --backtitle "$(backtitlep)" \
dialog --clear --backtitle "$(backtitle)" \
--nocancel --title "SN/Mac Options" \
--menu "Choose an Option" 7 60 0 \
2 "Use random SN/Mac (Reduced DSM Features)" \
@@ -454,7 +439,7 @@ function arcPatch() {
;;
3)
while true; do
dialog --backtitle "$(backtitlep)" --colors --title "Serial" \
dialog --backtitle "$(backtitle)" --colors --title "Serial" \
--inputbox "Please enter a valid SN!" 7 50 "" \
2>"${TMP_PATH}/resp"
[ $? -ne 0 ] && break 2
@@ -475,7 +460,6 @@ function arcPatch() {
###############################################################################
# Arc Settings Section
function arcSettings() {
STEP="build"
MODEL="$(readConfigKey "model" "${USER_CONFIG_FILE}")"
PRODUCTVER="$(readConfigKey "productver" "${USER_CONFIG_FILE}")"
PLATFORM="$(readConfigKey "platform" "${USER_CONFIG_FILE}")"
@@ -483,12 +467,10 @@ function arcSettings() {
PAT_URL="$(readConfigKey "paturl" "${USER_CONFIG_FILE}")"
PAT_HASH="$(readConfigKey "pathash" "${USER_CONFIG_FILE}")"
DT="$(readConfigKey "platforms.${PLATFORM}.dt" "${P_FILE}")"
ARCPATCH="$(readConfigKey "arc.patch" "${USER_CONFIG_FILE}")"
# Network Config for Loader
if [ "${ARCMODE}" = "config" ]; then
STEP="network"
dialog --backtitle "$(backtitlep)" --colors --title "Network Config" \
dialog --backtitle "$(backtitle)" --colors --title "Network Config" \
--infobox "Generating Network Config..." 3 40
sleep 2
getnet || return
@@ -502,8 +484,7 @@ function arcSettings() {
# Select Portmap for Loader
if [ "${DT}" = "false" ] && [ ${SATADRIVES} -gt 0 ]; then
STEP="storagemap"
dialog --backtitle "$(backtitlep)" --colors --title "Storage Map" \
dialog --backtitle "$(backtitle)" --colors --title "Storage Map" \
--infobox "Generating Storage Map..." 3 40
sleep 2
getmapSelection || return
@@ -511,8 +492,7 @@ function arcSettings() {
# Select Addons
if [ "${ARCMODE}" = "config" ]; then
STEP="addons"
dialog --backtitle "$(backtitlep)" --colors --title "Addons" \
dialog --backtitle "$(backtitle)" --colors --title "Addons" \
--infobox "Loading Addons Table..." 3 40
addonSelection || return
fi
@@ -520,7 +500,7 @@ function arcSettings() {
# CPU Frequency Scaling & Governor
if readConfigMap "addons" "${USER_CONFIG_FILE}" | grep -q "cpufreqscaling"; then
if [ "${ARCMODE}" = "config" ] && [ "${MACHINE}" = "Native" ]; then
dialog --backtitle "$(backtitlep)" --colors --title "CPU Frequency Scaling" \
dialog --backtitle "$(backtitle)" --colors --title "CPU Frequency Scaling" \
--infobox "Generating Governor Table..." 3 40
governorSelection || return
elif [ "${ARCMODE}" = "automated" ] && [ "${MACHINE}" = "Native" ]; then
@@ -534,13 +514,13 @@ function arcSettings() {
# Warnings and Checks
if [ "${ARCMODE}" = "config" ]; then
[ "${DT}" = "true" ] && [ "${EXTERNALCONTROLLER}" = "true" ] && dialog --backtitle "$(backtitlep)" --title "Arc Warning" --msgbox "WARN: You use a HBA/Raid Controller and selected a DT Model.\nThis is still an experimental." 6 70
[ "${DT}" = "true" ] && [ "${EXTERNALCONTROLLER}" = "true" ] && dialog --backtitle "$(backtitle)" --title "Arc Warning" --msgbox "WARN: You use a HBA/Raid Controller and selected a DT Model.\nThis is still an experimental." 6 70
DEVICENIC="$(readConfigKey "device.nic" "${USER_CONFIG_FILE}")"
MODELNIC="$(readConfigKey "${MODEL}.ports" "${S_FILE}" 2>/dev/null)"
[ ${DEVICENIC} -gt 8 ] && dialog --backtitle "$(backtitlep)" --title "Arc Warning" --msgbox "WARN: You have more NIC (${DEVICENIC}) than 8 NIC.\nOnly 8 supported by DSM." 6 60
[ ${DEVICENIC} -gt ${MODELNIC} ] && [ "${ARCPATCH}" = "true" ] && dialog --backtitle "$(backtitlep)" --title "Arc Warning" --msgbox "WARN: You have more NIC (${DEVICENIC}) than supported by Model (${MODELNIC}).\nOnly the first ${MODELNIC} are used by Arc Patch." 6 80
[ "${AESSYS}" = "false" ] && dialog --backtitle "$(backtitlep)" --title "Arc Warning" --msgbox "WARN: Your System doesn't support Hardware encryption in DSM. (AES)" 5 70
[[ "${CPUFREQ}" = "false" || "${ACPISYS}" = "false" ]] && readConfigMap "addons" "${USER_CONFIG_FILE}" | grep -q "cpufreqscaling" && dialog --backtitle "$(backtitlep)" --title "Arc Warning" --msgbox "WARN: It is possible that CPU Frequency Scaling is not working properly with your System." 6 80
[ ${DEVICENIC} -gt 8 ] && dialog --backtitle "$(backtitle)" --title "Arc Warning" --msgbox "WARN: You have more NIC (${DEVICENIC}) than 8 NIC.\nOnly 8 supported by DSM." 6 60
[ ${DEVICENIC} -gt ${MODELNIC} ] && [ "${ARCPATCH}" = "true" ] && dialog --backtitle "$(backtitle)" --title "Arc Warning" --msgbox "WARN: You have more NIC (${DEVICENIC}) than supported by Model (${MODELNIC}).\nOnly the first ${MODELNIC} are used by Arc Patch." 6 80
[ "${AESSYS}" = "false" ] && dialog --backtitle "$(backtitle)" --title "Arc Warning" --msgbox "WARN: Your System doesn't support Hardware encryption in DSM. (AES)" 5 70
[[ "${CPUFREQ}" = "false" || "${ACPISYS}" = "false" ]] && readConfigMap "addons" "${USER_CONFIG_FILE}" | grep -q "cpufreqscaling" && dialog --backtitle "$(backtitle)" --title "Arc Warning" --msgbox "WARN: It is possible that CPU Frequency Scaling is not working properly with your System." 6 80
fi
# eMMC Boot Support
@@ -556,8 +536,9 @@ function arcSettings() {
# Final Config Check
if [ -n "${PLATFORM}" ] && [ -n "${MODEL}" ] && [ -n "${KVER}" ] && [ -n "${PAT_URL}" ] && [ -n "${PAT_HASH}" ]; then
writeConfigKey "arc.confdone" "true" "${USER_CONFIG_FILE}"
CONFDONE="$(readConfigKey "arc.confdone" "${USER_CONFIG_FILE}")"
if [ "${ARCMODE}" = "config" ]; then
dialog --clear --backtitle "$(backtitlep)" --title "Config done" \
dialog --clear --backtitle "$(backtitle)" --title "Config done" \
--no-cancel --menu "Build now?" 7 40 0 \
1 "Yes - Build Arc Loader now" \
2 "No - I want to make changes" \
@@ -577,7 +558,6 @@ function arcSettings() {
###############################################################################
# Show Summary of Config
function arcSummary() {
STEP="build"
MODEL="$(readConfigKey "model" "${USER_CONFIG_FILE}")"
PRODUCTVER="$(readConfigKey "productver" "${USER_CONFIG_FILE}")"
PLATFORM="$(readConfigKey "platform" "${USER_CONFIG_FILE}")"
@@ -642,7 +622,7 @@ function arcSummary() {
SUMMARY+="\n>> Additional Controller: \Zb${EXTERNALCONTROLLER}\Zn"
SUMMARY+="\n"
dialog --backtitle "$(backtitlep)" --colors --title "Config Summary" \
dialog --backtitle "$(backtitle)" --colors --title "Config Summary" \
--extra-button --extra-label "Cancel" --msgbox "${SUMMARY}" 0 0
RET=$?
@@ -659,7 +639,6 @@ function arcSummary() {
###############################################################################
# Building Loader
function make() {
STEP="build"
# Read Model Config
MODEL="$(readConfigKey "model" "${USER_CONFIG_FILE}")"
PLATFORM="$(readConfigKey "platform" "${USER_CONFIG_FILE}")"
@@ -693,7 +672,7 @@ function make() {
(
livepatch
sleep 3
) 2>&1 | dialog --backtitle "$(backtitlep)" --colors --title "Build Loader" \
) 2>&1 | dialog --backtitle "$(backtitle)" --colors --title "Build Loader" \
--progressbox "Patching DSM Files..." 20 70
else
dialog --backtitle "$(backtitle)" --title "Build Loader" --aspect 18 \
@@ -723,7 +702,6 @@ function make() {
###############################################################################
# Finish Building Loader
function arcFinish() {
STEP="boot"
rm -f "${LOG_FILE}" >/dev/null 2>&1 || true
MODELID="$(readConfigKey "modelid" "${USER_CONFIG_FILE}")"

View File

@@ -1,46 +1,29 @@
# Get PortMap for Loader
function detect_drives() {
local pci_id=$1
local drive_var=$2
local class_path=$3
local grep_pattern=$4
local sed_pattern=$5
eval "${drive_var}=0"
if [ $(lspci -d ::${pci_id} 2>/dev/null | wc -l) -gt 0 ]; then
for PCI in $(lspci -d ::${pci_id} 2>/dev/null | awk '{print $1}'); do
PORT=$(ls -l ${class_path} | grep "${PCI}" | awk -F'/' '{print $NF}' | sed "${sed_pattern}" | sort -n 2>/dev/null)
PORTNUM=$(lsscsi -b | grep -v - | grep "${grep_pattern}${PORT}:" | wc -l)
eval "${drive_var}=\$((\${${drive_var}} + \${PORTNUM}))"
done
fi
}
function show_dialog() {
dialog --backtitle "$(backtitle)" --title "Sata Portmap" \
--menu "Choose a Portmap for Sata!?\n* Recommended Option" 8 60 0 \
1 "DiskIdxMap: Active Ports ${REMAP1}" \
2 "DiskIdxMap: Max Ports ${REMAP2}" \
3 "SataRemap: Remove empty Ports ${REMAP3}" \
4 "AhciRemap: Remove empty Ports (new) ${REMAP4}" \
5 "Set my own Portmap in Config" \
2>"${TMP_PATH}/resp"
[ $? -ne 0 ] && return 1
resp=$(cat "${TMP_PATH}/resp")
[ -z "${resp}" ] && return 1
}
function set_remap() {
case ${resp} in
1) writeConfigKey "arc.remap" "acports" "${USER_CONFIG_FILE}" ;;
2) writeConfigKey "arc.remap" "maxports" "${USER_CONFIG_FILE}" ;;
3) writeConfigKey "arc.remap" "remap" "${USER_CONFIG_FILE}" ;;
4) writeConfigKey "arc.remap" "ahci" "${USER_CONFIG_FILE}" ;;
5) writeConfigKey "arc.remap" "user" "${USER_CONFIG_FILE}" ;;
esac
}
function getmap() {
function show_dialog() {
dialog --backtitle "$(backtitle)" --title "Sata Portmap" \
--menu "Choose a Portmap for Sata!?\n* Recommended Option" 8 60 0 \
1 "DiskIdxMap: Active Ports ${REMAP1}" \
2 "DiskIdxMap: Max Ports ${REMAP2}" \
3 "SataRemap: Remove empty Ports ${REMAP3}" \
4 "AhciRemap: Remove empty Ports (new) ${REMAP4}" \
5 "Set my own Portmap in Config" \
2>"${TMP_PATH}/resp"
[ $? -ne 0 ] && return 1
resp=$(cat "${TMP_PATH}/resp")
[ -z "${resp}" ] && return 1
}
function set_remap() {
case ${resp} in
1) writeConfigKey "arc.remap" "acports" "${USER_CONFIG_FILE}" ;;
2) writeConfigKey "arc.remap" "maxports" "${USER_CONFIG_FILE}" ;;
3) writeConfigKey "arc.remap" "remap" "${USER_CONFIG_FILE}" ;;
4) writeConfigKey "arc.remap" "ahci" "${USER_CONFIG_FILE}" ;;
5) writeConfigKey "arc.remap" "user" "${USER_CONFIG_FILE}" ;;
esac
}
# Sata Disks
SATADRIVES=0
if [ $(lspci -d ::106 2>/dev/null | wc -l) -gt 0 ]; then
@@ -48,34 +31,34 @@ function getmap() {
for file in drivesmax drivescon ports remap; do
> "${TMP_PATH}/${file}"
done
DISKIDXMAPIDX=0
DISKIDXMAP=""
DISKIDXMAPIDXMAX=0
DISKIDXMAPMAX=""
for PCI in $(lspci -d ::106 2>/dev/null | awk '{print $1}'); do
NUMPORTS=0
CONPORTS=0
declare -A HOSTPORTS
while read -r LINE; do
PORT=$(echo ${LINE} | grep -o 'ata[0-9]*' | sed 's/ata//')
HOSTPORTS[${PORT}]=$(echo ${LINE} | grep -o 'host[0-9]*$')
done < <(ls -l /sys/class/scsi_host | grep -F "${PCI}")
for PORT in $(echo ${!HOSTPORTS[@]} | tr ' ' '\n' | sort -n); do
ATTACH=$(ls -l /sys/block | grep -F -q "${PCI}/ata${PORT}" && echo 1 || echo 0)
PCMD=$(cat /sys/class/scsi_host/${HOSTPORTS[${PORT}]}/ahci_port_cmd)
DUMMY=$([ ${PCMD} = 0 ] && echo 1 || echo 0)
[ ${ATTACH} = 1 ] && CONPORTS=$((CONPORTS + 1)) && echo $((PORT - 1)) >>"${TMP_PATH}/ports"
NUMPORTS=$((NUMPORTS + 1))
done
NUMPORTS=$((NUMPORTS > 8 ? 8 : NUMPORTS))
CONPORTS=$((CONPORTS > 8 ? 8 : CONPORTS))
echo -n "${NUMPORTS}" >>"${TMP_PATH}/drivesmax"
echo -n "${CONPORTS}" >>"${TMP_PATH}/drivescon"
DISKIDXMAP+=$(printf "%02x" $DISKIDXMAPIDX)
@@ -87,16 +70,44 @@ function getmap() {
fi
# SAS Disks
detect_drives "107" "SASDRIVES" "/sys/class/scsi_host" "\[${PORT}:" "s/host//"
SASDRIVES=0
if [ $(lspci -d ::107 2>/dev/null | wc -l) -gt 0 ]; then
for PCI in $(lspci -d ::107 2>/dev/null | awk '{print $1}'); do
PORT=$(ls -l /sys/class/scsi_host | grep "${PCI}" | awk -F'/' '{print $NF}' | sed 's/host//' | sort -n 2>/dev/null)
PORTNUM=$(lsscsi -b | grep -v - | grep "\[${PORT}:" | wc -l)
SASDRIVES=$((SASDRIVES + PORTNUM))
done
fi
# SCSI Disks
detect_drives "100" "SCSIDRIVES" "/sys/class/scsi_host" "\[${PORT}:" "s/host//"
SCSIDRIVES=0
if [ $(lspci -d ::100 2>/dev/null | wc -l) -gt 0 ]; then
for PCI in $(lspci -d ::100 2>/dev/null | awk '{print $1}'); do
PORT=$(ls -l /sys/class/scsi_host | grep "${PCI}" | awk -F'/' '{print $NF}' | sed 's/host//' | sort -n 2>/dev/null)
PORTNUM=$(lsscsi -b | grep -v - | grep "\[${PORT}:" | wc -l)
SCSIDRIVES=$((SCSIDRIVES + PORTNUM))
done
fi
# Raid Disks
detect_drives "104" "RAIDDRIVES" "/sys/class/scsi_host" "\[${PORT}:" "s/host//"
RAIDDRIVES=0
if [ $(lspci -d ::104 2>/dev/null | wc -l) -gt 0 ]; then
for PCI in $(lspci -d ::104 2>/dev/null | awk '{print $1}'); do
PORT=$(ls -l /sys/class/scsi_host | grep "${PCI}" | awk -F'/' '{print $NF}' | sed 's/host//' | sort -n 2>/dev/null)
PORTNUM=$(lsscsi -b | grep -v - | grep "\[${PORT}:" | wc -l)
RAIDDRIVES=$((RAIDDRIVES + PORTNUM))
done
fi
# NVMe Disks
detect_drives "108" "NVMEDRIVES" "/sys/class/nvme" "\[N:${PORT}:" "s/nvme//"
NVMEDRIVES=0
if [ $(ls -l /sys/class/nvme 2>/dev/null | wc -l) -gt 0 ]; then
for PCI in $(lspci -d ::108 2>/dev/null | awk '{print $1}'); do
PORTNUM=$(ls -l /sys/class/nvme | grep "${PCI}" | wc -l 2>/dev/null)
[ ${PORTNUM} -eq 0 ] && continue
NVMEDRIVES=$((NVMEDRIVES + PORTNUM))
done
fi
# USB Disks
USBDRIVES=0
@@ -167,13 +178,8 @@ function getmapSelection() {
REMAP1="*"
fi
if [ "${STEP}" = "storagemap" ]; then
show_dialog
set_remap
else
show_dialog
set_remap
fi
show_dialog
set_remap
else
# Show recommended Option to user
if [ -n "${SATAREMAP}" ] && [ "${EXTERNALCONTROLLER}" = "true" ] && [ "${MACHINE}" = "Native" ]; then

View File

@@ -46,21 +46,19 @@ PAT_HASH="$(readConfigKey "pathash" "${USER_CONFIG_FILE}")"
# Check if DSM Version changed
. "${RAMDISK_PATH}/etc/VERSION"
if [[ -n "${PRODUCTVER}" && -n "${BUILDNUM}" && -n "${SMALLNUM}" ]] &&
([[ "${PRODUCTVER}" != "${majorversion}.${minorversion}" ]] || [[ "${BUILDNUM}" != "${buildnumber}" ]] || [[ "${SMALLNUM}" != "${smallfixnumber}" ]]); then
if [[ -n "${BUILDNUM}" && ("${PRODUCTVER}" != "${majorversion}.${minorversion}" || "${BUILDNUM}" != "${buildnumber}" || "${SMALLNUM}" != "${smallfixnumber}") ]]; then
OLDVER="${PRODUCTVER}(${BUILDNUM}$([[ ${SMALLNUM:-0} -ne 0 ]] && echo "u${SMALLNUM}"))"
NEWVER="${majorversion}.${minorversion}(${buildnumber}$([[ ${smallfixnumber:-0} -ne 0 ]] && echo "u${smallfixnumber}"))"
PAT_URL=""
PAT_HASH=""
echo "Version changed from ${OLDVER} to ${NEWVER}"
echo "\nVersion changed from ${OLDVER} to ${NEWVER}"
fi
[ "${PATURL:0:1}" = "#" ] && PATURL=""
[ "${PATSUM:0:1}" = "#" ] && PATSUM=""
# Re-read PAT_URL and PAT_HASH if they are empty
if [ -z "${PAT_URL}" ] || [ -z "${PAT_HASH}" ]; then
# Re-read PAT_URL and PAT_HASH if they are empty or commented out
if [[ -z "${PAT_URL}" || "${PAT_URL:0:1}" == "#" ]]; then
PAT_URL="$(readConfigKey "${PLATFORM}.\"${MODEL}\".\"${majorversion}.${minorversion}\".url" "${D_FILE}")"
fi
if [[ -z "${PAT_HASH}" || "${PAT_HASH:0:1}" == "#" ]]; then
PAT_HASH="$(readConfigKey "${PLATFORM}.\"${MODEL}\".\"${majorversion}.${minorversion}\".hash" "${D_FILE}")"
fi
@@ -120,14 +118,18 @@ for PATCH in "${PATCHES[@]}"; do
done
# Add serial number to synoinfo.conf, to help to recover an installed DSM
echo "Set synoinfo SN" >>"${LOG_FILE}"
_set_conf_kv "SN" "${SN}" "${RAMDISK_PATH}/etc/synoinfo.conf" >>"${LOG_FILE}" 2>&1 || exit 1
_set_conf_kv "SN" "${SN}" "${RAMDISK_PATH}/etc.defaults/synoinfo.conf" >>"${LOG_FILE}" 2>&1 || exit 1
{
echo "Set synoinfo SN"
_set_conf_kv "SN" "${SN}" "${RAMDISK_PATH}/etc/synoinfo.conf" || exit 1
_set_conf_kv "SN" "${SN}" "${RAMDISK_PATH}/etc.defaults/synoinfo.conf" || exit 1
} >>"${LOG_FILE}" 2>&1
for KEY in "${!SYNOINFO[@]}"; do
echo "Set synoinfo ${KEY}" >>"${LOG_FILE}"
_set_conf_kv "${KEY}" "${SYNOINFO[${KEY}]}" "${RAMDISK_PATH}/etc/synoinfo.conf" >>"${LOG_FILE}" 2>&1 || exit 1
_set_conf_kv "${KEY}" "${SYNOINFO[${KEY}]}" "${RAMDISK_PATH}/etc.defaults/synoinfo.conf" >>"${LOG_FILE}" 2>&1 || exit 1
{
echo "Set synoinfo ${KEY}"
_set_conf_kv "${KEY}" "${SYNOINFO[${KEY}]}" "${RAMDISK_PATH}/etc/synoinfo.conf" || exit 1
_set_conf_kv "${KEY}" "${SYNOINFO[${KEY}]}" "${RAMDISK_PATH}/etc.defaults/synoinfo.conf" || exit 1
} >>"${LOG_FILE}" 2>&1
done
# Patch /sbin/init.post

View File

@@ -27,8 +27,12 @@ getCustom "files/p3/custom"
getLKMs "files/p3/lkms"
getTheme "files/p1/boot/grub"
getOffline "files/p3/configs"
mkdir -p "brx"
[ ! -f "../brx/bzImage" ] && getBuildrootx "brx" || copyBuildroot "brx"
case "${1}" in
min) getBuildroot "${1}" "br" ;;
ext) getBuildroot "${1}" "br" ;;
micro) getBuildroot "${1}" "br" ;;
*) echo "Invalid option specified" ;;
esac
# Sbase
IMAGE_FILE="arc.img"
@@ -46,17 +50,18 @@ mkdir -p "/tmp/p3"
sudo mount ${LOOPX}p1 "/tmp/p1"
sudo mount ${LOOPX}p3 "/tmp/p3"
ARC_BUILD="`date +'%y%m%d'`"
ARC_BUILD="$(date +'%y%m%d')"
ARC_VERSION="13.3.7"
ARC_BRANCH="extended"
echo "${ARC_BUILD}" >files/p1/ARC-BUILD
echo "${ARC_VERSION}" >files/p1/ARC-VERSION
echo "${ARC_BRANCH}" >files/p1/ARC-BRANCH
ARC_BRANCH="dev"
for file in ARC_BUILD ARC_VERSION ARC_BRANCH; do
echo "${!file}" > "files/p1/${file}"
done
echo "Repack initrd"
if [ -f "brx/bzImage-arc" ] && [ -f "brx/initrd-arc" ]; then
cp -f "brx/bzImage-arc" "files/p3/bzImage-arc"
repackInitrd "brx/initrd-arc" "files/initrd" "files/p3/initrd-arc"
if [ -f "br/bzImage-arc" ] && [ -f "br/initrd-arc" ]; then
cp -f "br/bzImage-arc" "files/p3/bzImage-arc"
repackInitrd "br/initrd-arc" "files/initrd" "files/p3/initrd-arc"
else
exit 1
fi
@@ -74,5 +79,4 @@ sudo rm -rf "/tmp/p3"
sudo losetup --detach ${LOOPX}
IMAGE_FILE="arc.img"
qemu-img convert -p -f raw -o subformat=monolithicFlat -O vmdk ${IMAGE_FILE} arc.vmdk

View File

@@ -1,77 +0,0 @@
#!/usr/bin/env bash
#
# Copyright (C) 2025 AuxXxilium <https://github.com/AuxXxilium>
#
# This is free software, licensed under the MIT License.
# See /LICENSE for more information.
#
set -e
# Clean cached Files
sudo git clean -fdx
. scripts/func.sh "${AUX_TOKEN}"
# Unmount Image File
sudo umount "/tmp/p1" 2>/dev/null || true
sudo umount "/tmp/p3" 2>/dev/null || true
# Get extractor, LKM, addons and Modules
echo "Get Dependencies"
getAddons "files/p3/addons"
getModules "files/p3/modules"
getConfigs "files/p3/configs"
getPatches "files/p3/patches"
getCustom "files/p3/custom"
getLKMs "files/p3/lkms"
getTheme "files/p1/boot/grub"
getOffline "files/p3/configs"
[ -f "../brs/bzImage" ] && copyBuildroot "brs" || getBuildroots "brs"
# Sbase
IMAGE_FILE="arc.img"
gzip -dc "files/initrd/opt/arc/grub.img.gz" >"${IMAGE_FILE}"
fdisk -l "${IMAGE_FILE}"
LOOPX=$(sudo losetup -f)
sudo losetup -P "${LOOPX}" "${IMAGE_FILE}"
echo "Mounting Image File"
sudo rm -rf "/tmp/p1"
sudo rm -rf "/tmp/p3"
mkdir -p "/tmp/p1"
mkdir -p "/tmp/p3"
sudo mount ${LOOPX}p1 "/tmp/p1"
sudo mount ${LOOPX}p3 "/tmp/p3"
ARC_BUILD="`date +'%y%m%d'`"
ARC_VERSION="13.3.7"
ARC_BRANCH="minimal"
echo "${ARC_BUILD}" >files/p1/ARC-BUILD
echo "${ARC_VERSION}" >files/p1/ARC-VERSION
echo "${ARC_BRANCH}" >files/p1/ARC-BRANCH
echo "Repack initrd"
if [ -f "brs/bzImage-arc" ] && [ -f "brs/initrd-arc" ]; then
cp -f "brs/bzImage-arc" "files/p3/bzImage-arc"
repackInitrd "brs/initrd-arc" "files/initrd" "files/p3/initrd-arc"
else
exit 1
fi
echo "Copying files"
sudo cp -rf "files/p1/"* "/tmp/p1"
sudo cp -rf "files/p3/"* "/tmp/p3"
sync
echo "Unmount image file"
sudo umount "/tmp/p1"
sudo umount "/tmp/p3"
sudo rm -rf "/tmp/p1"
sudo rm -rf "/tmp/p3"
sudo losetup --detach ${LOOPX}
IMAGE_FILE="arc.img"
qemu-img convert -p -f raw -o subformat=monolithicFlat -O vmdk ${IMAGE_FILE} arc.vmdk

View File

@@ -185,73 +185,51 @@ function getTheme() {
done < <(curl -skL -H "Authorization: token ${TOKEN}" "https://api.github.com/repos/AuxXxilium/arc-theme/releases/tags/${TAG}" | jq -r '.assets[] | "\(.id) \(.name)"')
}
# Get latest Buildroot-X
# $1 path
function getBuildrootx() {
echo "Getting Buildroot-X begin"
local DEST_PATH="${1}"
# Get latest Buildroot
# $1 type (min for S, ext for X, micro for M)
# $2 path
function getBuildroot() {
local TYPE="${1}"
local DEST_PATH="${2}"
local REPO=""
local ZIP_NAME=""
local TAG_VAR=""
TAG=$(curl -skL -H "Authorization: token ${TOKEN}" "https://api.github.com/repos/AuxXxilium/arc-buildroot-x/releases" | jq -r ".[].tag_name" | sort -rV | head -1)
export BRXTAG="${TAG}"
case "${TYPE}" in
min)
REPO="arc-buildroot-s"
TAG_VAR="BRSTAG"
;;
ext)
REPO="arc-buildroot-x"
TAG_VAR="BRXTAG"
;;
micro)
REPO="arc-buildroot-m"
TAG_VAR="BRMTAG"
;;
*)
echo "Invalid type specified"
return 1
;;
esac
echo "Getting Buildroot-${TYPE} begin"
TAG=$(curl -skL -H "Authorization: token ${TOKEN}" "https://api.github.com/repos/AuxXxilium/${REPO}/releases" | jq -r ".[].tag_name" | sort -rV | head -1)
export ${TAG_VAR}="${TAG}"
[ ! -d "${DEST_PATH}" ] && mkdir -p "${DEST_PATH}"
rm -f "${DEST_PATH}/bzImage-arc"
rm -f "${DEST_PATH}/initrd-arc"
while read -r ID NAME; do
if [ "${NAME}" = "buildroot-${TAG}.zip" ]; then
curl -kL -H "Authorization: token ${TOKEN}" -H "Accept: application/octet-stream" "https://api.github.com/repos/AuxXxilium/arc-buildroot-x/releases/assets/${ID}" -o "${DEST_PATH}/brx.zip"
echo "Buildroot-X: ${TAG}"
unzip -o "${DEST_PATH}/brx.zip" -d "${DEST_PATH}"
curl -kL -H "Authorization: token ${TOKEN}" -H "Accept: application/octet-stream" "https://api.github.com/repos/AuxXxilium/${REPO}/releases/assets/${ID}" -o "${DEST_PATH}/br.zip"
echo "Buildroot-${TYPE}: ${TAG}"
unzip -o "${DEST_PATH}/br.zip" -d "${DEST_PATH}"
mv -f "${DEST_PATH}/bzImage" "${DEST_PATH}/bzImage-arc"
mv -f "${DEST_PATH}/rootfs.cpio.zst" "${DEST_PATH}/initrd-arc"
[ -f "${DEST_PATH}/bzImage-arc" ] && [ -f "${DEST_PATH}/initrd-arc" ] && break
fi
done < <(curl -skL -H "Authorization: token ${TOKEN}" "https://api.github.com/repos/AuxXxilium/arc-buildroot-x/releases/tags/${TAG}" | jq -r '.assets[] | "\(.id) \(.name)"')
}
# Get latest Buildroot-S
# $1 path
function getBuildroots() {
echo "Getting Buildroot-S begin"
local DEST_PATH="${1}"
TAG=$(curl -skL -H "Authorization: token ${TOKEN}" "https://api.github.com/repos/AuxXxilium/arc-buildroot-s/releases" | jq -r ".[].tag_name" | sort -rV | head -1)
export BRSTAG="${TAG}"
[ ! -d "${DEST_PATH}" ] && mkdir -p "${DEST_PATH}"
rm -f "${DEST_PATH}/bzImage-arc"
rm -f "${DEST_PATH}/initrd-arc"
while read -r ID NAME; do
if [ "${NAME}" = "buildroot-${TAG}.zip" ]; then
curl -kL -H "Authorization: token ${TOKEN}" -H "Accept: application/octet-stream" "https://api.github.com/repos/AuxXxilium/arc-buildroot-s/releases/assets/${ID}" -o "${DEST_PATH}/brs.zip"
echo "Buildroot-S: ${TAG}"
unzip -o "${DEST_PATH}/brs.zip" -d "${DEST_PATH}"
mv -f "${DEST_PATH}/bzImage" "${DEST_PATH}/bzImage-arc"
mv -f "${DEST_PATH}/rootfs.cpio.zst" "${DEST_PATH}/initrd-arc"
[ -f "${DEST_PATH}/bzImage-arc" ] && [ -f "${DEST_PATH}/initrd-arc" ] && break
fi
done < <(curl -skL -H "Authorization: token ${TOKEN}" "https://api.github.com/repos/AuxXxilium/arc-buildroot-s/releases/tags/${TAG}" | jq -r '.assets[] | "\(.id) \(.name)"')
}
# Get latest Buildroot-M
# $1 path
function getBuildrootm() {
echo "Getting Buildroot-M begin"
local DEST_PATH="${1}"
TAG=$(curl -skL -H "Authorization: token ${TOKEN}" "https://api.github.com/repos/AuxXxilium/arc-buildroot-m/releases" | jq -r ".[].tag_name" | sort -rV | head -1)
export BRSTAG="${TAG}"
[ ! -d "${DEST_PATH}" ] && mkdir -p "${DEST_PATH}"
rm -f "${DEST_PATH}/bzImage-arc"
rm -f "${DEST_PATH}/initrd-arc"
while read -r ID NAME; do
if [ "${NAME}" = "buildroot-${TAG}.zip" ]; then
curl -kL -H "Authorization: token ${TOKEN}" -H "Accept: application/octet-stream" "https://api.github.com/repos/AuxXxilium/arc-buildroot-m/releases/assets/${ID}" -o "${DEST_PATH}/brm.zip"
echo "Buildroot-M: ${TAG}"
unzip -o "${DEST_PATH}/brm.zip" -d "${DEST_PATH}"
mv -f "${DEST_PATH}/bzImage" "${DEST_PATH}/bzImage-arc"
mv -f "${DEST_PATH}/rootfs.cpio.zst" "${DEST_PATH}/initrd-arc"
[ -f "${DEST_PATH}/bzImage-arc" ] && [ -f "${DEST_PATH}/initrd-arc" ] && break
fi
done < <(curl -skL -H "Authorization: token ${TOKEN}" "https://api.github.com/repos/AuxXxilium/arc-buildroot-m/releases/tags/${TAG}" | jq -r '.assets[] | "\(.id) \(.name)"')
done < <(curl -skL -H "Authorization: token ${TOKEN}" "https://api.github.com/repos/AuxXxilium/${REPO}/releases/tags/${TAG}" | jq -r '.assets[] | "\(.id) \(.name)"')
}
# Get latest Offline