forked from landley/toybox
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Wean scripts/install.c off toys.h so cross compiling less brittle.
- Loading branch information
Showing
6 changed files
with
36 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,8 +3,6 @@ | |
* Copyright 2015 Rob Landley <[email protected]> | ||
*/ | ||
|
||
#ifndef BUILD_FOR_HOST | ||
|
||
#if CFG_TOYBOX_SELINUX | ||
#include <selinux/selinux.h> | ||
#else | ||
|
@@ -115,5 +113,3 @@ static inline int lsm_fget_context(int file, char **context) | |
return smack_new_label_from_file(file, XATTR_NAME_SMACK, context); | ||
return fgetfilecon(file, context); | ||
} | ||
|
||
#endif // BUILD_FOR_HOST |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
/* Flags values for the third argument of NEWTOY() | ||
* | ||
* Included from both main.c (runs in toys.h context) and scripts/install.c | ||
* (which may build on crazy things like macosx when cross compiling). | ||
*/ | ||
|
||
// Flags describing command behavior. | ||
|
||
#define TOYFLAG_USR (1<<0) | ||
#define TOYFLAG_BIN (1<<1) | ||
#define TOYFLAG_SBIN (1<<2) | ||
#define TOYMASK_LOCATION ((1<<4)-1) | ||
|
||
// This is a shell built-in function, running in the same process context. | ||
#define TOYFLAG_NOFORK (1<<4) | ||
|
||
// Start command with a umask of 0 (saves old umask in this.old_umask) | ||
#define TOYFLAG_UMASK (1<<5) | ||
|
||
// This command runs as root. | ||
#define TOYFLAG_STAYROOT (1<<6) | ||
#define TOYFLAG_NEEDROOT (1<<7) | ||
#define TOYFLAG_ROOTONLY (TOYFLAG_STAYROOT|TOYFLAG_NEEDROOT) | ||
|
||
// Call setlocale to listen to environment variables. | ||
// This invalidates sprintf("%.*s", size, string) as a valid length constraint. | ||
#define TOYFLAG_LOCALE (1<<8) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,28 +3,26 @@ | |
* Copyright 2006 Rob Landley <[email protected]> | ||
*/ | ||
|
||
#include "toys.h" | ||
#include <stdio.h> | ||
#include "generated/config.h" | ||
#include "lib/toyflags.h" | ||
|
||
#undef NEWTOY | ||
#undef OLDTOY | ||
#define NEWTOY(name, opts, flags) {#name, 0, 0, flags}, | ||
#define OLDTOY(name, oldname, flags) {#name, 0, 0, flags}, | ||
#define NEWTOY(name, opts, flags) {#name, flags}, | ||
#define OLDTOY(name, oldname, flags) {#name, flags}, | ||
|
||
// Populate toy_list[]. | ||
|
||
struct toy_list toy_list[] = { | ||
struct {char *name; int flags;} toy_list[] = { | ||
#include "generated/newtoys.h" | ||
}; | ||
|
||
#define TOY_LIST_LEN (sizeof(toy_list)/sizeof(struct toy_list)) | ||
|
||
int main(int argc, char *argv[]) | ||
{ | ||
static char *toy_paths[]={"usr/","bin/","sbin/",0}; | ||
int i, len = 0; | ||
|
||
// Output list of applets. | ||
for (i=1; i<TOY_LIST_LEN; i++) { | ||
for (i=1; i<sizeof(toy_list)/sizeof(*toy_list); i++) { | ||
int fl = toy_list[i].flags; | ||
if (fl & TOYMASK_LOCATION) { | ||
if (argc>1) { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters