summaryrefslogtreecommitdiff
path: root/usr
diff options
context:
space:
mode:
authorMike Travis <travis@sgi.com>2009-01-01 01:34:16 (GMT)
committerIngo Molnar <mingo@elte.hu>2009-01-03 17:53:31 (GMT)
commit7eb19553369c46cc1fa64caf120cbcab1b597f7c (patch)
treeef1a3beae706b9497c845d0a2557ceb4d2754998 /usr
parent6092848a2a23b660150a38bc06f59d75838d70c8 (diff)
parent8c384cdee3e04d6194a2c2b192b624754f990835 (diff)
downloadlinux-7eb19553369c46cc1fa64caf120cbcab1b597f7c.tar.xz
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/rusty/linux-2.6-cpumask into merge-rr-cpumask
Conflicts: arch/x86/kernel/io_apic.c kernel/rcuclassic.c kernel/sched.c kernel/time/tick-sched.c Signed-off-by: Mike Travis <travis@sgi.com> [ mingo@elte.hu: backmerged typo fix for io_apic.c ] Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'usr')
-rw-r--r--usr/gen_init_cpio.c28
1 files changed, 27 insertions, 1 deletions
diff --git a/usr/gen_init_cpio.c b/usr/gen_init_cpio.c
index 7abc07f..f1d3fe3 100644
--- a/usr/gen_init_cpio.c
+++ b/usr/gen_init_cpio.c
@@ -370,6 +370,30 @@ error:
return rc;
}
+static char *cpio_replace_env(char *new_location)
+{
+ char expanded[PATH_MAX + 1];
+ char env_var[PATH_MAX + 1];
+ char *start;
+ char *end;
+
+ for (start = NULL; (start = strstr(new_location, "${")); ) {
+ end = strchr(start, '}');
+ if (start < end) {
+ *env_var = *expanded = '\0';
+ strncat(env_var, start + 2, end - start - 2);
+ strncat(expanded, new_location, start - new_location);
+ strncat(expanded, getenv(env_var), PATH_MAX);
+ strncat(expanded, end + 1, PATH_MAX);
+ strncpy(new_location, expanded, PATH_MAX);
+ } else
+ break;
+ }
+
+ return new_location;
+}
+
+
static int cpio_mkfile_line(const char *line)
{
char name[PATH_MAX + 1];
@@ -415,7 +439,8 @@ static int cpio_mkfile_line(const char *line)
} else {
dname = name;
}
- rc = cpio_mkfile(dname, location, mode, uid, gid, nlinks);
+ rc = cpio_mkfile(dname, cpio_replace_env(location),
+ mode, uid, gid, nlinks);
fail:
if (dname_len) free(dname);
return rc;
@@ -439,6 +464,7 @@ void usage(const char *prog)
"\n"
"<name> name of the file/dir/nod/etc in the archive\n"
"<location> location of the file in the current filesystem\n"
+ " expands shell variables quoted with ${}\n"
"<target> link target\n"
"<mode> mode/permissions of the file\n"
"<uid> user id (0=root)\n"