Refuse to install on buster.

This commit is contained in:
Robin Davies
2024-09-13 06:13:57 -04:00
parent f34da1f494
commit 3057d78efe
7 changed files with 367 additions and 37 deletions
+1 -6
View File
@@ -194,7 +194,6 @@ set (PIPEDAL_SOURCES
RequestHandler.hpp
Scratch.cpp PluginHost.hpp PluginHost.cpp
PluginType.hpp PluginType.cpp
Lv2Log.hpp Lv2Log.cpp
PiPedalSocket.hpp PiPedalSocket.cpp
PiPedalVersion.hpp PiPedalVersion.cpp
PiPedalModel.hpp PiPedalModel.cpp
@@ -297,7 +296,7 @@ target_link_libraries(pipedald PRIVATE PiPedalCommon
#################################
add_executable(hotspotManagerTest
hotspotManagerTestMain.cpp
HotspotManager.cpp HotspotManager.hpp Lv2Log.cpp Lv2Log.hpp)
HotspotManager.cpp HotspotManager.hpp)
target_link_libraries(hotspotManagerTest PRIVATE ${PIPEDAL_LIBS})
@@ -608,7 +607,6 @@ add_executable(pipedalconfig
SystemConfigFile.hpp SystemConfigFile.cpp
WifiChannelSelectors.cpp WifiChannelSelectors.hpp
asan_options.cpp
Lv2Log.cpp Lv2Log.hpp
)
@@ -621,7 +619,6 @@ add_executable(pipedal_latency_test
PiLatencyMain.cpp
PiPedalAlsa.hpp PiPedalAlsa.cpp
asan_options.cpp
Lv2Log.cpp Lv2Log.hpp
AlsaDriver.cpp AlsaDriver.hpp
JackConfiguration.hpp JackConfiguration.cpp
JackServerSettings.hpp JackServerSettings.cpp
@@ -648,7 +645,6 @@ target_link_libraries(capturepresets ${PIPEDAL_LIBS})
add_executable(pipedal_update
UpdateMain.cpp
UpdateResults.cpp UpdateResults.hpp
Lv2Log.hpp Lv2Log.cpp
Lv2SystemdLogger.cpp Lv2SystemdLogger.hpp
UpdateResults.cpp UpdateResults.hpp
AdminInstallUpdate.cpp AdminInstallUpdate.hpp
@@ -664,7 +660,6 @@ add_executable(pipedaladmind AdminMain.cpp CommandLineParser.hpp
JackServerSettings.hpp JackServerSettings.cpp
Lv2SystemdLogger.hpp Lv2SystemdLogger.cpp
Lv2Log.cpp Lv2Log.hpp
SystemConfigFile.hpp SystemConfigFile.cpp
CpuGovernor.cpp CpuGovernor.hpp
asan_options.cpp
+78 -28
View File
@@ -552,6 +552,11 @@ static bool IsP2pServiceEnabled()
void Uninstall()
{
// if NetworkManager isn't installed, Install will have failed.
// Do cleanup as if the Isntall had not failed.
PretendNetworkManagerIsInstalled();
try
{
OnWifiUninstall(true);
@@ -897,6 +902,11 @@ void InstallPgpKey()
void Install(const fs::path &programPrefix, const std::string endpointAddress)
{
cout << "Configuring pipedal" << endl;
if (!UsingNetworkManager())
{
throw std::runtime_error("The current OS is not using NetworkManager. Services not configured.");
}
try
{
DeployVarConfig();
@@ -1275,6 +1285,13 @@ static int ListP2PChannels(const std::vector<std::string> &arguments)
return EXIT_SUCCESS;
}
void RequireNetworkManager()
{
if (!UsingNetworkManager())
{
throw std::runtime_error("The current OS is not using NetworkManager.");
}
}
int main(int argc, char **argv)
{
CommandLineParser parser;
@@ -1407,68 +1424,92 @@ int main(int argc, char **argv)
}
if (install)
{
fs::path prefix;
if (prefixOption.length() != 0)
{
prefix = fs::path(prefixOption);
}
else
{
prefix = fs::path(argv[0]).parent_path().parent_path();
fs::path pipedalPath = prefix / "sbin" / "pipedald";
if (!fs::exists(pipedalPath))
try {
fs::path prefix;
if (prefixOption.length() != 0)
{
std::stringstream s;
s << "Can't find pipedald executable at " << pipedalPath << ". Try again using the -prefix option.";
throw std::runtime_error(s.str());
prefix = fs::path(prefixOption);
}
else
{
prefix = fs::path(argv[0]).parent_path().parent_path();
fs::path pipedalPath = prefix / "sbin" / "pipedald";
if (!fs::exists(pipedalPath))
{
std::stringstream s;
s << "Can't find pipedald executable at " << pipedalPath << ". Try again using the -prefix option.";
throw std::runtime_error(s.str());
}
}
}
if (portOption == "")
{
portOption = GetCurrentWebServicePort();
if (portOption == "")
{
portOption = "80";
portOption = GetCurrentWebServicePort();
if (portOption == "")
{
portOption = "80";
}
}
}
if (portOption.find(':') == string::npos)
if (portOption.find(':') == string::npos)
{
portOption = "0.0.0.0:" + portOption;
}
Install(prefix, portOption);
FileSystemSync();
} catch (const std::exception&e)
{
portOption = "0.0.0.0:" + portOption;
cout << "ERROR: " << e.what() << endl;
FileSystemSync();
return EXIT_SUCCESS; // say we succeeded so we don't put APT into a hellish state.
}
Install(prefix, portOption);
FileSystemSync();
}
else if (uninstall)
{
Uninstall();
FileSystemSync();
try {
Uninstall();
FileSystemSync();
} catch (const std::exception &e)
{
cout << "ERROR: " << e.what() << endl;
FileSystemSync();
return EXIT_SUCCESS; // Say we succeeds so that we don't put APT into a hellish state.
}
}
else if (stop)
{
RequireNetworkManager();
StopService();
}
else if (start)
{
RequireNetworkManager();
StartService();
}
else if (restart)
{
RequireNetworkManager();
RestartService(excludeShutdownService);
}
else if (enable)
{
RequireNetworkManager();
EnableService();
FileSystemSync();
}
else if (disable)
{
RequireNetworkManager();
DisableService();
FileSystemSync();
}
else if (enable_p2p)
{
cout << "ERROR: Wi-Fi p2p connections are no longer supported. Use hotspots instead." << endl;
return EXIT_FAILURE;
throw std::runtime_error("Wi-Fi p2p connections are no longer supported. Use hotspots instead.");
// try
// {
// auto argv = parser.Arguments();
@@ -1487,15 +1528,20 @@ int main(int argc, char **argv)
}
else if (disable_p2p)
{
RequireNetworkManager();
WifiDirectConfigSettings settings;
settings.Load();
settings.enable_ = false;
SetWifiDirectConfig(settings);
RestartService(true);
return EXIT_SUCCESS;
}
else if (enable_hotspot)
{
RequireNetworkManager();
auto argv = parser.Arguments();
WifiConfigSettings settings;
@@ -1522,9 +1568,12 @@ int main(int argc, char **argv)
{
throw std::runtime_error("Failed to restart the " PIPEDALD_SERVICE " service.");
}
FileSystemSync();
}
else if (disable_hotspot)
{
RequireNetworkManager();
WifiConfigSettings settings;
settings.valid_ = true;
settings.autoStartMode_ = (uint16_t)HotspotAutoStartMode::Never;
@@ -1533,6 +1582,7 @@ int main(int argc, char **argv)
{
throw std::runtime_error("Failed to restart the " PIPEDALD_SERVICE " service.");
}
FileSystemSync();
}
}
catch (const std::exception &e)