wok 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 285b47e3673c
children f40ed77124a0
files busybox-pam/receipt busybox/receipt busybox/stuff/busybox-1.12.0-install.u
line diff
     1.1 --- a/busybox-pam/receipt	Tue Apr 07 14:20:40 2009 +0000
     1.2 +++ b/busybox-pam/receipt	Tue Apr 07 16:03:51 2009 +0000
     1.3 @@ -34,6 +34,7 @@
     1.4  modprobe.u
     1.5  paths.u
     1.6  mkswap.u
     1.7 +install.u
     1.8  EOT
     1.9      cp $WOK/busybox/stuff/$SOURCE-$VERSION.config .config
    1.10      sed -i 's/# CONFIG_PAM is not set/CONFIG_PAM=y/' .config
     2.1 --- a/busybox/receipt	Tue Apr 07 14:20:40 2009 +0000
     2.2 +++ b/busybox/receipt	Tue Apr 07 16:03:51 2009 +0000
     2.3 @@ -32,6 +32,7 @@
     2.4  modprobe.u
     2.5  paths.u
     2.6  mkswap.u
     2.7 +install.u
     2.8  EOT
     2.9      cp ../stuff/$PACKAGE-$VERSION.config .config
    2.10      make oldconfig
     3.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.2 +++ b/busybox/stuff/busybox-1.12.0-install.u	Tue Apr 07 16:03:51 2009 +0000
     3.3 @@ -0,0 +1,55 @@
     3.4 +--- busybox-1.12.0/coreutils/install.c
     3.5 ++++ busybox-1.12.0/coreutils/install.c
     3.6 +@@ -93,9 +93,10 @@
     3.7 + 		OPT_GROUP         = 1 << 6,
     3.8 + 		OPT_MODE          = 1 << 7,
     3.9 + 		OPT_OWNER         = 1 << 8,
    3.10 ++		OPT_D             = 1 << 9,
    3.11 + #if ENABLE_SELINUX
    3.12 +-		OPT_SET_SECURITY_CONTEXT = 1 << 9,
    3.13 +-		OPT_PRESERVE_SECURITY_CONTEXT = 1 << 10,
    3.14 ++		OPT_SET_SECURITY_CONTEXT = 1 << 10,
    3.15 ++		OPT_PRESERVE_SECURITY_CONTEXT = 1 << 11,
    3.16 + #endif
    3.17 + 	};
    3.18 + 
    3.19 +@@ -106,7 +107,7 @@
    3.20 + 	/* -c exists for backwards compatibility, it's needed */
    3.21 + 	/* -v is ignored ("print name of each created directory") */
    3.22 + 	/* -b is ignored ("make a backup of each existing destination file") */
    3.23 +-	flags = getopt32(argv, "cvb" "dpsg:m:o:" USE_SELINUX("Z:"),
    3.24 ++	flags = getopt32(argv, "cvb" "dpsg:m:o:D" USE_SELINUX("Z:"),
    3.25 + 			&gid_str, &mode_str, &uid_str USE_SELINUX(, &scontext));
    3.26 + 	argc -= optind;
    3.27 + 	argv += optind;
    3.28 +@@ -161,6 +162,12 @@
    3.29 + 		} else {
    3.30 + 			if (isdir)
    3.31 + 				dest = concat_path_file(last, basename(arg));
    3.32 ++			if (flags & OPT_D) {
    3.33 ++				char *dir = xstrdup(dest);
    3.34 ++				bb_make_directory(dirname(dir), 0755, FILEUTILS_RECUR);
    3.35 ++				if (ENABLE_FEATURE_CLEAN_UP)
    3.36 ++					free(dir);
    3.37 ++			}
    3.38 + 			if (copy_file(arg, dest, copy_flags)) {
    3.39 + 				/* copy is not made */
    3.40 + 				ret = EXIT_FAILURE;
    3.41 +
    3.42 +--- busybox-1.12.0/include/usage.h
    3.43 ++++ busybox-1.12.0/include/usage.h
    3.44 +@@ -1869,12 +1869,13 @@
    3.45 + 	)
    3.46 + 
    3.47 + #define install_trivial_usage \
    3.48 +-       "[-cgmops] [sources] dest|directory"
    3.49 ++       "[-cdDgmops] [sources] dest|directory"
    3.50 + #define install_full_usage "\n\n" \
    3.51 +        "Copy files and set attributes\n" \
    3.52 +      "\nOptions:" \
    3.53 +      "\n	-c	Copy the file, default" \
    3.54 +      "\n	-d	Create directories" \
    3.55 ++     "\n	-D	Create target path" \
    3.56 +      "\n	-g	Set group ownership" \
    3.57 +      "\n	-m	Set permissions" \
    3.58 +      "\n	-o	Set ownership" \