wok-current view busybox/stuff/busybox-1.12.0-install.u @ rev 5657
Up: libogg (1.2.0)
author | Alexander Medvedev <devl547@gmail.com> |
---|---|
date | Sun May 30 02:45:16 2010 +0000 (2010-05-30) |
parents | |
children |
line source
1 --- busybox-1.12.0/coreutils/install.c
2 +++ busybox-1.12.0/coreutils/install.c
3 @@ -93,9 +93,10 @@
4 OPT_GROUP = 1 << 6,
5 OPT_MODE = 1 << 7,
6 OPT_OWNER = 1 << 8,
7 + OPT_D = 1 << 9,
8 #if ENABLE_SELINUX
9 - OPT_SET_SECURITY_CONTEXT = 1 << 9,
10 - OPT_PRESERVE_SECURITY_CONTEXT = 1 << 10,
11 + OPT_SET_SECURITY_CONTEXT = 1 << 10,
12 + OPT_PRESERVE_SECURITY_CONTEXT = 1 << 11,
13 #endif
14 };
16 @@ -106,7 +107,7 @@
17 /* -c exists for backwards compatibility, it's needed */
18 /* -v is ignored ("print name of each created directory") */
19 /* -b is ignored ("make a backup of each existing destination file") */
20 - flags = getopt32(argv, "cvb" "dpsg:m:o:" USE_SELINUX("Z:"),
21 + flags = getopt32(argv, "cvb" "dpsg:m:o:D" USE_SELINUX("Z:"),
22 &gid_str, &mode_str, &uid_str USE_SELINUX(, &scontext));
23 argc -= optind;
24 argv += optind;
25 @@ -161,6 +162,12 @@
26 } else {
27 if (isdir)
28 dest = concat_path_file(last, basename(arg));
29 + if (flags & OPT_D) {
30 + char *dir = xstrdup(dest);
31 + bb_make_directory(dirname(dir), 0755, FILEUTILS_RECUR);
32 + if (ENABLE_FEATURE_CLEAN_UP)
33 + free(dir);
34 + }
35 if (copy_file(arg, dest, copy_flags)) {
36 /* copy is not made */
37 ret = EXIT_FAILURE;
39 --- busybox-1.12.0/include/usage.h
40 +++ busybox-1.12.0/include/usage.h
41 @@ -1869,12 +1869,13 @@
42 )
44 #define install_trivial_usage \
45 - "[-cgmops] [sources] dest|directory"
46 + "[-cdDgmops] [sources] dest|directory"
47 #define install_full_usage "\n\n" \
48 "Copy files and set attributes\n" \
49 "\nOptions:" \
50 "\n -c Copy the file, default" \
51 "\n -d Create directories" \
52 + "\n -D Create target path" \
53 "\n -g Set group ownership" \
54 "\n -m Set permissions" \
55 "\n -o Set ownership" \