summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libbb/appletlib.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/libbb/appletlib.c b/libbb/appletlib.c
index 7b3f27c..b196808 100644
--- a/libbb/appletlib.c
+++ b/libbb/appletlib.c
@@ -586,7 +586,8 @@ static void check_suid(int applet_no)
#if ENABLE_FEATURE_INSTALLER
/* create (sym)links for each applet */
-static void install_links(const char *busybox, int use_symbolic_links)
+static void install_links(const char *busybox, int use_symbolic_links,
+ char *custom_install_dir)
{
/* directory table
* this should be consistent w/ the enum,
@@ -612,7 +613,7 @@ static void install_links(const char *busybox, int use_symbolic_links)
for (i = 0; i < ARRAY_SIZE(applet_main); i++) {
fpc = concat_path_file(
- install_dir[APPLET_INSTALL_LOC(i)],
+ custom_install_dir ? custom_install_dir : install_dir[APPLET_INSTALL_LOC(i)],
APPLET_NAME(i));
// debug: bb_error_msg("%slinking %s to busybox",
// use_symbolic_links ? "sym" : "", fpc);
@@ -624,7 +625,7 @@ static void install_links(const char *busybox, int use_symbolic_links)
}
}
#else
-#define install_links(x,y) ((void)0)
+#define install_links(x,y,z) ((void)0)
#endif /* FEATURE_INSTALLER */
/* If we were called as "busybox..." */
@@ -683,12 +684,15 @@ static int busybox_main(char **argv)
}
if (ENABLE_FEATURE_INSTALLER && strcmp(argv[1], "--install") == 0) {
+ int use_symbolic_links;
const char *busybox;
busybox = xmalloc_readlink(bb_busybox_exec_path);
if (!busybox)
busybox = bb_busybox_exec_path;
- /* -s makes symlinks */
- install_links(busybox, argv[2] && strcmp(argv[2], "-s") == 0);
+ /* -s makes symlinks, argv[3] is a custom defined */
+ /* install directory or NULL to use the hardcoded defaults */
+ use_symbolic_links = (argv[2] && strcmp(argv[2], "-s") == 0 && argv++);
+ install_links(busybox, use_symbolic_links, argv[2]);
return 0;
}