45 lines
986 B
Bash
Executable file
45 lines
986 B
Bash
Executable file
#!/bin/bash
|
|
# SPDX-License-Identifier: GPL-2.0
|
|
# Copyright (C) 2023 JELOS (https://github.com/JustEnoughLinuxOS)
|
|
|
|
. /etc/profile
|
|
|
|
ORGANIZATION="${GIT_ORGANIZATION}"
|
|
BRANCH="$(get_setting updates.branch)"
|
|
case ${BRANCH} in
|
|
dev)
|
|
PROJECT="${GIT_REPO}-dev"
|
|
;;
|
|
*)
|
|
PROJECT="${GIT_REPO}"
|
|
;;
|
|
esac
|
|
|
|
GIT_REPO="https://github.com/${ORGANIZATION}/${PROJECT}"
|
|
GIT_API="https://api.github.com/repos/${ORGANIZATION}/${PROJECT}"
|
|
|
|
FORCE="$(get_setting updates.force)"
|
|
|
|
function check_network() {
|
|
GW=$(ip route | awk '/eth0/ {a=$0} END{print $1}')
|
|
if [[ ${GW} =~ [0-9] ]]
|
|
then
|
|
echo true
|
|
else
|
|
echo false
|
|
fi
|
|
}
|
|
|
|
ONLINE_STATUS=$(check_network)
|
|
if [ "${ONLINE_STATUS}" == true ]
|
|
then
|
|
LATEST_RELEASE_TAG=$(curl -H 'Cache-Control: no-cache' -Ls "${GIT_API}/releases" | python -c "import sys, json; print(json.load(sys.stdin)[0]['tag_name'])")
|
|
|
|
if [ "${OS_VERSION}" -lt "${LATEST_RELEASE_TAG}" ] || [ "${FORCE}" == "1" ]
|
|
then
|
|
echo "${TAG}"
|
|
exit 0
|
|
fi
|
|
fi
|
|
|
|
exit 12
|