mirror of
https://github.com/pi-hole/pi-hole
synced 2024-12-22 23:08:07 +00:00
Function...
Signed-off-by: Dan Schaper <dan.schaper@pi-hole.net>
This commit is contained in:
parent
945e22874e
commit
0e8fd49669
@ -49,12 +49,22 @@ getLocalHash() {
|
|||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
PHVERSIONLATEST=$(curl -s https://api.github.com/repos/pi-hole/pi-hole/releases/latest | \
|
getRemoteVersion(){
|
||||||
awk -F: '$1 ~/tag_name/ { print $2 }' | \
|
# Get the version from the remote origin
|
||||||
tr -cd '[[:alnum:]]._-')
|
local daemon="${1}"
|
||||||
WEBVERSIONLATEST=$(curl -s https://api.github.com/repos/pi-hole/AdminLTE/releases/latest | \
|
local version
|
||||||
awk -F: '$1 ~/tag_name/ { print $2 }' | \
|
|
||||||
tr -cd '[[:alnum:]]._-')
|
version=$(curl --silent --fail https://api.github.com/repos/pi-hole/${daemon}/releases/latest | \
|
||||||
|
awk -F: '$1 ~/tag_name/ { print $2 }' | \
|
||||||
|
tr -cd '[[:alnum:]]._-')
|
||||||
|
if [[ "${version}" =~ ^v ]]; then
|
||||||
|
echo "${version}"
|
||||||
|
else
|
||||||
|
echo "ERROR"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
#PHHASHLATEST=$(curl -s https://api.github.com/repos/pi-hole/pi-hole/commits/master | \
|
#PHHASHLATEST=$(curl -s https://api.github.com/repos/pi-hole/pi-hole/commits/master | \
|
||||||
# grep sha | \
|
# grep sha | \
|
||||||
@ -70,13 +80,13 @@ WEBVERSIONLATEST=$(curl -s https://api.github.com/repos/pi-hole/AdminLTE/release
|
|||||||
|
|
||||||
|
|
||||||
normalOutput() {
|
normalOutput() {
|
||||||
echo "::: Pi-hole version is ${PHVERSION} (Latest version is ${PHVERSIONLATEST:-${DEFAULT}})"
|
echo "::: Pi-hole version is ${PHVERSION} (Latest version is ${PHVERSIONLATEST})"
|
||||||
echo "::: Web-Admin version is ${WEBVERSION} (Latest version is ${WEBVERSIONLATEST:-${DEFAULT}})"
|
echo "::: Web-Admin version is ${WEBVERSION} (Latest version is ${WEBVERSIONLATEST})"
|
||||||
}
|
}
|
||||||
|
|
||||||
webOutput() {
|
webOutput() {
|
||||||
case "${1}" in
|
case "${1}" in
|
||||||
"-l" | "--latest" ) echo "${WEBVERSIONLATEST:-${DEFAULT}}";;
|
"-l" | "--latest" ) echo "${WEBVERSIONLATEST}";;
|
||||||
"-c" | "--current" ) echo "${WEBVERSION}";;
|
"-c" | "--current" ) echo "${WEBVERSION}";;
|
||||||
"-h" | "--hash" ) echo "${WEBHASH}";;
|
"-h" | "--hash" ) echo "${WEBHASH}";;
|
||||||
* ) echo "::: Invalid Option!"; exit 1;
|
* ) echo "::: Invalid Option!"; exit 1;
|
||||||
@ -85,7 +95,7 @@ webOutput() {
|
|||||||
|
|
||||||
coreOutput() {
|
coreOutput() {
|
||||||
case "${1}" in
|
case "${1}" in
|
||||||
"-l" | "--latest" ) echo "${PHVERSIONLATEST:-${DEFAULT}}";;
|
"-l" | "--latest" ) echo "${PHVERSIONLATEST}";;
|
||||||
"-c" | "--current" ) echo "${PHVERSION}";;
|
"-c" | "--current" ) echo "${PHVERSION}";;
|
||||||
"-h" | "--hash" ) echo "${PHHASH}";;
|
"-h" | "--hash" ) echo "${PHHASH}";;
|
||||||
* ) echo "::: Invalid Option!"; exit 1;
|
* ) echo "::: Invalid Option!"; exit 1;
|
||||||
@ -112,9 +122,10 @@ EOM
|
|||||||
|
|
||||||
PHVERSION=$(getLocalVersion "${PHGITDIR}")
|
PHVERSION=$(getLocalVersion "${PHGITDIR}")
|
||||||
PHHASH=$(getLocalHash "${PHGITDIR}")
|
PHHASH=$(getLocalHash "${PHGITDIR}")
|
||||||
|
PHVERSIONLATEST=$(getRemoteVersion pi-hole)
|
||||||
WEBVERSION=$(getLocalVersion "${WEBGITDIR}")
|
WEBVERSION=$(getLocalVersion "${WEBGITDIR}")
|
||||||
WEBHASH=$(getLocalHash "${WEBGITDIR}")
|
WEBHASH=$(getLocalHash "${WEBGITDIR}")
|
||||||
|
WEBVERSIONLATEST=$(getRemoteVersion AdminLTE)
|
||||||
|
|
||||||
if [[ $# = 0 ]]; then
|
if [[ $# = 0 ]]; then
|
||||||
normalOutput
|
normalOutput
|
||||||
|
Loading…
Reference in New Issue
Block a user