From 8b66e203b605fc64e59186ce42de5957faa176c8 Mon Sep 17 00:00:00 2001
From: Emanuele Aina <emanuele.aina@collabora.com>
Date: Sun, 3 Mar 2019 22:42:04 +0100
Subject: [PATCH] overlays/media-tmpfs: Avoid wearing the flash for each media
 device attached

Subsume the unit mounting a tmpfs on /media that was formerly shipped by
apertis-customizations.

Signed-off-by: Emanuele Aina <emanuele.aina@collabora.com>
---
 apertis-ospack-basesdk.yaml                         | 3 +++
 apertis-ospack-devroot.yaml                         | 3 +++
 apertis-ospack-minimal.yaml                         | 3 +++
 apertis-ospack-sdk.yaml                             | 3 +++
 apertis-ospack-target.yaml                          | 3 +++
 overlays/media-tmpfs/lib/systemd/system/media.mount | 9 +++++++++
 6 files changed, 24 insertions(+)
 create mode 100644 overlays/media-tmpfs/lib/systemd/system/media.mount

diff --git a/apertis-ospack-basesdk.yaml b/apertis-ospack-basesdk.yaml
index 44c4e884..cece01ff 100644
--- a/apertis-ospack-basesdk.yaml
+++ b/apertis-ospack-basesdk.yaml
@@ -486,6 +486,9 @@ actions:
   - action: overlay
     source: overlays/loopback-interface
 
+  - action: overlay
+    source: overlays/media-tmpfs
+
   - action: overlay
     source: overlays/create-homedir
 
diff --git a/apertis-ospack-devroot.yaml b/apertis-ospack-devroot.yaml
index 85eaa0b5..a92cc431 100644
--- a/apertis-ospack-devroot.yaml
+++ b/apertis-ospack-devroot.yaml
@@ -387,6 +387,9 @@ actions:
   - action: overlay
     source: overlays/loopback-interface
 
+  - action: overlay
+    source: overlays/media-tmpfs
+
   - action: overlay
     source: overlays/create-homedir
 
diff --git a/apertis-ospack-minimal.yaml b/apertis-ospack-minimal.yaml
index cc16f409..f0a658b5 100644
--- a/apertis-ospack-minimal.yaml
+++ b/apertis-ospack-minimal.yaml
@@ -96,6 +96,9 @@ actions:
   - action: overlay
     source: overlays/loopback-interface
 
+  - action: overlay
+    source: overlays/media-tmpfs
+
   - action: overlay
     source: overlays/create-homedir
 
diff --git a/apertis-ospack-sdk.yaml b/apertis-ospack-sdk.yaml
index 633c249d..22d70173 100644
--- a/apertis-ospack-sdk.yaml
+++ b/apertis-ospack-sdk.yaml
@@ -680,6 +680,9 @@ actions:
   - action: overlay
     source: overlays/loopback-interface
 
+  - action: overlay
+    source: overlays/media-tmpfs
+
   - action: overlay
     source: overlays/create-homedir
 
diff --git a/apertis-ospack-target.yaml b/apertis-ospack-target.yaml
index 2f5cd26c..b7210480 100644
--- a/apertis-ospack-target.yaml
+++ b/apertis-ospack-target.yaml
@@ -209,6 +209,9 @@ actions:
   - action: overlay
     source: overlays/loopback-interface
 
+  - action: overlay
+    source: overlays/media-tmpfs
+
   - action: overlay
     source: overlays/create-homedir
 
diff --git a/overlays/media-tmpfs/lib/systemd/system/media.mount b/overlays/media-tmpfs/lib/systemd/system/media.mount
new file mode 100644
index 00000000..26caf52d
--- /dev/null
+++ b/overlays/media-tmpfs/lib/systemd/system/media.mount
@@ -0,0 +1,9 @@
+[Unit]
+Description=Mount points for removable media
+Before=local-fs.target
+
+[Mount]
+What=tmpfs
+Where=/media
+Type=tmpfs
+Options=nodev,noexec,nosuid,size=104857600,mode=0755
-- 
GitLab