mirror of
https://github.com/termux-pacman/termux-packages.git
synced 2026-01-28 05:32:35 +00:00
- For several users, the message was unclear and seemed to imply a serious problem occurring, which was not intended. This should improve the readability of the message.
81 lines
2.0 KiB
Diff
81 lines
2.0 KiB
Diff
--- a/utils/update-alternatives.c
|
|
+++ b/utils/update-alternatives.c
|
|
@@ -46,6 +46,8 @@
|
|
|
|
#include <dpkg/macros.h>
|
|
#include <dpkg/i18n.h>
|
|
+#include <dpkg/command.h>
|
|
+#include <dpkg/subproc.h>
|
|
|
|
/* Global variables: */
|
|
|
|
@@ -108,6 +108,8 @@ static FILE *fh_log = NULL;
|
|
static int opt_skip_auto = 0;
|
|
static int opt_verbose = OUTPUT_NORMAL;
|
|
static int opt_force = 0;
|
|
+/* for mandoc hook */
|
|
+static bool should_update_mandoc = false;
|
|
|
|
/*
|
|
* Functions.
|
|
@@ -2089,6 +2091,8 @@ alternative_prepare_install(struct alternative *a, const char *choice)
|
|
alternative_add_commit_op(a, OPCODE_RM, fn, NULL);
|
|
free(fn);
|
|
}
|
|
+
|
|
+ should_update_mandoc = true;
|
|
}
|
|
|
|
static void
|
|
@@ -2552,6 +2552,31 @@ alternative_install(struct alternative **aptr, struct alternative *inst_alt,
|
|
return new_choice;
|
|
}
|
|
|
|
+/* Update mandoc database after creating symbolic links */
|
|
+/* command launching logic copied from the extracthalf() function in src/deb/extract.c */
|
|
+static void
|
|
+update_mandoc(void) {
|
|
+ const char *cmd_string = "makewhatis";
|
|
+
|
|
+ if (!command_in_path(cmd_string)) {
|
|
+ warning("skipping updating manpage database as '%s' command from 'mandoc' package is not installed", cmd_string);
|
|
+ return;
|
|
+ }
|
|
+
|
|
+ log_msg("updating manpage database...");
|
|
+ pid_t current_process_is_parent = subproc_fork();
|
|
+
|
|
+ if (current_process_is_parent) {
|
|
+ subproc_reap(current_process_is_parent, cmd_string, 0);
|
|
+ return;
|
|
+ }
|
|
+
|
|
+ struct command cmd_struct;
|
|
+ command_init(&cmd_struct, cmd_string, cmd_string);
|
|
+ command_add_arg(&cmd_struct, cmd_string);
|
|
+ command_exec(&cmd_struct);
|
|
+}
|
|
+
|
|
static void
|
|
alternative_update(struct alternative *a,
|
|
const char *current_choice, const char *new_choice)
|
|
@@ -3221,5 +3225,8 @@ main(int argc, char **argv)
|
|
free(log_file);
|
|
free(admdir);
|
|
|
|
+ if (should_update_mandoc)
|
|
+ update_mandoc();
|
|
+
|
|
return 0;
|
|
}
|
|
--- a/utils/Makefile.am
|
|
+++ b/utils/Makefile.am
|
|
@@ -34,6 +34,7 @@ update_alternatives_SOURCES = \
|
|
|
|
update_alternatives_LDADD = \
|
|
../lib/compat/libcompat.la \
|
|
+ ../lib/dpkg/libdpkg.la \
|
|
$(LIBINTL) \
|
|
# EOL
|
|
|