mount profile on persistent data.

This commit is contained in:
Miroslav Šedivý
2021-07-25 12:38:57 +02:00
parent 36d3f14611
commit a215f184dd
2 changed files with 27 additions and 12 deletions
+18 -12
View File
@@ -15,8 +15,9 @@ const (
)
type PoliciesConfig struct {
Type PolicyType
Path string
Type PolicyType
Path string
Profile string
}
func GetConfig(image string) *PoliciesConfig {
@@ -25,13 +26,15 @@ func GetConfig(image string) *PoliciesConfig {
fallthrough
case "m1k1o/neko:firefox":
return &PoliciesConfig{
Type: Firefox,
Path: "/usr/lib/firefox/distribution/policies.json",
Type: Firefox,
Path: "/usr/lib/firefox/distribution/policies.json",
Profile: "/home/neko/.mozilla/firefox/profile.default",
}
case "m1k1o/neko:arm-firefox":
return &PoliciesConfig{
Type: Firefox,
Path: "/usr/lib/firefox-esr/distribution/policies.json",
Type: Firefox,
Path: "/usr/lib/firefox-esr/distribution/policies.json",
Profile: "/home/neko/.mozilla/firefox/profile.default",
}
case "m1k1o/neko:chromium":
fallthrough
@@ -39,18 +42,21 @@ func GetConfig(image string) *PoliciesConfig {
fallthrough
case "m1k1o/neko:ungoogled-chromium":
return &PoliciesConfig{
Type: Chromium,
Path: "/etc/chromium/policies/managed/policies.json",
Type: Chromium,
Path: "/etc/chromium/policies/managed/policies.json",
Profile: "/home/neko/.config/chromium",
}
case "m1k1o/neko:google-chrome":
return &PoliciesConfig{
Type: Chromium,
Path: "/etc/opt/chrome/policies/managed/policies.json",
Type: Chromium,
Path: "/etc/opt/chrome/policies/managed/policies.json",
Profile: "/home/neko/.config/google-chrome",
}
case "m1k1o/neko:brave":
return &PoliciesConfig{
Type: Chromium,
Path: "/etc/brave/policies/managed/policies.json",
Type: Chromium,
Path: "/etc/brave/policies/managed/policies.json",
Profile: "/home/neko/.config/brave",
}
}
+9
View File
@@ -234,6 +234,15 @@ func (manager *RoomManagerCtx) Create(settings types.RoomSettings) (string, erro
HostPath: policyPath,
ContainerPath: policyConfig.Path,
})
// mount persistent folder
if settings.Policies.PersistentData && policyConfig.Profile != "" {
settings.Mounts = append(settings.Mounts, types.RoomMount{
Type: types.MountPrivate,
HostPath: "/profile",
ContainerPath: policyConfig.Profile,
})
}
}
mounts := []dockerMount.Mount{}