summaryrefslogtreecommitdiff
path: root/src/ostree/ot-admin-instutil-builtin-selinux-ensure-labeled.c
diff options
context:
space:
mode:
authorColin Walters <walters@verbum.org>2014-05-22 19:24:39 -0400
committerColin Walters <walters@verbum.org>2014-05-22 22:51:21 -0400
commit19abd8277f43e8f4e916d4b5e68d530eef754724 (patch)
tree4739d75dc452ed93f1f80c43580044fb8c34554e /src/ostree/ot-admin-instutil-builtin-selinux-ensure-labeled.c
parenta864190a04da91ddb75812be7e0fe6d9de18eb15 (diff)
downloadostree-19abd8277f43e8f4e916d4b5e68d530eef754724.tar.gz
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.
Diffstat (limited to 'src/ostree/ot-admin-instutil-builtin-selinux-ensure-labeled.c')
-rw-r--r--src/ostree/ot-admin-instutil-builtin-selinux-ensure-labeled.c24
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 6bc80475..2ffe0981 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;