Various Ubuntu changes.
This commit is contained in:
+1
-1
@@ -58,7 +58,7 @@ set(CPACK_PACKAGE_DESCRIPTION "IoT guitar effect pedal for Raspberry Pi, with ph
|
|||||||
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "IoT guitar effect for Raspberry Pi")
|
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "IoT guitar effect for Raspberry Pi")
|
||||||
set(CPACK_DEBIAN_PACKAGE_SECTION non-free/sound)
|
set(CPACK_DEBIAN_PACKAGE_SECTION non-free/sound)
|
||||||
set(CPACK_DEBIAN_PACKAGE_SHLIBDEPS ON)
|
set(CPACK_DEBIAN_PACKAGE_SHLIBDEPS ON)
|
||||||
set(CPACK_DEBIAN_PACKAGE_PREDEPENDS hostapd)
|
set(CPACK_DEBIAN_PACKAGE_PREDEPENDS hostapd authbind )
|
||||||
set(CPACK_DEBIAN_PACKAGE_CONTROL_STRICT_PERMISSION TRUE)
|
set(CPACK_DEBIAN_PACKAGE_CONTROL_STRICT_PERMISSION TRUE)
|
||||||
set(CPACK_PACKAGING_INSTALL_PREFIX /usr/local)
|
set(CPACK_PACKAGING_INSTALL_PREFIX /usr/local)
|
||||||
set(CPACK_PROJECT_NAME ${PROJECT_NAME})
|
set(CPACK_PROJECT_NAME ${PROJECT_NAME})
|
||||||
|
|||||||
+4
-3
@@ -57,13 +57,13 @@ set(CMAKE_CXX_STANDARD_REQUIRED True)
|
|||||||
if (CMAKE_BUILD_TYPE MATCHES Debug)
|
if (CMAKE_BUILD_TYPE MATCHES Debug)
|
||||||
message(STATUS "Debug build")
|
message(STATUS "Debug build")
|
||||||
|
|
||||||
set (CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} "-Wno-psabi -fsanitize=address -static-libasan -O0 -DDEBUG" )
|
set (CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} "-Wno-psabi -fsanitize=address -static-libasan -O0 -DDEBUG -Werror" )
|
||||||
elseif(CMAKE_BUILD_TYPE MATCHES RelWithDebInfo)
|
elseif(CMAKE_BUILD_TYPE MATCHES RelWithDebInfo)
|
||||||
message(STATUS "RelWithgDebInfo build")
|
message(STATUS "RelWithgDebInfo build")
|
||||||
set (CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} "-Wno-psabi" )
|
set (CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} "-Wno-psabi -Werror" )
|
||||||
else()
|
else()
|
||||||
message(STATUS "Release build")
|
message(STATUS "Release build")
|
||||||
set (CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} "-Wno-psabi" )
|
set (CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} "-Wno-psabi -Werror" )
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|
||||||
@@ -182,6 +182,7 @@ add_executable(pipedalconfig json.cpp json.hpp
|
|||||||
SystemConfigFile.hpp SystemConfigFile.cpp
|
SystemConfigFile.hpp SystemConfigFile.cpp
|
||||||
SysExec.hpp SysExec.cpp
|
SysExec.hpp SysExec.cpp
|
||||||
asan_options.cpp
|
asan_options.cpp
|
||||||
|
Lv2Log.cpp Lv2Log.hpp
|
||||||
)
|
)
|
||||||
|
|
||||||
target_link_libraries(pipedalconfig PRIVATE pthread atomic stdc++fs
|
target_link_libraries(pipedalconfig PRIVATE pthread atomic stdc++fs
|
||||||
|
|||||||
+48
-37
@@ -38,8 +38,8 @@ using namespace pipedal;
|
|||||||
#define SERVICE_ACCOUNT_NAME "pipedal_d"
|
#define SERVICE_ACCOUNT_NAME "pipedal_d"
|
||||||
#define SERVICE_GROUP_NAME "pipedal_d"
|
#define SERVICE_GROUP_NAME "pipedal_d"
|
||||||
#define JACK_SERVICE_ACCOUNT_NAME "jack"
|
#define JACK_SERVICE_ACCOUNT_NAME "jack"
|
||||||
#define JACK_SERVICE_GROUP_NAME "jack"
|
|
||||||
#define AUDIO_SERVICE_GROUP_NAME "audio"
|
#define AUDIO_SERVICE_GROUP_NAME "audio"
|
||||||
|
#define JACK_SERVICE_GROUP_NAME AUDIO_SERVICE_GROUP_NAME
|
||||||
|
|
||||||
#define SYSTEMCTL_BIN "/usr/bin/systemctl"
|
#define SYSTEMCTL_BIN "/usr/bin/systemctl"
|
||||||
#define GROUPADD_BIN "/usr/sbin/groupadd"
|
#define GROUPADD_BIN "/usr/sbin/groupadd"
|
||||||
@@ -86,22 +86,22 @@ std::filesystem::path findOnPath(const std::string &command)
|
|||||||
|
|
||||||
void EnableService()
|
void EnableService()
|
||||||
{
|
{
|
||||||
if (SysExec(SYSTEMCTL_BIN " enable " NATIVE_SERVICE ".service") != EXIT_SUCCESS)
|
if (sysExec(SYSTEMCTL_BIN " enable " NATIVE_SERVICE ".service") != EXIT_SUCCESS)
|
||||||
{
|
{
|
||||||
cout << "Error: Failed to enable the " NATIVE_SERVICE " service.";
|
cout << "Error: Failed to enable the " NATIVE_SERVICE " service.";
|
||||||
}
|
}
|
||||||
if (SysExec(SYSTEMCTL_BIN " enable " SHUTDOWN_SERVICE ".service") != EXIT_SUCCESS)
|
if (sysExec(SYSTEMCTL_BIN " enable " SHUTDOWN_SERVICE ".service") != EXIT_SUCCESS)
|
||||||
{
|
{
|
||||||
cout << "Error: Failed to enable the " SHUTDOWN_SERVICE " service.";
|
cout << "Error: Failed to enable the " SHUTDOWN_SERVICE " service.";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
void DisableService()
|
void DisableService()
|
||||||
{
|
{
|
||||||
if (SysExec(SYSTEMCTL_BIN " disable " NATIVE_SERVICE ".service") != EXIT_SUCCESS)
|
if (sysExec(SYSTEMCTL_BIN " disable " NATIVE_SERVICE ".service") != EXIT_SUCCESS)
|
||||||
{
|
{
|
||||||
cout << "Error: Failed to disable the " NATIVE_SERVICE " service.";
|
cout << "Error: Failed to disable the " NATIVE_SERVICE " service.";
|
||||||
}
|
}
|
||||||
if (SysExec(SYSTEMCTL_BIN " disable " SHUTDOWN_SERVICE ".service") != EXIT_SUCCESS)
|
if (sysExec(SYSTEMCTL_BIN " disable " SHUTDOWN_SERVICE ".service") != EXIT_SUCCESS)
|
||||||
{
|
{
|
||||||
cout << "Error: Failed to disable the " SHUTDOWN_SERVICE " service.";
|
cout << "Error: Failed to disable the " SHUTDOWN_SERVICE " service.";
|
||||||
}
|
}
|
||||||
@@ -109,18 +109,18 @@ void DisableService()
|
|||||||
|
|
||||||
void StopService(bool excludeShutdownService = false)
|
void StopService(bool excludeShutdownService = false)
|
||||||
{
|
{
|
||||||
if (SysExec(SYSTEMCTL_BIN " stop " NATIVE_SERVICE ".service") != EXIT_SUCCESS)
|
if (sysExec(SYSTEMCTL_BIN " stop " NATIVE_SERVICE ".service") != EXIT_SUCCESS)
|
||||||
{
|
{
|
||||||
cout << "Error: Failed to stop the " NATIVE_SERVICE " service.";
|
cout << "Error: Failed to stop the " NATIVE_SERVICE " service.";
|
||||||
}
|
}
|
||||||
if (!excludeShutdownService)
|
if (!excludeShutdownService)
|
||||||
{
|
{
|
||||||
if (SysExec(SYSTEMCTL_BIN " stop " SHUTDOWN_SERVICE ".service") != EXIT_SUCCESS)
|
if (sysExec(SYSTEMCTL_BIN " stop " SHUTDOWN_SERVICE ".service") != EXIT_SUCCESS)
|
||||||
{
|
{
|
||||||
cout << "Error: Failed to stop the " SHUTDOWN_SERVICE " service.";
|
cout << "Error: Failed to stop the " SHUTDOWN_SERVICE " service.";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (SysExec(SYSTEMCTL_BIN " stop " JACK_SERVICE ".service") != EXIT_SUCCESS)
|
if (sysExec(SYSTEMCTL_BIN " stop " JACK_SERVICE ".service") != EXIT_SUCCESS)
|
||||||
{
|
{
|
||||||
throw PiPedalException("Failed to stop the " JACK_SERVICE " service.");
|
throw PiPedalException("Failed to stop the " JACK_SERVICE " service.");
|
||||||
}
|
}
|
||||||
@@ -130,22 +130,25 @@ void Uninstall()
|
|||||||
{
|
{
|
||||||
StopService();
|
StopService();
|
||||||
DisableService();
|
DisableService();
|
||||||
system(SYSTEMCTL_BIN " stop jack");
|
silentSysExec(SYSTEMCTL_BIN " stop jack");
|
||||||
system(SYSTEMCTL_BIN " disable jack");
|
silentSysExec(SYSTEMCTL_BIN " disable jack");
|
||||||
|
std::filesystem::remove("/usr/bin/systemd/system/" SHUTDOWN_SERVICE ".service");
|
||||||
|
std::filesystem::remove("/usr/bin/systemd/system/" NATIVE_SERVICE ".service");
|
||||||
|
std::filesystem::remove("/usr/bin/systemd/system/" JACK_SERVICE ".service");
|
||||||
}
|
}
|
||||||
|
|
||||||
void StartService(bool excludeShutdownService = false)
|
void StartService(bool excludeShutdownService = false)
|
||||||
{
|
{
|
||||||
|
|
||||||
SilentSysExec("/usr/bin/pulseaudio --kill"); // interferes with Jack audio service startup.
|
silentSysExec("/usr/bin/pulseaudio --kill"); // interferes with Jack audio service startup.
|
||||||
if (!excludeShutdownService)
|
if (!excludeShutdownService)
|
||||||
{
|
{
|
||||||
if (SysExec(SYSTEMCTL_BIN " start " SHUTDOWN_SERVICE ".service") != EXIT_SUCCESS)
|
if (sysExec(SYSTEMCTL_BIN " start " SHUTDOWN_SERVICE ".service") != EXIT_SUCCESS)
|
||||||
{
|
{
|
||||||
throw PiPedalException("Failed to start the " SHUTDOWN_SERVICE " service.");
|
throw PiPedalException("Failed to start the " SHUTDOWN_SERVICE " service.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (SysExec(SYSTEMCTL_BIN " start " NATIVE_SERVICE ".service") != EXIT_SUCCESS)
|
if (sysExec(SYSTEMCTL_BIN " start " NATIVE_SERVICE ".service") != EXIT_SUCCESS)
|
||||||
{
|
{
|
||||||
throw PiPedalException("Failed to start the " NATIVE_SERVICE " service.");
|
throw PiPedalException("Failed to start the " NATIVE_SERVICE " service.");
|
||||||
}
|
}
|
||||||
@@ -153,7 +156,7 @@ void StartService(bool excludeShutdownService = false)
|
|||||||
serverSettings.ReadJackConfiguration();
|
serverSettings.ReadJackConfiguration();
|
||||||
if (serverSettings.IsValid())
|
if (serverSettings.IsValid())
|
||||||
{
|
{
|
||||||
if (SysExec(SYSTEMCTL_BIN " start " JACK_SERVICE ".service") != EXIT_SUCCESS)
|
if (sysExec(SYSTEMCTL_BIN " start " JACK_SERVICE ".service") != EXIT_SUCCESS)
|
||||||
{
|
{
|
||||||
throw PiPedalException("Failed to start the " JACK_SERVICE " service.");
|
throw PiPedalException("Failed to start the " JACK_SERVICE " service.");
|
||||||
}
|
}
|
||||||
@@ -195,7 +198,7 @@ static bool userExists(const char *userName)
|
|||||||
|
|
||||||
void InstallPamEnv()
|
void InstallPamEnv()
|
||||||
{
|
{
|
||||||
std::string newLine = "JACK_PROMISCOUS_SERVER DEFAULT=jack";
|
std::string newLine = "JACK_PROMISCUOUS_SERVER DEFAULT=" JACK_SERVICE_GROUP_NAME;
|
||||||
std::vector<std::string> lines;
|
std::vector<std::string> lines;
|
||||||
std::filesystem::path path = "/etc/security/pam_env.conf";
|
std::filesystem::path path = "/etc/security/pam_env.conf";
|
||||||
try
|
try
|
||||||
@@ -248,7 +251,7 @@ void InstallPamEnv()
|
|||||||
|
|
||||||
void InstallLimits()
|
void InstallLimits()
|
||||||
{
|
{
|
||||||
if (SysExec(GROUPADD_BIN " -f " AUDIO_SERVICE_GROUP_NAME) != EXIT_SUCCESS)
|
if (sysExec(GROUPADD_BIN " -f " AUDIO_SERVICE_GROUP_NAME) != EXIT_SUCCESS)
|
||||||
{
|
{
|
||||||
throw PiPedalException("Failed to create audio service group.");
|
throw PiPedalException("Failed to create audio service group.");
|
||||||
}
|
}
|
||||||
@@ -270,34 +273,34 @@ void MaybeStartJackService()
|
|||||||
|
|
||||||
if (std::filesystem::exists(drcFile) && std::filesystem::file_size(drcFile) != 0)
|
if (std::filesystem::exists(drcFile) && std::filesystem::file_size(drcFile) != 0)
|
||||||
{
|
{
|
||||||
system(SYSTEMCTL_BIN " start jack");
|
sysExec(SYSTEMCTL_BIN " start jack");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
system(SYSTEMCTL_BIN " mask jack");
|
silentSysExec(SYSTEMCTL_BIN " mask jack");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
void InstallJackService()
|
void InstallJackService()
|
||||||
{
|
{
|
||||||
InstallLimits();
|
InstallLimits();
|
||||||
InstallPamEnv();
|
InstallPamEnv();
|
||||||
if (SysExec(GROUPADD_BIN " -f " JACK_SERVICE_GROUP_NAME) != EXIT_SUCCESS)
|
if (sysExec(GROUPADD_BIN " -f " JACK_SERVICE_GROUP_NAME) != EXIT_SUCCESS)
|
||||||
{
|
{
|
||||||
throw PiPedalException("Failed to create jack service group.");
|
throw PiPedalException("Failed to create jack service group.");
|
||||||
}
|
}
|
||||||
if (!userExists(JACK_SERVICE_ACCOUNT_NAME))
|
if (!userExists(JACK_SERVICE_ACCOUNT_NAME))
|
||||||
{
|
{
|
||||||
if (SysExec(USERADD_BIN " " JACK_SERVICE_ACCOUNT_NAME " -g " JACK_SERVICE_GROUP_NAME " -M -N -r") != EXIT_SUCCESS)
|
if (sysExec(USERADD_BIN " " JACK_SERVICE_ACCOUNT_NAME " -g " JACK_SERVICE_GROUP_NAME " -M -N -r") != EXIT_SUCCESS)
|
||||||
{
|
{
|
||||||
// throw PiPedalException("Failed to create service account.");
|
// throw PiPedalException("Failed to create service account.");
|
||||||
}
|
}
|
||||||
// lock account for login.
|
// lock account for login.
|
||||||
SysExec("passwd -l " JACK_SERVICE_ACCOUNT_NAME);
|
silentSysExec("passwd -l " JACK_SERVICE_ACCOUNT_NAME);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add to audio groups.
|
// Add to audio groups.
|
||||||
SysExec(USERMOD_BIN " -a -G " JACK_SERVICE_GROUP_NAME " " JACK_SERVICE_ACCOUNT_NAME);
|
// sysExec(USERMOD_BIN " -a -G " JACK_SERVICE_GROUP_NAME " " JACK_SERVICE_ACCOUNT_NAME);
|
||||||
SysExec(USERMOD_BIN " -a -G" AUDIO_SERVICE_GROUP_NAME " " JACK_SERVICE_ACCOUNT_NAME);
|
sysExec(USERMOD_BIN " -a -G" AUDIO_SERVICE_GROUP_NAME " " JACK_SERVICE_ACCOUNT_NAME);
|
||||||
|
|
||||||
// deploy the systemd service file
|
// deploy the systemd service file
|
||||||
std::map<std::string, std::string> map; // nothing to customize.
|
std::map<std::string, std::string> map; // nothing to customize.
|
||||||
@@ -309,6 +312,10 @@ void InstallJackService()
|
|||||||
|
|
||||||
void Install(const std::filesystem::path &programPrefix, const std::string endpointAddress)
|
void Install(const std::filesystem::path &programPrefix, const std::string endpointAddress)
|
||||||
{
|
{
|
||||||
|
if (sysExec(GROUPADD_BIN " -f " AUDIO_SERVICE_GROUP_NAME) != EXIT_SUCCESS)
|
||||||
|
{
|
||||||
|
throw PiPedalException("Failed to create audio service group.");
|
||||||
|
}
|
||||||
|
|
||||||
InstallJackService();
|
InstallJackService();
|
||||||
auto endpos = endpointAddress.find_last_of(':');
|
auto endpos = endpointAddress.find_last_of(':');
|
||||||
@@ -341,23 +348,23 @@ void Install(const std::filesystem::path &programPrefix, const std::string endpo
|
|||||||
|
|
||||||
// Create and configure service account.
|
// Create and configure service account.
|
||||||
|
|
||||||
if (SysExec(GROUPADD_BIN " -f " SERVICE_GROUP_NAME) != EXIT_SUCCESS)
|
if (sysExec(GROUPADD_BIN " -f " SERVICE_GROUP_NAME) != EXIT_SUCCESS)
|
||||||
{
|
{
|
||||||
throw PiPedalException("Failed to create service group.");
|
throw PiPedalException("Failed to create service group.");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!userExists(SERVICE_ACCOUNT_NAME))
|
if (!userExists(SERVICE_ACCOUNT_NAME))
|
||||||
{
|
{
|
||||||
if (SysExec(USERADD_BIN " " SERVICE_ACCOUNT_NAME " -g " SERVICE_GROUP_NAME " -M -N -r") != EXIT_SUCCESS)
|
if (sysExec(USERADD_BIN " " SERVICE_ACCOUNT_NAME " -g " SERVICE_GROUP_NAME " -M -N -r") != EXIT_SUCCESS)
|
||||||
{
|
{
|
||||||
// throw PiPedalException("Failed to create service account.");
|
// throw PiPedalException("Failed to create service account.");
|
||||||
}
|
}
|
||||||
// lock account for login.
|
// lock account for login.
|
||||||
SysExec("passwd -l " SERVICE_ACCOUNT_NAME);
|
silentSysExec("passwd -l " SERVICE_ACCOUNT_NAME);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add to audio groups.
|
// Add to audio groups.
|
||||||
SysExec(USERMOD_BIN " -a -G jack " SERVICE_ACCOUNT_NAME);
|
sysExec(USERMOD_BIN " -a -G " AUDIO_SERVICE_GROUP_NAME " " SERVICE_ACCOUNT_NAME);
|
||||||
SysExec(USERMOD_BIN " -a -G audio " SERVICE_ACCOUNT_NAME);
|
|
||||||
|
|
||||||
// create and configure /var directory.
|
// create and configure /var directory.
|
||||||
|
|
||||||
@@ -367,51 +374,55 @@ void Install(const std::filesystem::path &programPrefix, const std::string endpo
|
|||||||
{
|
{
|
||||||
std::stringstream s;
|
std::stringstream s;
|
||||||
s << CHGRP_BIN " " SERVICE_GROUP_NAME " " << varDirectory.c_str();
|
s << CHGRP_BIN " " SERVICE_GROUP_NAME " " << varDirectory.c_str();
|
||||||
SysExec(s.str().c_str());
|
sysExec(s.str().c_str());
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
std::stringstream s;
|
std::stringstream s;
|
||||||
s << CHOWN_BIN << " " << SERVICE_ACCOUNT_NAME << " " << varDirectory.c_str();
|
s << CHOWN_BIN << " " << SERVICE_ACCOUNT_NAME << " " << varDirectory.c_str();
|
||||||
SysExec(s.str().c_str());
|
sysExec(s.str().c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
std::stringstream s;
|
std::stringstream s;
|
||||||
s << CHMOD_BIN << " 775 " << varDirectory.c_str();
|
s << CHMOD_BIN << " 775 " << varDirectory.c_str();
|
||||||
SysExec(s.str().c_str());
|
sysExec(s.str().c_str());
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
std::stringstream s;
|
std::stringstream s;
|
||||||
s << CHMOD_BIN << " g+s " << varDirectory.c_str(); // child files/directories inherit ownership.
|
s << CHMOD_BIN << " g+s " << varDirectory.c_str(); // child files/directories inherit ownership.
|
||||||
SysExec(s.str().c_str());
|
sysExec(s.str().c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
// authbind port.
|
// authbind port.
|
||||||
|
|
||||||
if (authBindRequired)
|
if (authBindRequired)
|
||||||
{
|
{
|
||||||
|
std::filesystem::create_directories("/etc/authbind/byport");
|
||||||
std::filesystem::path portAuthFile = std::filesystem::path("/etc/authbind/byport") / strPort;
|
std::filesystem::path portAuthFile = std::filesystem::path("/etc/authbind/byport") / strPort;
|
||||||
|
|
||||||
{
|
{
|
||||||
// create it.
|
// create it.
|
||||||
std::ofstream f(portAuthFile);
|
std::ofstream f(portAuthFile);
|
||||||
|
if (!f.is_open()) {
|
||||||
|
throw PiPedalException("Failed to create " + portAuthFile.string());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
// own it.
|
// own it.
|
||||||
std::stringstream s;
|
std::stringstream s;
|
||||||
s << CHOWN_BIN << " " SERVICE_ACCOUNT_NAME " " << portAuthFile.c_str();
|
s << CHOWN_BIN << " " SERVICE_ACCOUNT_NAME " " << portAuthFile.c_str();
|
||||||
SysExec(s.str().c_str());
|
sysExec(s.str().c_str());
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
// group own it.
|
// group own it.
|
||||||
std::stringstream s;
|
std::stringstream s;
|
||||||
s << CHGRP_BIN << " " SERVICE_GROUP_NAME " " << portAuthFile.c_str();
|
s << CHGRP_BIN << " " SERVICE_GROUP_NAME " " << portAuthFile.c_str();
|
||||||
SysExec(s.str().c_str());
|
sysExec(s.str().c_str());
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
std::stringstream s;
|
std::stringstream s;
|
||||||
s << CHMOD_BIN << " 770 " << portAuthFile.c_str();
|
s << CHMOD_BIN << " 770 " << portAuthFile.c_str();
|
||||||
SysExec(s.str().c_str());
|
sysExec(s.str().c_str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -448,7 +459,7 @@ void Install(const std::filesystem::path &programPrefix, const std::string endpo
|
|||||||
}
|
}
|
||||||
WriteTemplateFile(map, std::filesystem::path("/etc/pipedal/templateShutdown.service"), GetServiceFileName(SHUTDOWN_SERVICE));
|
WriteTemplateFile(map, std::filesystem::path("/etc/pipedal/templateShutdown.service"), GetServiceFileName(SHUTDOWN_SERVICE));
|
||||||
|
|
||||||
SysExec(SYSTEMCTL_BIN " daemon-reload");
|
sysExec(SYSTEMCTL_BIN " daemon-reload");
|
||||||
|
|
||||||
cout << "Starting service" << endl;
|
cout << "Starting service" << endl;
|
||||||
RestartService(false);
|
RestartService(false);
|
||||||
@@ -607,7 +618,7 @@ int main(int argc, char **argv)
|
|||||||
std::string pkexec = "/usr/bin/pkexec"; // staged because "ISO C++ forbids converting a string constant to std::vector<char*>::value_type"(!)
|
std::string pkexec = "/usr/bin/pkexec"; // staged because "ISO C++ forbids converting a string constant to std::vector<char*>::value_type"(!)
|
||||||
args.push_back((char *)(pkexec.c_str()));
|
args.push_back((char *)(pkexec.c_str()));
|
||||||
|
|
||||||
std::string sPath = GetSelfExePath();
|
std::string sPath = getSelfExePath();
|
||||||
args.push_back(const_cast<char *>(sPath.c_str()));
|
args.push_back(const_cast<char *>(sPath.c_str()));
|
||||||
for (int arg = 1; arg < argc; ++arg)
|
for (int arg = 1; arg < argc; ++arg)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -25,6 +25,8 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
#include "unistd.h"
|
#include "unistd.h"
|
||||||
#include <filesystem>
|
#include <filesystem>
|
||||||
|
#include "Lv2Log.hpp"
|
||||||
|
#include "SysExec.hpp"
|
||||||
|
|
||||||
#define DRC_FILENAME "/etc/jackdrc"
|
#define DRC_FILENAME "/etc/jackdrc"
|
||||||
|
|
||||||
@@ -205,7 +207,7 @@ void JackServerSettings::Write()
|
|||||||
{
|
{
|
||||||
// jack1 incantation for promiscuous servers.
|
// jack1 incantation for promiscuous servers.
|
||||||
output << "#!/bin/sh" <<endl;
|
output << "#!/bin/sh" <<endl;
|
||||||
output << "export JACK_PROMISCUOUS_SERVER=jack" << endl;
|
output << "export JACK_PROMISCUOUS_SERVER=audio" << endl;
|
||||||
output << "export JACK_NO_AUDIO_RESERVATION=1" << endl;
|
output << "export JACK_NO_AUDIO_RESERVATION=1" << endl;
|
||||||
output << "umask 0" << endl;
|
output << "umask 0" << endl;
|
||||||
}
|
}
|
||||||
@@ -222,9 +224,10 @@ void JackServerSettings::Write()
|
|||||||
<< " -p" << this->bufferSize_
|
<< " -p" << this->bufferSize_
|
||||||
<< " -n" << this->numberOfBuffers_ << " -Xseq"
|
<< " -n" << this->numberOfBuffers_ << " -Xseq"
|
||||||
<< endl;
|
<< endl;
|
||||||
system("/usr/bin/chmod 755 " DRC_FILENAME);
|
if (silentSysExec("/usr/bin/chmod 755 " DRC_FILENAME) != 0)
|
||||||
system("/usr/bin/systemctl unmask jack");
|
{
|
||||||
system("/usr/bin/systemctl enable jack");
|
Lv2Log::error("Failed to set permissions on /etc/jackdrc");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch (const std::exception &e)
|
catch (const std::exception &e)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -880,7 +880,6 @@ void PiPedalModel::SetJackServerSettings(const JackServerSettings &jackServerSet
|
|||||||
this->jackServerSettings = jackServerSettings;
|
this->jackServerSettings = jackServerSettings;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// take a snapshot incase a client unsusbscribes in the notification handler (in which case the mutex won't protect us)
|
// take a snapshot incase a client unsusbscribes in the notification handler (in which case the mutex won't protect us)
|
||||||
IPiPedalModelSubscriber **t = new IPiPedalModelSubscriber *[this->subscribers.size()];
|
IPiPedalModelSubscriber **t = new IPiPedalModelSubscriber *[this->subscribers.size()];
|
||||||
for (size_t i = 0; i < subscribers.size(); ++i)
|
for (size_t i = 0; i < subscribers.size(); ++i)
|
||||||
@@ -896,6 +895,13 @@ void PiPedalModel::SetJackServerSettings(const JackServerSettings &jackServerSet
|
|||||||
|
|
||||||
if (ShutdownClient::CanUseShutdownClient())
|
if (ShutdownClient::CanUseShutdownClient())
|
||||||
{
|
{
|
||||||
|
|
||||||
|
// save the current (edited) preset now in case the service shutdown isn't clean.
|
||||||
|
CurrentPreset currentPreset;
|
||||||
|
currentPreset.modified_ = this->hasPresetChanged;
|
||||||
|
currentPreset.preset_ = this->pedalBoard;
|
||||||
|
storage.SaveCurrentPreset(currentPreset);
|
||||||
|
|
||||||
this->jackConfiguration.SetIsRestarting(true);
|
this->jackConfiguration.SetIsRestarting(true);
|
||||||
fireJackConfigurationChanged(this->jackConfiguration);
|
fireJackConfigurationChanged(this->jackConfiguration);
|
||||||
this->jackHost->UpdateServerConfiguration(
|
this->jackHost->UpdateServerConfiguration(
|
||||||
|
|||||||
@@ -298,7 +298,7 @@ static void requestShutdown(bool restart)
|
|||||||
}
|
}
|
||||||
s << " now";
|
s << " now";
|
||||||
|
|
||||||
if (SysExec(s.str().c_str()) != EXIT_SUCCESS)
|
if (sysExec(s.str().c_str()) != EXIT_SUCCESS)
|
||||||
{
|
{
|
||||||
Lv2Log::error("shutdown failed.");
|
Lv2Log::error("shutdown failed.");
|
||||||
if (restart) {
|
if (restart) {
|
||||||
|
|||||||
+16
-16
@@ -37,11 +37,11 @@ void pipedal::SetWifiConfig(const WifiConfigSettings&settings)
|
|||||||
char band;
|
char band;
|
||||||
if (!settings.enable_)
|
if (!settings.enable_)
|
||||||
{
|
{
|
||||||
SysExec(SYSTEMCTL_BIN " stop hostapd");
|
sysExec(SYSTEMCTL_BIN " stop hostapd");
|
||||||
SysExec(SYSTEMCTL_BIN " disable hostapd");
|
sysExec(SYSTEMCTL_BIN " disable hostapd");
|
||||||
|
|
||||||
SysExec(SYSTEMCTL_BIN " enable wpa_supplicant");
|
sysExec(SYSTEMCTL_BIN " enable wpa_supplicant");
|
||||||
SysExec(SYSTEMCTL_BIN " start wpa_supplicant");
|
sysExec(SYSTEMCTL_BIN " start wpa_supplicant");
|
||||||
} else {
|
} else {
|
||||||
std::filesystem::path path("/etc/hostapd/hostapd.conf");
|
std::filesystem::path path("/etc/hostapd/hostapd.conf");
|
||||||
SystemConfigFile apdConfig;
|
SystemConfigFile apdConfig;
|
||||||
@@ -167,29 +167,29 @@ void pipedal::SetWifiConfig(const WifiConfigSettings&settings)
|
|||||||
|
|
||||||
|
|
||||||
// **************** start services ************
|
// **************** start services ************
|
||||||
SysExec("rfkill unblock wlan");
|
sysExec("rfkill unblock wlan");
|
||||||
SysExec(SYSTEMCTL_BIN " daemon-reload");
|
sysExec(SYSTEMCTL_BIN " daemon-reload");
|
||||||
|
|
||||||
SysExec(SYSTEMCTL_BIN " mask wpa_supplicant");
|
sysExec(SYSTEMCTL_BIN " mask wpa_supplicant");
|
||||||
SysExec(SYSTEMCTL_BIN " stop wpa_supplicant");
|
sysExec(SYSTEMCTL_BIN " stop wpa_supplicant");
|
||||||
|
|
||||||
SysExec(SYSTEMCTL_BIN " unmask hostapd");
|
sysExec(SYSTEMCTL_BIN " unmask hostapd");
|
||||||
if (SysExec(SYSTEMCTL_BIN " restart hostapd") != 0)
|
if (sysExec(SYSTEMCTL_BIN " restart hostapd") != 0)
|
||||||
{
|
{
|
||||||
throw PiPedalException("Unable to start the access point.");
|
throw PiPedalException("Unable to start the access point.");
|
||||||
|
|
||||||
}
|
}
|
||||||
if (SysExec("systemctl is-active --quiet hostapd") != 0)
|
if (sysExec("systemctl is-active --quiet hostapd") != 0)
|
||||||
{
|
{
|
||||||
throw PiPedalException("Unable to start the access point.");
|
throw PiPedalException("Unable to start the access point.");
|
||||||
}
|
}
|
||||||
SysExec(SYSTEMCTL_BIN " enable hostapd");
|
sysExec(SYSTEMCTL_BIN " enable hostapd");
|
||||||
|
|
||||||
SysExec(SYSTEMCTL_BIN " stop wpa_supplicant");
|
sysExec(SYSTEMCTL_BIN " stop wpa_supplicant");
|
||||||
SysExec(SYSTEMCTL_BIN " mask wpa_supplicant");
|
sysExec(SYSTEMCTL_BIN " mask wpa_supplicant");
|
||||||
|
|
||||||
SysExec(SYSTEMCTL_BIN " restart dnsmasq");
|
sysExec(SYSTEMCTL_BIN " restart dnsmasq");
|
||||||
SysExec(SYSTEMCTL_BIN " enable dnsmasq");
|
sysExec(SYSTEMCTL_BIN " enable dnsmasq");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -87,7 +87,7 @@ void delayedRestartProc()
|
|||||||
{
|
{
|
||||||
sleep(1); // give a chance for websocket messages to propagate.
|
sleep(1); // give a chance for websocket messages to propagate.
|
||||||
Lv2Log::error("Delayed Restart");
|
Lv2Log::error("Delayed Restart");
|
||||||
std::string pipedalConfigPath = std::filesystem::path(GetSelfExePath()).parent_path() / "pipedalconfig";
|
std::string pipedalConfigPath = std::filesystem::path(getSelfExePath()).parent_path() / "pipedalconfig";
|
||||||
|
|
||||||
std::stringstream s;
|
std::stringstream s;
|
||||||
s << pipedalConfigPath.c_str() << " --restart --excludeShutdownService";
|
s << pipedalConfigPath.c_str() << " --restart --excludeShutdownService";
|
||||||
@@ -104,6 +104,9 @@ bool setJackConfiguration(JackServerSettings serverSettings)
|
|||||||
|
|
||||||
serverSettings.Write();
|
serverSettings.Write();
|
||||||
|
|
||||||
|
silentSysExec("/usr/bin/systemctl unmask jack");
|
||||||
|
silentSysExec("/usr/bin/systemctl enable jack");
|
||||||
|
|
||||||
std::thread delayedRestartThread(delayedRestartProc);
|
std::thread delayedRestartThread(delayedRestartProc);
|
||||||
delayedRestartThread.detach();
|
delayedRestartThread.detach();
|
||||||
return true;
|
return true;
|
||||||
@@ -241,11 +244,11 @@ private:
|
|||||||
|
|
||||||
} else if (s == "shutdown")
|
} else if (s == "shutdown")
|
||||||
{
|
{
|
||||||
result = SysExec("/usr/sbin/shutdown -P now");
|
result = sysExec("/usr/sbin/shutdown -P now");
|
||||||
}
|
}
|
||||||
else if (s == "restart")
|
else if (s == "restart")
|
||||||
{
|
{
|
||||||
result = SysExec("/usr/sbin/shutdown -r now");
|
result = sysExec("/usr/sbin/shutdown -r now");
|
||||||
} else if (startsWith(s,"setJackConfiguration "))
|
} else if (startsWith(s,"setJackConfiguration "))
|
||||||
{
|
{
|
||||||
auto remainder = s.substr(strlen("setJackConfiguration "));
|
auto remainder = s.substr(strlen("setJackConfiguration "));
|
||||||
|
|||||||
+31
-31
@@ -117,66 +117,66 @@ namespace pipedal
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void AbTopMonoMono(uint32_t frames)
|
void abTopMonoMono(uint32_t frames)
|
||||||
{
|
{
|
||||||
Copy(this->inputs[0], this->topInputs[0], frames);
|
Copy(this->inputs[0], this->topInputs[0], frames);
|
||||||
}
|
}
|
||||||
void AbTopMonoStereo(uint32_t frames)
|
void abTopMonoStereo(uint32_t frames)
|
||||||
{
|
{
|
||||||
Copy(this->inputs[0], this->topInputs[0], frames);
|
Copy(this->inputs[0], this->topInputs[0], frames);
|
||||||
Copy(this->inputs[0], this->topInputs[1], frames);
|
Copy(this->inputs[0], this->topInputs[1], frames);
|
||||||
}
|
}
|
||||||
void AbTopStereoStereo(uint32_t frames)
|
void abTopStereoStereo(uint32_t frames)
|
||||||
{
|
{
|
||||||
Copy(this->inputs[0], this->topInputs[0], frames);
|
Copy(this->inputs[0], this->topInputs[0], frames);
|
||||||
Copy(this->inputs[1], this->topInputs[1], frames);
|
Copy(this->inputs[1], this->topInputs[1], frames);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AbBottomMonoMono(uint32_t frames)
|
void abBottomMonoMono(uint32_t frames)
|
||||||
{
|
{
|
||||||
Copy(this->inputs[0], this->bottomInputs[0], frames);
|
Copy(this->inputs[0], this->bottomInputs[0], frames);
|
||||||
}
|
}
|
||||||
void AbBottomMonoStereo(uint32_t frames)
|
void abBottomMonoStereo(uint32_t frames)
|
||||||
{
|
{
|
||||||
Copy(this->inputs[0], this->bottomInputs[0], frames);
|
Copy(this->inputs[0], this->bottomInputs[0], frames);
|
||||||
Copy(this->inputs[0], this->bottomInputs[1], frames);
|
Copy(this->inputs[0], this->bottomInputs[1], frames);
|
||||||
}
|
}
|
||||||
void AbBottomStereoStereo(uint32_t frames)
|
void abBottomStereoStereo(uint32_t frames)
|
||||||
{
|
{
|
||||||
Copy(this->inputs[0], this->bottomInputs[0], frames);
|
Copy(this->inputs[0], this->bottomInputs[0], frames);
|
||||||
Copy(this->inputs[1], this->bottomInputs[1], frames);
|
Copy(this->inputs[1], this->bottomInputs[1], frames);
|
||||||
}
|
}
|
||||||
void LrTopMonoMono(uint32_t frames)
|
void lrTopMonoMono(uint32_t frames)
|
||||||
{
|
{
|
||||||
Copy(this->inputs[0], this->topInputs[0], frames);
|
Copy(this->inputs[0], this->topInputs[0], frames);
|
||||||
}
|
}
|
||||||
void LrTopMonoStereo(uint32_t frames)
|
void lrTopMonoStereo(uint32_t frames)
|
||||||
{
|
{
|
||||||
Copy(this->inputs[0], this->topInputs[0], frames);
|
Copy(this->inputs[0], this->topInputs[0], frames);
|
||||||
Copy(this->inputs[0], this->topInputs[1], frames);
|
Copy(this->inputs[0], this->topInputs[1], frames);
|
||||||
}
|
}
|
||||||
void LrTopStereoStereo(uint32_t frames)
|
void lrTopStereoStereo(uint32_t frames)
|
||||||
{
|
{
|
||||||
Copy(this->inputs[0], this->topInputs[0], frames);
|
Copy(this->inputs[0], this->topInputs[0], frames);
|
||||||
Copy(this->inputs[0], this->topInputs[1], frames);
|
Copy(this->inputs[0], this->topInputs[1], frames);
|
||||||
}
|
}
|
||||||
|
|
||||||
void LrBottomMonoMono(uint32_t frames)
|
void lrBottomMonoMono(uint32_t frames)
|
||||||
{
|
{
|
||||||
Copy(this->inputs[0], this->bottomInputs[0], frames);
|
Copy(this->inputs[0], this->bottomInputs[0], frames);
|
||||||
}
|
}
|
||||||
void LrBottomMonoStereo(uint32_t frames)
|
void lrBottomMonoStereo(uint32_t frames)
|
||||||
{
|
{
|
||||||
Copy(this->inputs[0], this->bottomInputs[0], frames);
|
Copy(this->inputs[0], this->bottomInputs[0], frames);
|
||||||
Copy(this->inputs[0], this->bottomInputs[1], frames);
|
Copy(this->inputs[0], this->bottomInputs[1], frames);
|
||||||
}
|
}
|
||||||
void LrBottomStereoStereo(uint32_t frames)
|
void lrBottomStereoStereo(uint32_t frames)
|
||||||
{
|
{
|
||||||
Copy(this->inputs[1], this->bottomInputs[0], frames);
|
Copy(this->inputs[1], this->bottomInputs[0], frames);
|
||||||
Copy(this->inputs[1], this->bottomInputs[1], frames);
|
Copy(this->inputs[1], this->bottomInputs[1], frames);
|
||||||
}
|
}
|
||||||
|
|
||||||
void UpdateMixFunction()
|
void updateMixFunction()
|
||||||
{
|
{
|
||||||
if (activated)
|
if (activated)
|
||||||
{
|
{
|
||||||
@@ -187,37 +187,37 @@ namespace pipedal
|
|||||||
if (this->inputs.size() == 1)
|
if (this->inputs.size() == 1)
|
||||||
{
|
{
|
||||||
if (this->topInputs.size() == 1)
|
if (this->topInputs.size() == 1)
|
||||||
this->preAbTop = &SplitEffect::AbTopMonoMono;
|
this->preAbTop = &SplitEffect::abTopMonoMono;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
this->preAbTop = &SplitEffect::AbTopMonoStereo;
|
this->preAbTop = &SplitEffect::abTopMonoStereo;
|
||||||
}
|
}
|
||||||
if (this->bottomInputs.size() == 1)
|
if (this->bottomInputs.size() == 1)
|
||||||
{
|
{
|
||||||
this->preAbBottom = &SplitEffect::AbBottomMonoMono;
|
this->preAbBottom = &SplitEffect::abBottomMonoMono;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
this->preAbBottom = &SplitEffect::AbBottomMonoStereo;
|
this->preAbBottom = &SplitEffect::abBottomMonoStereo;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (this->topInputs.size() == 1)
|
if (this->topInputs.size() == 1)
|
||||||
{
|
{
|
||||||
this->preAbTop == &SplitEffect::AbTopMonoMono;
|
this->preAbTop == &SplitEffect::abTopMonoMono;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
this->preAbTop = &SplitEffect::AbTopStereoStereo;
|
this->preAbTop = &SplitEffect::abTopStereoStereo;
|
||||||
}
|
}
|
||||||
if (this->bottomInputs.size() == 1)
|
if (this->bottomInputs.size() == 1)
|
||||||
{
|
{
|
||||||
this->preAbBottom == &SplitEffect::AbBottomMonoMono;
|
this->preAbBottom == &SplitEffect::abBottomMonoMono;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
this->preAbBottom = &SplitEffect::AbBottomStereoStereo;
|
this->preAbBottom = &SplitEffect::abBottomStereoStereo;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -226,37 +226,37 @@ namespace pipedal
|
|||||||
if (this->inputs.size() == 1)
|
if (this->inputs.size() == 1)
|
||||||
{
|
{
|
||||||
if (this->topInputs.size() == 1)
|
if (this->topInputs.size() == 1)
|
||||||
this->preAbTop = &SplitEffect::LrTopMonoMono;
|
this->preAbTop = &SplitEffect::lrTopMonoMono;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
this->preAbTop = &SplitEffect::LrTopMonoStereo;
|
this->preAbTop = &SplitEffect::lrTopMonoStereo;
|
||||||
}
|
}
|
||||||
if (this->bottomInputs.size() == 1)
|
if (this->bottomInputs.size() == 1)
|
||||||
{
|
{
|
||||||
this->preAbBottom = &SplitEffect::LrBottomMonoMono;
|
this->preAbBottom = &SplitEffect::lrBottomMonoMono;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
this->preAbBottom = &SplitEffect::LrBottomMonoStereo;
|
this->preAbBottom = &SplitEffect::lrBottomMonoStereo;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (this->topInputs.size() == 1)
|
if (this->topInputs.size() == 1)
|
||||||
{
|
{
|
||||||
this->preAbTop == &SplitEffect::LrTopMonoMono;
|
this->preAbTop == &SplitEffect::lrTopMonoMono;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
this->preAbTop = &SplitEffect::LrTopStereoStereo;
|
this->preAbTop = &SplitEffect::lrTopStereoStereo;
|
||||||
}
|
}
|
||||||
if (this->bottomInputs.size() == 1)
|
if (this->bottomInputs.size() == 1)
|
||||||
{
|
{
|
||||||
this->preAbBottom == &SplitEffect::LrBottomMonoMono;
|
this->preAbBottom == &SplitEffect::lrBottomMonoMono;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
this->preAbBottom = &SplitEffect::LrBottomStereoStereo;
|
this->preAbBottom = &SplitEffect::lrBottomStereoStereo;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -303,7 +303,7 @@ namespace pipedal
|
|||||||
void Activate()
|
void Activate()
|
||||||
{
|
{
|
||||||
activated = true;
|
activated = true;
|
||||||
UpdateMixFunction();
|
updateMixFunction();
|
||||||
snapToMixTarget();
|
snapToMixTarget();
|
||||||
|
|
||||||
mixBottomInputs.clear();
|
mixBottomInputs.clear();
|
||||||
@@ -471,7 +471,7 @@ namespace pipedal
|
|||||||
if (splitType != t)
|
if (splitType != t)
|
||||||
{
|
{
|
||||||
splitType = t;
|
splitType = t;
|
||||||
UpdateMixFunction();
|
updateMixFunction();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
+5
-4
@@ -63,7 +63,7 @@ static std::filesystem::path findOnSystemPath(const std::string &command)
|
|||||||
throw PiPedalException(s.str());
|
throw PiPedalException(s.str());
|
||||||
}
|
}
|
||||||
|
|
||||||
void pipedal::SilentSysExec(const char *szCommand)
|
int pipedal::silentSysExec(const char *szCommand)
|
||||||
{
|
{
|
||||||
std::stringstream s;
|
std::stringstream s;
|
||||||
s << szCommand << " 2>&1";
|
s << szCommand << " 2>&1";
|
||||||
@@ -76,10 +76,11 @@ void pipedal::SilentSysExec(const char *szCommand)
|
|||||||
{
|
{
|
||||||
fgets(buffer, sizeof(buffer), output);
|
fgets(buffer, sizeof(buffer), output);
|
||||||
}
|
}
|
||||||
pclose(output);
|
return pclose(output);
|
||||||
}
|
}
|
||||||
|
return -1;
|
||||||
}
|
}
|
||||||
int pipedal::SysExec(const char *szCommand)
|
int pipedal::sysExec(const char *szCommand)
|
||||||
{
|
{
|
||||||
char *args = strdup(szCommand);
|
char *args = strdup(szCommand);
|
||||||
int argc;
|
int argc;
|
||||||
@@ -135,7 +136,7 @@ int pipedal::SysExec(const char *szCommand)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
std::string pipedal::GetSelfExePath()
|
std::string pipedal::getSelfExePath()
|
||||||
{
|
{
|
||||||
char result[PATH_MAX+1];
|
char result[PATH_MAX+1];
|
||||||
ssize_t count = readlink("/proc/self/exe", result, PATH_MAX);
|
ssize_t count = readlink("/proc/self/exe", result, PATH_MAX);
|
||||||
|
|||||||
+3
-3
@@ -22,10 +22,10 @@
|
|||||||
|
|
||||||
namespace pipedal {
|
namespace pipedal {
|
||||||
// exec a command, returning the actual exit code (unlike execXX() or system() )
|
// exec a command, returning the actual exit code (unlike execXX() or system() )
|
||||||
int SysExec(const char*szCommand);
|
int sysExec(const char*szCommand);
|
||||||
|
|
||||||
// execute a command, suppressing output.
|
// execute a command, suppressing output.
|
||||||
void SilentSysExec(const char *szCommand);
|
int silentSysExec(const char *szCommand);
|
||||||
|
|
||||||
std::string GetSelfExePath();
|
std::string getSelfExePath();
|
||||||
}
|
}
|
||||||
@@ -16,7 +16,7 @@ Group=jack
|
|||||||
Restart=always
|
Restart=always
|
||||||
RestartSec=15
|
RestartSec=15
|
||||||
|
|
||||||
Environment=JACK_PROMISCUOUS_SERVER=jack
|
Environment=JACK_PROMISCUOUS_SERVER=audio
|
||||||
Environment=JACK_NO_AUDIO_RESERVATION=1
|
Environment=JACK_NO_AUDIO_RESERVATION=1
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user