install -D support

Bernhard Reutner-Fischer rep.dot.nop at gmail.com
Thu Sep 4 09:28:37 UTC 2008


On Wed, Sep 03, 2008 at 08:51:38PM +0200, Denys Vlasenko wrote:
>On Monday 01 September 2008 19:55, Vladimir Dronnikov wrote:
>> And -D option for install, please :^) I can't compile buildroot using
>> BB coreutils...
>
>Try this.
>--
>vda

>@@ -161,6 +161,16 @@ int install_main(int argc, char **argv)
> 		} else {
> 			if (isdir)
> 				dest = concat_path_file(last, basename(arg));
>+			if (opts & OPT_MKDIR_LEADING) {
>+				char *slash = strrchr(dest, '/');
>+				if (slash) {
>+					*slash = '\0';
>+					bb_make_directory(dest, 0755, FILEUTILS_RECUR);
>+					/* errors are not checked. copy_file
>+					 * will fail if dir is not created. */
>+					*slash = '/';
>+				}
>+			}

What about something like the attached, which is smaller for me?

$ size coreutils/install.o*
   text	   data	    bss	    dec	    hex	filename
    706	      0	      0	    706	    2c2	coreutils/install.o.oorig
    798	      0	      0	    798	    31e	coreutils/install.o.vda
    787	      0	      0	    787	    313	coreutils/install.o.attached

Perhaps it would be handy not to touch the path in bb_make_directory but
return NULL on error or the trimmed path on success?
-------------- next part --------------
A non-text attachment was scrubbed...
Name: install-D.smaller.diff
Type: text/x-diff
Size: 861 bytes
Desc: not available
Url : http://lists.busybox.net/pipermail/busybox/attachments/20080904/cbd0fef6/attachment.bin 


More information about the busybox mailing list