f75d3f9
From 83f08959d1bfaadc05581703780534ed5ed7ba82 Mon Sep 17 00:00:00 2001
f75d3f9
From: Zygmunt Krynicki <me@zygoon.pl>
f75d3f9
Date: Wed, 2 Nov 2016 12:37:37 +0200
f75d3f9
Subject: [PATCH] Set a context on the mount units
f75d3f9
f75d3f9
---
f75d3f9
 systemd/systemd.go | 8 +++++++-
f75d3f9
 1 file changed, 7 insertions(+), 1 deletion(-)
f75d3f9
f75d3f9
diff --git a/systemd/systemd.go b/systemd/systemd.go
f75d3f9
index a3f6c9e..32e0ebb 100644
f75d3f9
--- a/systemd/systemd.go
f75d3f9
+++ b/systemd/systemd.go
f75d3f9
@@ -438,14 +438,20 @@ func MountUnitPath(baseDir, ext string) string {
f75d3f9
 
f75d3f9
 func (s *systemd) WriteMountUnitFile(name, what, where, fstype string) (string, error) {
f75d3f9
 	extra := ""
f75d3f9
+	var options []string
f75d3f9
+	var extra string
f75d3f9
 	if osutil.IsDirectory(what) {
f75d3f9
-		extra = "Options=bind\n"
f75d3f9
+		options = append(options, "bind")
f75d3f9
 		fstype = "none"
f75d3f9
 	}
f75d3f9
 
f75d3f9
+	options = append(options, `context="system_u:object_r:snappy_var_lib_t:s0"`)
f75d3f9
 	if fstype == "squashfs" && useFuse() {
f75d3f9
 		fstype = "fuse.squashfuse"
f75d3f9
 	}
f75d3f9
+	if len(options) > 0 {
f75d3f9
+		extra = fmt.Sprintf("Options=%s\n", strings.Join(options, ","))
f75d3f9
+	}
f75d3f9
 
f75d3f9
 	c := fmt.Sprintf(`[Unit]
f75d3f9
 Description=Mount unit for %s
f75d3f9
-- 
f75d3f9
2.7.4
f75d3f9