sysroot: Error out on deploy --os=<unknown> which has not been initialized
We should hard require "ostree admin os-init foo" before letting deployments go there; it's too easy to typo the argument.
This commit is contained in:
1 parent
c6cc7412bf
commit
091523a3bd
2 files changed
+17
-1
No files matched your search
@@ -1043,6 +1043,7 @@ ostree_sysroot_deploy_one_tree (OstreeSysroot *self,
|
||||
gs_unref_object OstreeDeployment *new_deployment = NULL;
|
||||
gs_unref_object OstreeDeployment *merge_deployment = NULL;
|
||||
gs_unref_object OstreeRepo *repo = NULL;
|
||||
gs_unref_object GFile *osdeploydir = NULL;
|
||||
gs_unref_object GFile *commit_root = NULL;
|
||||
gs_unref_object GFile *tree_kernel_path = NULL;
|
||||
gs_unref_object GFile *tree_initramfs_path = NULL;
|
||||
@@ -1055,6 +1056,14 @@ ostree_sysroot_deploy_one_tree (OstreeSysroot *self,
|
||||
if (osname == NULL)
|
||||
osname = ostree_deployment_get_osname (self->booted_deployment);
|
||||
|
||||
osdeploydir = ot_gfile_get_child_build_path (self->path, "ostree", "deploy", osname, NULL);
|
||||
if (!g_file_query_exists (osdeploydir, NULL))
|
||||
{
|
||||
g_set_error (error, G_IO_ERROR, G_IO_ERROR_NOT_FOUND,
|
||||
"No OS named \"%s\" known", osname);
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (!ostree_sysroot_get_repo (self, &repo, cancellable, error))
|
||||
goto out;
|
||||
|
||||
|
||||
Reference in new issue
Block a user