From bdbbc72934bc781cff7306da3c5233d21022bc33 Mon Sep 17 00:00:00 2001 From: Arnout Vandecappelle Date: Mon, 3 Jul 2017 23:00:48 +0200 Subject: [PATCH] makedevs: support optional files Add the 'F' file type to makedevs, that allows a file to be optional. With this option, the line is just silently skipped if the file doesn't exist (or is not a regular file). This is useful for _PERMISSIONS where the file can be configured out by package-specific configuration that is not directly handled by Buildroot, like busybox. Cc: Clayton Shotwell Cc: Matthew Weber Cc: Niranjan Reddy Cc: Bryce Ferguson Signed-off-by: Arnout Vandecappelle (Essensium/Mind) Signed-off-by: Thomas Petazzoni --- package/makedevs/makedevs.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/package/makedevs/makedevs.c b/package/makedevs/makedevs.c index 7092b1475e..1ba5936342 100644 --- a/package/makedevs/makedevs.c +++ b/package/makedevs/makedevs.c @@ -570,9 +570,12 @@ int main(int argc, char **argv) ret = EXIT_FAILURE; goto loop; } - } else if (type == 'f') { + } else if (type == 'f' || type == 'F') { struct stat st; if ((stat(full_name, &st) < 0 || !S_ISREG(st.st_mode))) { + if (type == 'F') { + continue; /*Ignore optional files*/ + } bb_perror_msg("line %d: regular file '%s' does not exist", linenum, full_name); ret = EXIT_FAILURE; goto loop; -- 2.30.2