diff options
-rw-r--r-- | conf.d/etc/profile.d/xds-server.sh | 4 | ||||
-rw-r--r-- | conf.d/usr/lib/systemd/user/xds-server.service | 2 | ||||
-rwxr-xr-x | scripts/xds-docker-create-container.sh | 37 |
3 files changed, 33 insertions, 10 deletions
diff --git a/conf.d/etc/profile.d/xds-server.sh b/conf.d/etc/profile.d/xds-server.sh new file mode 100644 index 0000000..72f2b1a --- /dev/null +++ b/conf.d/etc/profile.d/xds-server.sh @@ -0,0 +1,4 @@ +#!/bin/bash + +#---------- AGL xds-server tool options Start ---------" +[ ":${PATH}:" != *":%%XDS_INSTALL_BIN_DIR%%:"* ] && export PATH=%%XDS_INSTALL_BIN_DIR%%:${PATH} diff --git a/conf.d/usr/lib/systemd/user/xds-server.service b/conf.d/usr/lib/systemd/user/xds-server.service index 600a343..0175d29 100644 --- a/conf.d/usr/lib/systemd/user/xds-server.service +++ b/conf.d/usr/lib/systemd/user/xds-server.service @@ -8,4 +8,4 @@ ExecStart=/opt/AGL/xds/server/xds-server-start.sh ExecStop=/opt/AGL/xds/server/xds-server-stop.sh [Install] -WantedBy=multi-user.target +WantedBy=default.target 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." |