From aa1b621c10c9df485a8b842e352a4cab25dc33c5 Mon Sep 17 00:00:00 2001 From: grossmj Date: Thu, 19 Mar 2020 17:50:27 +1030 Subject: [PATCH] Improvement of support for docker USER directive. Fixes #1727. --- gns3server/compute/docker/resources/init.sh | 8 ++------ gns3server/compute/docker/resources/run-cmd.sh | 6 ++++++ 2 files changed, 8 insertions(+), 6 deletions(-) create mode 100755 gns3server/compute/docker/resources/run-cmd.sh diff --git a/gns3server/compute/docker/resources/init.sh b/gns3server/compute/docker/resources/init.sh index bc33ea1c..8040d025 100755 --- a/gns3server/compute/docker/resources/init.sh +++ b/gns3server/compute/docker/resources/init.sh @@ -87,9 +87,5 @@ done ifup -a -f # continue normal docker startup -GNS3_CMD="PATH=$OLD_PATH exec" -while test "$#" -gt 0 ; do - GNS3_CMD="${GNS3_CMD} \"${1//\"/\\\"}\"" - shift -done -exec su ${GNS3_USER-root} -p -c "$GNS3_CMD" +eval HOME=$(echo ~${GNS3_USER-root}) +exec su ${GNS3_USER-root} -p -- /gns3/run-cmd.sh "$OLD_PATH" "$@" diff --git a/gns3server/compute/docker/resources/run-cmd.sh b/gns3server/compute/docker/resources/run-cmd.sh new file mode 100755 index 00000000..610d8d53 --- /dev/null +++ b/gns3server/compute/docker/resources/run-cmd.sh @@ -0,0 +1,6 @@ +#!/bin/sh +# run docker startup, first arg is new PATH, remainder is command + +PATH="$1" +shift +exec "$@"