File tree Expand file tree Collapse file tree 3 files changed +31
-4
lines changed Expand file tree Collapse file tree 3 files changed +31
-4
lines changed Original file line number Diff line number Diff line change 33# Use of this source code is governed by a BSD-style
44# license that can be found in the LICENSE file.
55
6+ # if an operator argument has been provided, set the operator to
7+ # the specified value; if the value is the special value "$USER"
8+ # then set the operator to the default user for the devcontainer.
9+ #
10+ # This is done before the sudo switchover so we have the actual
11+ # user persisted.
12+ if [[ -n " $OPERATOR " ]]; then
13+ if [[ " $OPERATOR " == " \$ USER" ]]; then
14+ OPERATOR=$( id -un)
15+ fi
16+ export OPERATOR
17+ fi
18+
619if [[ $( id -u) -ne 0 ]]; then
7- if ! command -v sudo > /dev/null; then
20+ if ! command -v sudo > /dev/null; then
821 >&2 echo " tailscaled could not start as root."
922 exit 1
1023 fi
3144 fi
3245fi
3346
34-
3547TAILSCALED_PID=" "
3648TAILSCALED_SOCK=/var/run/tailscale/tailscaled.sock
3749TAILSCALED_LOG=/var/log/tailscaled.log
@@ -72,6 +84,12 @@ if [[ -n "$auth_key" ]]; then
7284 if [[ -n " ${CODESPACE_NAME} " ]]; then
7385 hostnamearg=" --hostname=${CODESPACE_NAME} "
7486 fi
75- /usr/local/bin/tailscale up --accept-routes --authkey=" $auth_key " $hostnamearg
87+
88+ operatorarg=" "
89+ if [[ -n " ${OPERATOR} " ]]; then
90+ operatorarg=" --operator=${OPERATOR} "
91+ fi
92+
93+ /usr/local/bin/tailscale up --accept-routes --authkey=" $auth_key " $hostnamearg $operatorarg
7694 fi
7795fi
Original file line number Diff line number Diff line change 2727 "features" : {
2828 "tailscale" : {}
2929 }
30+ },
31+ "tailscale_operator" : {
32+ "image" : " ubuntu:latest" ,
33+ "features" : {
34+ "tailscale" : {
35+ "operator" : " $USER"
36+ }
37+ }
3038 }
31- }
39+ }
Original file line number Diff line number Diff line change 1+ test.sh
You can’t perform that action at this time.
0 commit comments