From: xf0r3m Date: Mon, 14 Aug 2023 10:40:38 +0000 (+0200) Subject: Nowa funkcja sprawdzającą, czy są obecne zmiany w projekcie immudex-testing X-Git-Url: https://gitweb.morketsmerke.org/?a=commitdiff_plain;h=d297836b1e9d63b649859fc851b1a6405ddf1524;p=immudex-testing.git Nowa funkcja sprawdzającą, czy są obecne zmiany w projekcie immudex-testing --- 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; }