From d297836b1e9d63b649859fc851b1a6405ddf1524 Mon Sep 17 00:00:00 2001 From: xf0r3m Date: Mon, 14 Aug 2023 12:40:38 +0200 Subject: [PATCH] =?utf8?q?Nowa=20funkcja=20sprawdzaj=C4=85c=C4=85,=20czy?= =?utf8?q?=20s=C4=85=20obecne=20zmiany=20w=20projekcie=20immudex-testing?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- tools/library.sh | 36 ++++++++++++------------------------ 1 file changed, 12 insertions(+), 24 deletions(-) diff --git a/tools/library.sh b/tools/library.sh index 1cb2454..998968a 100755 --- a/tools/library.sh +++ b/tools/library.sh @@ -17,33 +17,21 @@ function get_machine_arch() { fi } -function check_distro_version() { - set -e - root="/run/live/medium"; - if [ -d ${root}/live ]; then - if [ -f ${root}/live/version ]; then - version=$(cat ${root}/live/version | sed 's/\.//g'); - else version="000"; +function check_distro_commit() { + versionFile="/run/live/medium/live/version"; + if [ -f $versionFile ]; then + localVersion=$(cat $versionFile); + git clone -q --depth=1 https://git.morketsmerke.org/git/immudex-testing /tmp/immudex-testing; + latestVersion=$(cd /tmp/immudex-testing && git log --pretty=oneline | cut -d " " -f 1); + if [ "$1" ] && [ "$1" == "--print" ]; then + $(cd /tmp/immudex-testing && git log $latestVersion); fi - BRANCH=$(get_debian_branch); - ARCH=$(get_machine_arch); - if [ ! -f /tmp/ltver ]; then - wget -q https://ftp.morketsmerke.org/immudex/${BRANCH}/upgrades/latest/${ARCH}/version -O /tmp/ltver; - fi - if [ ! -s /tmp/ltver ]; then sudo rm /tmp/ltver; return 255; fi; - newVersionTxt=$(cat /tmp/ltver); - newVersionInt=$(echo $newVersionTxt | sed 's/\.//g'); - if [ $version -lt $newVersionInt ]; then - exitcode=0; + if [ "$localVersion" = "$latestVersion"]; then + return 0; else - exitcode=1; + return 1; fi else - exitcode=255; - fi - if [ "$1" ] && [ "$1" = "--print" ]; then - echo $newVersionTxt; - return 0; + return 255; fi - return $exitcode; } -- 2.39.5