From 8ed75dd176dcbf1e7d1935f7c532172145787bc0 Mon Sep 17 00:00:00 2001 From: DL6ER Date: Sat, 23 Dec 2017 00:42:41 +0100 Subject: [PATCH 1/3] Add extra entry to the end of the saved branches and versions such that PHP's explode() subroutine can correctly disentangle the first three entries and does not get confused by the newline character at the end of the FTL version/branch... Signed-off-by: DL6ER --- advanced/Scripts/updatecheck.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/advanced/Scripts/updatecheck.sh b/advanced/Scripts/updatecheck.sh index 04f210a2..07e8178f 100755 --- a/advanced/Scripts/updatecheck.sh +++ b/advanced/Scripts/updatecheck.sh @@ -47,7 +47,7 @@ if [[ "$2" == "remote" ]]; then GITHUB_WEB_VERSION="$(json_extract tag_name "$(curl -q 'https://api.github.com/repos/pi-hole/AdminLTE/releases/latest' 2> /dev/null)")" GITHUB_FTL_VERSION="$(json_extract tag_name "$(curl -q 'https://api.github.com/repos/pi-hole/FTL/releases/latest' 2> /dev/null)")" - echo "${GITHUB_CORE_VERSION} ${GITHUB_WEB_VERSION} ${GITHUB_FTL_VERSION}" > "/etc/pihole/GitHubVersions" + echo "${GITHUB_CORE_VERSION} ${GITHUB_WEB_VERSION} ${GITHUB_FTL_VERSION} X" > "/etc/pihole/GitHubVersions" else @@ -55,12 +55,12 @@ else WEB_BRANCH="$(get_local_branch /var/www/html/admin)" FTL_BRANCH="$(pihole-FTL branch)" - echo "${CORE_BRANCH} ${WEB_BRANCH} ${FTL_BRANCH}" > "/etc/pihole/localbranches" + echo "${CORE_BRANCH} ${WEB_BRANCH} ${FTL_BRANCH} X" > "/etc/pihole/localbranches" CORE_VERSION="$(get_local_version /etc/.pihole)" WEB_VERSION="$(get_local_version /var/www/html/admin)" FTL_VERSION="$(pihole-FTL version)" - echo "${CORE_VERSION} ${WEB_VERSION} ${FTL_VERSION}" > "/etc/pihole/localversions" + echo "${CORE_VERSION} ${WEB_VERSION} ${FTL_VERSION} X" > "/etc/pihole/localversions" fi From d15a5ad5c16892c662c019b79612f13a9d0b79b6 Mon Sep 17 00:00:00 2001 From: DL6ER Date: Sat, 23 Dec 2017 00:46:51 +0100 Subject: [PATCH 2/3] Add required documentation in the source code Signed-off-by: DL6ER --- advanced/Scripts/updatecheck.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/advanced/Scripts/updatecheck.sh b/advanced/Scripts/updatecheck.sh index 07e8178f..851cd0ce 100755 --- a/advanced/Scripts/updatecheck.sh +++ b/advanced/Scripts/updatecheck.sh @@ -47,6 +47,7 @@ if [[ "$2" == "remote" ]]; then GITHUB_WEB_VERSION="$(json_extract tag_name "$(curl -q 'https://api.github.com/repos/pi-hole/AdminLTE/releases/latest' 2> /dev/null)")" GITHUB_FTL_VERSION="$(json_extract tag_name "$(curl -q 'https://api.github.com/repos/pi-hole/FTL/releases/latest' 2> /dev/null)")" + # Have to store an extra dummy character at the end, see https://github.com/pi-hole/pi-hole/pull/1866 echo "${GITHUB_CORE_VERSION} ${GITHUB_WEB_VERSION} ${GITHUB_FTL_VERSION} X" > "/etc/pihole/GitHubVersions" else @@ -55,12 +56,14 @@ else WEB_BRANCH="$(get_local_branch /var/www/html/admin)" FTL_BRANCH="$(pihole-FTL branch)" + # Have to store an extra dummy character at the end, see https://github.com/pi-hole/pi-hole/pull/1866 echo "${CORE_BRANCH} ${WEB_BRANCH} ${FTL_BRANCH} X" > "/etc/pihole/localbranches" CORE_VERSION="$(get_local_version /etc/.pihole)" WEB_VERSION="$(get_local_version /var/www/html/admin)" FTL_VERSION="$(pihole-FTL version)" + # Have to store an extra dummy character at the end, see https://github.com/pi-hole/pi-hole/pull/1866 echo "${CORE_VERSION} ${WEB_VERSION} ${FTL_VERSION} X" > "/etc/pihole/localversions" fi From cca841292185a742c6913ae2f9dda8981c223caf Mon Sep 17 00:00:00 2001 From: DL6ER Date: Sat, 23 Dec 2017 11:52:27 +0100 Subject: [PATCH 3/3] Use "echo -n" to avoid haveing newlines in the files Signed-off-by: DL6ER --- advanced/Scripts/updatecheck.sh | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/advanced/Scripts/updatecheck.sh b/advanced/Scripts/updatecheck.sh index 851cd0ce..16938a3a 100755 --- a/advanced/Scripts/updatecheck.sh +++ b/advanced/Scripts/updatecheck.sh @@ -47,8 +47,7 @@ if [[ "$2" == "remote" ]]; then GITHUB_WEB_VERSION="$(json_extract tag_name "$(curl -q 'https://api.github.com/repos/pi-hole/AdminLTE/releases/latest' 2> /dev/null)")" GITHUB_FTL_VERSION="$(json_extract tag_name "$(curl -q 'https://api.github.com/repos/pi-hole/FTL/releases/latest' 2> /dev/null)")" - # Have to store an extra dummy character at the end, see https://github.com/pi-hole/pi-hole/pull/1866 - echo "${GITHUB_CORE_VERSION} ${GITHUB_WEB_VERSION} ${GITHUB_FTL_VERSION} X" > "/etc/pihole/GitHubVersions" + echo -n "${GITHUB_CORE_VERSION} ${GITHUB_WEB_VERSION} ${GITHUB_FTL_VERSION}" > "/etc/pihole/GitHubVersions" else @@ -56,14 +55,12 @@ else WEB_BRANCH="$(get_local_branch /var/www/html/admin)" FTL_BRANCH="$(pihole-FTL branch)" - # Have to store an extra dummy character at the end, see https://github.com/pi-hole/pi-hole/pull/1866 - echo "${CORE_BRANCH} ${WEB_BRANCH} ${FTL_BRANCH} X" > "/etc/pihole/localbranches" + echo -n "${CORE_BRANCH} ${WEB_BRANCH} ${FTL_BRANCH}" > "/etc/pihole/localbranches" CORE_VERSION="$(get_local_version /etc/.pihole)" WEB_VERSION="$(get_local_version /var/www/html/admin)" FTL_VERSION="$(pihole-FTL version)" - # Have to store an extra dummy character at the end, see https://github.com/pi-hole/pi-hole/pull/1866 - echo "${CORE_VERSION} ${WEB_VERSION} ${FTL_VERSION} X" > "/etc/pihole/localversions" + echo -n "${CORE_VERSION} ${WEB_VERSION} ${FTL_VERSION}" > "/etc/pihole/localversions" fi