[ostree] admin: Initialize /var more fully



commit a6e9e5489176e751b265631ea00682b9b26feb8d
Author: Colin Walters <walters verbum org>
Date:   Tue Sep 18 08:39:26 2012 -0400

    admin: Initialize /var more fully
    
    This helps out gnome-ostree, because gdm needs /var/lib for example.

 src/ostree/ot-admin-functions.c |   22 ++++++++++++++++++++--
 1 files changed, 20 insertions(+), 2 deletions(-)
---
diff --git a/src/ostree/ot-admin-functions.c b/src/ostree/ot-admin-functions.c
index 5209685..1d41826 100644
--- a/src/ostree/ot-admin-functions.c
+++ b/src/ostree/ot-admin-functions.c
@@ -65,12 +65,14 @@ ot_admin_ensure_initialized (GFile         *ostree_dir,
         }
     }
 
-  /* Ensure a few subdirectories of /var exist, since we need them for
-     dracut generation */
+  /* Ensure core subdirectories of /var exist, since we need them for
+   * dracut generation, and the host will want them too.
+   */
   g_clear_object (&dir);
   dir = ot_gfile_get_child_build_path (ostree_dir, "var", "log", NULL);
   if (!ot_gfile_ensure_directory (dir, TRUE, error))
     goto out;
+
   g_clear_object (&dir);
   dir = ot_gfile_get_child_build_path (ostree_dir, "var", "tmp", NULL);
   if (!ot_gfile_ensure_directory (dir, TRUE, error))
@@ -81,6 +83,22 @@ ot_admin_ensure_initialized (GFile         *ostree_dir,
       goto out;
     }
 
+  g_clear_object (&dir);
+  dir = ot_gfile_get_child_build_path (ostree_dir, "var", "lib", NULL);
+  if (!ot_gfile_ensure_directory (dir, TRUE, error))
+    goto out;
+
+  g_clear_object (&dir);
+  dir = ot_gfile_get_child_build_path (ostree_dir, "var", "run", NULL);
+  if (!g_file_test (ot_gfile_get_path_cached (dir), G_FILE_TEST_IS_SYMLINK))
+    {
+      if (symlink ("../run", ot_gfile_get_path_cached (dir)) < 0)
+        {
+          ot_util_set_error_from_errno (error, errno);
+          goto out;
+        }
+    }
+
   ret = TRUE;
  out:
   return ret;



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