[yast-devel] RFC: How to adapt /sbin/yast2 for running system and installation
Moin, I've been working on a task to make Linuxrc: DUD=http://path.to/yast2.rpm possible. Problem description ------------------- Right now, /sbin/yast2 script (#1) on a running system either starts the Yast Control Center or a Yast module given as parameter. In inst-sys (installation), this script is replaced by a symlink to YaST2.First-Stage #2 script and additionally /sbin/yast2.ssh also links to YaST2.First-Stage. This is done in installation-images #3. Because of this solution, when yast2.rpm via normal DUD replaces this symlink with script, the Yast Control Center is started instead. Expected Behavior ----------------- When DUD=yast2.rpm is used, Installer should start, not YCC. Proposed Solution ----------------- There are obviously several possibilities how to fix it. Solution 1: - Just ignore it and do not use DUD=*.rpm and build "real" DUD. - IMO not an option Solution 2: - Do not create symlinks in inst-sys - Adapt /sbin/yast2 to check that we are in inst-sys and either call YaST2.First-Stage or continue Solution 3: - Do not create symlinks in inst-sys - Move /sbin/yast2 functionality to some other library/script - Create new /sbin/yast2 that would either call the new script or YaST2.First-Stage, depending on where we are (including all parameters) - This is my favorite Solution 4: - Let Linuxrc start YaST2.First-Stage directly - This has a big disadvantage as users are used to run Linuxrc with startshell=1 and then start yast manually (anyway, it's IMO too big change in "API") Additional Issues ----------------- We don't have a stable mechanism to tell whether we are actually in inst-sys. Steffen suggests to either check that "/usr/src/packages does not exist" or that "/.packages.root is present". We can also check whether /.instsys.config or /linuxrc.config exists. Side note: Yast itself finds out whether we are in installation when WFM.Args contain that info, so we can't use that approach. #1 https://github.com/yast/yast-yast2/blob/master/scripts/yast2 #2 https://github.com/yast/yast-installation/blob/master/startup/YaST2.First-St... #3 https://github.com/openSUSE/installation-images/blob/master/data/root/root.f... Please comment, maybe you have a better idea? Thanks Lukas -- Lukas Ocilka, Systems Management (Yast) Team Leader SLE Department, SUSE Linux -- To unsubscribe, e-mail: yast-devel+unsubscribe@opensuse.org To contact the owner, e-mail: yast-devel+owner@opensuse.org
On Thu, 25 Jun 2015 13:49:30 +0200 Lukas Ocilka <lukas.ocilka@suse.com> wrote:
Moin,
I've been working on a task to make Linuxrc: DUD=http://path.to/yast2.rpm possible.
Problem description ------------------- Right now, /sbin/yast2 script (#1) on a running system either starts the Yast Control Center or a Yast module given as parameter. In inst-sys (installation), this script is replaced by a symlink to YaST2.First-Stage #2 script and additionally /sbin/yast2.ssh also links to YaST2.First-Stage. This is done in installation-images #3. Because of this solution, when yast2.rpm via normal DUD replaces this symlink with script, the Yast Control Center is started instead.
Expected Behavior ----------------- When DUD=yast2.rpm is used, Installer should start, not YCC.
Proposed Solution ----------------- There are obviously several possibilities how to fix it.
Solution 2: - Do not create symlinks in inst-sys - Adapt /sbin/yast2 to check that we are in inst-sys and either call YaST2.First-Stage or continue
This is my favority as I hope it is single trivial if statement, so for solution 3 it seems like overkill for me. Another option that get into my mind is to overuse PATH precedence...so having yast2 in /usr/bin and yast2 symlink in /sbin this way it is not overwritten and it will works without much tricks ( and as bonus allows common users to run yast2 with limited functionality ). Josef
Please comment, maybe you have a better idea?
Thanks Lukas
-- To unsubscribe, e-mail: yast-devel+unsubscribe@opensuse.org To contact the owner, e-mail: yast-devel+owner@opensuse.org
On 25.6.2015 14:06, Josef Reidinger wrote:
Solution 2: - Do not create symlinks in inst-sys - Adapt /sbin/yast2 to check that we are in inst-sys and either call YaST2.First-Stage or continue
This is my favority as I hope it is single trivial if statement, so for
It was my favorite as well before I checked the /sbin/yast2 code that already has 432 lines of shell code. Additionally, it plays with paths and ENV variables right at the beginning. Adding "just this" will definitely make the code worse.
solution 3 it seems like overkill for me. Another option that get into my mind is to overuse PATH precedence...so having yast2 in /usr/bin and yast2 symlink in /sbin this way it is not overwritten and it will works without much tricks ( and as bonus allows common users to run yast2 with limited functionality ).
Hmm, this actually sounds like a better solution. So, the only thing to do is to move /sbin/yast2 to /usr/sbin/yast2. And then maybe link it from /sbin/yast2 (for backward compatibility). Then the only difference in inst-sys would be different symlink. Thx Lukas -- Lukas Ocilka, Systems Management (Yast) Team Leader SLE Department, SUSE Linux -- To unsubscribe, e-mail: yast-devel+unsubscribe@opensuse.org To contact the owner, e-mail: yast-devel+owner@opensuse.org
On 25.6.2015 14:15, Lukas Ocilka wrote:
Hmm, this actually sounds like a better solution. So, the only thing to do is to move /sbin/yast2 to /usr/sbin/yast2. And then maybe link it from /sbin/yast2 (for backward compatibility). Then the only difference in inst-sys would be different symlink.
BTW, we already do this (almost). It just doesn't work as needed yet :) -- Lukas Ocilka, Systems Management (Yast) Team Leader SLE Department, SUSE Linux -- To unsubscribe, e-mail: yast-devel+unsubscribe@opensuse.org To contact the owner, e-mail: yast-devel+owner@opensuse.org
# lukas.ocilka@suse.com / 2015-06-25 14:15:48 +0200:
On 25.6.2015 14:06, Josef Reidinger wrote:
Another option that get into my mind is to overuse PATH precedence...so having yast2 in /usr/bin and yast2 symlink in /sbin this way it is not overwritten and it will works without much tricks ( and as bonus allows common users to run yast2 with limited functionality ).
Hmm, this actually sounds like a better solution. So, the only thing to do is to move /sbin/yast2 to /usr/sbin/yast2. And then maybe link it from /sbin/yast2 (for backward compatibility). Then the only difference in inst-sys would be different symlink.
my gut reaction: don't go there. same basename, different paths, that's going to hurt, people manipulate their PATH variables in various ways and you'll provoke a lot of bad blood in users. -- roman -- To unsubscribe, e-mail: yast-devel+unsubscribe@opensuse.org To contact the owner, e-mail: yast-devel+owner@opensuse.org
On 25.6.2015 14:06, Josef Reidinger wrote:
Solution 2: - Do not create symlinks in inst-sys - Adapt /sbin/yast2 to check that we are in inst-sys and either call YaST2.First-Stage or continue
This is my favority as I hope it is single trivial if statement, so for solution 3 it seems like overkill for me. Another option that get into my mind is to overuse PATH precedence...so having yast2 in /usr/bin and yast2 symlink in /sbin this way it is not overwritten and it will works without much tricks ( and as bonus allows common users to run yast2 with limited functionality ).
Good idea, but I've checked "The Internet" and seems that /sbin/yast2 is all over the place. We simply cannot change this place. So, /sbin/yast[2] is a must. And as inst-sys rewrites that, this idea doesn't seem to be an option. Moreover, adding this to SP1 would be a really big risk. We already have /usr/sbin/yast and /sbin/yast[2] is just a link. BTW, it's a change done by you :) https://github.com/yast/yast-yast2/commit/39cc36189b2768805064339ba054b7228c... So, next options on the list is adding one more `if` into already big /usr/sbin/yast script and actually at the very top of it. -- Lukas Ocilka, Systems Management (Yast) Team Leader SLE Department, SUSE Linux -- To unsubscribe, e-mail: yast-devel+unsubscribe@opensuse.org To contact the owner, e-mail: yast-devel+owner@opensuse.org
On Thu, Jun 25, 2015 at 03:25:02PM +0200, Lukas Ocilka wrote:
On 25.6.2015 14:06, Josef Reidinger wrote:
Solution 2: - Do not create symlinks in inst-sys - Adapt /sbin/yast2 to check that we are in inst-sys and either call YaST2.First-Stage or continue
This is my favority as I hope it is single trivial if statement, so for solution 3 it seems like overkill for me. Another option that get into my mind is to overuse PATH precedence...so having yast2 in /usr/bin and yast2 symlink in /sbin this way it is not overwritten and it will works without much tricks ( and as bonus allows common users to run yast2 with limited functionality ).
Good idea, but I've checked "The Internet" and seems that /sbin/yast2 is all over the place. We simply cannot change this place.
So, /sbin/yast[2] is a must. And as inst-sys rewrites that, this idea doesn't seem to be an option. Moreover, adding this to SP1 would be a really big risk.
We already have /usr/sbin/yast and /sbin/yast[2] is just a link.
BTW, it's a change done by you :) https://github.com/yast/yast-yast2/commit/39cc36189b2768805064339ba054b7228c...
So, next options on the list is adding one more `if` into already big /usr/sbin/yast script and actually at the very top of it.
You could make /usr/sbin/yast a pure delegator script, that is it just calls one of two other scripts. ciao Arvin -- Arvin Schnell, <aschnell@suse.de> Senior Software Engineer, Research & Development SUSE Linux GmbH, GF: Felix Imendörffer, Jane Smithard, Dilip Upmanyu, Graham Norton, HRB 21284 (AG Nürnberg) Maxfeldstraße 5 90409 Nürnberg Germany -- To unsubscribe, e-mail: yast-devel+unsubscribe@opensuse.org To contact the owner, e-mail: yast-devel+owner@opensuse.org
On 25.6.2015 16:03, Arvin Schnell wrote:
On Thu, Jun 25, 2015 at 03:25:02PM +0200, Lukas Ocilka wrote:
Good idea, but I've checked "The Internet" and seems that /sbin/yast2 is all over the place. We simply cannot change this place.
So, /sbin/yast[2] is a must. And as inst-sys rewrites that, this idea doesn't seem to be an option. Moreover, adding this to SP1 would be a really big risk.
We already have /usr/sbin/yast and /sbin/yast[2] is just a link.
BTW, it's a change done by you :) https://github.com/yast/yast-yast2/commit/39cc36189b2768805064339ba054b7228c...
So, next options on the list is adding one more `if` into already big /usr/sbin/yast script and actually at the very top of it.
You could make /usr/sbin/yast a pure delegator script, that is it just calls one of two other scripts.
Yes, that's actually "Solution 3" in the initial e-mail. -- Lukas Ocilka, Systems Management (Yast) Team Leader SLE Department, SUSE Linux -- To unsubscribe, e-mail: yast-devel+unsubscribe@opensuse.org To contact the owner, e-mail: yast-devel+owner@opensuse.org
participants (4)
-
Arvin Schnell
-
Josef Reidinger
-
Lukas Ocilka
-
rneuhauser@suse.cz