When building appliances with SUSE Studio, I was often challenged with finding a way to configuring an appliance on first boot. The most common use cases like locale, time zone and network configuration are being offered by Studio already.
Selecting these options will make Studio include the required packages and configuration to guide the user through a YaST workflow on first boot.
But is there an easy way for further customizing your application on first boot? Yes, there is! Enter AutoYaST and it's powerful "Ask the user for values during installation" feature.
Switch to the Configuration tab, select Scripts and check the "Run AutoYaST profile on appliance's first boot" option.
Next we need to create the AutoYaST profile, which will be run on first boot. The profile format is an ASCII XML file.
Here is a simple example, that will create a simple ask dialoge "Enter the user for this machine" and promt for input. The result will be writen to /tmp/answer_user.
Now let's look at a more complex profile, that uses a script to validate the users input. This technique can also be used to process the users input and e.g. change config files accordingly.
Note, the user provided value is present in the script as $VAL. If the script exit code is non-zero, AutoYaST will show the script output as an error.
Make sure to always include
For more details refer to the AutoYaST documentation on this feature which is available here.
One more way to customizing your appliance on first boot is to simply place scripts or binaries in /usr/share/firstboot/scripts. They will be executed automatically by YaST on first boot.