Thursday, June 30, 2011

Using AutoYaST for customizing your appliance on first boot

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 cont which will tell AutoYaST to process the question. (In AutoYaST terms the first boot is also called stage "cont".)

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.

5 comments:

  1. very nice article, thanx. If you found anything to enhance on AutoYaST in combination with Studio, just let me know.

    ciao, Uwe

    ReplyDelete
  2. Personally, I would like a extra option to help user to install proprietary driver for them.

    This function could be extremely important when it comes to a newbie. For they might misunderstand that Linux has POOR graphical performance without the drivers automatically installed.

    ReplyDelete
  3. I select "configuring network during the firstboot",
    But i don't have a "Run AutoYaST profile on appliance's first boot" option in choices. I have only the 2 other choices in Suse Studio.

    I test with SLE 11.1 and OpenSuse 11.4

    ReplyDelete
  4. Replies
    1. Hi Andrew, did you opt into the beta features? You can do this in your Studio account page.

      Delete

 
© 2013 SUSE