diff --git a/package/yast2-update.changes b/package/yast2-update.changes index 7c6993ed..e121f414 100644 --- a/package/yast2-update.changes +++ b/package/yast2-update.changes @@ -1,3 +1,12 @@ +------------------------------------------------------------------- +Wed Feb 10 09:12:10 UTC 2021 - Imobach Gonzalez Sosa + +- Do not rely on the 'installation-helper' binary to create + snapshots after installation or offline upgrade (bsc#1180142). +- Do not crash when it is not possible to create a snapshot before + upgrading the system (related to bsc#1180142). +- 4.2.21 + ------------------------------------------------------------------- Mon Dec 14 09:01:10 UTC 2020 - Ladislav Slezák diff --git a/package/yast2-update.spec b/package/yast2-update.spec index 741d902e..8166772f 100644 --- a/package/yast2-update.spec +++ b/package/yast2-update.spec @@ -17,7 +17,7 @@ Name: yast2-update -Version: 4.2.20 +Version: 4.2.21 Release: 0 Summary: YaST2 - Update Group: System/YaST diff --git a/src/modules/RootPart.rb b/src/modules/RootPart.rb index 6c095e06..63501734 100644 --- a/src/modules/RootPart.rb +++ b/src/modules/RootPart.rb @@ -1403,12 +1403,7 @@ def MountPartitions(root_device_current) else # enter the mount points of the newly mounted partitions update_staging! - if Yast2::FsSnapshot.configured? - # as of bsc #1092757 snapshot descriptions are not translated - snapshot = Yast2::FsSnapshot.create_pre("before update", cleanup: :number, - important: true) - Yast2::FsSnapshotStore.save("update", snapshot.number) - end + create_pre_snapshot Update.clean_backup create_backup inject_intsys_files @@ -2030,6 +2025,24 @@ def mount_regular_fstab_entry?(entry) # #MountVarIfRequired... except when /var is a subvolume path != "/var" || mntops.include?("subvol=") end + + # Creates a pre-update snapshot and stores its number + # + # If something goes wrong, it reports the problem to the user. + def create_pre_snapshot + return unless Yast2::FsSnapshot.configured? + + # as of bsc #1092757 snapshot descriptions are not translated + snapshot = Yast2::FsSnapshot.create_pre("before update", cleanup: :number, important: true) + Yast2::FsSnapshotStore.save("update", snapshot.number) + rescue Yast2::SnapshotCreationFailed => e + log.error("Error creating a pre-update snapshot: #{e}") + Yast::Report.Error( + _("A pre-update snapshot could not be created. You can continue with the \n" \ + "installation, but beware that you cannot roll back to a pre-update state \n" \ + "unless you have created a snapshot manually.") + ) + end end RootPart = RootPartClass.new