if we use post and pre together we can do this

This commit is contained in:
Erica Portnoy 2020-07-01 19:59:15 -07:00
parent 9ed789df0f
commit fd1d15c2b0
2 changed files with 15 additions and 7 deletions

View file

@ -1,15 +1,12 @@
#!/bin/sh -e
first_install="$(snapctl get first-install)"
if [ -z "$first_install" ]; then
snapctl set first-install="false"
# get certbot version
cb_installed="$(snapctl get cb-installed)"
if [ -z "$cb_installed" ]; then
exit 0
fi
ls $SNAP/certbot-version
# get certbot version
cb_installed=$(grep -oP 'installed:\s+\K\d+.\d+.\d(?=-)' $SNAP/certbot-version/certbot)
# get required certbot version for plugin
cb_required=$(grep -oP "certbot>=\K.*(?=')" $SNAP/setup.py)

View file

@ -0,0 +1,11 @@
#!/bin/sh -e
first_install="$(snapctl get first-install)"
if [ -z "$first_install" ]; then
snapctl set first-install="false"
exit 0
fi
cb_installed=$(grep -oP "__requires__ = 'certbot==\K.*(?=')" $SNAP/certbot-version/certbot)
echo "cb_installed $cb_installed"
snapctl set cb-installed="$cb_installed"