mirror of
https://github.com/AuxXxilium/arc.git
synced 2024-11-23 21:39:53 +07:00
tree: rework update functions
Signed-off-by: AuxXxilium <info@auxxxilium.tech>
This commit is contained in:
parent
e7994e5cd2
commit
ccfbd4c15c
@ -835,14 +835,10 @@ function updateMenu() {
|
||||
TAG=$(cat "${TMP_PATH}/input")
|
||||
[ -z "${TAG}" ] && return 1
|
||||
fi
|
||||
if updateLoader "${TAG}"; then
|
||||
writeConfigKey "arc.builddone" "false" "${USER_CONFIG_FILE}"
|
||||
BUILDDONE="$(readConfigKey "arc.builddone" "${USER_CONFIG_FILE}")"
|
||||
rebootTo "config"
|
||||
fi
|
||||
updateLoader "${TAG}"
|
||||
;;
|
||||
2)
|
||||
arcUpdate
|
||||
updateDependencies
|
||||
;;
|
||||
3)
|
||||
decryptMenu
|
||||
@ -884,7 +880,7 @@ function sysinfo() {
|
||||
[ -d /sys/firmware/efi ] && BOOTSYS="UEFI" || BOOTSYS="BIOS"
|
||||
HWID="$(readConfigKey "arc.hwid" "${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}')
|
||||
VENDOR=$(dmesg 2>/dev/null | grep -i "DMI:" | head -1 | sed 's/\[.*\] DMI: //i')
|
||||
ETHX="$(ls /sys/class/net 2>/dev/null | grep eth)"
|
||||
@ -1770,7 +1766,7 @@ function decryptMenu() {
|
||||
mv -f "${S_FILE_ARC}" "${S_FILE}"
|
||||
else
|
||||
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"
|
||||
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"
|
||||
@ -1949,8 +1945,7 @@ function dtsMenu() {
|
||||
3 "Edit dts file" \
|
||||
2>${TMP_PATH}/resp
|
||||
[ $? -ne 0 ] && break
|
||||
case "$(cat ${TMP_PATH}/resp)" in
|
||||
%) ;;
|
||||
case "$(cat ${TMP_PATH}/resp)" in %) ;;
|
||||
1)
|
||||
if ! tty 2>/dev/null | grep -q "/dev/pts"; then #if ! tty 2>/dev/null | grep -q "/dev/pts" || [ -z "${SSH_TTY}" ]; then
|
||||
MSG=""
|
||||
|
@ -852,8 +852,7 @@ function boot() {
|
||||
# Check for Arc Mode
|
||||
if [ "${ARCMODE}" == "update" ]; then
|
||||
if [ "${ARCOFFLINE}" != "true" ]; then
|
||||
UPDATEMODE="true"
|
||||
arcUpdate
|
||||
updateLoader
|
||||
else
|
||||
dialog --backtitle "$(backtitle)" --title "Arc Update" \
|
||||
--infobox "Update is not possible in Offline Mode!" 5 40
|
||||
|
@ -1,7 +1,9 @@
|
||||
###############################################################################
|
||||
# Update Loader
|
||||
function updateLoader() {
|
||||
CONFDONE="$(readConfigKey "arc.confdone" "${USER_CONFIG_FILE}")"
|
||||
local ARC_BRANCH="$(readConfigKey "arc.branch" "${USER_CONFIG_FILE}")"
|
||||
local ARCMODE="$(readConfigKey "arc.mode" "${USER_CONFIG_FILE}")"
|
||||
local TAG="${1}"
|
||||
if [ -z "${TAG}" ]; then
|
||||
idx=0
|
||||
@ -45,13 +47,39 @@ function updateLoader() {
|
||||
--infobox "Update successful!" 3 50
|
||||
sleep 2
|
||||
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
|
||||
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
|
||||
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
|
||||
sleep 2
|
||||
else
|
||||
updateFailed
|
||||
return 1
|
||||
fi
|
||||
else
|
||||
updateFailed
|
||||
return 1
|
||||
fi
|
||||
fi
|
||||
return 0
|
||||
@ -156,10 +184,10 @@ function updatePatches() {
|
||||
--infobox "Update successful!" 3 50
|
||||
sleep 2
|
||||
else
|
||||
updateFailed
|
||||
return 1
|
||||
fi
|
||||
else
|
||||
updateFailed
|
||||
return 1
|
||||
fi
|
||||
fi
|
||||
return 0
|
||||
@ -208,10 +236,10 @@ function updateCustom() {
|
||||
--infobox "Update successful!" 3 50
|
||||
sleep 2
|
||||
else
|
||||
updateFailed
|
||||
return 1
|
||||
fi
|
||||
else
|
||||
updateFailed
|
||||
return 1
|
||||
fi
|
||||
fi
|
||||
return 0
|
||||
@ -264,10 +292,10 @@ function updateModules() {
|
||||
--infobox "Update successful!" 3 50
|
||||
sleep 2
|
||||
else
|
||||
updateFailed
|
||||
return 1
|
||||
fi
|
||||
else
|
||||
updateFailed
|
||||
return 1
|
||||
fi
|
||||
if [ -f "${MODULES_PATH}/${PLATFORM}-${KVERP}.tgz" ] && [ -f "${MODULES_PATH}/firmware.tgz" ]; then
|
||||
dialog --backtitle "$(backtitle)" --title "Update Modules" \
|
||||
@ -332,10 +360,10 @@ function updateConfigs() {
|
||||
--infobox "Update successful!" 3 50
|
||||
sleep 2
|
||||
else
|
||||
updateFailed
|
||||
return 1
|
||||
fi
|
||||
else
|
||||
updateFailed
|
||||
return 1
|
||||
fi
|
||||
fi
|
||||
return 0
|
||||
@ -388,19 +416,29 @@ function updateLKMs() {
|
||||
--infobox "Update successful!" 3 50
|
||||
sleep 2
|
||||
else
|
||||
updateFailed
|
||||
return 1
|
||||
fi
|
||||
else
|
||||
updateFailed
|
||||
return 1
|
||||
fi
|
||||
fi
|
||||
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
|
||||
function arcUpdate() {
|
||||
KERNEL="$(readConfigKey "kernel" "${USER_CONFIG_FILE}")"
|
||||
function dependenciesUpdate() {
|
||||
BUILDDONE="$(readConfigKey "arc.builddone" "${USER_CONFIG_FILE}")"
|
||||
FAILED="false"
|
||||
dialog --backtitle "$(backtitle)" --title "Update Dependencies" --aspect 18 \
|
||||
@ -420,20 +458,10 @@ function arcUpdate() {
|
||||
[ $? -ne 0 ] && FAILED="true"
|
||||
updateOffline
|
||||
[ $? -ne 0 ] && FAILED="true"
|
||||
if [ "${FAILED}" == "true" ] && [ "${UPDATEMODE}" == "true" ]; then
|
||||
if [ "${FAILED}" == "true" ]; then
|
||||
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 "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
|
||||
dialog --backtitle "$(backtitle)" --title "Update Dependencies" --aspect 18 \
|
||||
--infobox "Update successful!" 0 0
|
||||
@ -443,21 +471,4 @@ function arcUpdate() {
|
||||
clear
|
||||
exec arc.sh
|
||||
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
|
||||
}
|
Loading…
Reference in New Issue
Block a user