aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnna (navi) Figueiredo Gomes <navi@vlhl.dev>2024-07-20 16:31:20 +0200
committerAnna (navi) Figueiredo Gomes <navi@vlhl.dev>2024-07-20 18:09:53 +0200
commit943231981871fc201dd06d14f512e526dd9e0e22 (patch)
treea62de23460b9ef3c4aee85e268ae3416f06074e3
parent26314e983b963a4252154aef25406acdca50b423 (diff)
support: add user.d examples
Signed-off-by: Anna (navi) Figueiredo Gomes <navi@vlhl.dev>
-rw-r--r--support/meson.build1
-rw-r--r--support/user.d.examples/README.md6
-rw-r--r--support/user.d.examples/dbus.in22
-rw-r--r--support/user.d.examples/dunst.in19
-rw-r--r--support/user.d.examples/meson.build25
-rw-r--r--support/user.d.examples/pipewire-pulse.in20
-rw-r--r--support/user.d.examples/pipewire.in19
-rw-r--r--support/user.d.examples/ssh-agent.in22
-rw-r--r--support/user.d.examples/wireplumber.in19
9 files changed, 153 insertions, 0 deletions
diff --git a/support/meson.build b/support/meson.build
index f1b7b7e1..348f339f 100644
--- a/support/meson.build
+++ b/support/meson.build
@@ -3,5 +3,6 @@ support_dir = support_dir / 'support'
subdir('deptree2dot')
subdir('init.d.examples')
+subdir('user.d.examples')
subdir('openvpn')
subdir('sysvinit')
diff --git a/support/user.d.examples/README.md b/support/user.d.examples/README.md
new file mode 100644
index 00000000..51db8de7
--- /dev/null
+++ b/support/user.d.examples/README.md
@@ -0,0 +1,6 @@
+Example OpenRC Service User Scripts
+###################################
+
+The service scripts in this directory are meant as examples only.
+They are not installed by default as the scripts will need tweaking on a
+per distro basis. They are also non essential to the operation of the system.
diff --git a/support/user.d.examples/dbus.in b/support/user.d.examples/dbus.in
new file mode 100644
index 00000000..dd2d26d6
--- /dev/null
+++ b/support/user.d.examples/dbus.in
@@ -0,0 +1,22 @@
+#!@SBINDIR@/openrc-run --user
+# Copyright (c) 2024 The OpenRC Authors.
+# See the Authors file at the top-level directory of this distribution and
+# https://github.com/OpenRC/openrc/blob/HEAD/AUTHORS
+#
+# This file is part of OpenRC. It is subject to the license terms in
+# the LICENSE file found in the top-level directory of this
+# distribution and at https://github.com/OpenRC/openrc/blob/HEAD/LICENSE
+# This file may not be copied, modified, propagated, or distributed
+# except according to the terms contained in the LICENSE file.
+
+DBUS_SESSION_BUS_ADDRESS="unix:path=${XDG_RUNTIME_DIR}/bus"
+
+command="/usr/bin/dbus-daemon"
+command_args="--session --syslog --nofork --address ${DBUS_SESSION_BUS_ADDRESS}"
+command_background=yes
+pidfile="${XDG_RUNTIME_DIR}/dbus.pid"
+
+extra_commands="socket"
+socket() {
+ echo ${DBUS_SESSION_BUS_ADDRESS}
+}
diff --git a/support/user.d.examples/dunst.in b/support/user.d.examples/dunst.in
new file mode 100644
index 00000000..9e58e4b5
--- /dev/null
+++ b/support/user.d.examples/dunst.in
@@ -0,0 +1,19 @@
+#!@SBINDIR@/openrc-run --user
+# Copyright (c) 2024 The OpenRC Authors.
+# See the Authors file at the top-level directory of this distribution and
+# https://github.com/OpenRC/openrc/blob/HEAD/AUTHORS
+#
+# This file is part of OpenRC. It is subject to the license terms in
+# the LICENSE file found in the top-level directory of this
+# distribution and at https://github.com/OpenRC/openrc/blob/HEAD/LICENSE
+# This file may not be copied, modified, propagated, or distributed
+# except according to the terms contained in the LICENSE file.
+
+depend() {
+ need dbus
+}
+
+DBUS_SESSION_BUS_ADDRESS=$(rc-service --user dbus socket)
+command="/usr/bin/dunst"
+command_background="true"
+pidfile="${XDG_RUNTIME_DIR}/dunst.pid"
diff --git a/support/user.d.examples/meson.build b/support/user.d.examples/meson.build
new file mode 100644
index 00000000..ec96b0ef
--- /dev/null
+++ b/support/user.d.examples/meson.build
@@ -0,0 +1,25 @@
+user_d_examples_dir = support_dir / 'user.d.examples'
+
+user_d_examples = [
+ 'dbus.in',
+ 'dunst.in',
+ 'pipewire.in',
+ 'pipewire-pulse.in',
+ 'ssh-agent.in',
+ 'wireplumber.in',
+]
+
+user_d_examples_data = [
+ 'README.md',
+]
+
+foreach user_d_example: user_d_examples
+ configure_file(input : user_d_example,
+ output : '@BASENAME@',
+ configuration : init_d_conf_data,
+ install_dir : user_d_examples_dir,
+ install_mode : 'rwxr-xr-x')
+endforeach
+
+install_data(user_d_examples_data,
+ install_dir : user_d_examples_dir)
diff --git a/support/user.d.examples/pipewire-pulse.in b/support/user.d.examples/pipewire-pulse.in
new file mode 100644
index 00000000..c7f52f50
--- /dev/null
+++ b/support/user.d.examples/pipewire-pulse.in
@@ -0,0 +1,20 @@
+#!@SBINDIR@/openrc-run --user
+# Copyright (c) 2024 The OpenRC Authors.
+# See the Authors file at the top-level directory of this distribution and
+# https://github.com/OpenRC/openrc/blob/HEAD/AUTHORS
+#
+# This file is part of OpenRC. It is subject to the license terms in
+# the LICENSE file found in the top-level directory of this
+# distribution and at https://github.com/OpenRC/openrc/blob/HEAD/LICENSE
+# This file may not be copied, modified, propagated, or distributed
+# except according to the terms contained in the LICENSE file.
+
+depend() {
+ need pipewire dbus
+}
+
+DBUS_SESSION_BUS_ADDRESS=$(rc-service --user dbus socket)
+command="/usr/bin/pipewire"
+command_args="-c pipewire-pulse.conf"
+command_background="true"
+pidfile="${XDG_RUNTIME_DIR}/pipewire-pulse.pid"
diff --git a/support/user.d.examples/pipewire.in b/support/user.d.examples/pipewire.in
new file mode 100644
index 00000000..9121c678
--- /dev/null
+++ b/support/user.d.examples/pipewire.in
@@ -0,0 +1,19 @@
+#!@SBINDIR@/openrc-run --user
+# Copyright (c) 2024 The OpenRC Authors.
+# See the Authors file at the top-level directory of this distribution and
+# https://github.com/OpenRC/openrc/blob/HEAD/AUTHORS
+#
+# This file is part of OpenRC. It is subject to the license terms in
+# the LICENSE file found in the top-level directory of this
+# distribution and at https://github.com/OpenRC/openrc/blob/HEAD/LICENSE
+# This file may not be copied, modified, propagated, or distributed
+# except according to the terms contained in the LICENSE file.
+
+depend() {
+ need dbus
+}
+
+DBUS_SESSION_BUS_ADDRESS=$(rc-service --user dbus socket)
+command="/usr/bin/pipewire"
+command_background="true"
+pidfile="${XDG_RUNTIME_DIR}/pipewire.pid"
diff --git a/support/user.d.examples/ssh-agent.in b/support/user.d.examples/ssh-agent.in
new file mode 100644
index 00000000..f944ccb3
--- /dev/null
+++ b/support/user.d.examples/ssh-agent.in
@@ -0,0 +1,22 @@
+#!@SBINDIR@/openrc-run --user
+# Copyright (c) 2024 The OpenRC Authors.
+# See the Authors file at the top-level directory of this distribution and
+# https://github.com/OpenRC/openrc/blob/HEAD/AUTHORS
+#
+# This file is part of OpenRC. It is subject to the license terms in
+# the LICENSE file found in the top-level directory of this
+# distribution and at https://github.com/OpenRC/openrc/blob/HEAD/LICENSE
+# This file may not be copied, modified, propagated, or distributed
+# except according to the terms contained in the LICENSE file.
+
+SSH_AUTH_SOCK="${XDG_RUNTIME_DIR}/ssh-agent.sock"
+
+command="/usr/bin/ssh-agent"
+command_args="-D -a $SSH_AUTH_SOCK"
+command_background=yes
+pidfile="${XDG_RUNTIME_DIR}/ssh-agent.pid"
+
+extra_commands="socket"
+socket() {
+ echo ${SSH_AUTH_SOCK}
+}
diff --git a/support/user.d.examples/wireplumber.in b/support/user.d.examples/wireplumber.in
new file mode 100644
index 00000000..520ff50c
--- /dev/null
+++ b/support/user.d.examples/wireplumber.in
@@ -0,0 +1,19 @@
+#!@SBINDIR@/openrc-run --user
+# Copyright (c) 2024 The OpenRC Authors.
+# See the Authors file at the top-level directory of this distribution and
+# https://github.com/OpenRC/openrc/blob/HEAD/AUTHORS
+#
+# This file is part of OpenRC. It is subject to the license terms in
+# the LICENSE file found in the top-level directory of this
+# distribution and at https://github.com/OpenRC/openrc/blob/HEAD/LICENSE
+# This file may not be copied, modified, propagated, or distributed
+# except according to the terms contained in the LICENSE file.
+
+depend() {
+ need pipewire dbus
+}
+
+DBUS_SESSION_BUS_ADDRESS=$(rc-service --user dbus socket)
+command="/usr/bin/wireplumber"
+command_background=true
+pidfile="${XDG_RUNTIME_DIR}/wireplumber.pid"