File tree Expand file tree Collapse file tree 3 files changed +20
-0
lines changed Expand file tree Collapse file tree 3 files changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -25,6 +25,11 @@ func GetRootlessUID() int {
25
25
return os .Getuid ()
26
26
}
27
27
28
+ // GetRootlessGID returns the GID of the user in the parent userNS
29
+ func GetRootlessGID () int {
30
+ return os .Getgid ()
31
+ }
32
+
28
33
// RootlessEnv returns the environment settings for the rootless containers
29
34
func RootlessEnv () []string {
30
35
return append (os .Environ (), UsernsEnvName + "=" )
Original file line number Diff line number Diff line change @@ -441,6 +441,16 @@ func GetRootlessUID() int {
441
441
return os .Getuid ()
442
442
}
443
443
444
+ // GetRootlessGID returns the GID of the user in the parent userNS
445
+ func GetRootlessGID () int {
446
+ gidEnv := getenv ("_CONTAINERS_ROOTLESS_GID" )
447
+ if gidEnv != "" {
448
+ u , _ := strconv .Atoi (gidEnv )
449
+ return u
450
+ }
451
+ return os .Getgid ()
452
+ }
453
+
444
454
// RootlessEnv returns the environment settings for the rootless containers
445
455
func RootlessEnv () []string {
446
456
return append (os .Environ (), UsernsEnvName + "=done" )
Original file line number Diff line number Diff line change @@ -25,6 +25,11 @@ func GetRootlessUID() int {
25
25
return os .Getuid ()
26
26
}
27
27
28
+ // GetRootlessGID returns the GID of the user in the parent userNS
29
+ func GetRootlessGID () int {
30
+ return os .Getgid ()
31
+ }
32
+
28
33
// RootlessEnv returns the environment settings for the rootless containers
29
34
func RootlessEnv () []string {
30
35
return append (os .Environ (), UsernsEnvName + "=" )
You can’t perform that action at this time.
0 commit comments