Blob Blame History Raw
<?xml version="1.0"?>
<libosinfo version="0.0.1">
  <!-- Licensed under the GNU General Public License version 2 or later.
     See http://www.gnu.org/licenses/ for a copy of the license text -->
  <install-script id="http://fedoraproject.org/fedora/kickstart/jeos">
    <profile>jeos</profile>
    <expected-filename>fedora.ks</expected-filename>
    <config>
      <param name="admin-password" policy="required"/>
      <param name="user-login" policy="optional"/>
      <param name="user-password" policy="optional"/>
      <param name="hostname" policy="optional"/>
      <param name="l10n-keyboard" policy="optional" value-map="http://x.org/x11-keyboard"/>
      <param name="l10n-language" policy="optional"/>
      <param name="l10n-timezone" policy="optional"/>
      <param name="target-disk" policy="optional"/>
      <param name="script-disk" policy="optional"/>
    </config>
    <injection-method>cdrom</injection-method>
    <injection-method>disk</injection-method>
    <injection-method>floppy</injection-method>
    <injection-method>initrd</injection-method>
    <template>
      <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
        <xsl:output method="text"/>
        <xsl:template name="hostname">
          <xsl:choose>
            <xsl:when test="config/hostname != ''">
              <xsl:value-of select="config/hostname"/>
            </xsl:when>
            <xsl:otherwise>
              <xsl:text>locahost</xsl:text>
            </xsl:otherwise>
          </xsl:choose>
        </xsl:template>
        <xsl:template name="target-disk">
          <xsl:choose>
            <xsl:when test="config/target-disk != ''">
              <xsl:value-of select="config/target-disk"/>
            </xsl:when>
            <xsl:when test="os/version &gt; 9">
              <!-- virtio -->
              <xsl:text>/dev/vda</xsl:text>
            </xsl:when>
            <xsl:when test="os/version &gt; 6">
              <!-- libata IDE -->
              <xsl:text>/dev/sda</xsl:text>
            </xsl:when>
            <xsl:otherwise>
              <!-- IDE -->
              <xsl:text>/dev/hda</xsl:text>
            </xsl:otherwise>
          </xsl:choose>
        </xsl:template>
        <xsl:template name="script-disk">
          <xsl:variable name="script-disk">
            <xsl:choose>
              <xsl:when test="config/script-disk != ''">
                <xsl:value-of select="config/script-disk"/>
              </xsl:when>
              <xsl:when test="os/version &gt; 9">
                <xsl:text>/dev/sda</xsl:text>
              </xsl:when>
              <xsl:when test="os/version &gt; 6">
                <xsl:text>/dev/sdb</xsl:text>
              </xsl:when>
              <xsl:otherwise>
                <xsl:text>/dev/hdb</xsl:text>
              </xsl:otherwise>
            </xsl:choose>
          </xsl:variable>
          <xsl:value-of select="substring-after($script-disk, '/dev/')"/>
        </xsl:template>
        <xsl:template name="rootfs">
          <xsl:choose>
            <xsl:when test="os/version &gt; 10">
              <xsl:text>ext4</xsl:text>
            </xsl:when>
            <xsl:otherwise>
              <xsl:text>ext3</xsl:text>
            </xsl:otherwise>
          </xsl:choose>
        </xsl:template>
        <xsl:template name="bootfs">
          <xsl:choose>
            <xsl:when test="os/version &gt; 11">
              <xsl:text>ext4</xsl:text>
            </xsl:when>
            <xsl:otherwise>
              <xsl:text>ext3</xsl:text>
            </xsl:otherwise>
          </xsl:choose>
        </xsl:template>
        <xsl:template name="keyboard">
          <xsl:choose>
            <xsl:when test="os/version &gt; 17">
              <xsl:value-of select="config/l10n-keyboard"/>
            </xsl:when>
            <xsl:otherwise>
              <!-- FIXME: F17 and older required keyboard layout to be a console
                   layout so we'll need a different datamap for those but
                   currently we only support one datamap per config param per
                   script. -->
              <xsl:text>us</xsl:text>
            </xsl:otherwise>
          </xsl:choose>
        </xsl:template>
        <xsl:template match="/command-line">
          <xsl:text>ks=</xsl:text>
          <xsl:choose>
            <xsl:when test="script/preferred-injection-method = 'initrd'">
              <xsl:text>file:/</xsl:text>
            </xsl:when>
            <xsl:otherwise>
              <xsl:text>hd:</xsl:text>
              <xsl:call-template name="script-disk"/>
              <xsl:text>:/</xsl:text>
            </xsl:otherwise>
          </xsl:choose>
          <xsl:value-of select="script/expected-filename"/>
          <xsl:if test="script/installation-source = 'network'">
            <xsl:choose>
              <xsl:when test="os/version &lt; 19">
                <xsl:text> method=</xsl:text>
              </xsl:when>
              <xsl:otherwise>
                <xsl:text> inst.repo=</xsl:text>
              </xsl:otherwise>
            </xsl:choose>
            <xsl:call-template name="installation-url"/>
          </xsl:if>
        </xsl:template>
        <xsl:template name="installation-url">
          <xsl:choose>
            <xsl:when test="config/installation-url != ''">
              <xsl:value-of select="config/installation-url"/>
            </xsl:when>
            <xsl:when test="tree/url != ''">
              <xsl:value-of select="tree/url"/>
            </xsl:when>
          </xsl:choose>
        </xsl:template>
        <xsl:template name="url-or-mirrorlist">
          <xsl:choose>
            <xsl:when test="config/installation-url != '' or tree/url != ''">
              <xsl:text> --url=</xsl:text>
              <xsl:call-template name="installation-url"/>
            </xsl:when>
            <xsl:otherwise>
              <xsl:text> --mirrorlist=</xsl:text>
              <xsl:text>https://mirrors.fedoraproject.org/metalink?repo=fedora-$releasever&amp;arch=$basearch</xsl:text>
            </xsl:otherwise>
          </xsl:choose>
        </xsl:template>
        <xsl:template match="/install-script-config">
# Install script for <xsl:value-of select="os/short-id"/> profile <xsl:value-of select="script/profile"/>
<xsl:if test="script/installation-source='media' and (count(media/variant) = 0 or not(contains(media/variant, 'netinst')))"><xsl:if test="os/version &lt; 29">
install
  </xsl:if>
cdrom
</xsl:if>
text
keyboard '<xsl:call-template name="keyboard"/>'
lang <xsl:value-of select="config/l10n-language"/>
<xsl:if test="os/version &lt; 7">
langsupport --default <xsl:value-of select="config/l10n-language"/> <xsl:value-of select="config/l10n-language"/>
mouse generic3ps/2 --device psaux
</xsl:if>
skipx
network --onboot yes --bootproto dhcp --hostname=<xsl:call-template name="hostname"/>
rootpw <xsl:value-of select="config/admin-password"/>
firewall --disabled
<xsl:choose><xsl:when test="os/version &lt; 28">
authconfig --enableshadow --enablemd5
  </xsl:when><xsl:otherwise>
authselect select sssd
  </xsl:otherwise></xsl:choose>
<xsl:if test="os/version &gt; 1">
selinux --enforcing
</xsl:if>
timezone --utc <xsl:value-of select="config/l10n-timezone"/>
bootloader --location=mbr
zerombr <xsl:if test="os/version &lt; 14">yes</xsl:if>

clearpart --all --drives=<xsl:call-template name="target-disk"/>

<xsl:choose><xsl:when test="os/version &lt; 3">
part /boot --fstype <xsl:call-template name="bootfs"/> --recommended --ondisk=<xsl:call-template name="target-disk"/>
part pv.2 --size=1 --grow --ondisk=<xsl:call-template name="target-disk"/>
volgroup VolGroup00 --pesize=32768 pv.2
logvol swap --fstype swap --name=LogVol01 --vgname=VolGroup00 --size=768 --grow --maxsize=1536
logvol / --fstype <xsl:call-template name="rootfs"/> --name=LogVol00 --vgname=VolGroup00 --size=1024 --grow
  </xsl:when><xsl:otherwise>
autopart
  </xsl:otherwise></xsl:choose>
reboot

<xsl:if test="script/installation-source='network' or contains(media/variant, 'netinst')">
repo --name=fedora --mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=fedora-$releasever&amp;arch=$basearch
repo --name=updates --mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=updates-released-f$releasever&amp;arch=$basearch
url <xsl:call-template name="url-or-mirrorlist"/>
</xsl:if>

%packages
<xsl:choose><xsl:when test="os/version &lt; 18">
@base
  </xsl:when><xsl:otherwise>
@standard
  </xsl:otherwise></xsl:choose>
@core
<xsl:if test="os/version &gt; 6">
@hardware-support
</xsl:if>
%end

%post --erroronfail

if test -n '<xsl:value-of select="config/user-login"/>' &amp;&amp; test -n '<xsl:value-of select="config/user-password"/>'; then
  useradd -G wheel <xsl:value-of select="config/user-login"/> # Add user
  echo '<xsl:value-of select="config/user-password"/>' |passwd --stdin <xsl:value-of select="config/user-login"/>
fi

# Create an osinfo-install-successful file in /root
touch /root/osinfo-install-successful

%end
        </xsl:template>
      </xsl:stylesheet>
    </template>
  </install-script>
</libosinfo>