admin: Initialize /var more fully

This helps out gnome-ostree, because gdm needs /var/lib for example.
This commit is contained in:
Colin Walters 2012-09-18 08:39:26 -04:00
parent 2881194186
commit a6e9e54891
1 changed files with 20 additions and 2 deletions

View File

@ -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;