summaryrefslogtreecommitdiffstats
path: root/scripts/xds-docker-create-container.sh
diff options
context:
space:
mode:
authorSebastien Douheret <sebastien.douheret@iot.bzh>2017-10-16 15:27:12 +0200
committerSebastien Douheret <sebastien.douheret@iot.bzh>2017-10-16 15:27:12 +0200
commit6f21a87e3b3cdbf013f470519ed17394f9d8853e (patch)
treeccf9b1ca2d6bbb5f6a7088523a6e9c7fe4bdcdaf /scripts/xds-docker-create-container.sh
parent5f67c1a72b982fc4057e2f6e4803324d3be1330a (diff)
Fixed xds systemd user service
Diffstat (limited to 'scripts/xds-docker-create-container.sh')
-rwxr-xr-xscripts/xds-docker-create-container.sh37
1 files changed, 28 insertions, 9 deletions
diff --git a/scripts/xds-docker-create-container.sh b/scripts/xds-docker-create-container.sh
index e29d7ec..f77d3c6 100755
--- a/scripts/xds-docker-create-container.sh
+++ b/scripts/xds-docker-create-container.sh
@@ -165,20 +165,39 @@ echo " ssh -p $SSH_PORT $DOCKER_USER@localhost"
### User / Group id
if ($UPDATE_UID); then
- echo "Setup docker user and group id to match yours"
- docker exec -t ${NAME} bash -c "systemctl --user stop xds-server" || exit 1
+ echo -n "Setup docker user and group id to match yours"
+
+ docker exec -t ${NAME} bash -c "/bin/loginctl kill-user devel"
+ res=3
+ max=30
+ count=0
+ while [ $res -ne 1 ] && [ $count -le $max ]; do
+ sleep 1
+ docker exec ${NAME} bash -c "loginctl user-status devel |grep sd-pam" 2>/dev/null 1>&2
+ res=$?
+ echo -n "."
+ count=$(expr $count + 1);
+ done
+
+ echo -n " ."
docker exec -t ${NAME} bash -c "usermod -u $(id -u) $DOCKER_USER && groupmod -g $(id -g) $DOCKER_USER" || exit 1
- docker exec -t ${NAME} bash -c "chown -R $DOCKER_USER:$DOCKER_USER /home/$DOCKER_USER /tmp/xds*" || exit 1
- docker exec -t ${NAME} bash -c "systemctl --user start xds-server" || exit 1
+ echo -n "."
+ docker exec -t ${NAME} bash -c "chown -R $DOCKER_USER:$DOCKER_USER /home/$DOCKER_USER" || exit 1
+ echo -n "."
+ docker exec -t ${NAME} bash -c "chown -R $DOCKER_USER:$DOCKER_USER /tmp/xds*"
+ echo -n "."
+ docker exec -t ${NAME} bash -c "systemctl start autologin"
+ echo -n "."
+ ssh -p $SSH_PORT $DOCKER_USER@localhost -- "systemctl --user start xds-server" || exit 1
+ echo -n "."
+ docker restart ${NAME}
+ echo
fi
### Force xds-server restart
if ($FORCE_RESTART); then
- echo "Stopping xds-server..."
- docker exec -t ${NAME} bash -c "systemctl --user stop xds-server" || exit 1
- sleep 1
- echo "Starting xds-server..."
- docker exec -t ${NAME} bash -c "systemctl --user start xds-server" || exit 1
+ echo "Restart xds-server..."
+ ssh -p $SSH_PORT $DOCKER_USER@localhost -- "systemctl --user restart xds-server" || exit 1
fi
echo "Done, docker container $NAME is ready to be used."