wok diff busybox/stuff/busybox-1.12.0-install.u @ rev 2585

busybox/install: add -D support
author Pascal Bellard <pascal.bellard@slitaz.org>
date Tue Apr 07 16:03:51 2009 +0000 (2009-04-07)
parents
children
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/busybox/stuff/busybox-1.12.0-install.u	Tue Apr 07 16:03:51 2009 +0000
     1.3 @@ -0,0 +1,55 @@
     1.4 +--- busybox-1.12.0/coreutils/install.c
     1.5 ++++ busybox-1.12.0/coreutils/install.c
     1.6 +@@ -93,9 +93,10 @@
     1.7 + 		OPT_GROUP         = 1 << 6,
     1.8 + 		OPT_MODE          = 1 << 7,
     1.9 + 		OPT_OWNER         = 1 << 8,
    1.10 ++		OPT_D             = 1 << 9,
    1.11 + #if ENABLE_SELINUX
    1.12 +-		OPT_SET_SECURITY_CONTEXT = 1 << 9,
    1.13 +-		OPT_PRESERVE_SECURITY_CONTEXT = 1 << 10,
    1.14 ++		OPT_SET_SECURITY_CONTEXT = 1 << 10,
    1.15 ++		OPT_PRESERVE_SECURITY_CONTEXT = 1 << 11,
    1.16 + #endif
    1.17 + 	};
    1.18 + 
    1.19 +@@ -106,7 +107,7 @@
    1.20 + 	/* -c exists for backwards compatibility, it's needed */
    1.21 + 	/* -v is ignored ("print name of each created directory") */
    1.22 + 	/* -b is ignored ("make a backup of each existing destination file") */
    1.23 +-	flags = getopt32(argv, "cvb" "dpsg:m:o:" USE_SELINUX("Z:"),
    1.24 ++	flags = getopt32(argv, "cvb" "dpsg:m:o:D" USE_SELINUX("Z:"),
    1.25 + 			&gid_str, &mode_str, &uid_str USE_SELINUX(, &scontext));
    1.26 + 	argc -= optind;
    1.27 + 	argv += optind;
    1.28 +@@ -161,6 +162,12 @@
    1.29 + 		} else {
    1.30 + 			if (isdir)
    1.31 + 				dest = concat_path_file(last, basename(arg));
    1.32 ++			if (flags & OPT_D) {
    1.33 ++				char *dir = xstrdup(dest);
    1.34 ++				bb_make_directory(dirname(dir), 0755, FILEUTILS_RECUR);
    1.35 ++				if (ENABLE_FEATURE_CLEAN_UP)
    1.36 ++					free(dir);
    1.37 ++			}
    1.38 + 			if (copy_file(arg, dest, copy_flags)) {
    1.39 + 				/* copy is not made */
    1.40 + 				ret = EXIT_FAILURE;
    1.41 +
    1.42 +--- busybox-1.12.0/include/usage.h
    1.43 ++++ busybox-1.12.0/include/usage.h
    1.44 +@@ -1869,12 +1869,13 @@
    1.45 + 	)
    1.46 + 
    1.47 + #define install_trivial_usage \
    1.48 +-       "[-cgmops] [sources] dest|directory"
    1.49 ++       "[-cdDgmops] [sources] dest|directory"
    1.50 + #define install_full_usage "\n\n" \
    1.51 +        "Copy files and set attributes\n" \
    1.52 +      "\nOptions:" \
    1.53 +      "\n	-c	Copy the file, default" \
    1.54 +      "\n	-d	Create directories" \
    1.55 ++     "\n	-D	Create target path" \
    1.56 +      "\n	-g	Set group ownership" \
    1.57 +      "\n	-m	Set permissions" \
    1.58 +      "\n	-o	Set ownership" \