mirror of
https://github.com/certbot/certbot.git
synced 2026-06-06 23:32:06 -04:00
try comparing version numbers in python
This commit is contained in:
parent
f5bb7fa34a
commit
1270b937c3
1 changed files with 8 additions and 5 deletions
|
|
@ -2,8 +2,8 @@
|
|||
|
||||
# get certbot version
|
||||
if [ ! -f "$SNAP/certbot-shared/__init__.py" ]; then
|
||||
echo "No certbot version available; not doing version comparison check" >> "$SNAP_DATA/debuglog"
|
||||
exit 0
|
||||
echo "No certbot version available; not doing version comparison check" >> "$SNAP_DATA/debuglog"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
cb_installed=$(grep -oP "__version__ = '\K.*(?=')" $SNAP/certbot-shared/__init__.py)
|
||||
|
|
@ -13,8 +13,11 @@ echo "cb_installed: $cb_installed" >> "$SNAP_DATA/debuglog"
|
|||
cb_required=$(grep -oP "certbot>=\K.*(?=')" $SNAP/setup.py)
|
||||
echo "cb_required: $cb_required" >> "$SNAP_DATA/debuglog"
|
||||
|
||||
if [ "$cb_installed" -lt "$cb_required" ]; then
|
||||
echo "Certbot is version $cb_installed but needs to be at least $cb_required before \
|
||||
python -c 'from distutils.version import LooseVersion;\
|
||||
exit(1) if LooseVersion("$cb_installed") < LooseVersion("$cb_required") else exit(0)'
|
||||
|
||||
if [ "$?" -eq 1 ]; then
|
||||
echo "Certbot is version $cb_installed but needs to be at least $cb_required before \
|
||||
this plugin can be updated; will try again on next refresh."
|
||||
exit 1
|
||||
exit 1
|
||||
fi
|
||||
|
|
|
|||
Loading…
Reference in a new issue