From 81866de229ba6889886a9c0bf23d94d0208f3c7e Mon Sep 17 00:00:00 2001 From: Michael Heuberger Date: Sat, 2 Sep 2023 22:59:39 +1200 Subject: [PATCH] Amend --always option to all git describe commands (#2275) --- management/status_checks.py | 6 +++--- setup/bootstrap.sh | 2 +- setup/questions.sh | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/management/status_checks.py b/management/status_checks.py index b31a9818..07e7dc1d 100755 --- a/management/status_checks.py +++ b/management/status_checks.py @@ -800,7 +800,7 @@ def query_dns(qname, rtype, nxdomain='[Not Set]', at=None, as_list=False): # running bind server), or if the 'at' argument is specified, use that host # as the nameserver. resolver = dns.resolver.get_default_resolver() - + # Make sure at is not a string that cannot be used as a nameserver if at and at not in {'[Not set]', '[timeout]'}: resolver = dns.resolver.Resolver() @@ -912,11 +912,11 @@ def list_apt_updates(apt_update=True): return pkgs def what_version_is_this(env): - # This function runs `git describe --abbrev=0` on the Mail-in-a-Box installation directory. + # This function runs `git describe --always --abbrev=0` on the Mail-in-a-Box installation directory. # Git may not be installed and Mail-in-a-Box may not have been cloned from github, # so this function may raise all sorts of exceptions. miab_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) - tag = shell("check_output", ["/usr/bin/git", "describe", "--abbrev=0"], env={"GIT_DIR": os.path.join(miab_dir, '.git')}).strip() + tag = shell("check_output", ["/usr/bin/git", "describe", "--always", "--abbrev=0"], env={"GIT_DIR": os.path.join(miab_dir, '.git')}).strip() return tag def get_latest_miab_version(): diff --git a/setup/bootstrap.sh b/setup/bootstrap.sh index d5ede149..ee35bcf2 100644 --- a/setup/bootstrap.sh +++ b/setup/bootstrap.sh @@ -73,7 +73,7 @@ fi cd $HOME/mailinabox # Update it. -if [ "$TAG" != $(git describe) ]; then +if [ "$TAG" != $(git describe --always) ]; then echo Updating Mail-in-a-Box to $TAG . . . git fetch --depth 1 --force --prune origin tag $TAG if ! git checkout -q $TAG; then diff --git a/setup/questions.sh b/setup/questions.sh index bf382f49..53e84bea 100644 --- a/setup/questions.sh +++ b/setup/questions.sh @@ -207,6 +207,6 @@ if [ "$PRIVATE_IPV6" != "$PUBLIC_IPV6" ]; then echo "Private IPv6 Address: $PRIVATE_IPV6" fi if [ -f /usr/bin/git ] && [ -d .git ]; then - echo "Mail-in-a-Box Version: " $(git describe) + echo "Mail-in-a-Box Version: " $(git describe --always) fi echo