Skip to content

Commit

Permalink
tools: add s6rc-generator
Browse files Browse the repository at this point in the history
Generates s6-rc service definitions for dbus services
  • Loading branch information
st3r4g committed Mar 18, 2021
1 parent ad327f0 commit 217ae2a
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions tools/s6rc-generator
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/bin/sh -e
# Generate s6-rc service definitions for dbus services
# usage: pass the absolute paths of dbus service definitions, i.e.
# /usr/share/dbus-1/system-services/* (for the system bus)
# or /usr/share/dbus-1/services/* (for the session bus)

mkdir 'dbus'
cd 'dbus'

for service in "$@"; do
name_=$(awk -F= '$1 == "Name" {print $2}' "$service")
exec_=$(awk -F= '$1 == "Exec" {print $2}' "$service")
systemdservice_=$(awk -F= '$1 == "SystemdService" {print $2}' "$service")

mkdir $name_
echo 'longrun' >> "$name_/type"
echo '#!/bin/execlineb -P' >> "$name_/run"
echo "$exec_" >> "$name_/run"
chmod +x "$name_/run"
done

0 comments on commit 217ae2a

Please sign in to comment.