From 1c2fab9e43b99def3ea5f68f94d5554e86bd67d9 Mon Sep 17 00:00:00 2001
From: Emanuele Aina <emanuele.aina@collabora.com>
Date: Fri, 1 Mar 2019 11:44:04 +0100
Subject: [PATCH] ospack: Empty machine-id so it's made unique on first boot

The apertis-customization package used to ship in tmpfiles.d/apertis.conf a
link from /etc/machine-id to /var/lib/dbus/machine-id to ensure that the
machine-id is unique.

This is now done automatically provided that /etc/machine-id is a empty file.

Signed-off-by: Emanuele Aina <emanuele.aina@collabora.com>
---
 apertis-ospack-basesdk.yaml | 5 +++++
 apertis-ospack-devroot.yaml | 5 +++++
 apertis-ospack-minimal.yaml | 5 +++++
 apertis-ospack-sdk.yaml     | 5 +++++
 apertis-ospack-target.yaml  | 5 +++++
 5 files changed, 25 insertions(+)

diff --git a/apertis-ospack-basesdk.yaml b/apertis-ospack-basesdk.yaml
index 946f369d..44c4e884 100644
--- a/apertis-ospack-basesdk.yaml
+++ b/apertis-ospack-basesdk.yaml
@@ -472,6 +472,11 @@ actions:
       - yelp
       - yelp-tools
 
+  - action: run
+    chroot: true
+    description: "Empty /etc/machine-id so it's regenerated on first boot with an unique value"
+    command: echo > /etc/machine-id
+
   - action: overlay
     source: overlays/hostname
 
diff --git a/apertis-ospack-devroot.yaml b/apertis-ospack-devroot.yaml
index ee777237..85eaa0b5 100644
--- a/apertis-ospack-devroot.yaml
+++ b/apertis-ospack-devroot.yaml
@@ -373,6 +373,11 @@ actions:
       - tinwell-dev
   {{ end }}
 
+  - action: run
+    chroot: true
+    description: "Empty /etc/machine-id so it's regenerated on first boot with an unique value"
+    command: echo > /etc/machine-id
+
   - action: overlay
     source: overlays/hostname
 
diff --git a/apertis-ospack-minimal.yaml b/apertis-ospack-minimal.yaml
index 07beeb78..1e7972b3 100644
--- a/apertis-ospack-minimal.yaml
+++ b/apertis-ospack-minimal.yaml
@@ -82,6 +82,11 @@ actions:
       - openssh-server
       - vim.tiny
 
+  - action: run
+    chroot: true
+    description: "Empty /etc/machine-id so it's regenerated on first boot with an unique value"
+    command: echo > /etc/machine-id
+
   - action: overlay
     source: overlays/hostname
 
diff --git a/apertis-ospack-sdk.yaml b/apertis-ospack-sdk.yaml
index 78b5b146..633c249d 100644
--- a/apertis-ospack-sdk.yaml
+++ b/apertis-ospack-sdk.yaml
@@ -666,6 +666,11 @@ actions:
       - tinwell-doc
       - traprain-mock-service
 
+  - action: run
+    chroot: true
+    description: "Empty /etc/machine-id so it's regenerated on first boot with an unique value"
+    command: echo > /etc/machine-id
+
   - action: overlay
     source: overlays/hostname
 
diff --git a/apertis-ospack-target.yaml b/apertis-ospack-target.yaml
index ac499679..eb13953d 100644
--- a/apertis-ospack-target.yaml
+++ b/apertis-ospack-target.yaml
@@ -195,6 +195,11 @@ actions:
       - tinwell
   {{ end }}
 
+  - action: run
+    chroot: true
+    description: "Empty /etc/machine-id so it's regenerated on first boot with an unique value"
+    command: echo > /etc/machine-id
+
   - action: overlay
     source: overlays/hostname
 
-- 
GitLab