[yast-commit] r60540 - in /branches/SuSE-Code-11-Branch/wagon: package/yast2-wagon.changes src/clients/wagon.ycp src/modules/Wagon.ycp
Author: locilka Date: Tue Jan 26 15:16:11 2010 New Revision: 60540 URL: http://svn.opensuse.org/viewcvs/yast?rev=60540&view=rev Log: - Added support for migration hook scripts. Modified: branches/SuSE-Code-11-Branch/wagon/package/yast2-wagon.changes branches/SuSE-Code-11-Branch/wagon/src/clients/wagon.ycp branches/SuSE-Code-11-Branch/wagon/src/modules/Wagon.ycp Modified: branches/SuSE-Code-11-Branch/wagon/package/yast2-wagon.changes URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-Branch/wagon/package/yast2-wagon.changes?rev=60540&r1=60539&r2=60540&view=diff ============================================================================== --- branches/SuSE-Code-11-Branch/wagon/package/yast2-wagon.changes (original) +++ branches/SuSE-Code-11-Branch/wagon/package/yast2-wagon.changes Tue Jan 26 15:16:11 2010 @@ -1,4 +1,9 @@ ------------------------------------------------------------------- +Tue Jan 26 15:13:12 CET 2010 - locilka@suse.cz + +- Added support for migration hook scripts. + +------------------------------------------------------------------- Mon Jan 25 11:59:30 CET 2010 - locilka@suse.cz - Upgrading installed products moved after wagon self-update and Modified: branches/SuSE-Code-11-Branch/wagon/src/clients/wagon.ycp URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-Branch/wagon/src/clients/wagon.ycp?rev=60540&r1=60539&r2=60540&view=diff ============================================================================== --- branches/SuSE-Code-11-Branch/wagon/src/clients/wagon.ycp (original) +++ branches/SuSE-Code-11-Branch/wagon/src/clients/wagon.ycp Tue Jan 26 15:16:11 2010 @@ -269,6 +269,10 @@ return true; } + // Hooks for testing and manual changes + // --> /usr/lib/YaST2/bin/wagon_hook_init + Wagon::RunHook ("init"); + // main() HandleInit(); @@ -294,5 +298,9 @@ HandleRet (ret); + // Hooks for testing and manual changes + // --> /usr/lib/YaST2/bin/wagon_hook_finish + Wagon::RunHook ("finish"); + return ret; } Modified: branches/SuSE-Code-11-Branch/wagon/src/modules/Wagon.ycp URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-Branch/wagon/src/modules/Wagon.ycp?rev=60540&r1=60539&r2=60540&view=diff ============================================================================== --- branches/SuSE-Code-11-Branch/wagon/src/modules/Wagon.ycp (original) +++ branches/SuSE-Code-11-Branch/wagon/src/modules/Wagon.ycp Tue Jan 26 15:16:11 2010 @@ -474,5 +474,31 @@ return (string) splitstring (cmd["stdout"]:"", "\n")[0]:nil; } + global boolean RunHook (string script_name) { + if (script_name == nil || script_name == "") { + y2error ("Script name '%1' is not supported", script_name); + } + + script_name = sformat ("/usr/lib/YaST2/bin/wagon_hook_%1", script_name); + + if (! FileUtils::Exists (script_name)) { + y2milestone ("Hook script %1 doesn't exist, nothing to run", script_name); + return false; + } + + y2milestone ("Running hook %1", script_name); + map cmd = (map) WFM::Execute (.local.bash_output, String::Quote (script_name)); + + if (cmd["exit"]:-1 != 0) { + y2error ("Hook script returned: %1", cmd); + Report::Error (sformat(_("Error running hook script %1."), script_name)); + return false; + } + + y2milestone ("Hook script returned: %1", cmd); + + return true; + } + /* EOF */ } -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org
participants (1)
-
locilka@svn.opensuse.org