mirror of
https://github.com/minio/minio.git
synced 2025-04-18 17:55:28 -04:00
Merge pull request #969 from harshavardhana/32bit
386: Support minio server on 32bit linux.
This commit is contained in:
commit
8046b24b97
@ -20,16 +20,16 @@ import (
|
|||||||
"os"
|
"os"
|
||||||
"os/user"
|
"os/user"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
"runtime"
|
||||||
|
"strconv"
|
||||||
|
|
||||||
"github.com/minio/minio-xl/pkg/probe"
|
"github.com/minio/minio-xl/pkg/probe"
|
||||||
"github.com/minio/minio-xl/pkg/quick"
|
"github.com/minio/minio-xl/pkg/quick"
|
||||||
)
|
)
|
||||||
|
|
||||||
// workaround for docker images with fully static binary.
|
// Workaround for docker images with fully static binary and 32bit linux operating systems.
|
||||||
// for static binaries NSS library will not be a part of the static binary
|
// For static binaries NSS library will not be a part of the static binary hence user.Current() fails.
|
||||||
// hence user.Current() fails
|
// For 32bit linux CGO is not enabled so it will not provide linux specific codebase.
|
||||||
// more here : http://gnu.ist.utl.pt/software/libc/FAQ.html
|
|
||||||
// FAQ says : NSS (for details just type `info libc "Name Service Switch"') won't work properly without shared libraries
|
|
||||||
func userCurrent() (*user.User, *probe.Error) {
|
func userCurrent() (*user.User, *probe.Error) {
|
||||||
if os.Getenv("DOCKERIMAGE") == "1" {
|
if os.Getenv("DOCKERIMAGE") == "1" {
|
||||||
wd, err := os.Getwd()
|
wd, err := os.Getwd()
|
||||||
@ -38,6 +38,15 @@ func userCurrent() (*user.User, *probe.Error) {
|
|||||||
}
|
}
|
||||||
return &user.User{Uid: "0", Gid: "0", Username: "root", Name: "root", HomeDir: wd}, nil
|
return &user.User{Uid: "0", Gid: "0", Username: "root", Name: "root", HomeDir: wd}, nil
|
||||||
}
|
}
|
||||||
|
if runtime.GOARCH == "386" && runtime.GOOS == "linux" {
|
||||||
|
return &user.User{
|
||||||
|
Uid: strconv.Itoa(os.Getuid()),
|
||||||
|
Gid: strconv.Itoa(os.Getgid()),
|
||||||
|
Username: os.Getenv("USER"),
|
||||||
|
Name: os.Getenv("USER"),
|
||||||
|
HomeDir: os.Getenv("HOME"),
|
||||||
|
}, nil
|
||||||
|
}
|
||||||
user, err := user.Current()
|
user, err := user.Current()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, probe.NewError(err)
|
return nil, probe.NewError(err)
|
||||||
|
18
utils.go
18
utils.go
@ -20,6 +20,7 @@ import (
|
|||||||
"encoding/base64"
|
"encoding/base64"
|
||||||
"os"
|
"os"
|
||||||
"os/user"
|
"os/user"
|
||||||
|
"runtime"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
@ -56,11 +57,9 @@ func isMaxObjectSize(size string) bool {
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
// workaround for docker images with fully static binary.
|
// Workaround for docker images with fully static binary and 32bit linux operating systems.
|
||||||
// for static binaries NSS library will not be a part of the static binary
|
// For static binaries NSS library will not be a part of the static binary hence user.Current() fails.
|
||||||
// hence user.Current() fails
|
// For 32bit linux CGO is not enabled so it will not provide linux specific codebase.
|
||||||
// more here : http://gnu.ist.utl.pt/software/libc/FAQ.html
|
|
||||||
// FAQ says : NSS (for details just type `info libc "Name Service Switch"') won't work properly without shared libraries
|
|
||||||
func userCurrent() (*user.User, *probe.Error) {
|
func userCurrent() (*user.User, *probe.Error) {
|
||||||
if os.Getenv("DOCKERIMAGE") == "1" {
|
if os.Getenv("DOCKERIMAGE") == "1" {
|
||||||
wd, err := os.Getwd()
|
wd, err := os.Getwd()
|
||||||
@ -69,6 +68,15 @@ func userCurrent() (*user.User, *probe.Error) {
|
|||||||
}
|
}
|
||||||
return &user.User{Uid: "0", Gid: "0", Username: "root", Name: "root", HomeDir: wd}, nil
|
return &user.User{Uid: "0", Gid: "0", Username: "root", Name: "root", HomeDir: wd}, nil
|
||||||
}
|
}
|
||||||
|
if runtime.GOARCH == "386" && runtime.GOOS == "linux" {
|
||||||
|
return &user.User{
|
||||||
|
Uid: strconv.Itoa(os.Getuid()),
|
||||||
|
Gid: strconv.Itoa(os.Getgid()),
|
||||||
|
Username: os.Getenv("USER"),
|
||||||
|
Name: os.Getenv("USER"),
|
||||||
|
HomeDir: os.Getenv("HOME"),
|
||||||
|
}, nil
|
||||||
|
}
|
||||||
user, err := user.Current()
|
user, err := user.Current()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, probe.NewError(err)
|
return nil, probe.NewError(err)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user