2020-03-29 19:52:49 -04:00
|
|
|
package alpine
|
|
|
|
|
|
|
|
|
|
import (
|
2021-07-23 16:06:19 +00:00
|
|
|
"os/user"
|
2020-03-29 19:52:49 -04:00
|
|
|
)
|
|
|
|
|
|
2021-07-23 18:51:51 +00:00
|
|
|
type Alpine struct {
|
2021-07-23 16:06:19 +00:00
|
|
|
alpineReleasePath string
|
|
|
|
|
passwdPath string
|
|
|
|
|
lookupID func(uid string) (*user.User, error)
|
|
|
|
|
lookup func(username string) (*user.User, error)
|
2020-03-29 19:52:49 -04:00
|
|
|
}
|
|
|
|
|
|
2021-07-23 18:51:51 +00:00
|
|
|
func New() *Alpine {
|
|
|
|
|
return &Alpine{
|
2021-07-23 16:06:19 +00:00
|
|
|
alpineReleasePath: "/etc/alpine-release",
|
|
|
|
|
passwdPath: "/etc/passwd",
|
|
|
|
|
lookupID: user.LookupId,
|
|
|
|
|
lookup: user.Lookup,
|
2020-03-29 19:52:49 -04:00
|
|
|
}
|
|
|
|
|
}
|