You can modify the configuration file to copy or install custom scripts onto newly provisioned machines. The Linux agent runs the scripts at the specified point in the workflow.
Your script can reference any of the ./properties.xml files in the /usr/share/gugent/site/workitem directories.
Prepare a kickstart or autoYaST configuration file. See Prepare the Linux Kickstart Configuration Sample File.
Your script must return a non-zero value on failure to prevent machine provisioning failure.
- Create or identify the script you want to use.
- Save the script as NN_scriptname.
NN is a two digit number. Scripts are executed in order from lowest to highest. If two scripts have the same number, the order is alphabetical based on scriptname.
- Make your script executable.
- Locate the post-installation section of your kickstart or autoYaST configuration file.
In kickstart, this is indicated by
%post. In autoYaST, this is indicated by
- Modify the post-installation section of the configuration file to copy or install your script into the /usr/share/gugent/site/workitem directory of your choice.
Custom scripts are most commonly run for virtual kickstart/autoYaST with the work items SetupOS (for create provisioning) and CustomizeOS (for clone provisioning), but you can run scripts at any point in the workflow.
For example, you can modify the configuration file to copy the script
11_addusers.shto the /usr/share/gugent/site/SetupOS directory on a newly provisioned machine by using the following command:
cp nfs:172.20.9.59/linuxscripts/11_addusers.sh /usr/share/gugent/site/SetupOS
The Linux agent runs the script in the order specified by the work item directory and the script file name.