|
@@ -9,6 +9,7 @@ import (
|
|
|
"path/filepath"
|
|
|
"strconv"
|
|
|
"strings"
|
|
|
+ "syscall"
|
|
|
"unicode"
|
|
|
|
|
|
"github.com/AlecAivazis/survey/v2"
|
|
@@ -400,8 +401,12 @@ func checkGroups(forceYes *bool) (*user.Group, error) {
|
|
|
if err != nil {
|
|
|
return dockerGroup, fmt.Errorf("unable to convert group ID to int: %s", err)
|
|
|
}
|
|
|
- if err := os.Chown(csConfig.DbConfig.DbPath, 0, intID); err != nil {
|
|
|
- return dockerGroup, fmt.Errorf("unable to chown sqlite db file '%s': %s", csConfig.DbConfig.DbPath, err)
|
|
|
+ if stat, err := os.Stat(csConfig.DbConfig.DbPath); err == nil {
|
|
|
+ if uint32(intID) != stat.Sys().(*syscall.Stat_t).Gid {
|
|
|
+ if err := os.Chown(csConfig.DbConfig.DbPath, 0, intID); err != nil {
|
|
|
+ return dockerGroup, fmt.Errorf("unable to chown sqlite db file '%s': %s", csConfig.DbConfig.DbPath, err)
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
return dockerGroup, nil
|
|
|
}
|