tree: rework update functions
Signed-off-by: AuxXxilium <info@auxxxilium.tech>
This commit is contained in:
@@ -835,14 +835,10 @@ function updateMenu() {
|
|||||||
TAG=$(cat "${TMP_PATH}/input")
|
TAG=$(cat "${TMP_PATH}/input")
|
||||||
[ -z "${TAG}" ] && return 1
|
[ -z "${TAG}" ] && return 1
|
||||||
fi
|
fi
|
||||||
if updateLoader "${TAG}"; then
|
updateLoader "${TAG}"
|
||||||
writeConfigKey "arc.builddone" "false" "${USER_CONFIG_FILE}"
|
|
||||||
BUILDDONE="$(readConfigKey "arc.builddone" "${USER_CONFIG_FILE}")"
|
|
||||||
rebootTo "config"
|
|
||||||
fi
|
|
||||||
;;
|
;;
|
||||||
2)
|
2)
|
||||||
arcUpdate
|
updateDependencies
|
||||||
;;
|
;;
|
||||||
3)
|
3)
|
||||||
decryptMenu
|
decryptMenu
|
||||||
@@ -884,7 +880,7 @@ function sysinfo() {
|
|||||||
[ -d /sys/firmware/efi ] && BOOTSYS="UEFI" || BOOTSYS="BIOS"
|
[ -d /sys/firmware/efi ] && BOOTSYS="UEFI" || BOOTSYS="BIOS"
|
||||||
HWID="$(readConfigKey "arc.hwid" "${USER_CONFIG_FILE}")"
|
HWID="$(readConfigKey "arc.hwid" "${USER_CONFIG_FILE}")"
|
||||||
USERID="$(readConfigKey "arc.userid" "${USER_CONFIG_FILE}")"
|
USERID="$(readConfigKey "arc.userid" "${USER_CONFIG_FILE}")"
|
||||||
CPU=$(echo $(cat /proc/cpuinfo 2>/dev/null | grep 'model name' | uniq | awk -F':' '{print $2}'))
|
CPU="$(cat /proc/cpuinfo 2>/dev/null | grep 'model name' | uniq | awk -F':' '{print $2}')"
|
||||||
SECURE=$(dmesg 2>/dev/null | grep -i "Secure Boot" | awk -F'] ' '{print $2}')
|
SECURE=$(dmesg 2>/dev/null | grep -i "Secure Boot" | awk -F'] ' '{print $2}')
|
||||||
VENDOR=$(dmesg 2>/dev/null | grep -i "DMI:" | head -1 | sed 's/\[.*\] DMI: //i')
|
VENDOR=$(dmesg 2>/dev/null | grep -i "DMI:" | head -1 | sed 's/\[.*\] DMI: //i')
|
||||||
ETHX="$(ls /sys/class/net 2>/dev/null | grep eth)"
|
ETHX="$(ls /sys/class/net 2>/dev/null | grep eth)"
|
||||||
@@ -1770,7 +1766,7 @@ function decryptMenu() {
|
|||||||
mv -f "${S_FILE_ARC}" "${S_FILE}"
|
mv -f "${S_FILE_ARC}" "${S_FILE}"
|
||||||
else
|
else
|
||||||
while true; do
|
while true; do
|
||||||
CONFIGSVERSION=$(cat "${MODEL_CONFIG_PATH}/VERSION")
|
CONFIGSVERSION="$(cat "${MODEL_CONFIG_PATH}/VERSION" 2>/dev/null)"
|
||||||
cp -f "${S_FILE}" "${S_FILE}.bak"
|
cp -f "${S_FILE}" "${S_FILE}.bak"
|
||||||
dialog --backtitle "$(backtitle)" --colors --title "Arc Decrypt" \
|
dialog --backtitle "$(backtitle)" --colors --title "Arc Decrypt" \
|
||||||
--inputbox "Enter Decryption Key for ${CONFIGSVERSION}!\nKey is available in my Discord:\nhttps://discord.auxxxilium.tech" 9 50 2>"${TMP_PATH}/resp"
|
--inputbox "Enter Decryption Key for ${CONFIGSVERSION}!\nKey is available in my Discord:\nhttps://discord.auxxxilium.tech" 9 50 2>"${TMP_PATH}/resp"
|
||||||
@@ -1949,8 +1945,7 @@ function dtsMenu() {
|
|||||||
3 "Edit dts file" \
|
3 "Edit dts file" \
|
||||||
2>${TMP_PATH}/resp
|
2>${TMP_PATH}/resp
|
||||||
[ $? -ne 0 ] && break
|
[ $? -ne 0 ] && break
|
||||||
case "$(cat ${TMP_PATH}/resp)" in
|
case "$(cat ${TMP_PATH}/resp)" in %) ;;
|
||||||
%) ;;
|
|
||||||
1)
|
1)
|
||||||
if ! tty 2>/dev/null | grep -q "/dev/pts"; then #if ! tty 2>/dev/null | grep -q "/dev/pts" || [ -z "${SSH_TTY}" ]; then
|
if ! tty 2>/dev/null | grep -q "/dev/pts"; then #if ! tty 2>/dev/null | grep -q "/dev/pts" || [ -z "${SSH_TTY}" ]; then
|
||||||
MSG=""
|
MSG=""
|
||||||
|
|||||||
@@ -852,8 +852,7 @@ function boot() {
|
|||||||
# Check for Arc Mode
|
# Check for Arc Mode
|
||||||
if [ "${ARCMODE}" == "update" ]; then
|
if [ "${ARCMODE}" == "update" ]; then
|
||||||
if [ "${ARCOFFLINE}" != "true" ]; then
|
if [ "${ARCOFFLINE}" != "true" ]; then
|
||||||
UPDATEMODE="true"
|
updateLoader
|
||||||
arcUpdate
|
|
||||||
else
|
else
|
||||||
dialog --backtitle "$(backtitle)" --title "Arc Update" \
|
dialog --backtitle "$(backtitle)" --title "Arc Update" \
|
||||||
--infobox "Update is not possible in Offline Mode!" 5 40
|
--infobox "Update is not possible in Offline Mode!" 5 40
|
||||||
|
|||||||
@@ -1,7 +1,9 @@
|
|||||||
###############################################################################
|
###############################################################################
|
||||||
# Update Loader
|
# Update Loader
|
||||||
function updateLoader() {
|
function updateLoader() {
|
||||||
|
CONFDONE="$(readConfigKey "arc.confdone" "${USER_CONFIG_FILE}")"
|
||||||
local ARC_BRANCH="$(readConfigKey "arc.branch" "${USER_CONFIG_FILE}")"
|
local ARC_BRANCH="$(readConfigKey "arc.branch" "${USER_CONFIG_FILE}")"
|
||||||
|
local ARCMODE="$(readConfigKey "arc.mode" "${USER_CONFIG_FILE}")"
|
||||||
local TAG="${1}"
|
local TAG="${1}"
|
||||||
if [ -z "${TAG}" ]; then
|
if [ -z "${TAG}" ]; then
|
||||||
idx=0
|
idx=0
|
||||||
@@ -45,13 +47,39 @@ function updateLoader() {
|
|||||||
--infobox "Update successful!" 3 50
|
--infobox "Update successful!" 3 50
|
||||||
sleep 2
|
sleep 2
|
||||||
else
|
else
|
||||||
updateFailed
|
if [ "${ARCMODE}" == "update" ]; then
|
||||||
|
dialog --backtitle "$(backtitle)" --title "Update Dependencies" --aspect 18 \
|
||||||
|
--infobox "Update failed!\nTry again later." 0 0
|
||||||
|
sleep 3
|
||||||
|
exec reboot
|
||||||
|
else
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
updateFailed
|
if [ "${ARCMODE}" == "update" ]; then
|
||||||
|
dialog --backtitle "$(backtitle)" --title "Update Dependencies" --aspect 18 \
|
||||||
|
--infobox "Update failed!\nTry again later." 0 0
|
||||||
|
sleep 3
|
||||||
|
exec reboot
|
||||||
|
else
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
return 0
|
if [ "${ARCMODE}" == "update" ] && [ "${CONFDONE}" == "true" ]; then
|
||||||
|
dialog --backtitle "$(backtitle)" --title "Update Loader" --aspect 18 \
|
||||||
|
--infobox "Update successful! -> Reboot to automated Build Mode..." 5 80
|
||||||
|
sleep 3
|
||||||
|
writeConfigKey "arc.builddone" "false" "${USER_CONFIG_FILE}"
|
||||||
|
rebootTo "automated"
|
||||||
|
else
|
||||||
|
dialog --backtitle "$(backtitle)" --title "Update Loader" --aspect 18 \
|
||||||
|
--infobox "Update successful! -> Reboot to Config Mode..." 5 80
|
||||||
|
sleep 3
|
||||||
|
writeConfigKey "arc.builddone" "false" "${USER_CONFIG_FILE}"
|
||||||
|
rebootTo "config"
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
@@ -104,10 +132,10 @@ function updateAddons() {
|
|||||||
--infobox "Update successful!" 3 50
|
--infobox "Update successful!" 3 50
|
||||||
sleep 2
|
sleep 2
|
||||||
else
|
else
|
||||||
updateFailed
|
return 1
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
updateFailed
|
return 1
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
return 0
|
return 0
|
||||||
@@ -156,10 +184,10 @@ function updatePatches() {
|
|||||||
--infobox "Update successful!" 3 50
|
--infobox "Update successful!" 3 50
|
||||||
sleep 2
|
sleep 2
|
||||||
else
|
else
|
||||||
updateFailed
|
return 1
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
updateFailed
|
return 1
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
return 0
|
return 0
|
||||||
@@ -208,10 +236,10 @@ function updateCustom() {
|
|||||||
--infobox "Update successful!" 3 50
|
--infobox "Update successful!" 3 50
|
||||||
sleep 2
|
sleep 2
|
||||||
else
|
else
|
||||||
updateFailed
|
return 1
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
updateFailed
|
return 1
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
return 0
|
return 0
|
||||||
@@ -264,10 +292,10 @@ function updateModules() {
|
|||||||
--infobox "Update successful!" 3 50
|
--infobox "Update successful!" 3 50
|
||||||
sleep 2
|
sleep 2
|
||||||
else
|
else
|
||||||
updateFailed
|
return 1
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
updateFailed
|
return 1
|
||||||
fi
|
fi
|
||||||
if [ -f "${MODULES_PATH}/${PLATFORM}-${KVERP}.tgz" ] && [ -f "${MODULES_PATH}/firmware.tgz" ]; then
|
if [ -f "${MODULES_PATH}/${PLATFORM}-${KVERP}.tgz" ] && [ -f "${MODULES_PATH}/firmware.tgz" ]; then
|
||||||
dialog --backtitle "$(backtitle)" --title "Update Modules" \
|
dialog --backtitle "$(backtitle)" --title "Update Modules" \
|
||||||
@@ -332,10 +360,10 @@ function updateConfigs() {
|
|||||||
--infobox "Update successful!" 3 50
|
--infobox "Update successful!" 3 50
|
||||||
sleep 2
|
sleep 2
|
||||||
else
|
else
|
||||||
updateFailed
|
return 1
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
updateFailed
|
return 1
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
return 0
|
return 0
|
||||||
@@ -388,19 +416,29 @@ function updateLKMs() {
|
|||||||
--infobox "Update successful!" 3 50
|
--infobox "Update successful!" 3 50
|
||||||
sleep 2
|
sleep 2
|
||||||
else
|
else
|
||||||
updateFailed
|
return 1
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
updateFailed
|
return 1
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
# Update Offline
|
||||||
|
function updateOffline() {
|
||||||
|
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
|
||||||
|
}
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
# Loading Update Mode
|
# Loading Update Mode
|
||||||
function arcUpdate() {
|
function dependenciesUpdate() {
|
||||||
KERNEL="$(readConfigKey "kernel" "${USER_CONFIG_FILE}")"
|
|
||||||
BUILDDONE="$(readConfigKey "arc.builddone" "${USER_CONFIG_FILE}")"
|
BUILDDONE="$(readConfigKey "arc.builddone" "${USER_CONFIG_FILE}")"
|
||||||
FAILED="false"
|
FAILED="false"
|
||||||
dialog --backtitle "$(backtitle)" --title "Update Dependencies" --aspect 18 \
|
dialog --backtitle "$(backtitle)" --title "Update Dependencies" --aspect 18 \
|
||||||
@@ -420,20 +458,10 @@ function arcUpdate() {
|
|||||||
[ $? -ne 0 ] && FAILED="true"
|
[ $? -ne 0 ] && FAILED="true"
|
||||||
updateOffline
|
updateOffline
|
||||||
[ $? -ne 0 ] && FAILED="true"
|
[ $? -ne 0 ] && FAILED="true"
|
||||||
if [ "${FAILED}" == "true" ] && [ "${UPDATEMODE}" == "true" ]; then
|
if [ "${FAILED}" == "true" ]; then
|
||||||
dialog --backtitle "$(backtitle)" --title "Update Dependencies" --aspect 18 \
|
dialog --backtitle "$(backtitle)" --title "Update Dependencies" --aspect 18 \
|
||||||
--infobox "Update failed!\nTry again later." 0 0
|
--infobox "Update failed!\nTry again later." 0 0
|
||||||
sleep 3
|
sleep 3
|
||||||
exec reboot
|
|
||||||
elif [ "${FAILED}" == "true" ]; then
|
|
||||||
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 "Update Dependencies" --aspect 18 \
|
|
||||||
--infobox "Update successful! -> Reboot to automated build..." 0 0
|
|
||||||
sleep 3
|
|
||||||
rebootTo "automated"
|
|
||||||
elif [ "${FAILED}" == "false" ]; then
|
elif [ "${FAILED}" == "false" ]; then
|
||||||
dialog --backtitle "$(backtitle)" --title "Update Dependencies" --aspect 18 \
|
dialog --backtitle "$(backtitle)" --title "Update Dependencies" --aspect 18 \
|
||||||
--infobox "Update successful!" 0 0
|
--infobox "Update successful!" 0 0
|
||||||
@@ -444,20 +472,3 @@ function arcUpdate() {
|
|||||||
exec arc.sh
|
exec arc.sh
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
###############################################################################
|
|
||||||
# Update Offline
|
|
||||||
function updateOffline() {
|
|
||||||
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
|
|
||||||
}
|
|
||||||
|
|
||||||
###############################################################################
|
|
||||||
# Update Failed
|
|
||||||
function updateFailed() {
|
|
||||||
return 1
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user