Tuesday, April 20, 2010

AutoYaST and it's Tools


"Al: Didn't you study the manual at all?
Tim: A real man doesn't need a manual. "


Because my last article was for the experts, this is more for the AutoYaST-newbies again.
It's not about AutoYaST itself but about the tools that orbit around it.

  • ayast_setup
    This tool is part of the autoyast2 RPM.
    Bubli wrote an excellent tutorial already so I'll just sum things up a little here.
    With ayast_setup you can reconfigure an already installed and running system without reinstalling it. All you need is an AutoYaST XML file and then call:
    yast2 ayast_setup setup filename=/tmp/my.xml

    The XML file will be read by AutoYaST and applied to your currently running system except (and that's good - you want it that way, believe me) all 1st stage configuration like partitioning, bootloader, pre- and chrootscripts and software selection. So if you use a XML file with partitioning information, your system will not get repartitioned.
    If you want to install packages, you have to use the <post-packages> section because the normal <software> section is evaluated during 1st stage only too.

  • yast2 clone_system
    This tool is also part of the autoyast2 RPM.
    This is kind of the opposite of ayast_setup. At the end of the normal installation, you have the option to clone the freshly installed system for AutoYaST but if you missed that opportunity, you can do that later in the running system with the clone_system client.
    Since openSUSE 11.3 you can call it like this:
    yast2 clone_system help

    and you'll get a list of "known modules" that can be cloned like this:
    known modules:
    bootloader dns-server
    firewall host
    http-server inetd
    iscsi-client kerberos
    lan ldap mail nfs
    ...

    and you can clone them like this:
    yast2 clone_system modules clone=lan,partitioning,software

    This will create an AutoYaST XML file in /root/autoinst.xml with the networking, partitioning and software section. If you don't specify any modules to clone, the same XML file will be created like with the "Clone this System" checkbox at the end of a normal installation.
    The "modules" parameter is new on openSUSE 11.3 and will not work on SLES11. On SLES11 you can only do the default cloning by calling
    yast2 clone_system

    Some customers are even doing remote-cloning with screen and ssh like this:
    ssh --batch root@myhost "screen -D -m yast clone_system &"


  • ayast_probe
    This tool is part of the autoyast2-installation RPM.
    It's not very useful in a running system but can become handy during the installation.
    When you use a rules.xml file, you can do things like (pseudocode) "if installed_product == 'SLES11' and memsize > 1024 use big_software.xml". The real syntax can be found
    here in the documentation.
    The question is, what are reasonable values of installed_product or memsize?
    /usr/lib/YaST2/bin/y2base ayast_probe ncurses
    shows you.


  • yast2 autoyast
    This tool is part of the autoyast2 RPM.
    If you start to look at AutoYaST for the first time, you'll probably get in touch with this tool immediately. It's the AutoYaST userinterface to create a XML file. Every module like networking, samba-client, partitioning, software configuration and so on has a UI here so you don't have to deal with XML code.
    But the AutoYaST UI can do more. You can clone single modules like you can do with the clone_system client by just pressing a single button (I painted that red in the screenshot, where the nfs-client is selected and would be cloned).
    You can apply the config of one module to the currently running system like with ayast_setup but with just a single button press again (green in the screenshot for the nfs-client config).
    And last but not least you can check your XML file for syntax errors.
    It's nearly impossible to create an invalid XML file with the UI and if you are not sure about certain XML parameters, the UI can be of a big help for you.



While the tools above were all 100% AutoYaST related and are only useful in combination with something autoyastish, the following tools are used by people who never heared of AutoYaST too.

  • xsltproc
    xsltproc is part of the libxslt RPM.
    This tool is used to apply XSLT files on a XML file.
    "What???!" - well, you only have to know that AutoYaST uses a XSLT file to merge multiple XML files into one big file. So when you use AutoYaST Rules or AutoYaST Classes your single XML files will be merged to a big one with the help of /usr/share/autoinstall/xslt/merge.xslt.
    It can be very useful to test the merging before you start the actual installation to make sure everything comes out as you planned it:
    /usr/bin/xsltproc --novalid \
    --param replace "'false'" \
    --param dontmerge1 "'package'" \
    --param with "'a.xml'" \
    --output out.xml \
    /usr/share/autoinstall/xslt/merge.xslt \
    b.xml

    a.xml and b.xml will be merged to out.xml. So take a look at out.xml to see if the merging led to the expected result.
    The dontmerge parameter is explained here. In short, you need that parameter if you want to merge two XML files that have the same sections. Like two XML files both with a <software> section.

  • create_update_source.sh and createrepo
    create_update_source.sh is part of the inst-source-utils RPM, createrepo is part of the createrepo RPM
    Both tools are for creating RPM repositories. If you create such a repo and add the location to your XML file, AutoYaST can install the RPMs from that repo too. So if you want to add own RPMs to your installation, don't change the actual SUSE Installation source, but create a new repo and add your RPM's there.
    How to do that is explained here.
    Even if you only want to install RPM's that are on openSUSE or SLES, you can use these tools. You can create a repo with all online-updates that were released and AutoYaST will install those updates then instead of the original RPM's.


I'd say those are the most important tools around AutoYaST - have fun using them for "more power" ;-)

ciao, Uwe