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

Add an init script for OpenRC #507

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions BUILD.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,13 @@ First copy the binary and the service files to their system directories:

* Upstart (Ubuntu, prior to 15.04): `sudo cp -R bin/* /usr/bin && sudo cp service/upstart/ckb-daemon.conf /etc/init`
* Systemd (Ubuntu 15.04 and later): `sudo cp -R bin/* /usr/bin && sudo cp service/systemd/ckb-daemon.service /usr/lib/systemd/system`
* OpenRC: `sudo cp -R bin/* /usr/bin && sudo cp service/openrc/ckb-daemon /etc/init.d/`

To launch the driver and enable it at start-up:

* Upstart: `sudo service ckb-daemon start`
* Systemd: `sudo systemctl start ckb-daemon && sudo systemctl enable ckb-daemon`
* OpenRC: `sudo rc-service ckb-daemon start && sudo rc-update add ckb-daemon default`

Open the `bin` directory and double-click on `ckb` to launch the user interface. If you want to run it at login, add `ckb --background` to your Startup Applications.

Expand Down
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,12 @@ sudo rm -f /usr/lib/systemd/system/ckb-daemon.service
sudo service ckb-daemon stop
sudo rm -f /etc/init/ckb-daemon.conf
```
* If you have OpenRC:
```
sudo rc-service ckb-daemon stop
sudo rc-update del ckb-daemon default
sudo rm -f /etc/init.d/ckb-daemon
```
* If you're not sure, re-run the `quickinstall` script and proceed to the service installation. The script will say `System service: Upstart detected` or `System service: systemd detected`

Afterward, remove the applications and related files:
Expand Down
17 changes: 17 additions & 0 deletions service/openrc/ckb-daemon
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/usr/bin/openrc-run
description="Daemon for the opensource ckb driver for corsair keyboards and mice"

daemon_ckb="/usr/bin/ckb-daemon"
PIDFILE="/dev/input/ckb0/pid"

start() {
ebegin "Starting ckb"
start-stop-daemon --start --quiet --exec ${daemon_ckb} --background
eend $?
}

stop() {
ebegin "Stopping ckb"
start-stop-daemon --stop --quiet --exec ${daemon_ckb} --pidfile $PIDFILE
eend $?
}