pkg_postinst() { if [[ ${REPLACING_VERSIONS} -le 1.3 ]]; then ... $ [[ ${REPLACING_VERSIONS} -le 1.3 ]] bash: [[: 1.3: syntax error: invalid arithmetic operator (error token is ".3") $
I thought that problem was obvious, but apparently it is not :( . -lt, -le, -gt, -ge, -eq, -ne operators support only integers. 1.3 is not integer. $ [[ 1 -le 3 ]] ; echo $? 0 $ [[ 3 -le 3 ]] ; echo $? 0 $ [[ 4 -le 3 ]] ; echo $? 1 $ [[ 1.5 -le 3 ]] ; echo $? bash: [[: 1.5: syntax error: invalid arithmetic operator (error token is ".5") 1 $ [[ 1 -le 1.5 ]] ; echo $? bash: [[: 1.5: syntax error: invalid arithmetic operator (error token is ".5") 1 $
Maybe version_is_at_least() from versionator.eclass could be used. local ver for ver in ${REPLACING_VERSIONS}; do if ! version_is_at_least 1.3 ${ver}; then ewarn ... break fi done
Sounds good.
Why would we expect multiple REPLACING_VERSIONS here?
You know what. rrdtool-1.2 was removed from the tree some 4 years ago. I have removed this obsolete piece of advice altogether.
https://projects.gentoo.org/pms/5/pms.html "Table 11.1: Defined variables ... REPLACING_VERSIONS ... A whitespace-separated list of versions of this package (including revision, if specified) that are being replaced (uninstalled or overwritten) as a result of this install. ... 11.1.2 REPLACING_VERSIONS and REPLACED_BY_VERSION ... REPLACING_VERSIONS is a list, not a single optional value, to handle pathological cases such as installing foo-2:2 to replace foo-2:1 and foo-3:2."