diff --git a/src/include/online-update-configuration/OUCDialogs.rb b/src/include/online-update-configuration/OUCDialogs.rb index f185e9f..bd5df9c 100644 --- a/src/include/online-update-configuration/OUCDialogs.rb +++ b/src/include/online-update-configuration/OUCDialogs.rb @@ -69,6 +69,7 @@ def initialize_online_update_configuration_OUCDialogs(include_target) @skipInteractivePatches = _("Skip Interactive Patches") @autoAgreeWithLicenses = _("Agree with Licenses") @includeRecommends = _("Include Recommended Packages") + @use_delta_rpm = _("Use delta rpms") @currentUpdateRepo = _("Current Update Repository:") @needToRegister = _( "In order to add the default update repository\nyou have to register this product." @@ -212,6 +213,14 @@ def getOUCDialog(type) OnlineUpdateConfiguration.includeRecommends == true ? true : false ) ), + VSpacing(0.2), + Left( + CheckBox( + Id(:use_delta_rpm), + @use_delta_rpm, + OnlineUpdateConfiguration.use_delta_rpm + ) + ), VSpacing(0.8), CheckBoxFrame( Id(:category), diff --git a/src/lib/online-update-configuration/zypp_config.rb b/src/lib/online-update-configuration/zypp_config.rb new file mode 100644 index 0000000..db14e8e --- /dev/null +++ b/src/lib/online-update-configuration/zypp_config.rb @@ -0,0 +1,35 @@ +module ZyppConfiguration + CONFIG_USE_DELTA_RPM = '.etc.zypp_conf.value.main.\"download.use_deltarpm\"' + + def zypp_config + @config ||= ZyppConfig.new + end + + class ZyppConfig + def use_delta_rpm? + current_config = delta_rpm_config_value + # Default settings in zypp.conf for using delta rpms is true + current_config == nil || current_config == 'true' + end + + def activate_delta_rpm + set_config_value(true) + end + + def deactivate_delta_rpm + set_config_value(false) + end + + private + + def set_config_value new_value + return if new_value == use_delta_rpm? + Yast::SCR.Write(Yast::Path.new(CONFIG_USE_DELTA_RPM), new_value) + end + + def delta_rpm_config_value + Yast::SCR.Read(Yast::Path.new(CONFIG_USE_DELTA_RPM)) + end + end +end + diff --git a/src/modules/OnlineUpdateConfiguration.rb b/src/modules/OnlineUpdateConfiguration.rb index a5260d1..9fc2c5b 100644 --- a/src/modules/OnlineUpdateConfiguration.rb +++ b/src/modules/OnlineUpdateConfiguration.rb @@ -28,9 +28,12 @@ # # $Id: OnlineUpdateConfiguration.ycp 1 2008-09-10 09:45:05Z jdsn $ require "yast" +require "online-update-configuration/zypp_config" module Yast class OnlineUpdateConfigurationClass < Module + include ZyppConfiguration + def main Yast.import "Pkg" @@ -45,6 +48,7 @@ def main @skipInteractivePatches = true @autoAgreeWithLicenses = false @includeRecommends = false + @use_delta_rpm = true @updateInterval = :weekly @currentCategories = [] @OUCmodified = false @@ -546,6 +550,8 @@ def Read path(".sysconfig.automatic_online_update.AOU_PATCH_CATEGORIES") ) ) + @use_delta_rpm = zypp_config.use_delta_rpm? + @currentCategories = Builtins.splitstring(patchCategories, " ") @currentCategories = Builtins.filter(@currentCategories) do |s| s != nil && s != "" @@ -617,6 +623,7 @@ def Write path(".sysconfig.automatic_online_update.AOU_INCLUDE_RECOMMENDS"), @includeRecommends == true ? "true" : "false" ) + @use_delta_rpm ? zypp_config.activate_delta_rpm : zypp_config.deactivate_delta_rpm catConf = "" if Ops.greater_than(Builtins.size(@currentCategories), 0) catConf = Builtins.mergestring(@currentCategories, " ") @@ -665,6 +672,7 @@ def Export publish :variable => :skipInteractivePatches, :type => "boolean" publish :variable => :autoAgreeWithLicenses, :type => "boolean" publish :variable => :includeRecommends, :type => "boolean" + publish :variable => :use_delta_rpm, :type => "boolean" publish :variable => :updateInterval, :type => "symbol" publish :variable => :currentCategories, :type => "list " publish :variable => :OUCmodified, :type => "boolean"