From f60723c03f7537793d61cb19caf509954ed54687 Mon Sep 17 00:00:00 2001 From: ramon Date: Mon, 11 Dec 2017 12:35:16 +0000 Subject: #768: {{{oglivecli check}}} comprueba también si hay nuevas descargas de imágenes ISO después de haber sido instaladas. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: https://opengnsys.es/svn/branches/version1.1@5525 a21b9725-9963-47de-94b9-378ad31fedc9 --- server/bin/oglivecli | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'server/bin/oglivecli') diff --git a/server/bin/oglivecli b/server/bin/oglivecli index cc2de743..5be4e6dc 100755 --- a/server/bin/oglivecli +++ b/server/bin/oglivecli @@ -186,7 +186,7 @@ function check() { [ ! -f $INFOFILE ] && echo "Configuration file does not exists: $INFOFILE" && let ERR++ [ -f $INFOFILE -a "$(jq -c keys $INFOFILE 2>/dev/null)" != "[\"default\",\"oglive\"]" ] && echo "Format error in configuration file: $INFOFILE" && let ERR++ [ ! -e $TFTPDIR ] && echo "TFTP directory does not exist: $TFTPDIR." && let ERR++ - # Check for installed ogLives. + # Check for installed ogLive clients. INST=( $(find $TFTPDIR/ -type d -name "$DEFOGLIVE-*" -a ! -name "*.old" -printf "%f\n" | sort) ) [[ ${#INST[@]} -eq 0 ]] && echo "No ogLive clients are installed." && let ERR++ DEF=( $(jq -r .oglive[].directory $INFOFILE 2>/dev/null | sort) ) @@ -202,6 +202,12 @@ function check() { [ -n "$AUX" ] && echo "Some ISOs are downloaded but not defined: ${AUX//$'\n'/, }" && let ERR++ AUX=$(comm -13 <(printf "%s\n" ${INST[*]}) <(printf "%s\n" ${DEF[*]})) [ -n "$AUX" ] && echo "Some ISOs are defined but not downloaded: ${AUX//$'\n'/, }" && let ERR++ + # Check for new ISO files downloaded after installation. + AUX=$(jq -r '.oglive[] as $og | $og.iso + ":" + $og.directory' $INFOFILE 2>/dev/null | \ + while IFS=":" read -r DEF INST; do + [ $DOWNLOADDIR/$DEF -nt $TFTPDIR/$INST ] && echo "$DEF" + done) + [ -n "$AUX" ] && echo "Some ISOs are downloaded after installation: ${AUX//$'\n'/, }" && let ERR++ # Print result. [ $ERR -eq 0 ] && echo "OK!" || echo "Problems detected: $ERR" return $ERR -- cgit v1.2.3-18-g5258