arc: cleanup

Signed-off-by: AuxXxilium <info@auxxxilium.tech>
This commit is contained in:
AuxXxilium 2024-09-05 20:50:31 +02:00
parent 3911aab34b
commit 5f6b18a216
6 changed files with 93 additions and 118 deletions

View File

@ -70,7 +70,7 @@ jobs:
echo "BRX_VERSION=${TAG}" >> $GITHUB_ENV
getBuildroots "latest" "brs"
echo "BRS_VERSION=${TAG}" >> $GITHUB_ENV
getOffline "files/p3/configs"
getOffline "files/p3/offline"
echo "BUILD_TIME=$(date +'%Y-%m-%d %H:%M')" >> $GITHUB_ENV
echo "OK"
@ -129,7 +129,7 @@ jobs:
convertova "${IMAGE_FILE}" "arc.ova"
# Zip update and generate checksum
zip -9j update.zip "files/p3/bzImage-arc" "files/p3/initrd-arc" "files/p1/ARC-VERSION" "files/p1/ARC-BRANCH" "files/p1/boot/grub/grub.cfg"
zip -9j update.zip "files/p3/bzImage-arc" "files/p3/initrd-arc" "files/p1/ARC-VERSION" "files/p1/ARC-BRANCH" "files/p1/boot/grub/grub.cfg" "files/p3/offline/offline.json"
sha256sum update.zip >checksum.sha256
# Build incremental
@ -187,7 +187,7 @@ jobs:
convertova "${IMAGE_FILE}" "arc-next.ova"
# Zip update and generate checksum
zip -9j update-next.zip "files/p3/bzImage-arc" "files/p3/initrd-arc" "files/p1/ARC-VERSION" "files/p1/ARC-BRANCH" "files/p1/boot/grub/grub.cfg"
zip -9j update-next.zip "files/p3/bzImage-arc" "files/p3/initrd-arc" "files/p1/ARC-VERSION" "files/p1/ARC-BRANCH" "files/p1/boot/grub/grub.cfg" "files/p3/offline/offline.json"
sha256sum update-next.zip >checksum-next.sha256
# Zip image and generate checksum

View File

@ -108,7 +108,7 @@ jobs:
echo "BRX_VERSION=${TAG}" >> $GITHUB_ENV
getBuildroots "latest" "brs"
echo "BRS_VERSION=${TAG}" >> $GITHUB_ENV
getOffline "files/p3/configs"
getOffline "files/p3/offline"
echo "BUILD_TIME=$(date +'%Y-%m-%d %H:%M')" >> $GITHUB_ENV
echo "OK"
@ -167,7 +167,7 @@ jobs:
convertova "${IMAGE_FILE}" "arc.ova"
# Zip update and generate checksum
zip -9j update.zip "files/p3/bzImage-arc" "files/p3/initrd-arc" "files/p1/ARC-VERSION" "files/p1/ARC-BRANCH" "files/p1/boot/grub/grub.cfg"
zip -9j update.zip "files/p3/bzImage-arc" "files/p3/initrd-arc" "files/p1/ARC-VERSION" "files/p1/ARC-BRANCH" "files/p1/boot/grub/grub.cfg" "files/p3/offline/offline.json"
sha256sum update.zip >checksum.sha256
# Build incremental
@ -225,7 +225,7 @@ jobs:
convertova "${IMAGE_FILE}" "arc-next.ova"
# Zip update and generate checksum
zip -9j update-next.zip "files/p3/bzImage-arc" "files/p3/initrd-arc" "files/p1/ARC-VERSION" "files/p1/ARC-BRANCH" "files/p1/boot/grub/grub.cfg"
zip -9j update-next.zip "files/p3/bzImage-arc" "files/p3/initrd-arc" "files/p1/ARC-VERSION" "files/p1/ARC-BRANCH" "files/p1/boot/grub/grub.cfg" "files/p3/offline/offline.json"
sha256sum update-next.zip >checksum-next.sha256
# Zip image and generate checksum

View File

@ -1268,6 +1268,8 @@ function sysinfo() {
TEXT+="\n Kernelload: \Zb${KERNELLOAD}\Zn"
TEXT+="\n Directboot: \Zb${DIRECTBOOT}\Zn"
TEXT+="\n Addons selected: \Zb${ADDONSINFO}\Zn"
else
TEXT+="\n Config not completed!\n"
fi
TEXT+="\n Modules loaded: \Zb${MODULESINFO}\Zn"
if [ "${CONFDONE}" == "true" ]; then

View File

@ -88,7 +88,6 @@ function backtitle() {
###############################################################################
# Model Selection
function arcModel() {
CHANGED="false"
dialog --backtitle "$(backtitle)" --title "DSM Model" \
--infobox "Reading Models..." 3 25
# Loop menu
@ -200,37 +199,17 @@ function arcModel() {
done
fi
# Reset Model Config if changed
if [ -z "${resp}" ] && [ -n "${MODEL}" ]; then
MODEL="$(readConfigKey "model" "${USER_CONFIG_FILE}")"
if [ "${AUTOMATED}" == "false" ] && [ "${MODEL}" != "${resp}" ]; then
MODEL="${resp}"
PLATFORM="$(grep -w "${MODEL}" "${TMP_PATH}/modellist" | awk '{print $2}' | head -n 1)"
MODELID=$(echo ${MODEL} | sed 's/d$/D/; s/rp$/RP/; s/rp+/RP+/')
writeConfigKey "arc.builddone" "false" "${USER_CONFIG_FILE}"
writeConfigKey "arc.confdone" "false" "${USER_CONFIG_FILE}"
writeConfigKey "arc.patch" "false" "${USER_CONFIG_FILE}"
writeConfigKey "arc.remap" "" "${USER_CONFIG_FILE}"
writeConfigKey "buildnum" "" "${USER_CONFIG_FILE}"
writeConfigKey "cmdline" "{}" "${USER_CONFIG_FILE}"
writeConfigKey "emmcboot" "false" "${USER_CONFIG_FILE}"
writeConfigKey "hddsort" "false" "${USER_CONFIG_FILE}"
writeConfigKey "platform" "${PLATFORM}" "${USER_CONFIG_FILE}"
writeConfigKey "ramdisk-hash" "" "${USER_CONFIG_FILE}"
writeConfigKey "smallnum" "" "${USER_CONFIG_FILE}"
writeConfigKey "zimage-hash" "" "${USER_CONFIG_FILE}"
elif [ "${MODEL}" != "${resp}" ]; then
PRODUCTVER=""
MODEL="${resp}"
PLATFORM="$(grep -w "${MODEL}" "${TMP_PATH}/modellist" | awk '{print $2}' | head -n 1)"
writeConfigKey "arc.builddone" "false" "${USER_CONFIG_FILE}"
writeConfigKey "arc.confdone" "false" "${USER_CONFIG_FILE}"
writeConfigKey "arc.patch" "false" "${USER_CONFIG_FILE}"
writeConfigKey "arc.remap" "" "${USER_CONFIG_FILE}"
writeConfigKey "buildnum" "" "${USER_CONFIG_FILE}"
writeConfigKey "emmcboot" "false" "${USER_CONFIG_FILE}"
writeConfigKey "hddsort" "false" "${USER_CONFIG_FILE}"
writeConfigKey "kernel" "official" "${USER_CONFIG_FILE}"
writeConfigKey "model" "${MODEL}" "${USER_CONFIG_FILE}"
writeConfigKey "modelid" "" "${USER_CONFIG_FILE}"
writeConfigKey "odp" "false" "${USER_CONFIG_FILE}"
writeConfigKey "model" "${MODEL}" "${USER_CONFIG_FILE}"
writeConfigKey "paturl" "" "${USER_CONFIG_FILE}"
writeConfigKey "pathash" "" "${USER_CONFIG_FILE}"
writeConfigKey "platform" "${PLATFORM}" "${USER_CONFIG_FILE}"
@ -239,7 +218,13 @@ function arcModel() {
writeConfigKey "smallnum" "" "${USER_CONFIG_FILE}"
writeConfigKey "sn" "" "${USER_CONFIG_FILE}"
writeConfigKey "zimage-hash" "" "${USER_CONFIG_FILE}"
CHANGED="true"
fi
PLATFORM="$(grep -w "${MODEL}" "${TMP_PATH}/modellist" | awk '{print $2}' | head -n 1)"
writeConfigKey "platform" "${PLATFORM}" "${USER_CONFIG_FILE}"
writeConfigKey "arc.builddone" "false" "${USER_CONFIG_FILE}"
writeConfigKey "arc.confdone" "false" "${USER_CONFIG_FILE}"
writeConfigKey "arc.patch" "false" "${USER_CONFIG_FILE}"
# Read Platform Data
ARCPATCH="$(readConfigKey "arc.patch" "${USER_CONFIG_FILE}")"
BUILDDONE="$(readConfigKey "arc.builddone" "${USER_CONFIG_FILE}")"
@ -255,17 +240,15 @@ function arcModel() {
# Arc Version Section
function arcVersion() {
# Read Model Config
CHANGED="false"
MODEL="$(readConfigKey "model" "${USER_CONFIG_FILE}")"
PLATFORM="$(readConfigKey "platform" "${USER_CONFIG_FILE}")"
DT="$(readConfigKey "platforms.${PLATFORM}.dt" "${P_FILE}")"
PRODUCTVER="$(readConfigKey "productver" "${USER_CONFIG_FILE}")"
AUTOMATED="$(readConfigKey "automated" "${USER_CONFIG_FILE}")"
# Get PAT Data from Config
PAT_URL_CONF="$(readConfigKey "paturl" "${USER_CONFIG_FILE}")"
PAT_HASH_CONF="$(readConfigKey "pathash" "${USER_CONFIG_FILE}")"
# Check for Custom Build
if [ "${AUTOMATED}" == "false" ] && [ "${OFFLINE}" == "false" ]; then
if [ "${AUTOMATED}" == "false" ]; then
# Select Build for DSM
ITEMS="$(readConfigEntriesArray "platforms.${PLATFORM}.productvers" "${P_FILE}" | sort -r)"
dialog --clear --no-items --nocancel --title "DSM Version" --backtitle "$(backtitle)" \
@ -284,9 +267,13 @@ function arcVersion() {
writeConfigKey "ramdisk-hash" "" "${USER_CONFIG_FILE}"
writeConfigKey "smallnum" "" "${USER_CONFIG_FILE}"
writeConfigKey "zimage-hash" "" "${USER_CONFIG_FILE}"
writeConfigKey "arc.builddone" "false" "${USER_CONFIG_FILE}"
writeConfigKey "arc.confdone" "false" "${USER_CONFIG_FILE}"
BUILDDONE="$(readConfigKey "arc.builddone" "${USER_CONFIG_FILE}")"
CONFDONE="$(readConfigKey "arc.confdone" "${USER_CONFIG_FILE}")"
CHANGED="true"
fi
if [ "${OFFLINE}" == "false" ]; then
dialog --backtitle "$(backtitle)" --title "DSM Version" \
--infobox "Reading DSM Build..." 3 25
PAT_URL=""
@ -342,6 +329,7 @@ function arcVersion() {
PAT_HASH="$(cat "${TMP_PATH}/resp" | sed -n '2p')"
[ -n "${PAT_URL}" ] && [ -n "${PAT_HASH}" ] && VALID="true"
fi
fi
elif [ "${AUTOMATED}" == "true" ]; then
PAT_URL="$(readConfigKey "paturl" "${USER_CONFIG_FILE}")"
PAT_HASH="$(readConfigKey "pathash" "${USER_CONFIG_FILE}")"
@ -361,13 +349,13 @@ function arcVersion() {
# Cleanup
mkdir -p "${USER_UP_PATH}"
DSM_FILE="${USER_UP_PATH}/${PAT_HASH}.tar"
if [ "${PAT_HASH}" != "${PAT_HASH_CONF}" ] || [ "${PAT_URL}" != "${PAT_URL_CONF}" ]; then
if [ "${PAT_HASH}" != "${PAT_HASH_CONF}" ] || [ "${PAT_URL}" != "${PAT_URL_CONF}" ] || [ "${CHANGED}" == "true" ]; then
# Write new PAT Data to Config
writeConfigKey "paturl" "${PAT_URL}" "${USER_CONFIG_FILE}"
writeConfigKey "pathash" "${PAT_HASH}" "${USER_CONFIG_FILE}"
rm -f "${ORI_ZIMAGE_FILE}" "${ORI_RDGZ_FILE}" "${MOD_ZIMAGE_FILE}" "${MOD_RDGZ_FILE}" >/dev/null 2>&1 || true
rm -f "${PART1_PATH}/grub_cksum.syno" "${PART1_PATH}/GRUB_VER" "${PART2_PATH}/"* >/dev/null 2>&1 || true
rm -f "${USER_UP_PATH}/${PAT_HASH_CONF}.tar" >/dev/null 2>&1 || true
rm -f "${USER_UP_PATH}/"*.tar >/dev/null 2>&1 || true
fi
if [ ! -f "${DSM_FILE}" ] && [ "${OFFLINE}" == "false" ] && [ "${VALID}" == "true" ]; then
dialog --backtitle "$(backtitle)" --colors --title "DSM Version" \
@ -399,11 +387,7 @@ function arcVersion() {
fi
elif [ ! -f "${DSM_FILE}" ] && [ "${OFFLINE}" == "true" ] && [ "${AUTOMATED}" == "false" ]; then
PAT_FILE=$(ls ${USER_UP_PATH}/*.pat | head -n 1)
if [ -f "${ORI_ZIMAGE_FILE}" ] && [ -f "${ORI_RDGZ_FILE}" ]; then
rm -f "${MOD_ZIMAGE_FILE}" "${MOD_RDGZ_FILE}" >/dev/null 2>&1 || true
VALID="true"
elif [ ! -f "${PAT_FILE}" ]; then
# Check for existing Files
if [ ! -f "${PAT_FILE}" ]; then
mkdir -p "${USER_UP_PATH}"
# Get new Files
MSG=""
@ -452,9 +436,16 @@ function arcVersion() {
sleep 5
fi
# Copy DSM Files to Locations
[ "${VALID}" == "true" ] && copyDSMFiles "${UNTAR_PAT_PATH}" 2>/dev/null
if [ "${VALID}" == "true" ]; then
if [ ! -f "${ORI_ZIMAGE_FILE}" ] || [ ! -f "${ORI_RDGZ_FILE}" ]; then
dialog --backtitle "$(backtitle)" --title "DSM Extraction" --aspect 18 \
--infobox "Copying DSM Files..." 3 40
copyDSMFiles "${UNTAR_PAT_PATH}" 2>/dev/null
fi
fi
# Cleanup
[ -d "${UNTAR_PAT_PATH}" ] && rm -rf "${UNTAR_PAT_PATH}"
# Change Config if Files are valid
if [ "${VALID}" == "true" ] && [ -f "${ORI_ZIMAGE_FILE}" ] && [ -f "${ORI_RDGZ_FILE}" ]; then
dialog --backtitle "$(backtitle)" --title "Arc Config" \
--infobox "Reconfiguring Addons, Cmdline, Modules and Synoinfo" 3 60
@ -472,16 +463,13 @@ function arcVersion() {
done < <(readConfigMap "addons" "${USER_CONFIG_FILE}")
# Reset Modules
KVER="$(readConfigKey "platforms.${PLATFORM}.productvers.\"${PRODUCTVER}\".kver" "${P_FILE}")"
# Modify KVER for Epyc7002
[ "${PLATFORM}" == "epyc7002" ] && KVERP="${PRODUCTVER}-${KVER}" || KVERP="${KVER}"
# Rewrite modules
writeConfigKey "modules" "{}" "${USER_CONFIG_FILE}"
while read -r ID DESC; do
writeConfigKey "modules.\"${ID}\"" "" "${USER_CONFIG_FILE}"
done < <(getAllModules "${PLATFORM}" "${KVERP}")
# Check for Only Version
if [ "${ONLYVERSION}" == "true" ]; then
# Build isn't done
writeConfigKey "arc.builddone" "false" "${USER_CONFIG_FILE}"
BUILDDONE="$(readConfigKey "arc.builddone" "${USER_CONFIG_FILE}")"
ONLYVERSION="false"
@ -505,7 +493,6 @@ function arcPatch() {
# Read Model Values
PLATFORM="$(readConfigKey "platform" "${USER_CONFIG_FILE}")"
MODEL="$(readConfigKey "model" "${USER_CONFIG_FILE}")"
AUTOMATED="$(readConfigKey "automated" "${USER_CONFIG_FILE}")"
ARCCONF="$(readConfigKey "${MODEL}.serial" "${S_FILE}" 2>/dev/null)"
# Check for Custom Build
SN="$(readConfigKey "sn" "${USER_CONFIG_FILE}")"
@ -591,7 +578,6 @@ function arcPatch() {
function arcSettings() {
PLATFORM="$(readConfigKey "platform" "${USER_CONFIG_FILE}")"
DT="$(readConfigKey "platforms.${PLATFORM}.dt" "${P_FILE}")"
AUTOMATED="$(readConfigKey "automated" "${USER_CONFIG_FILE}")"
# Get Network Config for Loader
dialog --backtitle "$(backtitle)" --colors --title "Network Config" \
--infobox "Generating Network Config..." 3 40
@ -599,7 +585,6 @@ function arcSettings() {
getnet
[ $? -ne 0 ] && return 1
if [ "${ONLYPATCH}" == "true" ]; then
# Build isn't done
writeConfigKey "arc.builddone" "false" "${USER_CONFIG_FILE}"
BUILDDONE="$(readConfigKey "arc.builddone" "${USER_CONFIG_FILE}")"
ONLYPATCH="false"
@ -623,9 +608,8 @@ function arcSettings() {
initConfigKey "addons.storagepanel" "" "${USER_CONFIG_FILE}"
addonSelection
[ $? -ne 0 ] && return 1
# Check for CPU Frequency Scaling
# Check for CPU Frequency Scaling & Governor
if [ "${CPUFREQ}" == "true" ] && readConfigMap "addons" "${USER_CONFIG_FILE}" | grep -q "cpufreqscaling"; then
# Select Governor for DSM
initConfigKey "addons.cpufreqscaling" "" "${USER_CONFIG_FILE}"
dialog --backtitle "$(backtitle)" --colors --title "CPU Frequency Scaling" \
--infobox "Generating Governor Table..." 3 40
@ -675,7 +659,7 @@ function arcSettings() {
# Max Memory for DSM
RAMCONFIG="$((${RAMTOTAL} * 1024))"
writeConfigKey "synoinfo.mem_max_mb" "${RAMCONFIG}" "${USER_CONFIG_FILE}"
if [ -f "${ORI_ZIMAGE_FILE}" ] && [ -f "${ORI_RDGZ_FILE}" ]; then
if [ -f "${ORI_ZIMAGE_FILE}" ] && [ -f "${ORI_RDGZ_FILE}" ] && [ -n "${PLATFORM}" ] && [ -n "${KVER}" ]; then
# Config is done
writeConfigKey "arc.confdone" "true" "${USER_CONFIG_FILE}"
CONFDONE="$(readConfigKey "arc.confdone" "${USER_CONFIG_FILE}")"
@ -732,14 +716,12 @@ function arcSummary() {
fi
DIRECTBOOT="$(readConfigKey "directboot" "${USER_CONFIG_FILE}")"
KERNELLOAD="$(readConfigKey "kernelload" "${USER_CONFIG_FILE}")"
OFFLINE="$(readConfigKey "arc.offline" "${USER_CONFIG_FILE}")"
HDDSORT="$(readConfigKey "hddsort" "${USER_CONFIG_FILE}")"
NIC="$(readConfigKey "device.nic" "${USER_CONFIG_FILE}")"
EXTERNALCONTROLLER="$(readConfigKey "device.externalcontroller" "${USER_CONFIG_FILE}")"
HARDDRIVES="$(readConfigKey "device.harddrives" "${USER_CONFIG_FILE}")"
DRIVES="$(readConfigKey "device.drives" "${USER_CONFIG_FILE}")"
EMMCBOOT="$(readConfigKey "emmcboot" "${USER_CONFIG_FILE}")"
OFFLINE="$(readConfigKey "arc.offline" "${USER_CONFIG_FILE}")"
KERNEL="$(readConfigKey "kernel" "${USER_CONFIG_FILE}")"
if [ "${DT}" == "false" ] && [ "${REMAP}" == "user" ]; then
if [ -z "${PORTMAP}" ] && [ -z "${DISKMAP}"] && [ -z "${PORTREMAP}" ] && [ -z "${AHCIPORTREMAP}" ]; then
@ -809,7 +791,6 @@ function make() {
PLATFORM="$(readConfigKey "platform" "${USER_CONFIG_FILE}")"
PRODUCTVER="$(readConfigKey "productver" "${USER_CONFIG_FILE}")"
DT="$(readConfigKey "platforms.${PLATFORM}.dt" "${P_FILE}")"
AUTOMATED="$(readConfigKey "automated" "${USER_CONFIG_FILE}")"
CONFDONE="$(readConfigKey "arc.confdone" "${USER_CONFIG_FILE}")"
if [ -f "${ORI_ZIMAGE_FILE}" ] && [ -f "${ORI_RDGZ_FILE}" ] && [ "${CONFDONE}" == "true" ]; then
(
@ -1171,10 +1152,10 @@ else
x) backupMenu; NEXT="x" ;;
M) arcNIC; NEXT="M" ;;
9) [ "${OFFLINE}" == "true" ] && OFFLINE='false' || OFFLINE='true'
[ "${OFFLINE}" == "false" ] && ntpCheck
offlineCheck "${OFFLINE}"
ARCNIC="$(readConfigKey "arc.nic" "${USER_CONFIG_FILE}")"
OFFLINE="$(readConfigKey "arc.offline" "${USER_CONFIG_FILE}")"
. ${ARC_PATH}/include/network.sh
NEXT="9"
;;
y) keymapMenu; NEXT="y" ;;

View File

@ -351,7 +351,7 @@ def getmodelsoffline(platforms=None):
PS = []
models = []
with open(os.path.join('/mnt/p3/configs', "offline.json")) as user_file:
with open(os.path.join('/mnt/p3/offline', "offline.json")) as user_file:
data = json.load(user_file)
for I in data["channel"]["item"]:

View File

@ -561,7 +561,6 @@ function ntpCheck() {
# Offline Check
function offlineCheck() {
CNT=0
AUTOMATED="$(readConfigKey "automated" "${USER_CONFIG_FILE}")"
local ARCNIC=""
local OFFLINE="${1}"
if [ "${OFFLINE}" == "true" ]; then
@ -590,21 +589,14 @@ function offlineCheck() {
if [ -n "${ARCNIC}" ]; then
OFFLINE="false"
elif [ -z "${ARCNIC}" ]; then
if [ "${AUTOMATED}" == "false" ]; then
dialog --backtitle "$(backtitle)" --title "Online Check" \
--infobox "Could not connect to Github.\nSwitch to Offline Mode!" 0 0
else
dialog --backtitle "$(backtitle)" --title "Online Check" \
--infobox "Could not connect to Github.\nSwitch to Offline Mode!\nDisable Automated Mode!" 0 0
fi
sleep 5
cp -f "${PART3_PATH}/configs/offline.json" "${ARC_PATH}/include/offline.json"
AUTOMATED="false"
ARCNIC="offline"
OFFLINE="true"
fi
fi
writeConfigKey "automated" "${AUTOMATED}" "${USER_CONFIG_FILE}"
[ "${OFFLINE}" == "true" ] && cp -f "${PART3_PATH}/offline/offline.json" "${ARC_PATH}/include/offline.json"
writeConfigKey "arc.nic" "${ARCNIC}" "${USER_CONFIG_FILE}"
writeConfigKey "arc.offline" "${OFFLINE}" "${USER_CONFIG_FILE}"
}