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 3
3
# Use of this source code is governed by a BSD-style
4
4
# license that can be found in the LICENSE file.
5
5
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
+
6
19
if [[ $( id -u) -ne 0 ]]; then
7
- if ! command -v sudo > /dev/null; then
20
+ if ! command -v sudo > /dev/null; then
8
21
>&2 echo " tailscaled could not start as root."
9
22
exit 1
10
23
fi
31
44
fi
32
45
fi
33
46
34
-
35
47
TAILSCALED_PID=" "
36
48
TAILSCALED_SOCK=/var/run/tailscale/tailscaled.sock
37
49
TAILSCALED_LOG=/var/log/tailscaled.log
@@ -72,6 +84,12 @@ if [[ -n "$auth_key" ]]; then
72
84
if [[ -n " ${CODESPACE_NAME} " ]]; then
73
85
hostnamearg=" --hostname=${CODESPACE_NAME} "
74
86
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
76
94
fi
77
95
fi
Original file line number Diff line number Diff line change 27
27
"features" : {
28
28
"tailscale" : {}
29
29
}
30
+ },
31
+ "tailscale_operator" : {
32
+ "image" : " ubuntu:latest" ,
33
+ "features" : {
34
+ "tailscale" : {
35
+ "operator" : " $USER"
36
+ }
37
+ }
30
38
}
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