- configure_network: remove hardcoded paths to ifup/ifdown

Signed-off-by: Thilo Graf <dbt@novatux.de>
This commit is contained in:
svenhoefer
2022-06-12 22:59:08 +02:00
committed by Thilo Graf
parent fb6abf3444
commit 834b803db9

View File

@@ -214,26 +214,37 @@ void CNetworkConfig::commitConfig(void)
void CNetworkConfig::startNetwork(void) void CNetworkConfig::startNetwork(void)
{ {
std::string cmd = "/sbin/ifup " + ifname; std::string ifup = find_executable("ifup");
if (ifup.empty())
{
printf("CNetworkConfig::startNetwork: ifup not found\n");
return;
}
std::string cmd = ifup + " " + ifname;
#ifdef DEBUG #ifdef DEBUG
printf("CNetworkConfig::startNetwork: %s\n", cmd.c_str()); printf("CNetworkConfig::startNetwork: %s\n", cmd.c_str());
#endif #endif
my_system(3, "/bin/sh", "-c", cmd.c_str()); my_system(3, "/bin/sh", "-c", cmd.c_str());
if (!inet_static) { if (!inet_static)
init_vars(); init_vars();
} }
//mysystem((char *) "ifup", (char *) "-v", (char *) "eth0");
}
void CNetworkConfig::stopNetwork(void) void CNetworkConfig::stopNetwork(void)
{ {
std::string cmd = "/sbin/ifdown " + ifname; std::string ifdown = find_executable("ifdown");
if (ifdown.empty())
{
printf("CNetworkConfig::stopNetwork: ifdown not found\n");
return;
}
std::string cmd = ifdown + " " + ifname;
#ifdef DEBUG #ifdef DEBUG
printf("CNetworkConfig::stopNetwork: %s\n", cmd.c_str()); printf("CNetworkConfig::stopNetwork: %s\n", cmd.c_str());
#endif #endif
my_system(3, "/bin/sh", "-c", cmd.c_str()); my_system(3, "/bin/sh", "-c", cmd.c_str());
} }
void CNetworkConfig::readWpaConfig() void CNetworkConfig::readWpaConfig()