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 echo "BRX_VERSION=${TAG}" >> $GITHUB_ENV
getBuildroots "latest" "brs" getBuildroots "latest" "brs"
echo "BRS_VERSION=${TAG}" >> $GITHUB_ENV 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 "BUILD_TIME=$(date +'%Y-%m-%d %H:%M')" >> $GITHUB_ENV
echo "OK" echo "OK"
@ -129,7 +129,7 @@ jobs:
convertova "${IMAGE_FILE}" "arc.ova" convertova "${IMAGE_FILE}" "arc.ova"
# Zip update and generate checksum # 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 sha256sum update.zip >checksum.sha256
# Build incremental # Build incremental
@ -187,7 +187,7 @@ jobs:
convertova "${IMAGE_FILE}" "arc-next.ova" convertova "${IMAGE_FILE}" "arc-next.ova"
# Zip update and generate checksum # 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 sha256sum update-next.zip >checksum-next.sha256
# Zip image and generate checksum # Zip image and generate checksum

View File

@ -108,7 +108,7 @@ jobs:
echo "BRX_VERSION=${TAG}" >> $GITHUB_ENV echo "BRX_VERSION=${TAG}" >> $GITHUB_ENV
getBuildroots "latest" "brs" getBuildroots "latest" "brs"
echo "BRS_VERSION=${TAG}" >> $GITHUB_ENV 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 "BUILD_TIME=$(date +'%Y-%m-%d %H:%M')" >> $GITHUB_ENV
echo "OK" echo "OK"
@ -167,7 +167,7 @@ jobs:
convertova "${IMAGE_FILE}" "arc.ova" convertova "${IMAGE_FILE}" "arc.ova"
# Zip update and generate checksum # 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 sha256sum update.zip >checksum.sha256
# Build incremental # Build incremental
@ -225,7 +225,7 @@ jobs:
convertova "${IMAGE_FILE}" "arc-next.ova" convertova "${IMAGE_FILE}" "arc-next.ova"
# Zip update and generate checksum # 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 sha256sum update-next.zip >checksum-next.sha256
# Zip image and generate checksum # Zip image and generate checksum

View File

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

View File

@ -88,7 +88,6 @@ function backtitle() {
############################################################################### ###############################################################################
# Model Selection # Model Selection
function arcModel() { function arcModel() {
CHANGED="false"
dialog --backtitle "$(backtitle)" --title "DSM Model" \ dialog --backtitle "$(backtitle)" --title "DSM Model" \
--infobox "Reading Models..." 3 25 --infobox "Reading Models..." 3 25
# Loop menu # Loop menu
@ -200,37 +199,17 @@ function arcModel() {
done done
fi fi
# Reset Model Config if changed # Reset Model Config if changed
if [ -z "${resp}" ] && [ -n "${MODEL}" ]; then if [ "${AUTOMATED}" == "false" ] && [ "${MODEL}" != "${resp}" ]; then
MODEL="$(readConfigKey "model" "${USER_CONFIG_FILE}")" MODEL="${resp}"
PLATFORM="$(grep -w "${MODEL}" "${TMP_PATH}/modellist" | awk '{print $2}' | head -n 1)" 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 "arc.remap" "" "${USER_CONFIG_FILE}"
writeConfigKey "buildnum" "" "${USER_CONFIG_FILE}" writeConfigKey "buildnum" "" "${USER_CONFIG_FILE}"
writeConfigKey "cmdline" "{}" "${USER_CONFIG_FILE}" writeConfigKey "cmdline" "{}" "${USER_CONFIG_FILE}"
writeConfigKey "emmcboot" "false" "${USER_CONFIG_FILE}" writeConfigKey "emmcboot" "false" "${USER_CONFIG_FILE}"
writeConfigKey "hddsort" "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 "kernel" "official" "${USER_CONFIG_FILE}"
writeConfigKey "model" "${MODEL}" "${USER_CONFIG_FILE}"
writeConfigKey "modelid" "" "${USER_CONFIG_FILE}"
writeConfigKey "odp" "false" "${USER_CONFIG_FILE}" writeConfigKey "odp" "false" "${USER_CONFIG_FILE}"
writeConfigKey "model" "${MODEL}" "${USER_CONFIG_FILE}"
writeConfigKey "paturl" "" "${USER_CONFIG_FILE}" writeConfigKey "paturl" "" "${USER_CONFIG_FILE}"
writeConfigKey "pathash" "" "${USER_CONFIG_FILE}" writeConfigKey "pathash" "" "${USER_CONFIG_FILE}"
writeConfigKey "platform" "${PLATFORM}" "${USER_CONFIG_FILE}" writeConfigKey "platform" "${PLATFORM}" "${USER_CONFIG_FILE}"
@ -239,7 +218,13 @@ function arcModel() {
writeConfigKey "smallnum" "" "${USER_CONFIG_FILE}" writeConfigKey "smallnum" "" "${USER_CONFIG_FILE}"
writeConfigKey "sn" "" "${USER_CONFIG_FILE}" writeConfigKey "sn" "" "${USER_CONFIG_FILE}"
writeConfigKey "zimage-hash" "" "${USER_CONFIG_FILE}" writeConfigKey "zimage-hash" "" "${USER_CONFIG_FILE}"
CHANGED="true"
fi 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 # Read Platform Data
ARCPATCH="$(readConfigKey "arc.patch" "${USER_CONFIG_FILE}")" ARCPATCH="$(readConfigKey "arc.patch" "${USER_CONFIG_FILE}")"
BUILDDONE="$(readConfigKey "arc.builddone" "${USER_CONFIG_FILE}")" BUILDDONE="$(readConfigKey "arc.builddone" "${USER_CONFIG_FILE}")"
@ -255,17 +240,15 @@ function arcModel() {
# Arc Version Section # Arc Version Section
function arcVersion() { function arcVersion() {
# Read Model Config # Read Model Config
CHANGED="false"
MODEL="$(readConfigKey "model" "${USER_CONFIG_FILE}")" MODEL="$(readConfigKey "model" "${USER_CONFIG_FILE}")"
PLATFORM="$(readConfigKey "platform" "${USER_CONFIG_FILE}")" PLATFORM="$(readConfigKey "platform" "${USER_CONFIG_FILE}")"
DT="$(readConfigKey "platforms.${PLATFORM}.dt" "${P_FILE}")" DT="$(readConfigKey "platforms.${PLATFORM}.dt" "${P_FILE}")"
PRODUCTVER="$(readConfigKey "productver" "${USER_CONFIG_FILE}")" PRODUCTVER="$(readConfigKey "productver" "${USER_CONFIG_FILE}")"
AUTOMATED="$(readConfigKey "automated" "${USER_CONFIG_FILE}")"
# Get PAT Data from Config # Get PAT Data from Config
PAT_URL_CONF="$(readConfigKey "paturl" "${USER_CONFIG_FILE}")" PAT_URL_CONF="$(readConfigKey "paturl" "${USER_CONFIG_FILE}")"
PAT_HASH_CONF="$(readConfigKey "pathash" "${USER_CONFIG_FILE}")" PAT_HASH_CONF="$(readConfigKey "pathash" "${USER_CONFIG_FILE}")"
# Check for Custom Build # Check for Custom Build
if [ "${AUTOMATED}" == "false" ] && [ "${OFFLINE}" == "false" ]; then if [ "${AUTOMATED}" == "false" ]; then
# Select Build for DSM # Select Build for DSM
ITEMS="$(readConfigEntriesArray "platforms.${PLATFORM}.productvers" "${P_FILE}" | sort -r)" ITEMS="$(readConfigEntriesArray "platforms.${PLATFORM}.productvers" "${P_FILE}" | sort -r)"
dialog --clear --no-items --nocancel --title "DSM Version" --backtitle "$(backtitle)" \ dialog --clear --no-items --nocancel --title "DSM Version" --backtitle "$(backtitle)" \
@ -284,63 +267,68 @@ function arcVersion() {
writeConfigKey "ramdisk-hash" "" "${USER_CONFIG_FILE}" writeConfigKey "ramdisk-hash" "" "${USER_CONFIG_FILE}"
writeConfigKey "smallnum" "" "${USER_CONFIG_FILE}" writeConfigKey "smallnum" "" "${USER_CONFIG_FILE}"
writeConfigKey "zimage-hash" "" "${USER_CONFIG_FILE}" writeConfigKey "zimage-hash" "" "${USER_CONFIG_FILE}"
writeConfigKey "arc.builddone" "false" "${USER_CONFIG_FILE}"
writeConfigKey "arc.confdone" "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}")" CONFDONE="$(readConfigKey "arc.confdone" "${USER_CONFIG_FILE}")"
CHANGED="true"
fi fi
dialog --backtitle "$(backtitle)" --title "DSM Version" \ if [ "${OFFLINE}" == "false" ]; then
--infobox "Reading DSM Build..." 3 25 dialog --backtitle "$(backtitle)" --title "DSM Version" \
PAT_URL="" --infobox "Reading DSM Build..." 3 25
PAT_HASH="" PAT_URL=""
URLVER="" PAT_HASH=""
while true; do URLVER=""
PJ="$(python ${ARC_PATH}/include/functions.py getpats4mv -m "${MODEL}" -v "${PRODUCTVER}")" while true; do
if [[ -z "${PJ}" || "${PJ}" = "{}" ]]; then PJ="$(python ${ARC_PATH}/include/functions.py getpats4mv -m "${MODEL}" -v "${PRODUCTVER}")"
MSG="Unable to connect to Synology API, Please check the network and try again!" if [[ -z "${PJ}" || "${PJ}" = "{}" ]]; then
dialog --backtitle "$(backtitle)" --colors --title "DSM Version" \ MSG="Unable to connect to Synology API, Please check the network and try again!"
--yes-label "Retry" \ dialog --backtitle "$(backtitle)" --colors --title "DSM Version" \
--yesno "${MSG}" 0 0 --yes-label "Retry" \
[ $? -eq 0 ] && continue # yes-button --yesno "${MSG}" 0 0
return 1 [ $? -eq 0 ] && continue # yes-button
else return 1
PVS="$(echo "${PJ}" | jq -r 'keys | sort | reverse | join("\n")')" else
[ -f "${TMP_PATH}/versions" ] && rm -f "${TMP_PATH}/versions" >/dev/null 2>&1 && touch "${TMP_PATH}/versions" PVS="$(echo "${PJ}" | jq -r 'keys | sort | reverse | join("\n")')"
while IFS= read -r line; do [ -f "${TMP_PATH}/versions" ] && rm -f "${TMP_PATH}/versions" >/dev/null 2>&1 && touch "${TMP_PATH}/versions"
VERSION="${line}" while IFS= read -r line; do
CHECK_URL=$(echo "${PJ}" | jq -r ".\"${VERSION}\".url") VERSION="${line}"
if curl --head -skL -m 5 "${CHECK_URL}" | head -n 1 | grep -q "404\|403"; then CHECK_URL=$(echo "${PJ}" | jq -r ".\"${VERSION}\".url")
continue if curl --head -skL -m 5 "${CHECK_URL}" | head -n 1 | grep -q "404\|403"; then
else continue
echo "${VERSION}" >>"${TMP_PATH}/versions" else
fi echo "${VERSION}" >>"${TMP_PATH}/versions"
done < <(echo "${PVS}") fi
DSMPVS="$(cat ${TMP_PATH}/versions)" done < <(echo "${PVS}")
dialog --backtitle "$(backtitle)" --colors --title "DSM Version" \ DSMPVS="$(cat ${TMP_PATH}/versions)"
--no-items --menu "Choose a DSM Build" 0 0 0 ${DSMPVS} \ dialog --backtitle "$(backtitle)" --colors --title "DSM Version" \
2>${TMP_PATH}/resp --no-items --menu "Choose a DSM Build" 0 0 0 ${DSMPVS} \
2>${TMP_PATH}/resp
RET=$?
[ ${RET} -ne 0 ] && return
PV=$(cat ${TMP_PATH}/resp)
PAT_URL=$(echo "${PJ}" | jq -r ".\"${PV}\".url")
PAT_HASH=$(echo "${PJ}" | jq -r ".\"${PV}\".sum")
URLVER="$(echo "${PV}" | cut -d'.' -f1,2)"
[ "${PRODUCTVER}" != "${URLVER}" ] && PRODUCTVER="${URLVER}"
writeConfigKey "productver" "${PRODUCTVER}" "${USER_CONFIG_FILE}"
[ -n "${PAT_URL}" ] && [ -n "${PAT_HASH}" ] && VALID="true" && break
fi
done
if [ -z "${PAT_URL}" ] || [ -z "${PAT_HASH}" ]; then
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://auxxxilium.tech/wiki/arc-loader-arc-loader/url-hash-liste"
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=$? RET=$?
[ ${RET} -ne 0 ] && return [ ${RET} -eq 0 ] # ok-button
PV=$(cat ${TMP_PATH}/resp) return 1 # 1 or 255 # cancel-button or ESC
PAT_URL=$(echo "${PJ}" | jq -r ".\"${PV}\".url") PAT_URL="$(cat "${TMP_PATH}/resp" | sed -n '1p')"
PAT_HASH=$(echo "${PJ}" | jq -r ".\"${PV}\".sum") PAT_HASH="$(cat "${TMP_PATH}/resp" | sed -n '2p')"
URLVER="$(echo "${PV}" | cut -d'.' -f1,2)" [ -n "${PAT_URL}" ] && [ -n "${PAT_HASH}" ] && VALID="true"
[ "${PRODUCTVER}" != "${URLVER}" ] && PRODUCTVER="${URLVER}"
writeConfigKey "productver" "${PRODUCTVER}" "${USER_CONFIG_FILE}"
[ -n "${PAT_URL}" ] && [ -n "${PAT_HASH}" ] && VALID="true" && break
fi fi
done
if [ -z "${PAT_URL}" ] || [ -z "${PAT_HASH}" ]; then
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://auxxxilium.tech/wiki/arc-loader-arc-loader/url-hash-liste"
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=$?
[ ${RET} -eq 0 ] # ok-button
return 1 # 1 or 255 # cancel-button or ESC
PAT_URL="$(cat "${TMP_PATH}/resp" | sed -n '1p')"
PAT_HASH="$(cat "${TMP_PATH}/resp" | sed -n '2p')"
[ -n "${PAT_URL}" ] && [ -n "${PAT_HASH}" ] && VALID="true"
fi fi
elif [ "${AUTOMATED}" == "true" ]; then elif [ "${AUTOMATED}" == "true" ]; then
PAT_URL="$(readConfigKey "paturl" "${USER_CONFIG_FILE}")" PAT_URL="$(readConfigKey "paturl" "${USER_CONFIG_FILE}")"
@ -361,13 +349,13 @@ function arcVersion() {
# Cleanup # Cleanup
mkdir -p "${USER_UP_PATH}" mkdir -p "${USER_UP_PATH}"
DSM_FILE="${USER_UP_PATH}/${PAT_HASH}.tar" 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 # Write new PAT Data to Config
writeConfigKey "paturl" "${PAT_URL}" "${USER_CONFIG_FILE}" writeConfigKey "paturl" "${PAT_URL}" "${USER_CONFIG_FILE}"
writeConfigKey "pathash" "${PAT_HASH}" "${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 "${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 "${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 fi
if [ ! -f "${DSM_FILE}" ] && [ "${OFFLINE}" == "false" ] && [ "${VALID}" == "true" ]; then if [ ! -f "${DSM_FILE}" ] && [ "${OFFLINE}" == "false" ] && [ "${VALID}" == "true" ]; then
dialog --backtitle "$(backtitle)" --colors --title "DSM Version" \ dialog --backtitle "$(backtitle)" --colors --title "DSM Version" \
@ -399,11 +387,7 @@ function arcVersion() {
fi fi
elif [ ! -f "${DSM_FILE}" ] && [ "${OFFLINE}" == "true" ] && [ "${AUTOMATED}" == "false" ]; then elif [ ! -f "${DSM_FILE}" ] && [ "${OFFLINE}" == "true" ] && [ "${AUTOMATED}" == "false" ]; then
PAT_FILE=$(ls ${USER_UP_PATH}/*.pat | head -n 1) PAT_FILE=$(ls ${USER_UP_PATH}/*.pat | head -n 1)
if [ -f "${ORI_ZIMAGE_FILE}" ] && [ -f "${ORI_RDGZ_FILE}" ]; then if [ ! -f "${PAT_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
mkdir -p "${USER_UP_PATH}" mkdir -p "${USER_UP_PATH}"
# Get new Files # Get new Files
MSG="" MSG=""
@ -452,9 +436,16 @@ function arcVersion() {
sleep 5 sleep 5
fi fi
# Copy DSM Files to Locations # 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 # Cleanup
[ -d "${UNTAR_PAT_PATH}" ] && rm -rf "${UNTAR_PAT_PATH}" [ -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 if [ "${VALID}" == "true" ] && [ -f "${ORI_ZIMAGE_FILE}" ] && [ -f "${ORI_RDGZ_FILE}" ]; then
dialog --backtitle "$(backtitle)" --title "Arc Config" \ dialog --backtitle "$(backtitle)" --title "Arc Config" \
--infobox "Reconfiguring Addons, Cmdline, Modules and Synoinfo" 3 60 --infobox "Reconfiguring Addons, Cmdline, Modules and Synoinfo" 3 60
@ -472,16 +463,13 @@ function arcVersion() {
done < <(readConfigMap "addons" "${USER_CONFIG_FILE}") done < <(readConfigMap "addons" "${USER_CONFIG_FILE}")
# Reset Modules # Reset Modules
KVER="$(readConfigKey "platforms.${PLATFORM}.productvers.\"${PRODUCTVER}\".kver" "${P_FILE}")" KVER="$(readConfigKey "platforms.${PLATFORM}.productvers.\"${PRODUCTVER}\".kver" "${P_FILE}")"
# Modify KVER for Epyc7002
[ "${PLATFORM}" == "epyc7002" ] && KVERP="${PRODUCTVER}-${KVER}" || KVERP="${KVER}" [ "${PLATFORM}" == "epyc7002" ] && KVERP="${PRODUCTVER}-${KVER}" || KVERP="${KVER}"
# Rewrite modules
writeConfigKey "modules" "{}" "${USER_CONFIG_FILE}" writeConfigKey "modules" "{}" "${USER_CONFIG_FILE}"
while read -r ID DESC; do while read -r ID DESC; do
writeConfigKey "modules.\"${ID}\"" "" "${USER_CONFIG_FILE}" writeConfigKey "modules.\"${ID}\"" "" "${USER_CONFIG_FILE}"
done < <(getAllModules "${PLATFORM}" "${KVERP}") done < <(getAllModules "${PLATFORM}" "${KVERP}")
# Check for Only Version # Check for Only Version
if [ "${ONLYVERSION}" == "true" ]; then if [ "${ONLYVERSION}" == "true" ]; then
# Build isn't done
writeConfigKey "arc.builddone" "false" "${USER_CONFIG_FILE}" writeConfigKey "arc.builddone" "false" "${USER_CONFIG_FILE}"
BUILDDONE="$(readConfigKey "arc.builddone" "${USER_CONFIG_FILE}")" BUILDDONE="$(readConfigKey "arc.builddone" "${USER_CONFIG_FILE}")"
ONLYVERSION="false" ONLYVERSION="false"
@ -505,7 +493,6 @@ function arcPatch() {
# Read Model Values # Read Model Values
PLATFORM="$(readConfigKey "platform" "${USER_CONFIG_FILE}")" PLATFORM="$(readConfigKey "platform" "${USER_CONFIG_FILE}")"
MODEL="$(readConfigKey "model" "${USER_CONFIG_FILE}")" MODEL="$(readConfigKey "model" "${USER_CONFIG_FILE}")"
AUTOMATED="$(readConfigKey "automated" "${USER_CONFIG_FILE}")"
ARCCONF="$(readConfigKey "${MODEL}.serial" "${S_FILE}" 2>/dev/null)" ARCCONF="$(readConfigKey "${MODEL}.serial" "${S_FILE}" 2>/dev/null)"
# Check for Custom Build # Check for Custom Build
SN="$(readConfigKey "sn" "${USER_CONFIG_FILE}")" SN="$(readConfigKey "sn" "${USER_CONFIG_FILE}")"
@ -591,7 +578,6 @@ function arcPatch() {
function arcSettings() { function arcSettings() {
PLATFORM="$(readConfigKey "platform" "${USER_CONFIG_FILE}")" PLATFORM="$(readConfigKey "platform" "${USER_CONFIG_FILE}")"
DT="$(readConfigKey "platforms.${PLATFORM}.dt" "${P_FILE}")" DT="$(readConfigKey "platforms.${PLATFORM}.dt" "${P_FILE}")"
AUTOMATED="$(readConfigKey "automated" "${USER_CONFIG_FILE}")"
# Get Network Config for Loader # Get Network Config for Loader
dialog --backtitle "$(backtitle)" --colors --title "Network Config" \ dialog --backtitle "$(backtitle)" --colors --title "Network Config" \
--infobox "Generating Network Config..." 3 40 --infobox "Generating Network Config..." 3 40
@ -599,7 +585,6 @@ function arcSettings() {
getnet getnet
[ $? -ne 0 ] && return 1 [ $? -ne 0 ] && return 1
if [ "${ONLYPATCH}" == "true" ]; then if [ "${ONLYPATCH}" == "true" ]; then
# Build isn't done
writeConfigKey "arc.builddone" "false" "${USER_CONFIG_FILE}" writeConfigKey "arc.builddone" "false" "${USER_CONFIG_FILE}"
BUILDDONE="$(readConfigKey "arc.builddone" "${USER_CONFIG_FILE}")" BUILDDONE="$(readConfigKey "arc.builddone" "${USER_CONFIG_FILE}")"
ONLYPATCH="false" ONLYPATCH="false"
@ -623,9 +608,8 @@ function arcSettings() {
initConfigKey "addons.storagepanel" "" "${USER_CONFIG_FILE}" initConfigKey "addons.storagepanel" "" "${USER_CONFIG_FILE}"
addonSelection addonSelection
[ $? -ne 0 ] && return 1 [ $? -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 if [ "${CPUFREQ}" == "true" ] && readConfigMap "addons" "${USER_CONFIG_FILE}" | grep -q "cpufreqscaling"; then
# Select Governor for DSM
initConfigKey "addons.cpufreqscaling" "" "${USER_CONFIG_FILE}" initConfigKey "addons.cpufreqscaling" "" "${USER_CONFIG_FILE}"
dialog --backtitle "$(backtitle)" --colors --title "CPU Frequency Scaling" \ dialog --backtitle "$(backtitle)" --colors --title "CPU Frequency Scaling" \
--infobox "Generating Governor Table..." 3 40 --infobox "Generating Governor Table..." 3 40
@ -675,7 +659,7 @@ function arcSettings() {
# Max Memory for DSM # Max Memory for DSM
RAMCONFIG="$((${RAMTOTAL} * 1024))" RAMCONFIG="$((${RAMTOTAL} * 1024))"
writeConfigKey "synoinfo.mem_max_mb" "${RAMCONFIG}" "${USER_CONFIG_FILE}" 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 # Config is done
writeConfigKey "arc.confdone" "true" "${USER_CONFIG_FILE}" writeConfigKey "arc.confdone" "true" "${USER_CONFIG_FILE}"
CONFDONE="$(readConfigKey "arc.confdone" "${USER_CONFIG_FILE}")" CONFDONE="$(readConfigKey "arc.confdone" "${USER_CONFIG_FILE}")"
@ -732,14 +716,12 @@ function arcSummary() {
fi fi
DIRECTBOOT="$(readConfigKey "directboot" "${USER_CONFIG_FILE}")" DIRECTBOOT="$(readConfigKey "directboot" "${USER_CONFIG_FILE}")"
KERNELLOAD="$(readConfigKey "kernelload" "${USER_CONFIG_FILE}")" KERNELLOAD="$(readConfigKey "kernelload" "${USER_CONFIG_FILE}")"
OFFLINE="$(readConfigKey "arc.offline" "${USER_CONFIG_FILE}")"
HDDSORT="$(readConfigKey "hddsort" "${USER_CONFIG_FILE}")" HDDSORT="$(readConfigKey "hddsort" "${USER_CONFIG_FILE}")"
NIC="$(readConfigKey "device.nic" "${USER_CONFIG_FILE}")" NIC="$(readConfigKey "device.nic" "${USER_CONFIG_FILE}")"
EXTERNALCONTROLLER="$(readConfigKey "device.externalcontroller" "${USER_CONFIG_FILE}")" EXTERNALCONTROLLER="$(readConfigKey "device.externalcontroller" "${USER_CONFIG_FILE}")"
HARDDRIVES="$(readConfigKey "device.harddrives" "${USER_CONFIG_FILE}")" HARDDRIVES="$(readConfigKey "device.harddrives" "${USER_CONFIG_FILE}")"
DRIVES="$(readConfigKey "device.drives" "${USER_CONFIG_FILE}")" DRIVES="$(readConfigKey "device.drives" "${USER_CONFIG_FILE}")"
EMMCBOOT="$(readConfigKey "emmcboot" "${USER_CONFIG_FILE}")" EMMCBOOT="$(readConfigKey "emmcboot" "${USER_CONFIG_FILE}")"
OFFLINE="$(readConfigKey "arc.offline" "${USER_CONFIG_FILE}")"
KERNEL="$(readConfigKey "kernel" "${USER_CONFIG_FILE}")" KERNEL="$(readConfigKey "kernel" "${USER_CONFIG_FILE}")"
if [ "${DT}" == "false" ] && [ "${REMAP}" == "user" ]; then if [ "${DT}" == "false" ] && [ "${REMAP}" == "user" ]; then
if [ -z "${PORTMAP}" ] && [ -z "${DISKMAP}"] && [ -z "${PORTREMAP}" ] && [ -z "${AHCIPORTREMAP}" ]; then if [ -z "${PORTMAP}" ] && [ -z "${DISKMAP}"] && [ -z "${PORTREMAP}" ] && [ -z "${AHCIPORTREMAP}" ]; then
@ -809,7 +791,6 @@ function make() {
PLATFORM="$(readConfigKey "platform" "${USER_CONFIG_FILE}")" PLATFORM="$(readConfigKey "platform" "${USER_CONFIG_FILE}")"
PRODUCTVER="$(readConfigKey "productver" "${USER_CONFIG_FILE}")" PRODUCTVER="$(readConfigKey "productver" "${USER_CONFIG_FILE}")"
DT="$(readConfigKey "platforms.${PLATFORM}.dt" "${P_FILE}")" DT="$(readConfigKey "platforms.${PLATFORM}.dt" "${P_FILE}")"
AUTOMATED="$(readConfigKey "automated" "${USER_CONFIG_FILE}")"
CONFDONE="$(readConfigKey "arc.confdone" "${USER_CONFIG_FILE}")" CONFDONE="$(readConfigKey "arc.confdone" "${USER_CONFIG_FILE}")"
if [ -f "${ORI_ZIMAGE_FILE}" ] && [ -f "${ORI_RDGZ_FILE}" ] && [ "${CONFDONE}" == "true" ]; then if [ -f "${ORI_ZIMAGE_FILE}" ] && [ -f "${ORI_RDGZ_FILE}" ] && [ "${CONFDONE}" == "true" ]; then
( (
@ -1171,10 +1152,10 @@ else
x) backupMenu; NEXT="x" ;; x) backupMenu; NEXT="x" ;;
M) arcNIC; NEXT="M" ;; M) arcNIC; NEXT="M" ;;
9) [ "${OFFLINE}" == "true" ] && OFFLINE='false' || OFFLINE='true' 9) [ "${OFFLINE}" == "true" ] && OFFLINE='false' || OFFLINE='true'
[ "${OFFLINE}" == "false" ] && ntpCheck
offlineCheck "${OFFLINE}" offlineCheck "${OFFLINE}"
ARCNIC="$(readConfigKey "arc.nic" "${USER_CONFIG_FILE}")" ARCNIC="$(readConfigKey "arc.nic" "${USER_CONFIG_FILE}")"
OFFLINE="$(readConfigKey "arc.offline" "${USER_CONFIG_FILE}")" OFFLINE="$(readConfigKey "arc.offline" "${USER_CONFIG_FILE}")"
. ${ARC_PATH}/include/network.sh
NEXT="9" NEXT="9"
;; ;;
y) keymapMenu; NEXT="y" ;; y) keymapMenu; NEXT="y" ;;

View File

@ -351,7 +351,7 @@ def getmodelsoffline(platforms=None):
PS = [] PS = []
models = [] 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) data = json.load(user_file)
for I in data["channel"]["item"]: for I in data["channel"]["item"]:

View File

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