/* inst_myclient.ycp * Purpose: * General purpose module to perform custom commands * at the end of an AutoYaST installation. * Variables/other to change before using : * number_of_steps (mandatory) * The individual steps (mandatory) * log_filename (optional) * helptext (optional) * sleep_after_completion (optional) * Dialog title in Wizard::SetContents (optional) * * Authors: Andreas Taschner ataschner@novell.com * Version: 0.18 * Date : 26 Aug 2009 */ { import "CommandLine"; import "Directory"; import "Installation"; import "Label"; import "SCR"; import "Wizard"; textdomain "installation"; /********************************************************* * * * Begin parameters to change - block 1 * * * *********************************************************/ // Help text // Note that in the ncurses interface it will be be displayed in // the left pane of the dialog while the module is running. // In the qt interface the Help button must be pressed to show it. string helptext = ("
MyCompany Customization module is now downloading files to the machine and performing additional configuration. Depending on how the wind is blowing, temperature, CPU and the amount of memory, this process can take some time.
"); // Define the number of steps/commands to be performed below // Needed for correct behavior of the progress bar integer number_of_steps = 3 ; // Name of the log - located in /var/log/YaST2/ string logfilename = "/y2log.mycustomization" ; // The time to sleep after all steps are done, to allow // for user to be able to read what happened. // Defined in miliseconds integer sleep_after_completion = 5000 ; /********************************************************* * * * End parameters to change - block 1 * * * *********************************************************/ integer current_step = 0; string log_destination = ">> " + Directory::logdir + logfilename ; string log_destination_verbose = "|tee -a " + Directory::logdir + "/y2log.mycustomization"; ////////////////////////////////////////////////////////////////// // Functions // ////////////////////////////////////////////////////////////////// // Display a step in the LogView widget and increment the progress bar. // Uses global variable 'current_step'. // @param step_descr description of the step. define void logStep( string step_descr ) ``{ current_step = current_step + 1; UI::ChangeWidget( `id(`progress), `Value, current_step ); UI::ChangeWidget( `id(`log), `LastLine, step_descr + "\n" ); }; // Run a step on the target and log its output to the globally specified // 'log_destination'. // @param step command to execute in this step define void runStep( string step ) ``{ string command = sformat( "HOME=%1 %2 %3 2>&1", Directory::tmpdir, step, log_destination ); y2milestone( "Executing '%1'", command ); SCR::Execute( .target.bash, command ); }; define void runStepVerbose( string step ) ``{ // Write command being executed to log and screen string command2 = sformat( "HOME=%1 %2 %3 %4", Directory::tmpdir, "echo -e \"\\n**** Executing : \"", step, log_destination_verbose ); SCR::Execute( .target.bash, command2 ); UI::ChangeWidget( `id(`log), `LastLine, step + "\n" ); string command = sformat( "HOME=%1 %2 2>&1", Directory::tmpdir, step ); y2milestone( "Executing '%1'", command ); // Execute the actual command SCR::Execute(.background.run_output, command ); list