tree: rework

Signed-off-by: AuxXxilium <info@auxxxilium.tech>
This commit is contained in:
AuxXxilium 2024-10-30 19:56:11 +01:00
parent b6c0b24b70
commit 3295073c99
5 changed files with 310 additions and 233 deletions

View File

@ -992,6 +992,7 @@ function sysinfo() {
TEXT+="\n Subversion: \ZbAddons ${ADDONSVERSION} | Configs ${CONFIGSVERSION} | LKM ${LKMVERSION} | Modules ${MODULESVERSION} | Patches ${PATCHESVERSION}\Zn"
TEXT+="\n Config | Build: \Zb${CONFDONE} | ${BUILDDONE}\Zn"
TEXT+="\n Config Version: \Zb${CONFIGVER}\Zn"
[ "${ARCOFFLINE}" == "true" ] && TEXT+="\n Offline Mode: \Zb${ARCOFFLINE}\Zn"
if [ "${CONFDONE}" == "true" ]; then
TEXT+="\n\Z4> DSM ${PRODUCTVER} (${BUILDNUM}): ${MODELID:-${MODEL}}\Zn"
TEXT+="\n Kernel | LKM: \Zb${KVER} | ${LKM}\Zn"
@ -1196,30 +1197,34 @@ function networkdiag() {
dnsserver=$(cat /etc/resolv.conf | grep nameserver | awk '{print $2}')
echo -e "DNS Server:\n${dnsserver}"
echo
websites=("google.com" "github.com" "auxxxilium.tech")
for website in "${websites[@]}"; do
if ping -I ${ETH} -c 1 "${website}" &> /dev/null; then
echo -e "Connection to ${website} is successful."
else
echo -e "Connection to ${website} failed."
fi
done
echo
GITHUBAPI=$(curl --interface ${ETH} -skL "https://api.github.com/repos/AuxXxilium/arc/releases" | jq -r ".[].tag_name" | grep -v "dev" | sort -rV | head -1 2>/dev/null)
if [[ $? -ne 0 || -z "${GITHUBAPI}" ]]; then
echo -e "Github API not reachable!"
if [ "${ARCOFFLINE}" == "true" ]; then
echo -e "Offline Mode: ${ARCOFFLINE}"
else
echo -e "Github API reachable!"
fi
if [ "${CONFDONE}" == "true" ]; then
SYNOAPI=$(curl --interface ${ETH} -m 3 -skL "https://www.synology.com/api/support/findDownloadInfo?lang=en-us&product=${MODEL/+/%2B}&major=${PRODUCTVER%%.*}&minor=${PRODUCTVER##*.}" | jq -r '.info.system.detail[0].items[0].files[0].url')
if [[ $? -ne 0 || -z "${SYNOAPI}" ]]; then
echo -e "Syno API not reachable!"
websites=("google.com" "github.com" "auxxxilium.tech")
for website in "${websites[@]}"; do
if ping -I ${ETH} -c 1 "${website}" &> /dev/null; then
echo -e "Connection to ${website} is successful."
else
echo -e "Connection to ${website} failed."
fi
done
echo
GITHUBAPI=$(curl --interface ${ETH} -skL "https://api.github.com/repos/AuxXxilium/arc/releases" | jq -r ".[].tag_name" | grep -v "dev" | sort -rV | head -1 2>/dev/null)
if [[ $? -ne 0 || -z "${GITHUBAPI}" ]]; then
echo -e "Github API not reachable!"
else
echo -e "Syno API reachable!"
echo -e "Github API reachable!"
fi
if [ "${CONFDONE}" == "true" ]; then
SYNOAPI=$(curl --interface ${ETH} -m 3 -skL "https://www.synology.com/api/support/findDownloadInfo?lang=en-us&product=${MODEL/+/%2B}&major=${PRODUCTVER%%.*}&minor=${PRODUCTVER##*.}" | jq -r '.info.system.detail[0].items[0].files[0].url')
if [[ $? -ne 0 || -z "${SYNOAPI}" ]]; then
echo -e "Syno API not reachable!"
else
echo -e "Syno API reachable!"
fi
else
echo -e "For Syno API Checks you need to configure Loader first!"
fi
else
echo -e "For Syno API Checks you need to configure Loader first!"
fi
done
) 2>&1 | dialog --backtitle "$(backtitle)" --colors --title "Networkdiag" \
@ -1243,12 +1248,17 @@ function credits() {
TEXT+="\n\Z4>> Based on:\Zn"
TEXT+="\n Redpill: \ZbTTG / Pocopico\Zn"
TEXT+="\n ARPL/RR: \Zbfbelavenuto / wjz304\Zn"
TEXT+="\n Others: \Zb007revad / more...\Zn"
TEXT+="\n System: \ZbBuildroot 2023.08.x / 2024.02.x\Zn"
TEXT+="\n DSM: \ZbSynology Inc.\Zn"
TEXT+="\n"
TEXT+="\n\Z4>> Note:\Zn"
TEXT+="\n Arc and all non encoded Parts are OpenSource."
TEXT+="\n Arc and all not encrypted Parts are OpenSource."
TEXT+="\n The encrypted Parts and DSM are licensed to"
TEXT+="\n Synology Inc. and are not under GPL!"
TEXT+="\n"
TEXT+="\n Commercial use is not permitted!"
TEXT+="\n"
TEXT+="\n This Loader is FREE and it is forbidden"
TEXT+="\n to sell Arc or Parts of it."
TEXT+="\n"

View File

@ -68,7 +68,11 @@ function backtitle() {
BACKTITLE+="Config: ${CONFDONE} | "
BACKTITLE+="Build: ${BUILDDONE} | "
BACKTITLE+="${MACHINE}(${BUS}) | "
BACKTITLE+="KB: ${KEYMAP}"
if [ -n "${KEYMAP}" ]; then
BACKTITLE+="KB: ${KEYMAP}"
elif [ "${ARCOFFLINE}" == "true" ]; then
BACKTITLE+="Offline"
fi
echo "${BACKTITLE}"
}
@ -708,12 +712,12 @@ function arcSummary() {
}
###############################################################################
# Building Loader Online
# Building Loader
function make() {
ARCCONF="$(readConfigKey "${MODEL}.serial" "${S_FILE}" 2>/dev/null)"
SN="$(readConfigKey "sn" "${USER_CONFIG_FILE}")"
BOOTMODE="$(readConfigKey "arc.mode" "${USER_CONFIG_FILE}")"
if [ "${BOOTMODE}" != "automated" ] && [[ "${ARCPATCH}" != "true" || -z "${ARCCONF}" ]]; then
if [ "${BOOTMODE}" != "automated" ] && [ "${ARCOFFLINE}" != "true" ] && [[ "${ARCPATCH}" != "true" || -z "${ARCCONF}" ]]; then
if ! curl -skL "https://auxxxilium.tech/check.yml" -o "${TMP_PATH}/check.yml" 2>/dev/null; then
SN=$(generateSerial "${MODEL}" "false")
else
@ -847,8 +851,15 @@ function boot() {
# Main loop
# Check for Arc Mode
if [ "${ARCMODE}" == "update" ]; then
UPDATEMODE="true"
arcUpdate
if [ "${ARCOFFLINE}" != "true" ]; then
UPDATEMODE="true"
arcUpdate
else
dialog --backtitle "$(backtitle)" --title "Arc Update" \
--infobox "Update is not possible in Offline Mode!" 5 40
sleep 3
exec reboot
fi
elif [ "${ARCMODE}" == "automated" ]; then
# Check for Custom Build
if [ "${BUILDDONE}" == "false" ] || [ "${MODEL}" != "${MODELID}" ]; then
@ -866,7 +877,7 @@ else
fi
while true; do
echo "= \"\Z4========== Main ==========\Zn \" " >"${TMP_PATH}/menu"
if [ -z "${ARCCONF}" ]; then
if [ -z "${ARCCONF}" ] && [ "${ARCOFFLINE}" != "true" ]; then
echo "0 \"Enable Arc Patch\" " >>"${TMP_PATH}/menu"
fi
echo "1 \"Choose Model \" " >>"${TMP_PATH}/menu"
@ -971,7 +982,7 @@ else
fi
echo "= \"\Z4========== Misc ==========\Zn \" " >>"${TMP_PATH}/menu"
echo "x \"Backup/Restore/Recovery \" " >>"${TMP_PATH}/menu"
echo "z \"Update Menu \" " >>"${TMP_PATH}/menu"
[ "${ARCOFFLINE}" != "true" ] && echo "z \"Update Menu \" " >>"${TMP_PATH}/menu"
echo "I \"Power/Service Menu \" " >>"${TMP_PATH}/menu"
echo "V \"Credits \" " >>"${TMP_PATH}/menu"

View File

@ -5,10 +5,10 @@ PART3_PATH="/mnt/p3"
TMP_PATH="/tmp"
if [ -f "${PART1_PATH}/ARC-BRANCH" ]; then
ARC_BRANCH=$(cat "${PART1_PATH}/ARC-BRANCH")
ARC_BRANCH=$(cat "${PART1_PATH}/ARC-BRANCH" 2>/dev/null)
fi
if [ -f "${PART1_PATH}/ARC-VERSION" ]; then
ARC_VERSION=$(cat "${PART1_PATH}/ARC-VERSION")
ARC_VERSION=$(cat "${PART1_PATH}/ARC-VERSION" 2>/dev/null)
fi
ARC_TITLE="Arc ${ARC_VERSION}"

View File

@ -517,7 +517,7 @@ function ntpCheck() {
if [ "${KEYMAP}" == "ua" ] || [ "${REGION}" == "Kyiv" ] || [ "${REGION}" == "Kiev" ]; then
poweroff
fi
if echo "${ARC_VERSION}" | grep -v "dev"; then
if [ $(echo "${ARC_VERSION}" | grep "dev" | wc -l) -eq 0 ]; then
while true; do
NEWTAG="$(curl -m 5 -skL "https://api.github.com/repos/AuxXxilium/arc/releases" | jq -r ".[].tag_name" | grep -v "dev" | sort -rV | head -1)"
CNT=$((${CNT} + 1))
@ -529,7 +529,7 @@ function ntpCheck() {
break
fi
done
else
elif [ $(echo "${ARC_VERSION}" | grep "dev" | wc -l) -gt 0 ]; then
while true; do
NEWTAG="$(curl -m 5 -skL "https://api.github.com/repos/AuxXxilium/arc/releases" | jq -r ".[].tag_name" | grep "dev" | sort -rV | head -1)"
CNT=$((${CNT} + 1))

View File

@ -19,27 +19,37 @@ function updateLoader() {
done
fi
if [ -n "${TAG}" ]; then
(
echo "Downloading ${TAG}"
local URL="https://github.com/AuxXxilium/arc/releases/download/${TAG}/update-${TAG}-${ARC_BRANCH}.zip"
curl -#kL "${URL}" -o "${TMP_PATH}/update.zip" 2>&1 | while IFS= read -r -n1 char; do
[[ $char =~ [0-9] ]] && keep=1 ;
[[ $char == % ]] && echo "$progress%" && progress="" && keep=0 ;
[[ $keep == 1 ]] && progress="$progress$char" ;
done
if [ -f "${TMP_PATH}/update.zip" ] && [ $(ls -s "${TMP_PATH}/update.zip" | cut -d' ' -f1) -gt 300000 ]; then
echo -e "Downloading ${TAG}-${ARC_BRANCH} Loader successful!\nUpdating Loader..."
if unzip -oq "${TMP_PATH}/update.zip" -d "/mnt"; then
echo "Successful!"
sleep 2
else
updateFailed
fi
export URL="https://github.com/AuxXxilium/arc/releases/download/${TAG}/update-${TAG}-${ARC_BRANCH}.zip"
export TAG="${TAG}"
{
curl -kL "$URL" -o ${TMP_PATH}/update.zip 2>&1 |
perl -C -lane '
BEGIN {$header = "Downloading $ENV{TAG}...\n\n"; $| = 1}
$pcent = $F[0];
$_ = join "", unpack("x3 a7 x4 a9 x8 a9 x7 a*") if length > 20;
s/ /\xa0/g;
if ($. <= 3) {
$header .= "$_\n";
$/ = "\r" if $. == 2
} else {
print "XXX\n$pcent\n$header$_\nXXX"
}' |
dialog --backtitle "$(backtitle)" --title "Update Loader" \
--gauge "Download Loader: $TAG ..." 14 72
}
if [ -f "${TMP_PATH}/update.zip" ] && [ $(ls -s "${TMP_PATH}/update.zip" | cut -d' ' -f1) -gt 300000 ]; then
dialog --backtitle "$(backtitle)" --title "Update Loader" \
--infobox "Updating Loader..." 3 50
if unzip -oq "${TMP_PATH}/update.zip" -d "/mnt"; then
dialog --backtitle "$(backtitle)" --title "Update Loader" \
--infobox "Update successful!" 3 50
sleep 2
else
updateFailed
fi
) 2>&1 | dialog --backtitle "$(backtitle)" --title "System" \
--progressbox "Update ${ARC_BRANCH} Loader..." 20 70
else
updateFailed
fi
fi
return 0
}
@ -58,38 +68,47 @@ function updateAddons() {
idx=$((${idx} + 1))
done
if [ -n "${TAG}" ] && [ "${ADDONSVERSION}" != "${TAG}" ]; then
(
echo "Downloading ${TAG}"
local URL="https://github.com/AuxXxilium/arc-addons/releases/download/${TAG}/addons-${TAG}.zip"
curl -#kL "${URL}" -o "${TMP_PATH}/addons.zip" 2>&1 | while IFS= read -r -n1 char; do
[[ $char =~ [0-9] ]] && keep=1 ;
[[ $char == % ]] && echo "$progress%" && progress="" && keep=0 ;
[[ $keep == 1 ]] && progress="$progress$char" ;
done
if [ -f "${TMP_PATH}/addons.zip" ]; then
rm -rf "${ADDONS_PATH}"
mkdir -p "${ADDONS_PATH}"
echo "Installing new Addons..."
if unzip -oq "${TMP_PATH}/addons.zip" -d "${ADDONS_PATH}"; then
rm -f "${TMP_PATH}/addons.zip"
for F in $(ls ${ADDONS_PATH}/*.addon 2>/dev/null); do
ADDON=$(basename "${F}" | sed 's|.addon||')
rm -rf "${ADDONS_PATH}/${ADDON}"
mkdir -p "${ADDONS_PATH}/${ADDON}"
tar -xaf "${F}" -C "${ADDONS_PATH}/${ADDON}"
rm -f "${F}"
done
echo "Successful!"
else
updateFailed
fi
export URL="https://github.com/AuxXxilium/arc-addons/releases/download/${TAG}/addons-${TAG}.zip"
export TAG="${TAG}"
{
curl -kL "$URL" -o ${TMP_PATH}/addons.zip 2>&1 |
perl -C -lane '
BEGIN {$header = "Downloading $ENV{TAG}...\n\n"; $| = 1}
$pcent = $F[0];
$_ = join "", unpack("x3 a7 x4 a9 x8 a9 x7 a*") if length > 20;
s/ /\xa0/g;
if ($. <= 3) {
$header .= "$_\n";
$/ = "\r" if $. == 2
} else {
print "XXX\n$pcent\n$header$_\nXXX"
}' |
dialog --backtitle "$(backtitle)" --title "Update Addons" \
--gauge "Download Addons: $TAG ..." 14 72
}
if [ -f "${TMP_PATH}/addons.zip" ]; then
rm -rf "${ADDONS_PATH}"
mkdir -p "${ADDONS_PATH}"
dialog --backtitle "$(backtitle)" --title "Update Addons" \
--infobox "Updating Addons..." 3 50
if unzip -oq "${TMP_PATH}/addons.zip" -d "${ADDONS_PATH}"; then
rm -f "${TMP_PATH}/addons.zip"
for F in $(ls ${ADDONS_PATH}/*.addon 2>/dev/null); do
ADDON=$(basename "${F}" | sed 's|.addon||')
rm -rf "${ADDONS_PATH}/${ADDON}"
mkdir -p "${ADDONS_PATH}/${ADDON}"
tar -xaf "${F}" -C "${ADDONS_PATH}/${ADDON}"
rm -f "${F}"
done
dialog --backtitle "$(backtitle)" --title "Update Addons" \
--infobox "Update successful!" 3 50
sleep 2
else
echo "Error downloading new Version!"
sleep 5
updateFailed
fi
) 2>&1 | dialog --backtitle "$(backtitle)" --title "Addons" \
--progressbox "Update Addons..." 20 70
else
updateFailed
fi
fi
return 0
}
@ -108,31 +127,40 @@ function updatePatches() {
idx=$((${idx} + 1))
done
if [ -n "${TAG}" ] && [ "${PATCHESVERSION}" != "${TAG}" ]; then
(
local URL="https://github.com/AuxXxilium/arc-patches/releases/download/${TAG}/patches-${TAG}.zip"
echo "Downloading ${TAG}"
curl -#kL "${URL}" -o "${TMP_PATH}/patches.zip" 2>&1 | while IFS= read -r -n1 char; do
[[ $char =~ [0-9] ]] && keep=1 ;
[[ $char == % ]] && echo "$progress%" && progress="" && keep=0 ;
[[ $keep == 1 ]] && progress="$progress$char" ;
done
if [ -f "${TMP_PATH}/patches.zip" ]; then
rm -rf "${PATCH_PATH}"
mkdir -p "${PATCH_PATH}"
echo "Installing new Patches..."
if unzip -oq "${TMP_PATH}/patches.zip" -d "${PATCH_PATH}"; then
rm -f "${TMP_PATH}/patches.zip"
echo "Successful!"
else
updateFailed
fi
export URL="https://github.com/AuxXxilium/arc-patches/releases/download/${TAG}/patches-${TAG}.zip"
export TAG="${TAG}"
{
curl -kL "$URL" -o ${TMP_PATH}/patches.zip 2>&1 |
perl -C -lane '
BEGIN {$header = "Downloading $ENV{TAG}...\n\n"; $| = 1}
$pcent = $F[0];
$_ = join "", unpack("x3 a7 x4 a9 x8 a9 x7 a*") if length > 20;
s/ /\xa0/g;
if ($. <= 3) {
$header .= "$_\n";
$/ = "\r" if $. == 2
} else {
print "XXX\n$pcent\n$header$_\nXXX"
}' |
dialog --backtitle "$(backtitle)" --title "Update Patches" \
--gauge "Download Patches: $TAG ..." 14 72
}
if [ -f "${TMP_PATH}/patches.zip" ]; then
rm -rf "${PATCH_PATH}"
mkdir -p "${PATCH_PATH}"
dialog --backtitle "$(backtitle)" --title "Update Patches" \
--infobox "Updating Patches..." 3 50
if unzip -oq "${TMP_PATH}/patches.zip" -d "${PATCH_PATH}"; then
rm -f "${TMP_PATH}/patches.zip"
dialog --backtitle "$(backtitle)" --title "Update Patches" \
--infobox "Update successful!" 3 50
sleep 2
else
echo "Error downloading new Version!"
sleep 5
updateFailed
fi
) 2>&1 | dialog --backtitle "$(backtitle)" --title "Patches" \
--progressbox "Update Patches..." 20 70
else
updateFailed
fi
fi
return 0
}
@ -151,31 +179,40 @@ function updateCustom() {
idx=$((${idx} + 1))
done
if [ -n "${TAG}" ] && [ "${CUSTOMVERSION}" != "${TAG}" ]; then
(
local URL="https://github.com/AuxXxilium/arc-custom/releases/download/${TAG}/custom-${TAG}.zip"
echo "Downloading ${TAG}"
curl -#kL "${URL}" -o "${TMP_PATH}/custom.zip" 2>&1 | while IFS= read -r -n1 char; do
[[ $char =~ [0-9] ]] && keep=1 ;
[[ $char == % ]] && echo "$progress%" && progress="" && keep=0 ;
[[ $keep == 1 ]] && progress="$progress$char" ;
done
if [ -f "${TMP_PATH}/custom.zip" ]; then
rm -rf "${CUSTOM_PATH}"
mkdir -p "${CUSTOM_PATH}"
echo "Installing new Custom Kernel..."
if unzip -oq "${TMP_PATH}/custom.zip" -d "${CUSTOM_PATH}"; then
rm -f "${TMP_PATH}/custom.zip"
echo "Successful!"
else
updateFailed
fi
export URL="https://github.com/AuxXxilium/arc-custom/releases/download/${TAG}/custom-${TAG}.zip"
export TAG="${TAG}"
{
curl -kL "$URL" -o ${TMP_PATH}/custom.zip 2>&1 |
perl -C -lane '
BEGIN {$header = "Downloading $ENV{TAG}...\n\n"; $| = 1}
$pcent = $F[0];
$_ = join "", unpack("x3 a7 x4 a9 x8 a9 x7 a*") if length > 20;
s/ /\xa0/g;
if ($. <= 3) {
$header .= "$_\n";
$/ = "\r" if $. == 2
} else {
print "XXX\n$pcent\n$header$_\nXXX"
}' |
dialog --backtitle "$(backtitle)" --title "Update Custom Kernel" \
--gauge "Download Custom Kernel: $TAG ..." 14 72
}
if [ -f "${TMP_PATH}/custom.zip" ]; then
rm -rf "${CUSTOM_PATH}"
mkdir -p "${CUSTOM_PATH}"
dialog --backtitle "$(backtitle)" --title "Update Custom Kernel" \
--infobox "Updating Custom Kernel..." 3 50
if unzip -oq "${TMP_PATH}/custom.zip" -d "${CUSTOM_PATH}"; then
rm -f "${TMP_PATH}/custom.zip"
dialog --backtitle "$(backtitle)" --title "Update Custom Kernel" \
--infobox "Update successful!" 3 50
sleep 2
else
echo "Error downloading new Version!"
sleep 5
updateFailed
fi
) 2>&1 | dialog --backtitle "$(backtitle)" --title "Custom" \
--progressbox "Update Custom..." 20 70
else
updateFailed
fi
fi
return 0
}
@ -198,39 +235,52 @@ function updateModules() {
idx=$((${idx} + 1))
done
if [ -n "${TAG}" ] && [[ "${MODULESVERSION}" != "${TAG}" || ! -f "${MODULES_PATH}/${PLATFORM}-${KVERP}.tgz" ]]; then
(
rm -rf "${MODULES_PATH}"
mkdir -p "${MODULES_PATH}"
local URL="https://github.com/AuxXxilium/arc-modules/releases/download/${TAG}/modules-${TAG}.zip"
echo "Downloading Modules ${TAG}"
curl -#kL "${URL}" -o "${TMP_PATH}/modules.zip" 2>&1 | while IFS= read -r -n1 char; do
[[ $char =~ [0-9] ]] && keep=1 ;
[[ $char == % ]] && echo "$progress%" && progress="" && keep=0 ;
[[ $keep == 1 ]] && progress="$progress$char" ;
done
if [ -f "${TMP_PATH}/modules.zip" ]; then
echo "Installing new Modules..."
if unzip -oq "${TMP_PATH}/modules.zip" -d "${MODULES_PATH}"; then
rm -f "${TMP_PATH}/modules.zip"
echo "Successful!"
else
updateFailed
fi
rm -rf "${MODULES_PATH}"
mkdir -p "${MODULES_PATH}"
export URL="https://github.com/AuxXxilium/arc-modules/releases/download/${TAG}/modules-${TAG}.zip"
export TAG="${TAG}"
{
curl -kL "$URL" -o ${TMP_PATH}/modules.zip 2>&1 |
perl -C -lane '
BEGIN {$header = "Downloading $ENV{TAG}...\n\n"; $| = 1}
$pcent = $F[0];
$_ = join "", unpack("x3 a7 x4 a9 x8 a9 x7 a*") if length > 20;
s/ /\xa0/g;
if ($. <= 3) {
$header .= "$_\n";
$/ = "\r" if $. == 2
} else {
print "XXX\n$pcent\n$header$_\nXXX"
}' |
dialog --backtitle "$(backtitle)" --title "Update Modules" \
--gauge "Download Modules: $TAG ..." 14 72
}
if [ -f "${TMP_PATH}/modules.zip" ]; then
dialog --backtitle "$(backtitle)" --title "Update Modules" \
--infobox "Updating Modules..." 3 50
if unzip -oq "${TMP_PATH}/modules.zip" -d "${MODULES_PATH}"; then
rm -f "${TMP_PATH}/modules.zip"
dialog --backtitle "$(backtitle)" --title "Update Modules" \
--infobox "Update successful!" 3 50
sleep 2
else
echo "Error downloading new Version!"
sleep 5
updateFailed
fi
if [ -f "${MODULES_PATH}/${PLATFORM}-${KVERP}.tgz" ] && [ -f "${MODULES_PATH}/firmware.tgz" ]; then
writeConfigKey "modules" "{}" "${USER_CONFIG_FILE}"
echo "Rebuilding Modules..."
while read -r ID DESC; do
writeConfigKey "modules.${ID}" "" "${USER_CONFIG_FILE}"
done < <(getAllModules "${PLATFORM}" "${KVERP}")
echo "Successful!"
fi
) 2>&1 | dialog --backtitle "$(backtitle)" --title "Modules" \
--progressbox "Update Modules..." 20 70
else
updateFailed
fi
if [ -f "${MODULES_PATH}/${PLATFORM}-${KVERP}.tgz" ] && [ -f "${MODULES_PATH}/firmware.tgz" ]; then
dialog --backtitle "$(backtitle)" --title "Update Modules" \
--infobox "Rewrite Modules..." 3 50
sleep 2
writeConfigKey "modules" "{}" "${USER_CONFIG_FILE}"
while read -r ID DESC; do
writeConfigKey "modules.${ID}" "" "${USER_CONFIG_FILE}"
done < <(getAllModules "${PLATFORM}" "${KVERP}")
dialog --backtitle "$(backtitle)" --title "Update Modules" \
--infobox "Rewrite successful!" 3 50
sleep 2
fi
fi
return 0
}
@ -254,30 +304,39 @@ function updateConfigs() {
local TAG="${1}"
fi
if [ -n "${TAG}" ] && [ "${CONFIGSVERSION}" != "${TAG}" ]; then
(
local URL="https://github.com/AuxXxilium/arc-configs/releases/download/${TAG}/configs-${TAG}.zip"
echo "Downloading ${TAG}"
curl -#kL "${URL}" -o "${TMP_PATH}/configs.zip" 2>&1 | while IFS= read -r -n1 char; do
[[ $char =~ [0-9] ]] && keep=1 ;
[[ $char == % ]] && echo "$progress%" && progress="" && keep=0 ;
[[ $keep == 1 ]] && progress="$progress$char" ;
done
if [ -f "${TMP_PATH}/configs.zip" ]; then
mkdir -p "${MODEL_CONFIG_PATH}"
echo "Installing new Configs..."
if unzip -oq "${TMP_PATH}/configs.zip" -d "${MODEL_CONFIG_PATH}"; then
rm -f "${TMP_PATH}/configs.zip"
echo "Successful!"
else
updateFailed
fi
export URL="https://github.com/AuxXxilium/arc-configs/releases/download/${TAG}/configs-${TAG}.zip"
export TAG="${TAG}"
{
curl -kL "$URL" -o ${TMP_PATH}/configs.zip 2>&1 |
perl -C -lane '
BEGIN {$header = "Downloading $ENV{TAG}...\n\n"; $| = 1}
$pcent = $F[0];
$_ = join "", unpack("x3 a7 x4 a9 x8 a9 x7 a*") if length > 20;
s/ /\xa0/g;
if ($. <= 3) {
$header .= "$_\n";
$/ = "\r" if $. == 2
} else {
print "XXX\n$pcent\n$header$_\nXXX"
}' |
dialog --backtitle "$(backtitle)" --title "Update Configs" \
--gauge "Download Configs: $TAG ..." 14 72
}
if [ -f "${TMP_PATH}/configs.zip" ]; then
mkdir -p "${MODEL_CONFIG_PATH}"
dialog --backtitle "$(backtitle)" --title "Update Configs" \
--infobox "Updating Configs..." 3 50
if unzip -oq "${TMP_PATH}/configs.zip" -d "${MODEL_CONFIG_PATH}"; then
rm -f "${TMP_PATH}/configs.zip"
dialog --backtitle "$(backtitle)" --title "Update Configs" \
--infobox "Update successful!" 3 50
sleep 2
else
echo "Error downloading new Version!"
sleep 5
updateFailed
fi
) 2>&1 | dialog --backtitle "$(backtitle)" --title "Configs" \
--progressbox "Installing Configs..." 20 70
else
updateFailed
fi
fi
return 0
}
@ -300,31 +359,40 @@ function updateLKMs() {
local TAG="${1}"
fi
if [ -n "${TAG}" ] && [ "${LKMVERSION}" != "${TAG}" ]; then
(
local URL="https://github.com/AuxXxilium/arc-lkm/releases/download/${TAG}/rp-lkms.zip"
echo "Downloading ${TAG}"
curl -#kL "${URL}" -o "${TMP_PATH}/rp-lkms.zip" 2>&1 | while IFS= read -r -n1 char; do
[[ $char =~ [0-9] ]] && keep=1 ;
[[ $char == % ]] && echo "$progress%" && progress="" && keep=0 ;
[[ $keep == 1 ]] && progress="$progress$char" ;
done
if [ -f "${TMP_PATH}/rp-lkms.zip" ]; then
rm -rf "${LKMS_PATH}"
mkdir -p "${LKMS_PATH}"
echo "Installing new LKMs..."
if unzip -oq "${TMP_PATH}/rp-lkms.zip" -d "${LKMS_PATH}"; then
rm -f "${TMP_PATH}/rp-lkms.zip"
echo "Successful!"
else
updateFailed
fi
export URL="https://github.com/AuxXxilium/arc-lkm/releases/download/${TAG}/rp-lkms.zip"
export TAG="${TAG}"
{
curl -kL "$URL" -o ${TMP_PATH}/rp-lkms.zip 2>&1 |
perl -C -lane '
BEGIN {$header = "Downloading $ENV{TAG}...\n\n"; $| = 1}
$pcent = $F[0];
$_ = join "", unpack("x3 a7 x4 a9 x8 a9 x7 a*") if length > 20;
s/ /\xa0/g;
if ($. <= 3) {
$header .= "$_\n";
$/ = "\r" if $. == 2
} else {
print "XXX\n$pcent\n$header$_\nXXX"
}' |
dialog --backtitle "$(backtitle)" --title "Update LKMs" \
--gauge "Download LKMs: $TAG ..." 14 72
}
if [ -f "${TMP_PATH}/rp-lkms.zip" ]; then
rm -rf "${LKMS_PATH}"
mkdir -p "${LKMS_PATH}"
dialog --backtitle "$(backtitle)" --title "Update LKMs" \
--infobox "Updating LKMs..." 3 50
if unzip -oq "${TMP_PATH}/rp-lkms.zip" -d "${LKMS_PATH}"; then
rm -f "${TMP_PATH}/rp-lkms.zip"
dialog --backtitle "$(backtitle)" --title "Update LKMs" \
--infobox "Update successful!" 3 50
sleep 2
else
echo "Error downloading new Version!"
sleep 5
updateFailed
fi
) 2>&1 | dialog --backtitle "$(backtitle)" --title "LKMs" \
--progressbox "Installing LKMs..." 20 70
else
updateFailed
fi
fi
return 0
}
@ -335,27 +403,39 @@ function arcUpdate() {
KERNEL="$(readConfigKey "kernel" "${USER_CONFIG_FILE}")"
BUILDDONE="$(readConfigKey "arc.builddone" "${USER_CONFIG_FILE}")"
FAILED="false"
dialog --backtitle "$(backtitle)" --title "Full Update" --aspect 18 \
dialog --backtitle "$(backtitle)" --title "Update Dependencies" --aspect 18 \
--infobox "Updating Dependencies..." 0 0
sleep 3
updateLoader
sleep 2
updateAddons
[ $? -ne 0 ] && FAILED="true"
updateModules
[ $? -ne 0 ] && FAILED="true"
updateCustom
[ $? -ne 0 ] && FAILED="true"
updatePatches
[ $? -ne 0 ] && FAILED="true"
updateConfigs
[ $? -ne 0 ] && FAILED="true"
updateLKMs
[ $? -ne 0 ] && FAILED="true"
updateOffline
[ $? -ne 0 ] && FAILED="true"
if [ "${FAILED}" == "true" ] && [ "${UPDATEMODE}" == "true" ]; then
dialog --backtitle "$(backtitle)" --title "Full Update" --aspect 18 \
dialog --backtitle "$(backtitle)" --title "Update Dependencies" --aspect 18 \
--infobox "Update failed!\nTry again later." 0 0
sleep 3
exec reboot
elif [ "${FAILED}" == "true" ]; then
dialog --backtitle "$(backtitle)" --title "Full Update" --aspect 18 \
dialog --backtitle "$(backtitle)" --title "Update Dependencies" --aspect 18 \
--infobox "Update failed!\nTry again later." 0 0
sleep 3
elif [ "${FAILED}" == "false" ] && [ "${UPDATEMODE}" == "true" ]; then
dialog --backtitle "$(backtitle)" --title "Full Update" --aspect 18 \
dialog --backtitle "$(backtitle)" --title "Update Dependencies" --aspect 18 \
--infobox "Update successful! -> Reboot to automated build..." 0 0
sleep 3
rebootTo "automated"
elif [ "${FAILED}" == "false" ]; then
dialog --backtitle "$(backtitle)" --title "Full Update" --aspect 18 \
dialog --backtitle "$(backtitle)" --title "Update Dependencies" --aspect 18 \
--infobox "Update successful!" 0 0
writeConfigKey "arc.builddone" "false" "${USER_CONFIG_FILE}"
BUILDDONE="$(readConfigKey "arc.builddone" "${USER_CONFIG_FILE}")"
@ -368,10 +448,10 @@ function arcUpdate() {
###############################################################################
# Update Offline
function updateOffline() {
local ARCMODE="$(readConfigKey "arc.mode" "${USER_CONFIG_FILE}")"
if [ "${ARCMODE}" != "automated" ]; then
rm -f "${SYSTEM_PATH}/include/offline.json"
curl -skL "https://autoupdate.synology.com/os/v2" -o "${SYSTEM_PATH}/include/offline.json"
local ARCOFFLINE="$(readConfigKey "arc.offline" "${USER_CONFIG_FILE}")"
if [ "${ARCOFFLINE}" != "true" ]; then
rm -f "${CONFIGS_PATH}/offline.json"
curl -skL "https://autoupdate.synology.com/os/v2" -o "${CONFIGS_PATH}/offline.json"
fi
return 0
}
@ -379,29 +459,5 @@ function updateOffline() {
###############################################################################
# Update Failed
function updateFailed() {
local MODE="$(readConfigKey "arc.mode" "${USER_CONFIG_FILE}")"
if [ "${ARCMODE}" == "automated" ]; then
echo "Installation failed!"
sleep 5
exec reboot
exit 1
else
echo "Installation failed!"
return 1
fi
}
function updateFaileddialog() {
local MODE="$(readConfigKey "arc.mode" "${USER_CONFIG_FILE}")"
if [ "${ARCMODE}" == "automated" ]; then
dialog --backtitle "$(backtitle)" --title "Update Failed" \
--infobox "Installation failed!" 0 0
sleep 5
exec reboot
exit 1
else
dialog --backtitle "$(backtitle)" --title "Update Failed" \
--msgbox "Installation failed!" 0 0
return 1
fi
return 1
}