fix: correct dbus address for p2p mode

Old location has permission issue.

Signed-off-by: black-desk <me@black-desk.cn>
This commit is contained in:
black-desk 2024-01-04 11:02:09 +08:00
parent 14feec11d7
commit e3a46e5e6b
No known key found for this signature in database
GPG Key ID: 761EE6143999AE8B
3 changed files with 11 additions and 13 deletions

View File

@ -37,7 +37,7 @@ void startProcess(QString program, QStringList args = {})
qint64 pid = 0;
process.startDetached(&pid);
QObject::connect(QCoreApplication::instance(), &QCoreApplication::aboutToQuit, [&pid]() {
QObject::connect(QCoreApplication::instance(), &QCoreApplication::aboutToQuit, [pid]() {
kill(pid, SIGTERM);
});
}

View File

@ -103,7 +103,7 @@ void withDBusDaemon()
void withoutDBusDaemon()
{
auto pkgManHelperConn =
QDBusConnection::connectToPeer("unix:path=/run/linglong/system-helper.socket",
QDBusConnection::connectToPeer("unix:path=/tmp/linglong-system-helper.socket",
"ll-system-helper");
auto pkgManHelper =
new linglong::api::dbus::v1::PackageManagerHelper("",
@ -140,19 +140,18 @@ void withoutDBusDaemon()
auto jobMan = new linglong::job_manager::JobManager(*ostreeRepo, QCoreApplication::instance());
new linglong::adaptors::job_manger::JobManager1(jobMan);
QDir::root().mkpath("/run/linglong");
auto server =
new QDBusServer("/run/linglong/package-manager.socket", QCoreApplication::instance());
auto server = new QDBusServer("unix:path=/tmp/linglong-package-manager.socket",
QCoreApplication::instance());
if (!server->isConnected()) {
qCritical() << "listen on socket:" << server->lastError();
QCoreApplication::exit(-1);
return;
}
QObject::connect(QCoreApplication::instance(), &QCoreApplication::aboutToQuit, []() {
if (QDir::root().remove("/run/linglong/package-manager.socket")) {
if (QDir::root().remove("/tmp/linglong-package-manager.socket")) {
return;
}
qCritical() << "failed to remove /run/linglong/package-manager.socket.";
qCritical() << "failed to remove /tmp/linglong-package-manager.socket.";
});
QObject::connect(

View File

@ -59,7 +59,7 @@ void withDBusDaemon()
res = registerDBusService(bus, linglong::SystemHelperDBusServiceName);
if (!res.has_value()) {
qCritical() << res.error().code() << res.error().message();
qCritical() << res.error();
QCoreApplication::exit(-1);
return;
}
@ -83,19 +83,18 @@ void withoutDBusDaemon()
auto filesystemHelperAdaptor =
new linglong::adaptors::system_helper::FilesystemHelper1(filesystemHelper);
QDir::root().mkpath("/run/linglong");
auto qDBusServer =
new QDBusServer("unix:path=/run/linglong/system-helper.socket", QCoreApplication::instance());
new QDBusServer("unix:path=/tmp/linglong-system-helper.socket", QCoreApplication::instance());
if (!qDBusServer->isConnected()) {
qCritical() << "dbusServer is not connected:" << qDBusServer->lastError();
QCoreApplication::exit(-1);
return;
}
QObject::connect(QCoreApplication::instance(), &QCoreApplication::aboutToQuit, []() {
if (QDir::root().remove("/run/linglong/system-helper.socket")) {
if (QDir::root().remove("/tmp/linglong-system-helper.socket")) {
return;
}
qCritical() << "failed to remove /run/linglong/system-helper.socket.";
qCritical() << "failed to remove /tmp/linglong-system-helper.socket.";
});
QObject::connect(
@ -139,7 +138,7 @@ int main(int argc, char *argv[])
QCoreApplication::instance(),
[]() {
QCommandLineParser parser;
QCommandLineOption optBus("bus", "service bus address", "bus");
QCommandLineOption optBus("no-dbus", "run without dbus daemon", "no-dbus");
optBus.setFlags(QCommandLineOption::HiddenFromHelp);
parser.addOptions({ optBus });