From 28867c4e9cf74d49afdb0b7517265182e77646f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9F=D1=8D=D0=B9=D0=BD=D1=82?= Date: Wed, 5 May 2021 22:20:31 +0700 Subject: [PATCH] Replace systemd service with runit service --- makefile | 8 +++++--- readme.md | 25 +++++++++++-------------- res/ly-runit-service/conf | 14 ++++++++++++++ res/ly-runit-service/finish | 3 +++ res/ly-runit-service/run | 15 +++++++++++++++ res/ly.service | 15 --------------- 6 files changed, 48 insertions(+), 32 deletions(-) create mode 100755 res/ly-runit-service/conf create mode 100755 res/ly-runit-service/finish create mode 100755 res/ly-runit-service/run delete mode 100644 res/ly.service diff --git a/makefile b/makefile index eef31ad..d62ad8e 100644 --- a/makefile +++ b/makefile @@ -78,8 +78,9 @@ install: $(BIND)/$(NAME) @install -DZ $(RESD)/wsetup.sh -t $(DATADIR) @install -dZ $(DATADIR)/lang @install -DZ $(RESD)/lang/* -t $(DATADIR)/lang - @install -DZ $(RESD)/ly.service -m 644 -t ${DESTDIR}/usr/lib/systemd/system @install -DZ $(RESD)/pam.d/ly -m 644 -t ${DESTDIR}/etc/pam.d + @install -dZ ${DESTDIR}/etc/runit/sv/ly + @install -DZ $(RESD)/ly/* -t ${DESTDIR}/etc/runit/sv/ly installnoconf: $(BIND)/$(NAME) @echo "installing without the configuration file" @@ -89,16 +90,17 @@ installnoconf: $(BIND)/$(NAME) @install -DZ $(RESD)/wsetup.sh -t $(DATADIR) @install -dZ $(DATADIR)/lang @install -DZ $(RESD)/lang/* -t $(DATADIR)/lang - @install -DZ $(RESD)/ly.service -m 644 -t ${DESTDIR}/usr/lib/systemd/system @install -DZ $(RESD)/pam.d/ly -m 644 -t ${DESTDIR}/etc/pam.d + @install -dZ ${DESTDIR}/etc/runit/sv/ly + @install -DZ $(RESD)/ly/* -t ${DESTDIR}/etc/runit/sv/ly uninstall: @echo "uninstalling" @rm -rf ${DESTDIR}/etc/ly @rm -rf $(DATADIR) @rm -f ${DESTDIR}/usr/bin/ly - @rm -f ${DESTDIR}/usr/lib/systemd/system/ly.service @rm -f ${DESTDIR}/etc/pam.d/ly + @rm -rf ${DESTDIR}/etc/runit/sv/ly clean: @echo "cleaning" diff --git a/readme.md b/readme.md index c7a0736..b183395 100644 --- a/readme.md +++ b/readme.md @@ -1,8 +1,12 @@ -# Ly - a TUI display manager +# Ly - a TUI display manager (for Artix Linux) ![Ly screenshot](https://user-images.githubusercontent.com/5473047/88958888-65efbf80-d2a1-11ea-8ae5-3f263bce9cce.png "Ly screenshot") Ly is a lightweight TUI (ncurses-like) display manager for Linux and BSD. +## Patches added in fork +- runit service instead of systemd one by @qub1750ul +- service installed on default Artix service path (`/etc/runit/sv/`) + ## Dependencies - a C99 compiler (tested with tcc and gcc) - a C standard library @@ -47,7 +51,7 @@ changing the source code won't be necessary :) ## Cloning and Compiling Clone the repository ``` -git clone https://github.com/nullgemm/ly.git +git clone https://github.com/xcession/ly-artix-runit.git ``` Fetch submodules @@ -60,26 +64,19 @@ Compile make ``` -Test in the configured tty (tty2 by default) -or a terminal emulator (but desktop environments won't start) -``` -sudo make run -``` - -Install Ly and the provided systemd service file +Install Ly and the runit service file ``` sudo make install ``` -Enable the service +You can disable getty-tty2 ``` -sudo systemctl enable ly.service +sudo unlink /run/runit/service/agetty-tty2 ``` -If you need to switch between ttys after Ly's start you also have to -disable getty on Ly's tty to prevent "login" from spawning on top of it +Now enable the runit service to make it spawn on startup ``` -sudo systemctl disable getty@tty2.service +sudo ln -s /etc/runit/sv/ly/ /run/runit/service/ ``` ## Configuration diff --git a/res/ly-runit-service/conf b/res/ly-runit-service/conf new file mode 100755 index 0000000..b7becba --- /dev/null +++ b/res/ly-runit-service/conf @@ -0,0 +1,14 @@ +if [ -x /sbin/agetty -o -x /bin/agetty ]; then + # util-linux specific settings + if [ "${tty}" = "tty1" ]; then + GETTY_ARGS="--noclear" + fi +fi + +BAUD_RATE=38400 +TERM_NAME=linux + +StandardInput=tty +TTYPath=/dev/tty2 +TTYReset=yes +TTYVHangup=yes diff --git a/res/ly-runit-service/finish b/res/ly-runit-service/finish new file mode 100755 index 0000000..f23bb9d --- /dev/null +++ b/res/ly-runit-service/finish @@ -0,0 +1,3 @@ +#!/bin/sh +tty=${PWD##*-} +exec utmpset -w $tty diff --git a/res/ly-runit-service/run b/res/ly-runit-service/run new file mode 100755 index 0000000..f4f9eb0 --- /dev/null +++ b/res/ly-runit-service/run @@ -0,0 +1,15 @@ +#!/bin/sh + +tty=${PWD##*-} + +[ -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} -nl /usr/bin/ly tty2 "${BAUD_RATE}" "${TERM_NAME}" diff --git a/res/ly.service b/res/ly.service deleted file mode 100644 index 135b987..0000000 --- a/res/ly.service +++ /dev/null @@ -1,15 +0,0 @@ -[Unit] -Description=TUI display manager -After=systemd-user-sessions.service plymouth-quit-wait.service -After=getty@tty2.service - -[Service] -Type=idle -ExecStart=/usr/bin/ly -StandardInput=tty -TTYPath=/dev/tty2 -TTYReset=yes -TTYVHangup=yes - -[Install] -Alias=display-manager.service