Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OpenRC service and support for more inits #368

Merged
merged 29 commits into from
Aug 13, 2022

Conversation

Cavernosa
Copy link
Contributor

@Cavernosa Cavernosa commented May 17, 2022

I tested and it doesn't seem to break anything

Closes #343 #295

@FordJ2
Copy link
Contributor

FordJ2 commented May 25, 2022

i am still trying to get this branch working on gentoo.

start() in res/ly-openrc does not execute.
i have been playing around with other commands to try to
fix this, and i will let you know when i have solved the issue.

@Cavernosa
Copy link
Contributor Author

Weird.. if it's running openrc it should run fine since it's the exact same init and afaik it's the same structure.
You could try changing the shebang to /usr/bin/openrc-run or something, or using getty instead of agetty. (if you haven't tried these already)
That, or it's just spawning in another tty that you're not looking xd. That's all i can think of...

@gagero
Copy link

gagero commented Jun 8, 2022

@wncry Did you manage to get it working?

@MadcowOG
Copy link
Contributor

MadcowOG commented Jul 7, 2022

This doesn't seem to be working for me either. But I did get a script together that seemed to work for me.
The issue that appears to me with your script is that when executing supervise-daemon directly in start() causes issues with the arguments for agetty.
Instead it's recommended to use supervisor.

Also I don't know if this a case specific issue (I am testing on artix linux) but I will start on tty2, no matter what the script does. So it might just be best to use tty2 (It might also be useful to note that the systemd service file uses tty2).

I made a fork with my version of the script feel free to just steal it for this PR. I did use this script from pspiagicw to start out because it worked somewhat.

@Cavernosa
Copy link
Contributor Author

Also I don't know if this a case specific issue (I am testing on artix linux) but I will start on tty2, no matter what the script does. So it might just be best to use tty2 (It might also be useful to note that the systemd service file uses tty2).

The script only starts ly in the provided tty, it's ly that's teleporting you to tty2, try to edit the tty in config.ini to be the same as the init. (sorry, i guess i forgot to say that)
I'll try to come with something so that the two values sync automatically.

I'm using tty7 because i thought it's easier, for the 1-6 ones you have to disable the agetty.tty* service so that the normal agetty doesn't override the ly agetty (assuming you have them enabled by default)

Instead it's recommended to use supervisor.

Yeah, that's fine i guess.

I made a fork with my version of the script feel free to just steal it for this PR. I did use this script from pspiagicw to start out because it worked somewhat.

pspiagicw's script clogs up openrc-run which introduces a lot of issues, read my issue here where i tried to explain: #343
Basically you shouldn't be using exec ly directly because it doesn't fork the process, thus clogging up openrc-run.

@MadcowOG
Copy link
Contributor

MadcowOG commented Jul 8, 2022

I see now! I'm thinking this should be mentioned in the documentation. Although this could be intuited, some users may not.
I changed the script to fit these needs, would you say it works for the use case? It is essentially the same as your script, but it follows the guidelines in the OpenRC Script Guide a bit more closely.
For automatically syncing with config.ini do you think that using sed would be appropriate?
I got the script to pull from the config for tty. I have tested it and it appears to work.

@Cavernosa
Copy link
Contributor Author

Cavernosa commented Jul 9, 2022

I see now! I'm thinking this should be mentioned in the documentation. Although this could be intuited, some users may not.
I changed the script to fit these needs, would you say it works for the use case? It is essentially the same as your script, but it follows the guidelines in the OpenRC Script Guide a bit more closely.

Yeah. Nice script, i'll try it out but i'm pretty sure it works.
One thing though, i think the TTYCONF can be boiled down to just
cat /etc/ly/config.ini | sed -n 's/^tty.*=[^1-9]*// p'
(i'm making a PR)

For automatically syncing with config.ini do you think that using sed would be appropriate? I got the script to pull from the config for tty. I have tested it and it appears to work.

lmao that's exactly what i was doing

Fixed typo in line 16: /sbin/getty > /sbin/agetty
Better CONFTTY command
Change ${var} to just $var
@MadcowOG
Copy link
Contributor

MadcowOG commented Jul 9, 2022

Sounds great! It might be useful to mention that the method mentioned in #207 by Figuera; for changing the background and foreground color is still possible. By adding this line:

/usr/bin/printf "%b" "\e]P0{background-color}\e]P7{foreground-color}\ec" > /dev/"${TTY}"

Best to place it either after CONFTTY or TTY and depending on which var; the var in place of the tty will need to be changed, of course. In this case I have placed it at the end of the script ( I really would've liked to use start_pre() for this, and frankly most of the stuff in this script, but that doesn't seem to work; despite start_pre() being in the documentation). This could also be placed in a different service script, if you wanted.

@MadcowOG
Copy link
Contributor

MadcowOG commented Jul 9, 2022

@nullgemm I'm recommending that along with this PR there should be a version bump so that the non-git packages also come with the fix to the issue talked about in #216 which prevents logging in, at least with non-systemd machines.

@Cavernosa
Copy link
Contributor Author

The background color changer could be added but i don't think the init script is the best place to put that. It should be a built-in option in ly .
Also @MadcowOG i think you forgot to accept my PR so i can merge the changes

@MadcowOG
Copy link
Contributor

My apologies I didn't see that. I have merged it.

@MadcowOG
Copy link
Contributor

The background color changer could be added but i don't think the init script is the best place to put that. It should be a built-in option in ly .

I would like the same thing but nullgemm has said that he doesn't plan on supporting that feature, #207. So it's more of a workaround.

@MadcowOG
Copy link
Contributor

MadcowOG commented Jul 12, 2022

One thing could be a good change is to move the installation of each service file to their own make functions (like with openrc atm). Because install always installs the systemd service file even if you are on openrc and will end up using installopenrc. It might require a little bit of work downstream but still might be worth it for long term compatibility with other inits.

@MadcowOG
Copy link
Contributor

MadcowOG commented Jul 12, 2022

I made a make-services branch which contains a modified makefile and readme. Let me know if this seems good.

@MadcowOG
Copy link
Contributor

@wncry Would you mind testing the latest script in this PR to confirm that it works on Gentoo?

MadcowOG and others added 2 commits July 16, 2022 02:14
Also added tiny clarification of installing ly within install and installnoconf.
Independent install for each service, and documentation to accomodate.
@Cavernosa Cavernosa changed the title OpenRC support OpenRC service and support for more inits Jul 16, 2022
@AnErrupTion
Copy link
Collaborator

@MadcowOG @Cavernosa Can this be merged?

@Cavernosa
Copy link
Contributor Author

I think so. I don't have any new ideas and the script is working fine.

@AnErrupTion
Copy link
Collaborator

Alright then!

@AnErrupTion AnErrupTion merged commit 0cefb3d into fairyglade:master Aug 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[OpenRC] Can't shutdown or reboot after login
5 participants