mirror of
https://github.com/AdguardTeam/AdGuardHome.git
synced 2025-05-04 23:12:56 +03:00
Pull request: all: support setgid, setuid on unix
Updates #2763. Squashed commit of the following: commit bd2077c6569b53ae341a58aa73de6063d7037e8e Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Fri Jun 4 16:25:17 2021 +0300 all: move rlimit_nofile, imp docs commit ba95d4ab7c722bf83300d626a598aface37539ad Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Fri Jun 4 15:12:23 2021 +0300 all: support setgid, setuid on unix
This commit is contained in:
parent
3b87478470
commit
48c44c29ab
14 changed files with 283 additions and 31 deletions
internal/home
|
@ -19,7 +19,7 @@ import (
|
|||
)
|
||||
|
||||
// currentSchemaVersion is the current schema version.
|
||||
const currentSchemaVersion = 10
|
||||
const currentSchemaVersion = 11
|
||||
|
||||
// These aliases are provided for convenience.
|
||||
type (
|
||||
|
@ -81,6 +81,7 @@ func upgradeConfigSchema(oldVersion int, diskConf yobj) (err error) {
|
|||
upgradeSchema7to8,
|
||||
upgradeSchema8to9,
|
||||
upgradeSchema9to10,
|
||||
upgradeSchema10to11,
|
||||
}
|
||||
|
||||
n := 0
|
||||
|
@ -611,6 +612,41 @@ func upgradeSchema9to10(diskConf yobj) (err error) {
|
|||
return nil
|
||||
}
|
||||
|
||||
// upgradeSchema10to11 performs the following changes:
|
||||
//
|
||||
// # BEFORE:
|
||||
// 'rlimit_nofile': 42
|
||||
//
|
||||
// # AFTER:
|
||||
// 'os':
|
||||
// 'group': ''
|
||||
// 'rlimit_nofile': 42
|
||||
// 'user': ''
|
||||
//
|
||||
func upgradeSchema10to11(diskConf yobj) (err error) {
|
||||
log.Printf("Upgrade yaml: 10 to 11")
|
||||
|
||||
diskConf["schema_version"] = 11
|
||||
|
||||
rlimit := 0
|
||||
rlimitVal, ok := diskConf["rlimit_nofile"]
|
||||
if ok {
|
||||
rlimit, ok = rlimitVal.(int)
|
||||
if !ok {
|
||||
return fmt.Errorf("unexpected type of rlimit_nofile: %T", rlimitVal)
|
||||
}
|
||||
}
|
||||
|
||||
delete(diskConf, "rlimit_nofile")
|
||||
diskConf["os"] = yobj{
|
||||
"group": "",
|
||||
"rlimit_nofile": rlimit,
|
||||
"user": "",
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// TODO(a.garipov): Replace with log.Output when we port it to our logging
|
||||
// package.
|
||||
func funcName() string {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue