Author: openvasfelix Date: Fri Feb 12 11:26:33 2010 New Revision: 60808 URL: http://svn.opensuse.org/viewcvs/yast?rev=60808&view=rev Log: * src/helps.ycp: Added note about cron job. * src/openvas-feed-sync.cron.daily: Removed. * src/dialogs.ycp: Notify feed choices and en/disable certain options on change, create symlink for cron job instead of own script. Removed: branches/SuSE-Code-11-SP1-Branch/openvas-security-scanner/src/openvas-feed-sync.cron.daily Modified: branches/SuSE-Code-11-SP1-Branch/openvas-security-scanner/src/dialogs.ycp branches/SuSE-Code-11-SP1-Branch/openvas-security-scanner/src/helps.ycp Modified: branches/SuSE-Code-11-SP1-Branch/openvas-security-scanner/src/dialogs.ycp URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP1-Branch/openvas-security-scanner/src/dialogs.ycp?rev=60808&r1=60807&r2=60808&view=diff ============================================================================== --- branches/SuSE-Code-11-SP1-Branch/openvas-security-scanner/src/dialogs.ycp (original) +++ branches/SuSE-Code-11-SP1-Branch/openvas-security-scanner/src/dialogs.ycp Fri Feb 12 11:26:33 2010 @@ -52,15 +52,15 @@ term radio_group = `VBox (); radio_group = add (radio_group, `Left( - `RadioButton(`id(`no_feed), _("&Disable OpenVAS Security Scanner"), no_feed_selected) )); + `RadioButton(`id(`no_feed), `opt(`notify), _("&Disable OpenVAS Security Scanner"), no_feed_selected) )); radio_group = add (radio_group, `Left( - `RadioButton(`id(`onf), _("Enable and use &OpenVAS NVT Feed"), (OpenvasSecurityScanner::feed_choice == "OpenVAS NVT Feed")) )); + `RadioButton(`id(`onf), `opt(`notify), _("Enable and use &OpenVAS NVT Feed"), (OpenvasSecurityScanner::feed_choice == "OpenVAS NVT Feed")) )); // Disable the Greenbone Security Feed option if the GSF scripts are not installed / activated if (OpenvasSecurityScanner::IsGSFInstalled ()) { - radio_group = add (radio_group, `Left(`RadioButton(`id(`gsf), _("Enable and use &Greenbone Security Feed"), (OpenvasSecurityScanner::feed_choice == "Greenbone Security Feed")) )); + radio_group = add (radio_group, `Left(`RadioButton(`id(`gsf), `opt(`notify), _("Enable and use &Greenbone Security Feed"), (OpenvasSecurityScanner::feed_choice == "Greenbone Security Feed")) )); } else { @@ -87,7 +87,7 @@ : `PushButton(`id(`feedsync_now), `opt(`notify), _("&Synchronize with Feed now")); feed_management_box = add (feed_management_box, sync_now_button); - term croncheckbox = `CheckBox(`id(`cronjob), `opt(`notify), _("Do a da&ily feed synchronization"), OpenvasSecurityScanner::daily_sync); + term croncheckbox = `CheckBox(`id(`cronjob), _("Do a da&ily feed synchronization"), OpenvasSecurityScanner::daily_sync); feed_management_box = add (feed_management_box, croncheckbox); @@ -102,10 +102,33 @@ Label::BackButton (), Label::FinishButton ()); Wizard::DisableBackButton(); + // Does not make sense to have synchronize with "no feed", disable widgets in that case + if (no_feed_selected) + { + UI::ChangeWidget (`id(`cronjob), `Enabled, false); + UI::ChangeWidget (`id(`cronjob), `Value, false); + } + any ret = nil; while (true) { ret = UI::UserInput (); + // handle no feed onf, gsf and en/disable the daily sync checkbox accordingly. + if (ret == `no_feed) + { + UI::ChangeWidget (`id(`cronjob), `Enabled, false); + UI::ChangeWidget (`id(`cronjob), `Value, false); + UI::ChangeWidget (`id(`feedsync_now), `Enabled, false); + continue; + } + else if (ret == `onf || ret == `gsf) + { + UI::ChangeWidget (`id(`cronjob), `Enabled, true); + UI::ChangeWidget (`id(`feedsync_now), `Enabled, true); + continue; + } + + /* Abort? */ if (ret == `abort) { @@ -124,10 +147,6 @@ else if (ret == `gsf) choice = "Greenbone Security Feed"; - /** @todo Check whether cronjob script is installed, not allow/ grey out choice otherwise. */ - ret = UI::QueryWidget (`id(`cronjob), `Value); - OpenvasSecurityScanner::daily_sync = (boolean) ret; - /* Check whether the feed-choice changed, do nothing if so */ if (OpenvasSecurityScanner::feed_choice == choice) ret = `write; @@ -143,6 +162,29 @@ ret = `fetch_new; } } + + /** @todo Check whether cronjob script is installed, not allow/ grey out choice otherwise. */ + any ui_dailysync = UI::QueryWidget (`id(`cronjob), `Value); + + if (!(boolean) ui_dailysync || choice == "No Feed") + { + SCR::Execute (.target.remove, "/etc/cron.daily/openvas-nvt-sync"); + SCR::Execute (.target.remove, "/etc/cron.daily/greenbone-nvt-sync"); + } + else // Daily sync was checked + { + if (choice == "OpenVAS NVT Feed") + { + SCR::Execute (.target.symlink, "/usr/sbin/openvas-nvt-sync", "/etc/cron.daily/openvas-nvt-sync"); + SCR::Execute (.target.remove, "/etc/cron.daily/greenbone-nvt-sync"); + } + else if (choice == "Greenbone Security Feed") + { + SCR::Execute (.target.symlink, "/usr/sbin/greenbone-nvt-sync", "/etc/cron.daily/greenbone-nvt-sync"); + SCR::Execute (.target.remove, "/etc/cron.daily/openvas-nvt-sync"); + } + } + break; } Modified: branches/SuSE-Code-11-SP1-Branch/openvas-security-scanner/src/helps.ycp URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP1-Branch/openvas-security-scanner/src/helps.ycp?rev=60808&r1=60807&r2=60808&view=diff ============================================================================== --- branches/SuSE-Code-11-SP1-Branch/openvas-security-scanner/src/helps.ycp (original) +++ branches/SuSE-Code-11-SP1-Branch/openvas-security-scanner/src/helps.ycp Fri Feb 12 11:26:33 2010 @@ -69,7 +69,7 @@ + _("Will immediately start a synchronize with the selected feed. Note that this option is not available if you just changed the feed. ") // Do a daily feed synchronization + "</p><p><b>" + _("Do a daily feed synchronization") + "</b>: " - + _("Will enable the daily feed synchronization with a cron job, if a feed was chosen and the service is enabled. Note that the openvas scanner service will then be restarted daily, too.") + + _("Will enable the daily feed synchronization with a cron job, if a feed was chosen and the service is enabled. Note that the openvas scanner service has to be restarted to be able to use the newly fetched NVTs.") // Next + "</p><p><b>" + _("Next") + "</b>: " -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org