Author: ug Date: Thu Jul 16 13:58:00 2009 New Revision: 58082 URL: http://svn.opensuse.org/viewcvs/yast?rev=58082&view=rev Log: default_value_script added to ask-dialogs Modified: trunk/autoinstallation/doc/CreateProfileDetails.xml trunk/autoinstallation/package/autoyast2.changes trunk/autoinstallation/src/dialogs/ask.ycp Modified: trunk/autoinstallation/doc/CreateProfileDetails.xml URL: http://svn.opensuse.org/viewcvs/yast/trunk/autoinstallation/doc/CreateProfileDetails.xml?rev=58082&r1=58081&r2=58082&view=diff ============================================================================== --- trunk/autoinstallation/doc/CreateProfileDetails.xml (original) +++ trunk/autoinstallation/doc/CreateProfileDetails.xml Thu Jul 16 13:58:00 2009 @@ -3409,11 +3409,51 @@ <para><screen><timeout config:type="integer">30</timeout></screen></para></entry> <entry>optional. A missing value is interpreted as 0 which means that there is no timeout</entry> </row> + <row> + <entry>default_value_script (available since openSUSE 11.2 but not in SLES11)</entry> + <entry>with 11.2 you can run scripts to set the default value for a question(see the table below for detailed instructions about default value scripts). It's useful if you can "calculate" a useful default value, especially in combination with the "timeout" option. + <para><screen><default_value_script>...</default_value_script></screen></para></entry> + <entry>optional (default is no script)</entry> + </row> </tbody> </tgroup> </table> </para> + + <para> + The following elements must be between the <ask-list config:type="list"><ask><default_value_script>...</default_value_script>...</ask></ask-list> tags in the <general> section. It's available since 11.2 (not SLES11). + </para> + <para> + <table frame='top'> + <title>XML representation</title> + <tgroup cols="3"> + <thead> + <row> + <entry>Element</entry> + <entry>Description</entry> + <entry>Comment</entry> + </row> + </thead> + <tbody> + <row> + <entry>source</entry> + <entry>the source code of the script. Whatever you echo to STDOUT will be used as default value for the ask-dialog. If your script has an exit code other than 0, the normal default element is used. Take care you echo with "echo -n" to suppress the '\n' and that you echo reasonable values and not "okay" for a boolean + <para><screen><source>...</source></screen></para></entry> + <entry>this value is required. Otherwise nothing would be executed</entry> + </row> + <row> + <entry>interpreter</entry> + <entry>the interpreter to use + <para><screen><interpreter>perl</interpreter></screen></para></entry> + <entry>default is shell (you can set "/bin/myinterpreter" as value too)</entry> + </row> + </tbody> + </tgroup> + </table> + </para> + + <para> The following elements must be between the <ask-list config:type="list"><ask><script>...</script>...</ask></ask-list> tags in the <general> section. It's available since 10.3 (not SLES10 SP1). </para> Modified: trunk/autoinstallation/package/autoyast2.changes URL: http://svn.opensuse.org/viewcvs/yast/trunk/autoinstallation/package/autoyast2.changes?rev=58082&r1=58081&r2=58082&view=diff ============================================================================== --- trunk/autoinstallation/package/autoyast2.changes (original) +++ trunk/autoinstallation/package/autoyast2.changes Thu Jul 16 13:58:00 2009 @@ -1,4 +1,9 @@ ------------------------------------------------------------------- +Thu Jul 16 13:57:11 CEST 2009 - ug@suse.de + +- default_value_script added to ask-dialogs + +------------------------------------------------------------------- Tue Jul 14 11:45:40 CEST 2009 - ug@suse.de - timeout added to ask-dialog configuration Modified: trunk/autoinstallation/src/dialogs/ask.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/autoinstallation/src/dialogs/ask.ycp?rev=58082&r1=58081&r2=58082&view=diff ============================================================================== --- trunk/autoinstallation/src/dialogs/ask.ycp (original) +++ trunk/autoinstallation/src/dialogs/ask.ycp Thu Jul 16 13:58:00 2009 @@ -90,6 +90,21 @@ timeout = ask["timeout"]:0; mod = true; + if( haskey( ask, "default_value_script" ) ) { + string interpreter = ask["default_value_script", "interpreter"]:"shell"; + if( interpreter == "shell" ) + interpreter = "/bin/sh"; + else if( interpreter == "perl" ) + interpreter = "/usr/bin/perl"; + string scriptPath = sformat("%1/%2", AutoinstConfig::tmpDir, "ask_default_value_script" ); + SCR::Write(.target.string, scriptPath, ask["default_value_script","source"]:""); + map out = (map) SCR::Execute (.target.bash_output, interpreter + " " + scriptPath, $[]); + y2debug("%1", out); + if( out["exit"]:-1 == 0 ) + ask["default"] = out["stdout"]:ask["default"]:""; + y2debug("default for '%1' is '%2' after script execution with exit code %3 (%4)", question, ask["default"]:"__undefined__", out["exit"]:-1, out["stderr"]:""); + } + term dlg = `Dummy(); if( type == "boolean" ) { boolean on=(ask["default"]:nil=="true")?(true):(false); -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org