From 47dd32825ea32796f3094f45f4e4b0e7e1657520 Mon Sep 17 00:00:00 2001 From: Rob Landley Date: Mon, 23 Mar 2015 13:45:47 -0500 Subject: Promote runcon to android (and add an android menu). --- toys/android/README | 5 +++++ toys/android/runcon.c | 27 +++++++++++++++++++++++++++ toys/pending/runcon.c | 27 --------------------------- 3 files changed, 32 insertions(+), 27 deletions(-) create mode 100644 toys/android/README create mode 100644 toys/android/runcon.c delete mode 100644 toys/pending/runcon.c (limited to 'toys') diff --git a/toys/android/README b/toys/android/README new file mode 100644 index 00000000..d471a20a --- /dev/null +++ b/toys/android/README @@ -0,0 +1,5 @@ +Android + +Commands primarily used by Android, not vanilla Linux. (Also SELinux stuff.) + +Bug Elliott Hughes about this. diff --git a/toys/android/runcon.c b/toys/android/runcon.c new file mode 100644 index 00000000..c2f71e2d --- /dev/null +++ b/toys/android/runcon.c @@ -0,0 +1,27 @@ +/* runcon.c - Run command in specified security context + * + * Copyright 2015 The Android Open Source Project + +USE_RUNCON(NEWTOY(runcon, "<2", TOYFLAG_USR|TOYFLAG_SBIN)) + +config RUNCON + bool "runcon" + depends on TOYBOX_SELINUX + default y + help + usage: runcon CONTEXT COMMAND [ARGS...] + + Run a command in a specified security context. +*/ + +#define FOR_runcon +#include "toys.h" + +void runcon_main(void) +{ + char *context = *toys.optargs; + + if (setexeccon(context)) perror_exit("Could not set context to %s", context); + + xexec(++toys.optargs); +} diff --git a/toys/pending/runcon.c b/toys/pending/runcon.c deleted file mode 100644 index b916b424..00000000 --- a/toys/pending/runcon.c +++ /dev/null @@ -1,27 +0,0 @@ -/* runcon.c - Run command in specified security context - * - * Copyright 2015 The Android Open Source Project - -USE_RUNCON(NEWTOY(runcon, "<2", TOYFLAG_USR|TOYFLAG_SBIN)) - -config RUNCON - bool "runcon" - depends on TOYBOX_SELINUX - default n - help - usage: runcon CONTEXT COMMAND [ARGS...] - - Run a command in a specified security context. -*/ - -#define FOR_runcon -#include "toys.h" - -void runcon_main(void) -{ - char *context = *toys.optargs; - - if (setexeccon(context)) perror_exit("Could not set context to %s", context); - - xexec(++toys.optargs); -} -- cgit v1.2.3