Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OpenRC Support #8

Open
parinzee opened this issue Apr 25, 2021 · 9 comments
Open

OpenRC Support #8

parinzee opened this issue Apr 25, 2021 · 9 comments
Labels
enhancement New feature or request

Comments

@parinzee
Copy link

Hi, I've taken a look at the source code for this. Would it be possible to add OpenRC support to it? From the looks of it, we only need a OpenRC service file. I am happy to write this up, however, are there any more aspects of this that depend on SystemD?

Sincerely,
Parin

@qzed
Copy link
Member

qzed commented Apr 25, 2021

I don't see why OpenRC wouldn't work. There's no hard dependency on systemd from the actual executables, only on D-Bus. Keep in mind though that the system service should be started after the DTX device is available (this udev rule helps with that for the systemd service).

Feel free to send a PR.

@parinzee
Copy link
Author

Right thank you for the reply, I'll report the progress back in a few days.

@werdahias
Copy link

My take on it so far:

#!/sbin/openrc-run

command="/usr/bin/surface-dtx-userd"
command_args="--no-log-time"
pidfile="/run/${RC_SVCNAME}.pid"

depends ()
{
	after surface-dtx-daemon
}


#!/sbin/openrc-run

command="/usr/bin/surface-dtx-daemon"
command_args="--no-log-time"
pidfile="/run/${RC_SVCNAME}.pid"

depends ()
{

}

@werdahias
Copy link

forgot the name section

@werdahias
Copy link

Interesting:

sudo rc-service surface-dtx-userd start
 * surface-dtx-userd: waiting for surface-dtx-daemon (50 seconds)
 * Starting surface-dtx-userd ...
 INFO sdtxu: running...
ERROR sdtxu: critical error: Failed to connect to D-Bus (session)

Error: Failed to connect to D-Bus (session)

Caused by:
    Unable to autolaunch a dbus-daemon without a $DISPLAY for X11
 * Failed to start surface-dtx-userd                                                                                                                                        [ !! ]
 * ERROR: surface-dtx-userd failed to start

surface-dtx-daemon.txt
surface-dtx-userd.txt

@qzed
Copy link
Member

qzed commented Nov 28, 2021

The general idea behind the two daemons is: The system daemon is responsible for detaching whereas userd is a per-user daemon that takes care of notifying the user (e.g. when the clipboard can be detached). They need a D-Bus interface as they're communicating over that. The user-daemon also sends notifications to the user via D-Bus interface.

I have no idea how OpenRC works exactly, but you have to launch the userd as any user that wants to be notified, not as root. In general, this also makes only sense for any user that has a graphical interface as the userd is essentially only for notifications.

@werdahias
Copy link

Can confirm dtx is working when just invoking dtx-daemon using above init script. I've deactivated userd for now.

@parinzee
Copy link
Author

parinzee commented Nov 29, 2021

Interesting:

sudo rc-service surface-dtx-userd start
 * surface-dtx-userd: waiting for surface-dtx-daemon (50 seconds)
 * Starting surface-dtx-userd ...
 INFO sdtxu: running...
ERROR sdtxu: critical error: Failed to connect to D-Bus (session)

Error: Failed to connect to D-Bus (session)

Caused by:
    Unable to autolaunch a dbus-daemon without a $DISPLAY for X11
 * Failed to start surface-dtx-userd                                                                                                                                        [ !! ]
 * ERROR: surface-dtx-userd failed to start

surface-dtx-daemon.txt surface-dtx-userd.txt

@CountOmega

Looks like surface-dtx-userd depends on dbus. But that couldn't start without an x server. Perhaps userd can be launched after your WM/DE?

@werdahias
Copy link

yeah still have to check it out. With above service file for surface-dtx-daemon it is stuck at starting and doesn't work. When I launch the service manuallly, it starts, and is working, but the command keeps running. If if ctrl +c it after some time it stops, obviously.


sudo rc-service surface-dtx-daemon status
 * status: starting

sudo rc-service surface-dtx-daemon stop
 * Call to flock failed: Resource temporarily unavailable
 * ERROR: surface-dtx-daemon stopped by something else

sudo rc-service surface-dtx-daemon restart
 * Starting surface-dtx-daemon ...
 INFO sdtxd: running...

Really strange.

@qzed qzed added the enhancement New feature or request label Sep 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants