[gnome-build-meta/valentindavid/snapd: 14/16] Bind mount /var/home to /home instead of using a symlink




commit 2afc0da88567e6be02d6f29289cf38f4bb26ddd1
Author: Valentin David <me valentindavid com>
Date:   Wed Oct 13 15:16:35 2021 +0200

    Bind mount /var/home to /home instead of using a symlink
    
    Same with `/root` and `/var/roothome`. This helps issues with software
    expecting `/home` to be the directory to contain home directories, for
    example systemd-homed and snapd.

 elements/vm/common-deps.bst       |  2 +-
 elements/vm/ostree-config.bst     |  9 ++++++---
 files/vm/ostree-config/home.mount | 13 +++++++++++++
 files/vm/ostree-config/root.mount | 13 +++++++++++++
 4 files changed, 33 insertions(+), 4 deletions(-)
---
diff --git a/elements/vm/common-deps.bst b/elements/vm/common-deps.bst
index 0d87c10c3..532cc47bb 100644
--- a/elements/vm/common-deps.bst
+++ b/elements/vm/common-deps.bst
@@ -34,7 +34,7 @@ depends:
 - vm/NetworkManager-vpnc.bst
 
 - freedesktop-sdk.bst:vm/config/sudo.bst
-- freedesktop-sdk.bst:vm/config/useradd-ostree.bst
+- freedesktop-sdk.bst:vm/config/useradd-default.bst
 - freedesktop-sdk.bst:vm/mesa-default.bst
 - freedesktop-sdk.bst:components/bash-completion.bst
 - freedesktop-sdk.bst:components/bash-config.bst
diff --git a/elements/vm/ostree-config.bst b/elements/vm/ostree-config.bst
index afdd3f8e9..70b18f62f 100644
--- a/elements/vm/ostree-config.bst
+++ b/elements/vm/ostree-config.bst
@@ -32,16 +32,19 @@ config:
     mkdir %{install-root}/tmp
     mkdir %{install-root}/dev
     mkdir %{install-root}/proc
+    mkdir %{install-root}/home
+    mkdir %{install-root}/root
 
   - |
     mkdir -p "%{install-root}/sysroot"
     ln -s sysroot/ostree "%{install-root}/ostree"
-    ln -s var/home "%{install-root}/home"
-    rm -rf "%{install-root}/root"
-    ln -s var/roothome "%{install-root}/root"
     ln -s run/media "%{install-root}/media"
+    ln -s var/lib/snapd/snap "%{install-root}/snap"
 
   - |
     install -Dm644 -t "%{install-root}/usr/lib/tmpfiles.d" ostree.conf
     install -Dm644 *.gpg "%{install-root}/etc/pki/ostree/gnome.gpg"
     install -Dm644 -t "%{install-root}/etc/ostree/remotes.d" gnome.conf
+
+  - |
+    install -Dm644 -t "%{install-root}/usr/lib/systemd/system" home.mount root.mount
diff --git a/files/vm/ostree-config/home.mount b/files/vm/ostree-config/home.mount
new file mode 100644
index 000000000..06828b7e8
--- /dev/null
+++ b/files/vm/ostree-config/home.mount
@@ -0,0 +1,13 @@
+[Unit]
+Description=Bind mount of /home
+DefaultDependencies=no
+Before=local-fs.target snapd.service
+
+[Mount]
+What=/var/home
+Where=/home
+Type=none
+Options=bind
+
+[Install]
+WantedBy=local-fs.target
diff --git a/files/vm/ostree-config/root.mount b/files/vm/ostree-config/root.mount
new file mode 100644
index 000000000..033bd9199
--- /dev/null
+++ b/files/vm/ostree-config/root.mount
@@ -0,0 +1,13 @@
+[Unit]
+Description=Bind mount of /root
+DefaultDependencies=no
+Before=local-fs.target snapd.service
+
+[Mount]
+What=/var/roothome
+Where=/root
+Type=none
+Options=bind
+
+[Install]
+WantedBy=local-fs.target


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]