[ostree] selinux-ensure-labeled: Support no arguments to just traverse deployment root



commit 19abd8277f43e8f4e916d4b5e68d530eef754724
Author: Colin Walters <walters verbum org>
Date:   Thu May 22 19:24:39 2014 -0400

    selinux-ensure-labeled: Support no arguments to just traverse deployment root
    
    This makes it easy to use for the case where rpm-ostree-toolbox is
    injecting systemd services into the deployment root, and we don't
    actually need to traverse the whole FS.

 ...admin-instutil-builtin-selinux-ensure-labeled.c |   24 ++++++++++----------
 1 files changed, 12 insertions(+), 12 deletions(-)
---
diff --git a/src/ostree/ot-admin-instutil-builtin-selinux-ensure-labeled.c 
b/src/ostree/ot-admin-instutil-builtin-selinux-ensure-labeled.c
index 6bc8047..2ffe098 100644
--- a/src/ostree/ot-admin-instutil-builtin-selinux-ensure-labeled.c
+++ b/src/ostree/ot-admin-instutil-builtin-selinux-ensure-labeled.c
@@ -179,23 +179,12 @@ ot_admin_instutil_builtin_selinux_ensure_labeled (int argc, char **argv, OstreeS
   gboolean ret = FALSE;
   const char *policy_name;
   gs_unref_object GFile *subpath = NULL;
-  const char *prefix;
+  const char *prefix = NULL;
   gs_unref_object OstreeSePolicy *sepolicy = NULL;
   gs_unref_ptrarray GPtrArray *deployments = NULL;
   OstreeDeployment *first_deployment;
   gs_unref_object GFile *deployment_path = NULL;
 
-  if (argc < 3)
-    {
-      g_printerr ("usage: %s SUBPATH PREFIX\n", argv[0]);
-      g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
-                   "Option processing failed");
-      goto out;
-    }
-  
-  subpath = g_file_new_for_path (argv[1]);
-  prefix = argv[2];
-
   if (!ostree_sysroot_load (sysroot, cancellable, error))
     goto out;
 
@@ -209,6 +198,17 @@ ot_admin_instutil_builtin_selinux_ensure_labeled (int argc, char **argv, OstreeS
   first_deployment = deployments->pdata[0];
   deployment_path = ostree_sysroot_get_deployment_directory (sysroot, first_deployment);
 
+  if (argc >= 2)
+    {
+      subpath = g_file_new_for_path (argv[1]);
+      prefix = argv[2];
+    }
+  else
+    {
+      subpath = g_object_ref (deployment_path);
+      prefix = "";
+    }
+
   sepolicy = ostree_sepolicy_new (deployment_path, cancellable, error);
   if (!sepolicy)
     goto out;


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