From f05252ec77e98fef1dc7c9bcb9fd0464ab5e0570 Mon Sep 17 00:00:00 2001 From: MadcowOG Date: Thu, 7 Jul 2022 15:43:02 -0700 Subject: [PATCH 1/8] OpenRC script --- res/ly-openrc | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 res/ly-openrc diff --git a/res/ly-openrc b/res/ly-openrc new file mode 100644 index 0000000..3731580 --- /dev/null +++ b/res/ly-openrc @@ -0,0 +1,28 @@ +#! /sbin/openrc-run + +name="ly" +description="TUI Display Manager" + +supervisor=supervise-daemon +respawn-period=60 +pidfile=/run/"${RC_SVCNAME}.pid" + +depend() { + after agetty +} + +start() { + TTY=tty2 + BAUD=38400 + TERM=linux + + if [ -x /sbin/getty -o -x /bin/getty ]; + then + GETTY=/sbin/getty + elif [ -x /sbin/getty -o -x /bin/getty ]; + then + GETTY=/sbin/agetty + fi + + exec setsid ${GETTY} -nl /usr/bin/ly "${TTY}" "${BAUD}" "${TERM}" +} From d5db6b8a2fb0deb52c0d9cc2daec347a0cadadbf Mon Sep 17 00:00:00 2001 From: MadcowOG Date: Fri, 8 Jul 2022 01:00:21 -0700 Subject: [PATCH 2/8] Fix respawn period typo --- res/ly-openrc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/res/ly-openrc b/res/ly-openrc index 3731580..36065a8 100644 --- a/res/ly-openrc +++ b/res/ly-openrc @@ -4,7 +4,7 @@ name="ly" description="TUI Display Manager" supervisor=supervise-daemon -respawn-period=60 +respawn_period=60 pidfile=/run/"${RC_SVCNAME}.pid" depend() { From d94132e99773d290803c98534a8328f264189855 Mon Sep 17 00:00:00 2001 From: MadcowOG Date: Fri, 8 Jul 2022 01:47:23 -0700 Subject: [PATCH 3/8] Fixed process locking of service --- res/ly-openrc | 26 ++++++++++---------------- 1 file changed, 10 insertions(+), 16 deletions(-) diff --git a/res/ly-openrc b/res/ly-openrc index 36065a8..72c310e 100644 --- a/res/ly-openrc +++ b/res/ly-openrc @@ -7,22 +7,16 @@ supervisor=supervise-daemon respawn_period=60 pidfile=/run/"${RC_SVCNAME}.pid" +# tty to spawn ly in +## Make sure this corresponds with the tty in /etc/ly/config.ini +TTY=tty7 +TERM=linux +BAUD=38400 +command="/sbin/agetty" +command_args_foreground="-nl /usr/bin/ty ${TTY} ${BAUD} ${TERM}" + depend() { after agetty -} - -start() { - TTY=tty2 - BAUD=38400 - TERM=linux - - if [ -x /sbin/getty -o -x /bin/getty ]; - then - GETTY=/sbin/getty - elif [ -x /sbin/getty -o -x /bin/getty ]; - then - GETTY=/sbin/agetty - fi - - exec setsid ${GETTY} -nl /usr/bin/ly "${TTY}" "${BAUD}" "${TERM}" + provide display-manager + want elogind } From 103241e9b28114624d93bac309a66a96f60552b0 Mon Sep 17 00:00:00 2001 From: MadcowOG Date: Fri, 8 Jul 2022 03:35:23 -0700 Subject: [PATCH 4/8] Added tty pull from conf file. --- res/ly-openrc | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/res/ly-openrc b/res/ly-openrc index 72c310e..5663e75 100644 --- a/res/ly-openrc +++ b/res/ly-openrc @@ -3,16 +3,32 @@ name="ly" description="TUI Display Manager" +## Supervisor daemon supervisor=supervise-daemon respawn_period=60 pidfile=/run/"${RC_SVCNAME}.pid" -# tty to spawn ly in -## Make sure this corresponds with the tty in /etc/ly/config.ini -TTY=tty7 +## Check for getty or agetty +if [ -x /sbin/getty ] || [ -x /bin/getty ]; +then + # busybox + commandB="/sbin/getty" +elif [ -x /sbin/getty ] || [ -x /bin/agetty ]; +then + # util-linux + commandUL="/sbin/agetty" +fi + +## Get the tty from the conf file +CONFTTY=$(cat /etc/ly/conf.ini | grep tty | grep -v '#' | sed -e 's/tty = //' | sed -e 's/ //') + +## The execution vars +# If CONFTTY is empty the default to 2 +TTY=${CONFTTY:-"2"} TERM=linux BAUD=38400 -command="/sbin/agetty" +# If we don't have getty then we should have agetty +command=${commandB:-$commandUL} command_args_foreground="-nl /usr/bin/ty ${TTY} ${BAUD} ${TERM}" depend() { From 72c10f5e0059c1e7a0b3e28bb25160a8dff73f29 Mon Sep 17 00:00:00 2001 From: MadcowOG <88654251+MadcowOG@users.noreply.github.com> Date: Fri, 8 Jul 2022 10:39:10 +0000 Subject: [PATCH 5/8] Small typo --- res/ly-openrc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/res/ly-openrc b/res/ly-openrc index 5663e75..f0395fc 100644 --- a/res/ly-openrc +++ b/res/ly-openrc @@ -23,7 +23,7 @@ fi CONFTTY=$(cat /etc/ly/conf.ini | grep tty | grep -v '#' | sed -e 's/tty = //' | sed -e 's/ //') ## The execution vars -# If CONFTTY is empty the default to 2 +# If CONFTTY is empty then default to 2 TTY=${CONFTTY:-"2"} TERM=linux BAUD=38400 From 86e13dfe62d162916f87b021fcf52b4728fe92f8 Mon Sep 17 00:00:00 2001 From: MadcowOG <88654251+MadcowOG@users.noreply.github.com> Date: Fri, 8 Jul 2022 10:42:58 +0000 Subject: [PATCH 6/8] Small typo --- res/ly-openrc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/res/ly-openrc b/res/ly-openrc index f0395fc..f82ec53 100644 --- a/res/ly-openrc +++ b/res/ly-openrc @@ -20,7 +20,7 @@ then fi ## Get the tty from the conf file -CONFTTY=$(cat /etc/ly/conf.ini | grep tty | grep -v '#' | sed -e 's/tty = //' | sed -e 's/ //') +CONFTTY=$(cat /etc/ly/config.ini | grep tty | grep -v '#' | sed -e 's/tty = //' | sed -e 's/ //') ## The execution vars # If CONFTTY is empty then default to 2 From 7ba8b88f3ef9329434f206e44833d70f3994e543 Mon Sep 17 00:00:00 2001 From: MadcowOG Date: Fri, 8 Jul 2022 12:56:00 -0700 Subject: [PATCH 7/8] Added tty to TTY var. Fixed typo in ly call. --- res/ly-openrc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/res/ly-openrc b/res/ly-openrc index f82ec53..199ee7b 100644 --- a/res/ly-openrc +++ b/res/ly-openrc @@ -24,12 +24,12 @@ CONFTTY=$(cat /etc/ly/config.ini | grep tty | grep -v '#' | sed -e 's/tty = //' ## The execution vars # If CONFTTY is empty then default to 2 -TTY=${CONFTTY:-"2"} +TTY="tty${CONFTTY:-'2'}" TERM=linux BAUD=38400 # If we don't have getty then we should have agetty command=${commandB:-$commandUL} -command_args_foreground="-nl /usr/bin/ty ${TTY} ${BAUD} ${TERM}" +command_args_foreground="-nl /usr/bin/ly ${TTY} ${BAUD} ${TERM}" depend() { after agetty From cf3a87c0b7074d00f1593cc9bc2c6224ee34899e Mon Sep 17 00:00:00 2001 From: Cavernosa <42952107+Cavernosa@users.noreply.github.com> Date: Sat, 9 Jul 2022 01:42:30 +0000 Subject: [PATCH 8/8] Fixes Fixed typo in line 16: /sbin/getty > /sbin/agetty Better CONFTTY command Change ${var} to just $var --- res/ly-openrc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/res/ly-openrc b/res/ly-openrc index 199ee7b..ad01958 100644 --- a/res/ly-openrc +++ b/res/ly-openrc @@ -1,4 +1,4 @@ -#! /sbin/openrc-run +#!/sbin/openrc-run name="ly" description="TUI Display Manager" @@ -13,14 +13,14 @@ if [ -x /sbin/getty ] || [ -x /bin/getty ]; then # busybox commandB="/sbin/getty" -elif [ -x /sbin/getty ] || [ -x /bin/agetty ]; +elif [ -x /sbin/agetty ] || [ -x /bin/agetty ]; then # util-linux commandUL="/sbin/agetty" fi ## Get the tty from the conf file -CONFTTY=$(cat /etc/ly/config.ini | grep tty | grep -v '#' | sed -e 's/tty = //' | sed -e 's/ //') +CONFTTY=$(cat /etc/ly/config.ini | sed -n 's/^tty.*=[^1-9]*// p') ## The execution vars # If CONFTTY is empty then default to 2 @@ -29,7 +29,7 @@ TERM=linux BAUD=38400 # If we don't have getty then we should have agetty command=${commandB:-$commandUL} -command_args_foreground="-nl /usr/bin/ly ${TTY} ${BAUD} ${TERM}" +command_args_foreground="-nl /usr/bin/ly $TTY $BAUD $TERM" depend() { after agetty