#!/bin/sh . "$LIXROOT/lib/versionformat.sh" versionpasses() { # index() { echo "$1" | tr -s '[:space:]' ' ' | cut -d' ' -f$2; } format="$(versionformat "$1")" version="$2" constraints="$3" value="yes" while [ "$constraints" != "" ]; do # handle 'or' operator if [ "$(index "$constraints" 1)" = "||" ]; then constraints="$(index "$constraints" 2-)" [ "$value" = "yes" ] \ && break \ || { value="yes" && continue; } fi # handle implicit 'and' operator if [ "$value" = "yes" ]; then value="$(vercmp -f "$format" "$version $(index "$constraints" -2)")" fi constraints="$(index "$constraints" 3-)" done echo "$value" }