# HG changeset patch # User Rob Landley # Date 1427136347 18000 # Node ID 0f940c4f9658ee3910d619905a5d89710ffcdc25 # Parent 2d51d89b9d79dee26c3925fca7396a76758fe368 Promote runcon to android (and add an android menu). diff -r 2d51d89b9d79 -r 0f940c4f9658 toys/android/README --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/toys/android/README Mon Mar 23 13:45:47 2015 -0500 @@ -0,0 +1,5 @@ +Android + +Commands primarily used by Android, not vanilla Linux. (Also SELinux stuff.) + +Bug Elliott Hughes about this. diff -r 2d51d89b9d79 -r 0f940c4f9658 toys/android/runcon.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/toys/android/runcon.c Mon Mar 23 13:45:47 2015 -0500 @@ -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 -r 2d51d89b9d79 -r 0f940c4f9658 toys/pending/runcon.c --- a/toys/pending/runcon.c Mon Mar 23 13:09:48 2015 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -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); -}