Skip to content
New issue

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

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

Already on GitHub? # to your account

Create basic OpenRC service #114

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: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
internal/*
firmware.bin
xow
/xow
*.d
*.o
.vscode/*
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ firmware.bin:
.PHONY: install
install: xow
sed 's|#BINDIR#|$(BINDIR)|' install/service.in > xow.service
sed 's|#BINDIR#|$(BINDIR)|' install/openrc/initd/xow.in > install/openrc/initd/xow
install -D -m 755 xow $(DESTDIR)$(BINDIR)/xow
install -D -m 644 install/udev.rules $(DESTDIR)$(UDEVDIR)/50-xow.rules
install -D -m 644 install/modules.conf $(DESTDIR)$(MODLDIR)/xow-uinput.conf
Expand Down
6 changes: 6 additions & 0 deletions install/openrc/confd/xow
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Enable compatibility mode (Xbox 360 emulation)
#XOW_COMPATIBILITY=1

# Defaults to nobody if not set
XOW_USER=
XOW_GROUP=
27 changes: 27 additions & 0 deletions install/openrc/initd/xow.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/sbin/openrc-run

description="Xbox One Wireless Dongle Driver"
command="#BINDIR#/xow"

command_user="${XOW_USER:-nobody}:${XOW_GROUP:-nobody}"
supervisor="supervise-daemon"
output_log="/var/log/${RC_SVCNAME}.log"
error_log="${output_log}"

extra_started_commands="pair"
description_pair="Enable dongle pairing mode"

depend() {
keyword -lxc -openvz -docker
}

start_pre() {
checkpath -q \
--owner "${command_user}" \
--file "${output_log}"
}

pair() {
"${supervisor}" "${RC_SVCNAME}" \
--signal USR1
}