summaryrefslogtreecommitdiffstats
path: root/server/bin
diff options
context:
space:
mode:
authorRamón M. Gómez <ramongomez@us.es>2019-06-07 12:54:06 +0200
committerRamón M. Gómez <ramongomez@us.es>2019-06-07 12:54:06 +0200
commit72d19dab151b88cb9fefc579b5db94412a599685 (patch)
treea64bf397edab524e1c041e23f604bb5b3bd2be5a /server/bin
parent30f8b1dad3c6cb466b12ef8d02b2bb8549e2df87 (diff)
#914: Script {{{oglivecli}}} checks if installed ogLive images are fully compatible.
Diffstat (limited to 'server/bin')
-rwxr-xr-xserver/bin/oglivecli24
1 files changed, 16 insertions, 8 deletions
diff --git a/server/bin/oglivecli b/server/bin/oglivecli
index e6f8575b..140f2c81 100755
--- a/server/bin/oglivecli
+++ b/server/bin/oglivecli
@@ -14,13 +14,14 @@
# Global constants definition.
-PROG=$(basename "$(realpath "$0")")
-OPENGNSYS=/opt/opengnsys
-DOWNLOADDIR=$OPENGNSYS/lib
-DOWNLOADURL="https://opengnsys.es/trac/downloads"
-TFTPDIR=$OPENGNSYS/tftpboot
-DEFOGLIVE="ogLive"
-INFOFILE=$OPENGNSYS/etc/ogliveinfo.json
+PROG=$(basename "$(realpath "$0")") # Program name.
+OPENGNSYS=/opt/opengnsys # OpenGnsys main directory.
+DOWNLOADDIR=$OPENGNSYS/lib # Directory to store ogLive images.
+DOWNLOADURL="https://opengnsys.es/trac/downloads" # Download URL.
+TFTPDIR=$OPENGNSYS/tftpboot # TFTP directory.
+DEFOGLIVE="ogLive" # Default ogLive directory.
+MINREL=20190601 # Mininum ogLive compatibility release.
+INFOFILE=$OPENGNSYS/etc/ogliveinfo.json # Configuration file.
# Auxiliar functions.
@@ -154,6 +155,7 @@ ogLive download URL: $DOWNLOADURL
ogLive download directory: $DOWNLOADDIR
ogLive installation directory: $TFTPDIR
Default ogLive name: $DEFOGLIVE
+Mainimum compatibility release: r$MINREL
EOT
;;
1) # Show specified parameter.
@@ -163,6 +165,7 @@ EOT
download-dir) echo "$DOWNLOADDIR" ;;
install-dir) echo "$TFTPDIR" ;;
default-name) echo "$DEFOGLIVE" ;;
+ min-release) echo "r$MINREL" ;;
*) raiseError notfound "$1" ;;
esac
;;
@@ -208,6 +211,11 @@ function check() {
[ $DOWNLOADDIR/$DEF -nt $TFTPDIR/$INST ] && echo "$DEF"
done)
[ -n "$AUX" ] && echo "Some ISOs are downloaded after installation: ${AUX//$'\n'/, }" && let ERR++
+ AUX=$(jq -r '.oglive[] as $og | $og.revision[1:9] + ":" + $og.directory' $INFOFILE 2>/dev/null | \
+ while IFS=":" read -r DEF INST; do
+ [ $DEF -lt $MINREL ] && echo "$INST"
+ done)
+ [ -n "$AUX" ] && echo "Some installed ogLive aren't fully compatible: ${AUX//$'\n'/, }" && let ERR++
# Print result.
[ $ERR -eq 0 ] && echo "OK!" || echo "Problems detected: $ERR"
return $ERR
@@ -253,7 +261,7 @@ function search() {
# Show a menu to select and download an ogLive ISO image from the OpenGnsys website.
function download() {
local OGLIVE NISOS i SOURCELENGTH TARGETFILE
- local ISOREL MINREL=5000 # Mininum compatibility release.
+ local ISOREL
[ $# -gt 1 ] && raiseError usage
[ ! -d $DOWNLOADDIR ] && raiseError notfound "Download directory"
[ ! -w $DOWNLOADDIR ] && raiseError access "Download directory"