Don't rely on /etc/install.inf being available [15-SP4] #613
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Target Branch / Product
This is for SLE-15-SP4. A port to master will follow.
Bugzilla
https://bugzilla.suse.com/show_bug.cgi?id=1198560
Trello
https://trello.com/c/AXWDv2jh/
Problem
When migrating from Leap 15.4 to SLE-15 SP4 on the installed system, YaST crashes with an exception "The installation URL is not set" in https://github.com/yast/yast-packager/blob/master/src/lib/y2packager/installation_medium.rb#L48-L50 .
Cause
It tried to read
/etc/install.inf
(the config file that linuxrc writes for YaST to consume) to check if the installation media has several products or just one. But in this scenario, the migration started from the installed system, not from an inst-sys on installation media; so there was no/etc/install.inf
.Fix
Check if there is an
install.inf
; more precisely, if any data from that could be read, i.e. if there was any content at all from such a file.If there is none, read the products from libzypp: In this scenario, the old repos from the system that we want to migrate away from were just removed, and the ones from the new one (that we want to migrate to) were added. Those repos are what we need here.
Notice that in this scenario it does not make sense to read a repo URL from a
control.xml
file: While there is one in/etc/YaST2/control.xml
, that is not the default path on installation media, so it won't be found; and, worse, that file contains the URL of the old repo, the system that we are migrating away from.Related PR
PR for master: #615