diff options
| author | Denys Vlasenko <vda.linux@googlemail.com> | 2009-07-15 00:35:34 +0200 |
|---|---|---|
| committer | Denys Vlasenko <vda.linux@googlemail.com> | 2009-07-15 00:35:34 +0200 |
| commit | 3b405437b8bf7884c6679a5bca8d48c1edb2bf11 (patch) | |
| tree | 6777953977882ba40abe2cd007513decc8e36299 /libbb | |
| parent | b3ba9e28e8796cdbba0e6e290a486706ce8bcb48 (diff) | |
| download | busybox-w32-3b405437b8bf7884c6679a5bca8d48c1edb2bf11.tar.gz busybox-w32-3b405437b8bf7884c6679a5bca8d48c1edb2bf11.tar.bz2 busybox-w32-3b405437b8bf7884c6679a5bca8d48c1edb2bf11.zip | |
busybox --install [-s] [DIR]: allow a parameter - destination DIR
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'libbb')
| -rw-r--r-- | libbb/appletlib.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/libbb/appletlib.c b/libbb/appletlib.c index 7b3f27c36..b19680808 100644 --- a/libbb/appletlib.c +++ b/libbb/appletlib.c | |||
| @@ -586,7 +586,8 @@ static void check_suid(int applet_no) | |||
| 586 | 586 | ||
| 587 | #if ENABLE_FEATURE_INSTALLER | 587 | #if ENABLE_FEATURE_INSTALLER |
| 588 | /* create (sym)links for each applet */ | 588 | /* create (sym)links for each applet */ |
| 589 | static void install_links(const char *busybox, int use_symbolic_links) | 589 | static void install_links(const char *busybox, int use_symbolic_links, |
| 590 | char *custom_install_dir) | ||
| 590 | { | 591 | { |
| 591 | /* directory table | 592 | /* directory table |
| 592 | * this should be consistent w/ the enum, | 593 | * this should be consistent w/ the enum, |
| @@ -612,7 +613,7 @@ static void install_links(const char *busybox, int use_symbolic_links) | |||
| 612 | 613 | ||
| 613 | for (i = 0; i < ARRAY_SIZE(applet_main); i++) { | 614 | for (i = 0; i < ARRAY_SIZE(applet_main); i++) { |
| 614 | fpc = concat_path_file( | 615 | fpc = concat_path_file( |
| 615 | install_dir[APPLET_INSTALL_LOC(i)], | 616 | custom_install_dir ? custom_install_dir : install_dir[APPLET_INSTALL_LOC(i)], |
| 616 | APPLET_NAME(i)); | 617 | APPLET_NAME(i)); |
| 617 | // debug: bb_error_msg("%slinking %s to busybox", | 618 | // debug: bb_error_msg("%slinking %s to busybox", |
| 618 | // use_symbolic_links ? "sym" : "", fpc); | 619 | // use_symbolic_links ? "sym" : "", fpc); |
| @@ -624,7 +625,7 @@ static void install_links(const char *busybox, int use_symbolic_links) | |||
| 624 | } | 625 | } |
| 625 | } | 626 | } |
| 626 | #else | 627 | #else |
| 627 | #define install_links(x,y) ((void)0) | 628 | #define install_links(x,y,z) ((void)0) |
| 628 | #endif /* FEATURE_INSTALLER */ | 629 | #endif /* FEATURE_INSTALLER */ |
| 629 | 630 | ||
| 630 | /* If we were called as "busybox..." */ | 631 | /* If we were called as "busybox..." */ |
| @@ -683,12 +684,15 @@ static int busybox_main(char **argv) | |||
| 683 | } | 684 | } |
| 684 | 685 | ||
| 685 | if (ENABLE_FEATURE_INSTALLER && strcmp(argv[1], "--install") == 0) { | 686 | if (ENABLE_FEATURE_INSTALLER && strcmp(argv[1], "--install") == 0) { |
| 687 | int use_symbolic_links; | ||
| 686 | const char *busybox; | 688 | const char *busybox; |
| 687 | busybox = xmalloc_readlink(bb_busybox_exec_path); | 689 | busybox = xmalloc_readlink(bb_busybox_exec_path); |
| 688 | if (!busybox) | 690 | if (!busybox) |
| 689 | busybox = bb_busybox_exec_path; | 691 | busybox = bb_busybox_exec_path; |
| 690 | /* -s makes symlinks */ | 692 | /* -s makes symlinks, argv[3] is a custom defined */ |
| 691 | install_links(busybox, argv[2] && strcmp(argv[2], "-s") == 0); | 693 | /* install directory or NULL to use the hardcoded defaults */ |
| 694 | use_symbolic_links = (argv[2] && strcmp(argv[2], "-s") == 0 && argv++); | ||
| 695 | install_links(busybox, use_symbolic_links, argv[2]); | ||
| 692 | return 0; | 696 | return 0; |
| 693 | } | 697 | } |
| 694 | 698 | ||
