Module: check_mk
Branch: master
Commit: 2240d8c420439350311025f563859215856c8b7b
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=2240d8c4204393…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Tue Oct 24 13:23:21 2017 +0200
Check/create the build user not only during chroot setup
Change-Id: I0f8062b2587ea35494af5950928695b24e2dafdc
---
agents/windows/make-agent | 9 +++++++++
agents/windows/make-chroot | 6 ------
2 files changed, 9 insertions(+), 6 deletions(-)
diff --git a/agents/windows/make-agent b/agents/windows/make-agent
index 1623201..c664283 100755
--- a/agents/windows/make-agent
+++ b/agents/windows/make-agent
@@ -63,6 +63,15 @@ fi
VERSIONFILE=$versionfile CHROOT_PATH=$CHROOT_PATH \
CHROOT_BUILD_DIR=$CHROOT_BUILD_DIR ./make-chroot
fi
+
+ # Add user for building windows agent without root privileges.
+ # Check that user does not exist before since SUDO_USER may be root, as well.
+ #
+ # Do this not only during setup, because the setup is only executed once and
+ # the build may be started with different SUDO_USER users).
+ if ! grep -q "\<${SUDO_USER}\>" "$CHROOT_PATH/etc/passwd" ;
then
+ ./do-chroot "useradd -lmo -u $(id -u $SUDO_USER) -s /bin/bash
$SUDO_USER"
+ fi
) 200>/var/lock/cmk-make-agent_${CHROOT_PATH//\//-}.lock
echo "[MAKE-CHROOT LOCK] released"
diff --git a/agents/windows/make-chroot b/agents/windows/make-chroot
index df319a9..288080a 100755
--- a/agents/windows/make-chroot
+++ b/agents/windows/make-chroot
@@ -148,12 +148,6 @@ if [ ! -h $CHROOT_PATH/usr/bin/python ] ; then
ln -sf python2.7 $CHROOT_PATH/usr/bin/python
fi
-# Add user for building windows agent without root privileges.
-# Check that user does not exist before since SUDO_USER may be root, as well.
-if ! grep -q "\<${SUDO_USER}\>" "$CHROOT_PATH/etc/passwd" ;
then
- ./do-chroot "useradd -lmo -u $(id -u $SUDO_USER) -s /bin/bash $SUDO_USER"
-fi
-
# "Disable" apt privilege dropping in chroot
sed -ri 's/^_apt:x:[0-9]+:/_apt:x:0:/g' $CHROOT_PATH/etc/passwd