Skip to content

Commit

Permalink
Add an init script for OpenRC
Browse files Browse the repository at this point in the history
  • Loading branch information
DefaultUser committed Oct 30, 2016
1 parent eb1fe4e commit 82006fa
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 0 deletions.
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 $?
}

0 comments on commit 82006fa

Please sign in to comment.