mirror of
https://github.com/AuxXxilium/arc.git
synced 2024-11-23 23:39:54 +07:00
arc: offlinemode rework
Signed-off-by: AuxXxilium <info@auxxxilium.tech>
This commit is contained in:
parent
4ad6f52ed9
commit
ea9c7526d2
@ -1193,9 +1193,9 @@ else
|
||||
x) backupMenu; NEXT="x" ;;
|
||||
M) arcNIC; NEXT="M" ;;
|
||||
9) [ "${OFFLINE}" == "true" ] && OFFLINE='false' || OFFLINE='true'
|
||||
[ "${OFFLINE}" == "false" ] && offlineCheck
|
||||
writeConfigKey "arc.builddone" "false" "${USER_CONFIG_FILE}"
|
||||
BUILDDONE="$(readConfigKey "arc.builddone" "${USER_CONFIG_FILE}")"
|
||||
offlineCheck "${OFFLINE}"
|
||||
ARCNIC="$(readConfigKey "arc.nic" "${USER_CONFIG_FILE}")"
|
||||
OFFLINE="$(readConfigKey "arc.offline" "${USER_CONFIG_FILE}")"
|
||||
NEXT="9"
|
||||
;;
|
||||
y) keymapMenu; NEXT="y" ;;
|
||||
|
@ -539,47 +539,51 @@ function ntpCheck() {
|
||||
# Offline Check
|
||||
function offlineCheck() {
|
||||
CNT=0
|
||||
ARCNIC=""
|
||||
AUTOMATED="$(readConfigKey "arc.automated" "${USER_CONFIG_FILE}")"
|
||||
while true; do
|
||||
NEWTAG="$(curl -m 10 -skL "https://api.github.com/repos/AuxXxilium/arc/releases" | jq -r ".[].tag_name" | sort -rV | head -1)"
|
||||
CNT=$((${CNT} + 1))
|
||||
if [ -n "${NEWTAG}" ]; then
|
||||
ARCNIC="auto"
|
||||
break
|
||||
elif [ ${CNT} -ge 3 ]; then
|
||||
ETHX="$(ls /sys/class/net/ 2>/dev/null | grep eth)"
|
||||
for ETH in ${ETHX}; do
|
||||
# Update Check
|
||||
NEWTAG="$(curl --interface ${ETH} -m 10 -skL "https://api.github.com/repos/AuxXxilium/arc/releases" | jq -r ".[].tag_name" | sort -rV | head -1)"
|
||||
if [ -n "${NEWTAG}" ]; then
|
||||
ARCNIC="${ETH}"
|
||||
break 2
|
||||
fi
|
||||
done
|
||||
break
|
||||
local ARCNIC=""
|
||||
local OFFLINE="${1}"
|
||||
if [ "${OFFLINE}" == "true" ]; then
|
||||
ARCNIC="offline"
|
||||
OFFLINE="true"
|
||||
elif [ "${OFFLINE}" == "false" ]; then
|
||||
while true; do
|
||||
NEWTAG="$(curl -m 10 -skL "https://api.github.com/repos/AuxXxilium/arc/releases" | jq -r ".[].tag_name" | sort -rV | head -1)"
|
||||
CNT=$((${CNT} + 1))
|
||||
if [ -n "${NEWTAG}" ]; then
|
||||
ARCNIC="auto"
|
||||
break
|
||||
elif [ ${CNT} -ge 3 ]; then
|
||||
ETHX="$(ls /sys/class/net/ 2>/dev/null | grep eth)"
|
||||
for ETH in ${ETHX}; do
|
||||
# Update Check
|
||||
NEWTAG="$(curl --interface ${ETH} -m 10 -skL "https://api.github.com/repos/AuxXxilium/arc/releases" | jq -r ".[].tag_name" | sort -rV | head -1)"
|
||||
if [ -n "${NEWTAG}" ]; then
|
||||
ARCNIC="${ETH}"
|
||||
break 2
|
||||
fi
|
||||
done
|
||||
break
|
||||
fi
|
||||
done
|
||||
if [ -n "${ARCNIC}" ]; then
|
||||
OFFLINE="false"
|
||||
elif [ -z "${ARCNIC}" ] && [ "${AUTOMATED}" == "false" ]; then
|
||||
dialog --backtitle "$(backtitle)" --title "Online Check" \
|
||||
--msgbox "Could not connect to Github.\nSwitch to Offline Mode!" 0 0
|
||||
cp -f "${PART3_PATH}/configs/offline.json" "${ARC_PATH}/include/offline.json"
|
||||
ARCNIC="offline"
|
||||
OFFLINE="true"
|
||||
elif [ -z "${ARCNIC}" ] && [ "${AUTOMATED}" == "true" ]; then
|
||||
dialog --backtitle "$(backtitle)" --title "Online Check" \
|
||||
--msgbox "Could not connect to Github.\nSwitch to Offline Mode!\nDisable Automated Mode!" 0 0
|
||||
writeConfigKey "arc.automated" "false" "${USER_CONFIG_FILE}"
|
||||
[ -f "${PART3_PATH}/automated" ] && rm -f "${PART3_PATH}/automated" >/dev/null
|
||||
ARCNIC="offline"
|
||||
OFFLINE="true"
|
||||
fi
|
||||
done
|
||||
if [ -n "${ARCNIC}" ]; then
|
||||
OFFLINE="false"
|
||||
elif [ -z "${ARCNIC}" ] && [ "${AUTOMATED}" == "false" ]; then
|
||||
dialog --backtitle "$(backtitle)" --title "Online Check" \
|
||||
--msgbox "Could not connect to Github.\nSwitch to Offline Mode!" 0 0
|
||||
cp -f "${PART3_PATH}/configs/offline.json" "${ARC_PATH}/include/offline.json"
|
||||
ARCNIC="offline"
|
||||
OFFLINE="true"
|
||||
elif [ -z "${ARCNIC}" ] && [ "${AUTOMATED}" == "true" ]; then
|
||||
dialog --backtitle "$(backtitle)" --title "Online Check" \
|
||||
--msgbox "Could not connect to Github.\nSwitch to Offline Mode!\nDisable Automated Mode!" 0 0
|
||||
writeConfigKey "arc.automated" "false" "${USER_CONFIG_FILE}"
|
||||
[ -f "${PART3_PATH}/automated" ] && rm -f "${PART3_PATH}/automated" >/dev/null
|
||||
ARCNIC="offline"
|
||||
OFFLINE="true"
|
||||
fi
|
||||
writeConfigKey "arc.nic" "${ARCNIC}" "${USER_CONFIG_FILE}"
|
||||
writeConfigKey "arc.offline" "${OFFLINE}" "${USER_CONFIG_FILE}"
|
||||
ARCNIC="$(readConfigKey "arc.nic" "${USER_CONFIG_FILE}")"
|
||||
OFFLINE="$(readConfigKey "arc.offline" "${USER_CONFIG_FILE}")"
|
||||
}
|
||||
|
||||
###############################################################################
|
||||
|
Loading…
Reference in New Issue
Block a user