multicall: load config file data as early as possible

This commit is contained in:
Ariadne Conill 2020-09-14 17:18:45 -06:00
parent 5b27d8408c
commit b4e35c442e
2 changed files with 5 additions and 0 deletions

View file

@ -10,6 +10,7 @@ PACKAGE_BUGREPORT := https://github.com/ifupdown-ng/ifupdown-ng/issues/new
INTERFACES_FILE := /etc/network/interfaces INTERFACES_FILE := /etc/network/interfaces
STATE_FILE := /run/ifstate STATE_FILE := /run/ifstate
CONFIG_FILE := /etc/network/ifupdown-ng.conf
EXECUTOR_PATH := /usr/libexec/ifupdown-ng EXECUTOR_PATH := /usr/libexec/ifupdown-ng
CFLAGS ?= -ggdb3 -Os CFLAGS ?= -ggdb3 -Os
@ -18,6 +19,7 @@ CFLAGS += ${LIBBSD_CFLAGS}
CPPFLAGS = -I. CPPFLAGS = -I.
CPPFLAGS += -DINTERFACES_FILE=\"${INTERFACES_FILE}\" CPPFLAGS += -DINTERFACES_FILE=\"${INTERFACES_FILE}\"
CPPFLAGS += -DSTATE_FILE=\"${STATE_FILE}\" CPPFLAGS += -DSTATE_FILE=\"${STATE_FILE}\"
CPPFLAGS += -DCONFIG_FILE=\"${CONFIG_FILE}\"
CPPFLAGS += -DPACKAGE_NAME=\"${PACKAGE_NAME}\" CPPFLAGS += -DPACKAGE_NAME=\"${PACKAGE_NAME}\"
CPPFLAGS += -DPACKAGE_VERSION=\"${PACKAGE_VERSION}\" CPPFLAGS += -DPACKAGE_VERSION=\"${PACKAGE_VERSION}\"
CPPFLAGS += -DPACKAGE_BUGREPORT=\"${PACKAGE_BUGREPORT}\" CPPFLAGS += -DPACKAGE_BUGREPORT=\"${PACKAGE_BUGREPORT}\"
@ -127,6 +129,7 @@ install: all
for i in ${EXECUTOR_SCRIPTS_STUB}; do \ for i in ${EXECUTOR_SCRIPTS_STUB}; do \
install -D -m755 executor-scripts/stub/$$i ${DESTDIR}${EXECUTOR_PATH}/$$i; \ install -D -m755 executor-scripts/stub/$$i ${DESTDIR}${EXECUTOR_PATH}/$$i; \
done done
install -D -m644 dist/ifupdown-ng.conf.example ${DESTDIR}${CONFIG_FILE}.example
.scd.1 .scd.2 .scd.3 .scd.4 .scd.5 .scd.6 .scd.7 .scd.8: .scd.1 .scd.2 .scd.3 .scd.4 .scd.5 .scd.6 .scd.7 .scd.8:
${SCDOC} < $< > $@ ${SCDOC} < $< > $@

View file

@ -72,6 +72,8 @@ main(int argc, char *argv[])
argv0 = basename(argv[0]); argv0 = basename(argv[0]);
const struct if_applet **app; const struct if_applet **app;
lif_config_load(CONFIG_FILE);
app = bsearch(argv0, applet_table, app = bsearch(argv0, applet_table,
ARRAY_SIZE(applet_table), sizeof(*applet_table), ARRAY_SIZE(applet_table), sizeof(*applet_table),
applet_cmp); applet_cmp);