|
|
|
@ -8,23 +8,6 @@
|
|
|
|
|
# This file is copyright under the latest version of the EUPL.
|
|
|
|
|
# Please see LICENSE file for your rights under this license.
|
|
|
|
|
|
|
|
|
|
# Credit: https://stackoverflow.com/a/46324904
|
|
|
|
|
function json_extract() {
|
|
|
|
|
local key=$1
|
|
|
|
|
local json=$2
|
|
|
|
|
|
|
|
|
|
local string_regex='"([^"\]|\\.)*"'
|
|
|
|
|
local number_regex='-?(0|[1-9][0-9]*)(\.[0-9]+)?([eE][+-]?[0-9]+)?'
|
|
|
|
|
local value_regex="${string_regex}|${number_regex}|true|false|null"
|
|
|
|
|
local pair_regex="\"${key}\"[[:space:]]*:[[:space:]]*(${value_regex})"
|
|
|
|
|
|
|
|
|
|
if [[ ${json} =~ ${pair_regex} ]]; then
|
|
|
|
|
echo $(sed 's/^"\|"$//g' <<< "${BASH_REMATCH[1]}")
|
|
|
|
|
else
|
|
|
|
|
return 1
|
|
|
|
|
fi
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function get_local_branch() {
|
|
|
|
|
# Return active branch
|
|
|
|
|
cd "${1}" 2> /dev/null || return 1
|
|
|
|
@ -61,19 +44,19 @@ if [[ "$2" == "remote" ]]; then
|
|
|
|
|
sleep 30
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
GITHUB_CORE_VERSION="$(json_extract tag_name "$(curl -s 'https://api.github.com/repos/pi-hole/pi-hole/releases/latest' 2> /dev/null)")"
|
|
|
|
|
GITHUB_CORE_VERSION="$(curl -s 'https://api.github.com/repos/pi-hole/pi-hole/releases/latest' 2> /dev/null | jq --raw-output .tag_name)"
|
|
|
|
|
addOrEditKeyValPair "${VERSION_FILE}" "GITHUB_CORE_VERSION" "${GITHUB_CORE_VERSION}"
|
|
|
|
|
|
|
|
|
|
if [[ "${INSTALL_WEB_INTERFACE}" == true ]]; then
|
|
|
|
|
GITHUB_WEB_VERSION="$(json_extract tag_name "$(curl -s 'https://api.github.com/repos/pi-hole/AdminLTE/releases/latest' 2> /dev/null)")"
|
|
|
|
|
GITHUB_WEB_VERSION="$(curl -s 'https://api.github.com/repos/pi-hole/AdminLTE/releases/latest' 2> /dev/null | jq --raw-output .tag_name)"
|
|
|
|
|
addOrEditKeyValPair "${VERSION_FILE}" "GITHUB_WEB_VERSION" "${GITHUB_WEB_VERSION}"
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
GITHUB_FTL_VERSION="$(json_extract tag_name "$(curl -s 'https://api.github.com/repos/pi-hole/FTL/releases/latest' 2> /dev/null)")"
|
|
|
|
|
GITHUB_FTL_VERSION="$(curl -s 'https://api.github.com/repos/pi-hole/FTL/releases/latest' 2> /dev/null | jq --raw-output .tag_name)"
|
|
|
|
|
addOrEditKeyValPair "${VERSION_FILE}" "GITHUB_FTL_VERSION" "${GITHUB_FTL_VERSION}"
|
|
|
|
|
|
|
|
|
|
if [[ "${PIHOLE_DOCKER_TAG}" ]]; then
|
|
|
|
|
GITHUB_DOCKER_VERSION="$(json_extract tag_name "$(curl -s 'https://api.github.com/repos/pi-hole/docker-pi-hole/releases/latest' 2> /dev/null)")"
|
|
|
|
|
GITHUB_DOCKER_VERSION="$(curl -s 'https://api.github.com/repos/pi-hole/docker-pi-hole/releases/latest' 2> /dev/null | jq --raw-output .tag_name)"
|
|
|
|
|
addOrEditKeyValPair "${VERSION_FILE}" "GITHUB_DOCKER_VERSION" "${GITHUB_DOCKER_VERSION}"
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|