summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSerge Hallyn <serge.hallyn@ubuntu.com>2015-11-30 22:24:16 -0600
committerSerge Hallyn <serge.hallyn@ubuntu.com>2015-11-30 22:24:16 -0600
commita1eda6d10d7b2d712e9e248e9a48970bec53d5f0 (patch)
tree0a7a29ad94d88206858eb7054334bcbba22ccf31
parent2baf93abf93bdbef2fdf565baadf716a67d633ee (diff)
bzr: make sure EMAIL is defined
Bzr refuses to commit changes before name and email are configured. If etckeeper is run very early during install, it can happen that these are in fac tnot yet set up. This patch ensures that they are configured. It has been in the Ubuntu delta for many years. Reference: https://bugs.launchpad.net/ubuntu/+source/etckeeper/+bug/661024 Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
-rwxr-xr-xcommit.d/50vcs-commit3
1 files changed, 3 insertions, 0 deletions
diff --git a/commit.d/50vcs-commit b/commit.d/50vcs-commit
index 43af353..569ba6c 100755
--- a/commit.d/50vcs-commit
+++ b/commit.d/50vcs-commit
@@ -28,6 +28,7 @@ if [ -n "$dnsdomainname" ]; then
hostname="$hostname.$dnsdomainname"
fi
+ORIG_USER=$USER
USER=
if [ -n "$SUDO_USER" ]; then
USER="$SUDO_USER"
@@ -95,6 +96,8 @@ elif [ "$VCS" = bzr ] && [ -d .bzr ]; then
if [ -z "$EMAIL" ] && [ -n "$USER" ]; then
EMAIL="$USER <$USER@$hostname>"
export EMAIL
+ else
+ bzr whoami || export EMAIL="$ORIG_USER <$ORIG_USER@$hostname>"
fi
if [ -n "$logfile" ]; then
bzr commit $BZR_COMMIT_OPTIONS -F "$logfile"