diff --git a/bin/xbps-reconfigure/Makefile b/bin/xbps-reconfigure/Makefile index eb32edb8..3887b17f 100644 --- a/bin/xbps-reconfigure/Makefile +++ b/bin/xbps-reconfigure/Makefile @@ -2,7 +2,7 @@ TOPDIR = ../.. -include $(TOPDIR)/config.mk BIN = xbps-reconfigure -OBJS = main.o ../xbps-install/state_cb.o +OBJS = main.o #MAN = $(BIN).8 include $(TOPDIR)/mk/prog.mk diff --git a/bin/xbps-reconfigure/main.c b/bin/xbps-reconfigure/main.c index aa0cb6dc..93944dab 100644 --- a/bin/xbps-reconfigure/main.c +++ b/bin/xbps-reconfigure/main.c @@ -29,9 +29,9 @@ #include #include #include +#include #include -#include "../xbps-bin/defs.h" static void __attribute__((noreturn)) usage(bool fail) @@ -50,6 +50,37 @@ usage(bool fail) exit(fail ? EXIT_FAILURE : EXIT_SUCCESS); } +static void +state_cb(struct xbps_handle *xhp, struct xbps_state_cb_data *xscd, void *cbd) +{ + bool syslog_enabled = false; + + (void)cbd; + + if (xhp->flags & XBPS_FLAG_SYSLOG) { + syslog_enabled = true; + openlog("xbps-reconfigure", LOG_CONS, LOG_USER); + } + + switch (xscd->state) { + /* notifications */ + case XBPS_STATE_CONFIGURE: + printf("Configuring `%s-%s' ...\n", xscd->pkgname, + xscd->version); + break; + /* errors */ + case XBPS_STATE_CONFIGURE_FAIL: + xbps_error_printf("%s\n", xscd->desc); + if (syslog_enabled) + syslog(LOG_ERR, "%s", xscd->desc); + break; + default: + xbps_dbg_printf(xhp, + "unknown state %d\n", xscd->state); + break; + } +} + int main(int argc, char **argv) {