diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2009-07-15 02:35:34 +0400 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2009-07-15 02:35:34 +0400 |
commit | 3b405437b8bf7884c6679a5bca8d48c1edb2bf11 (patch) | |
tree | 6777953977882ba40abe2cd007513decc8e36299 /libbb/appletlib.c | |
parent | b3ba9e28e8796cdbba0e6e290a486706ce8bcb48 (diff) |
busybox --install [-s] [DIR]: allow a parameter - destination DIR
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'libbb/appletlib.c')
-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) #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; } |