diff options
Diffstat (limited to 'libbb')
| -rw-r--r-- | libbb/appletlib.c | 34 |
1 files changed, 32 insertions, 2 deletions
diff --git a/libbb/appletlib.c b/libbb/appletlib.c index 11136de11..8a66b3303 100644 --- a/libbb/appletlib.c +++ b/libbb/appletlib.c | |||
| @@ -776,7 +776,8 @@ static void install_links(const char *busybox, | |||
| 776 | while (*appname) { | 776 | while (*appname) { |
| 777 | fpc = xasprintf("%s/%s.exe", custom_install_dir, appname); | 777 | fpc = xasprintf("%s/%s.exe", custom_install_dir, appname); |
| 778 | rc = link(busybox, fpc); | 778 | rc = link(busybox, fpc); |
| 779 | if (rc != 0 && errno != EEXIST) { | 779 | if (rc != 0 && (errno != EEXIST || |
| 780 | strcmp("busybox.exe", bb_basename(fpc)) != 0)) { | ||
| 780 | bb_simple_perror_msg(fpc); | 781 | bb_simple_perror_msg(fpc); |
| 781 | } | 782 | } |
| 782 | free(fpc); | 783 | free(fpc); |
| @@ -885,7 +886,13 @@ int busybox_main(int argc UNUSED_PARAM, char **argv) | |||
| 885 | " or: busybox --show SCRIPT\n" | 886 | " or: busybox --show SCRIPT\n" |
| 886 | # endif | 887 | # endif |
| 887 | IF_FEATURE_INSTALLER( | 888 | IF_FEATURE_INSTALLER( |
| 888 | " or: busybox --install "IF_NOT_PLATFORM_MINGW32("[-s] ")"[DIR]\n" | 889 | IF_NOT_PLATFORM_MINGW32( |
| 890 | " or: busybox --install [-s] [DIR]\n" | ||
| 891 | ) | ||
| 892 | IF_PLATFORM_MINGW32( | ||
| 893 | " or: busybox --install [DIR]\n" | ||
| 894 | " or: busybox --uninstall [-n] file\n" | ||
| 895 | ) | ||
| 889 | ) | 896 | ) |
| 890 | " or: function [arguments]...\n" | 897 | " or: function [arguments]...\n" |
| 891 | "\n" | 898 | "\n" |
| @@ -1016,6 +1023,29 @@ int busybox_main(int argc UNUSED_PARAM, char **argv) | |||
| 1016 | return 0; | 1023 | return 0; |
| 1017 | } | 1024 | } |
| 1018 | 1025 | ||
| 1026 | #if ENABLE_PLATFORM_MINGW32 && ENABLE_FEATURE_INSTALLER | ||
| 1027 | if (strcmp(argv[1], "--uninstall") == 0) { | ||
| 1028 | char name[PATH_MAX]; | ||
| 1029 | int dry_run = (argv[2] && strcmp(argv[2], "-n") == 0 && ++argv); | ||
| 1030 | const char *file = argv[2]; | ||
| 1031 | |||
| 1032 | if (!argv[2]) | ||
| 1033 | bb_error_msg_and_die(bb_msg_requires_arg, "--uninstall"); | ||
| 1034 | |||
| 1035 | while (enumerate_links(file, name)) { | ||
| 1036 | if (dry_run) { | ||
| 1037 | full_write1_str(name); | ||
| 1038 | full_write1_str("\n"); | ||
| 1039 | } | ||
| 1040 | else if (unlink(name) != 0) { | ||
| 1041 | bb_simple_perror_msg(name); | ||
| 1042 | } | ||
| 1043 | file = NULL; | ||
| 1044 | } | ||
| 1045 | return 0; | ||
| 1046 | } | ||
| 1047 | #endif | ||
| 1048 | |||
| 1019 | if (strcmp(argv[1], "--help") == 0) { | 1049 | if (strcmp(argv[1], "--help") == 0) { |
| 1020 | /* "busybox --help [<applet>]" */ | 1050 | /* "busybox --help [<applet>]" */ |
| 1021 | if (!argv[2]) | 1051 | if (!argv[2]) |
