feat: add runit support

This commit is contained in:
javalsai 2024-09-03 20:33:47 +02:00
parent 2ccfc039d5
commit 50c251318a
Signed by: javalsai
SSH Key Fingerprint: SHA256:3G83yKhBUWVABVX/vPWH88xnK4+ptMtHkZGCRXD4Mk8
6 changed files with 37 additions and 5 deletions

View File

@ -43,13 +43,18 @@ install-service:
make install-service-systemd; \
elif command -v dinitctl &> /dev/null; then \
make install-service-dinit; \
elif command -v sv &> /dev/null; then \
make install-service-runit; \
else \
printf '\x1b[1;31m%s\x1b[0m\n' "Unknown init system, skipping install..."; \
printf '\x1b[1;31m%s\x1b[0m\n' "Unknown init system, skipping service install..."; \
fi
install-service-systemd:
install -m755 ./assets/services/systemd.service /etc/systemd/system/lidm.service
install -m655 ./assets/services/systemd.service /etc/systemd/system/lidm.service
@printf '\x1b[1m%s\x1b[0m\n\n' " don't forget to run 'systemctl enable lidm'"
install-service-dinit:
install -m755 ./assets/services/dinit /etc/dinit.d/lidm
install -m655 ./assets/services/dinit /etc/dinit.d/lidm
@printf '\x1b[1m%s\x1b[0m\n\n' " don't forget to run 'dinitctl enable lidm'"
install-service-runit:
rsync -a --no-owner --no-group ./assets/services/runit/. /etc/runit/sv/lidm
@printf '\x1b[1m%s\x1b[0m\n\n' " don't forget to run 'ln -s /etc/runit/sv/lidm /run/runit/service' and 'sv enable lidm'"

View File

@ -24,7 +24,7 @@ LiDM is like any [X Display Manager](https://en.wikipedia.org/wiki/X_display_man
* Fast and possibly efficient.
* Fully customizable, from strings, including action keys, to colors (I hope you know ansi escape codes)
* Automatically detects xorg and wayland sessions, plus allowing to launch the default user shell (if enabled in config)
* Starts with many init systems eg: systemd and dinit.
* Starts with many init systems (systemd, dinit and runit).
## WIP
* Desktop's file `TryExec` key.
@ -60,7 +60,7 @@ We all know that the most important thing in a project is the ideology of the au
# Usage
### Arguments
If a single argument is provided (don't even do `--` or standard parsing...), it passes that argument to `chvt` on startup, used (at least) by the dinit service.
If a single argument is provided (don't even do `--` or standard parsing...), it passes that argument to `chvt` on startup, used (at least) by the dinit and runit services.
### Program
On top of pure intuition:
@ -100,6 +100,7 @@ make install-service
# or if you don't like autodetection
make install-service-systemd # systemd
make install-service-dinit # dinit
# ...other supported init systems....
```
## AUR

View File

@ -15,3 +15,4 @@ There are three packages that follow standard conventions:
Summary of what to do to install service files anyways:
* **systemd:** Copy `assets/services/systemd.service` to `/etc/systemd/system/lidm.service` and enable the service (`systemctl enable lidm`)
* **dinit:** Copy `assets/services/dinit` to `/etc/dinit.d/lidm` and enable the service (`dinitctl enable lidm`)
* **runit:** Copy `assets/services/runit/` to `/etc/runit/sv/lidm/`, add the service (`ln -s /etc/runit/sv/lidm /run/runit/service`) and enable it (`sv enable lidm`)

5
assets/services/runit/conf Executable file
View File

@ -0,0 +1,5 @@
BAUD_RATE=38400
TERM_NAME=linux
TTY=tty7
EXEC_PATH=/bin/lidm

5
assets/services/runit/finish Executable file
View File

@ -0,0 +1,5 @@
#!/bin/sh
[ -r conf ] && . ./conf
exec utmpset -w $TTY

15
assets/services/runit/run Executable file
View File

@ -0,0 +1,15 @@
#!/bin/sh
[ -r conf ] && . ./conf
if [ -x /sbin/getty -o -x /bin/getty ]; then
# busybox
GETTY=getty
elif [ -x /sbin/agetty -o -x /bin/agetty ]; then
# util-linux
GETTY=agetty
fi
exec setsid ${GETTY} ${GETTY_ARGS} \
"${TTY}" "${TERM_NAME}" \
-n -l "${EXEC_PATH}" -o 7