build: Add DAEMON_ prefix to CONFIGDIR and STORAGEDIR

This commit is contained in:
Marcel Holtmann 2018-09-14 17:58:44 +02:00
parent 1e37ef31fe
commit 2606bc73ad
5 changed files with 14 additions and 13 deletions

View File

@ -63,14 +63,14 @@ if (test "${prefix}" = "NONE"); then
fi
if (test "$localstatedir" = '${prefix}/var'); then
storagedir="${prefix}/var/lib/iwd"
daemon_storagedir="${prefix}/var/lib/iwd"
else
storagedir="${localstatedir}/lib/iwd"
daemon_storagedir="${localstatedir}/lib/iwd"
fi
AC_DEFINE_UNQUOTED(STORAGEDIR, "${storagedir}",
AC_DEFINE_UNQUOTED(DAEMON_STORAGEDIR, "${daemon_storagedir}",
[Directory for the storage files])
AC_DEFINE_UNQUOTED(CONFIGDIR, "/etc/iwd", [Configuration directory])
AC_DEFINE_UNQUOTED(DAEMON_CONFIGDIR, "/etc/iwd", [Configuration directory])
AC_CHECK_HEADERS(linux/types.h linux/if_alg.h)

View File

@ -369,9 +369,10 @@ bool known_networks_init(void)
return false;
}
dir = opendir(STORAGEDIR);
dir = opendir(DAEMON_STORAGEDIR);
if (!dir) {
l_info("Unable to open %s: %s", STORAGEDIR, strerror(errno));
l_info("Unable to open %s: %s", DAEMON_STORAGEDIR,
strerror(errno));
l_dbus_unregister_interface(dbus, IWD_KNOWN_NETWORK_INTERFACE);
return false;
}
@ -404,8 +405,8 @@ bool known_networks_init(void)
closedir(dir);
storage_dir_watch = l_fswatch_new(STORAGEDIR, known_networks_watch_cb,
NULL,
storage_dir_watch = l_fswatch_new(DAEMON_STORAGEDIR,
known_networks_watch_cb, NULL,
known_networks_watch_destroy);
return true;

View File

@ -437,9 +437,9 @@ int main(int argc, char *argv[])
l_info("Wireless daemon version %s", VERSION);
if (!config_dir)
config_dir = CONFIGDIR;
config_dir = DAEMON_CONFIGDIR;
config_path = l_strdup_printf("/%s/%s", config_dir, "main.conf");
config_path = l_strdup_printf("%s/%s", config_dir, "main.conf");
iwd_config = l_settings_new();
if (!l_settings_load_from_file(iwd_config, config_path))

View File

@ -183,12 +183,12 @@ char *storage_get_network_file_path(enum security type, const char *ssid)
hex = l_util_hexstring((const unsigned char *) ssid,
strlen(ssid));
path = l_strdup_printf(STORAGEDIR "/=%s.%s", hex,
path = l_strdup_printf(DAEMON_STORAGEDIR "/=%s.%s", hex,
security_to_str(type));
l_free(hex);
} else
path = l_strdup_printf(STORAGEDIR "/%s.%s", ssid,
path = l_strdup_printf(DAEMON_STORAGEDIR "/%s.%s", ssid,
security_to_str(type));
return path;

View File

@ -1809,7 +1809,7 @@ static void create_network_and_run_tests(const void *key, void *value,
HW_CONFIG_GROUP_SETUP,
HW_CONFIG_SETUP_IWD_CONF_DIR);
if (!iwd_config_dir)
iwd_config_dir = CONFIGDIR;
iwd_config_dir = DAEMON_CONFIGDIR;
iwd_pid = start_iwd(iwd_config_dir, wiphy_list,
iwd_ext_options);