[Libosinfo] [PATCH v2] Add install script for RHEL 6.x

Fabiano Fidêncio fabiano at fidencio.org
Tue Jan 8 23:43:19 UTC 2013


On Tue, Jan 8, 2013 at 9:23 PM, Zeeshan Ali (Khattak)
<zeeshanak at gnome.org> wrote:
> From: "Zeeshan Ali (Khattak)" <zeeshanak at gnome.org>
>
> The same script might work for other RHEL 6.x too but I have only tested
> it against RHEL 6.3 for now. Still some issues though:
>
> 1. For some reason user's avatar is ignored although according to the docs
> I could find*, copying the avatar to /home/${USER}/.face should be
> enough.
>
> 2. We don't set the keyboard layout properly yet and just hardcode it to
>   'us'. This will require the same kind of mapping as Fedora 17 and older.
>
> * http://projects.gnome.org/gdm/docs/2.14/configuration.html
> ---
>  data/install-scripts/Makefile.am |   1 +
>  data/install-scripts/rhel.xml    | 204 +++++++++++++++++++++++++++++++++++++++
>  data/oses/rhel.xml.in            |  20 ++++
>  3 files changed, 225 insertions(+)
>  create mode 100644 data/install-scripts/rhel.xml
>
> diff --git a/data/install-scripts/Makefile.am b/data/install-scripts/Makefile.am
> index cb24e09..c310468 100644
> --- a/data/install-scripts/Makefile.am
> +++ b/data/install-scripts/Makefile.am
> @@ -2,6 +2,7 @@
>  databasedir = $(pkgdatadir)/db/install-scripts/
>  database_DATA =     \
>    fedora.xml        \
> +  rhel.xml          \
>    windows-sif.xml   \
>    windows-cmd.xml   \
>    windows-reg.xml   \
> diff --git a/data/install-scripts/rhel.xml b/data/install-scripts/rhel.xml
> new file mode 100644
> index 0000000..9c17f11
> --- /dev/null
> +++ b/data/install-scripts/rhel.xml
> @@ -0,0 +1,204 @@
> +<libosinfo version="0.0.1">
> +  <!-- JEOS PROFILE -->
> +  <install-script id='http://redhat.com/scripts/rhel/jeos'>
> +    <profile>jeos</profile>
> +    <expected-filename>fedora.ks</expected-filename>
> +    <config>
> +      <param name="admin-password" policy="optional"/>
> +      <param name="l10n-keyboard" policy="optional"/>
> +      <param name="l10n-language" policy="optional"/>
> +      <param name="l10n-timezone" policy="optional"/>
> +      <param name="target-disk" policy="optional"/>
> +    </config>
> +    <template>
> +      <xsl:stylesheet
> +        xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
> +        version="1.0">
> +
> +        <xsl:output method="text"/>
> +
> +        <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 > 4">
> +              <!-- virtio -->
> +              <xsl:text>/dev/vda</xsl:text>
> +            </xsl:when>
> +            <xsl:otherwise>
> +              <!-- IDE -->
> +              <xsl:text>/dev/sda</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"/>
> +install
> +text
> +<!-- FIXME: RHEL requires keyboard layout to be a console layout so to do this right, we'll need
> +            mapping from language to console layout. -->
> +keyboard us
> +lang <xsl:value-of select="config/l10n-language"/>
> +skipx
> +network --device eth0 --bootproto dhcp
> +rootpw <xsl:value-of select="config/admin-password"/>
> +firewall --disabled
> +authconfig --enableshadow --enablemd5
> +selinux --enforcing
> +timezone --utc <xsl:value-of select="config/l10n-timezone"/>
> +bootloader --location=mbr
> +zerombr
> +
> +clearpart --all --drives=<xsl:call-template name="target-disk"/>

According with: https://bugzilla.gnome.org/show_bug.cgi?id=676537#c12
JeOS scripts should be identical to scripts provided by:
https://github.com/clalancette/oz/tree/master/oz/auto

So, if the script works properly without "--drives=...", remove it
from JeOS profile.

ACK, otherwise.

> +
> +part /boot --fstype ext4 --size=200 --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 ext4 --name=LogVol00 --vgname=VolGroup00 --size=1024 --grow
> +reboot
> +
> +%packages
> +<xsl:choose>
> +  <xsl:when test="os/version < 7">
> + at base
> +  </xsl:when>
> +  <xsl:otherwise>
> + at standard
> +  </xsl:otherwise>
> +</xsl:choose>
> + at core
> +
> +%end
> +       </xsl:template>
> +      </xsl:stylesheet>
> +    </template>
> +  </install-script>
> +
> +  <!-- DESKTOP PROFILE -->
> +  <install-script id='http://redhat.com/scripts/rhel/desktop'>
> +    <profile>desktop</profile>
> +    <expected-filename>fedora.ks</expected-filename>
> +    <config>
> +        <param name="l10n-keyboard" policy="optional"/>
> +        <param name="l10n-language" policy="optional"/>
> +        <param name="l10n-timezone" policy="optional"/>
> +        <param name="hostname" policy="optional"/>
> +        <param name="user-login" policy="required"/>
> +        <param name="user-password" policy="required"/>
> +        <param name="admin-password" policy="required"/>
> +        <param name="avatar-location" policy="optional"/>
> +        <param name="avatar-disk" policy="optional"/>
> +        <param name="target-disk" policy="optional"/>
> +    </config>
> +    <avatar-format>
> +      <mime-type>image/png</mime-type>
> +    </avatar-format>
> +    <template>
> +      <xsl:stylesheet
> +        xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
> +        version="1.0">
> +
> +        <xsl:output method="text"/>
> +
> +        <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 > 4">
> +              <!-- virtio -->
> +              <xsl:text>/dev/vda</xsl:text>
> +            </xsl:when>
> +            <xsl:otherwise>
> +              <!-- IDE -->
> +              <xsl:text>/dev/sda</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"/>
> +install
> +keyboard us
> +lang <xsl:value-of select="config/l10n-language"/>
> +network --onboot yes --device eth0 --bootproto dhcp --noipv6 --hostname=<xsl:value-of select="config/hostname"/> --activate
> +rootpw dummyPa55w0rd # Actual password set (or unset) in %post below
> +firewall --disabled
> +authconfig --enableshadow --enablemd5
> +timezone --utc <xsl:value-of select="config/l10n-timezone"/>
> +bootloader --location=mbr
> +zerombr
> +
> +clearpart --all --drives=<xsl:call-template name="target-disk"/>
> +
> +firstboot --disable
> +
> +part /boot --fstype ext4 --size=200 --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 ext4 --name=LogVol00 --vgname=VolGroup00 --size=1024 --grow
> +reboot
> +
> +%packages
> + at core
> + at x11
> + at basic-desktop
> + at general-desktop
> + at desktop-platform
> + at internet-applications
> + at internet-browser
> + at input-methods
> + at office-suite
> +
> +%end
> +
> +%post --erroronfail
> +
> +useradd -G wheel <xsl:value-of select="config/user-login"/> # Add user
> +if test -z <xsl:value-of select="config/user-password"/>; then
> +    passwd -d <xsl:value-of select="config/user-login"/> # Make user account passwordless
> +else
> +    echo <xsl:value-of select="config/user-password"/> |passwd --stdin <xsl:value-of select="config/user-login"/>
> +fi
> +
> +if test -z <xsl:value-of select="config/admin-password"/>; then
> +    passwd -d root # Make root account passwordless
> +else
> +    echo <xsl:value-of select="config/admin-password"/> |passwd --stdin root
> +fi
> +
> +# Set user avatar
> +if test -n <xsl:value-of select="config/avatar-location"/>; then
> +mkdir /mnt/unattended-media
> +mount <xsl:value-of select='config/avatar-disk'/> /mnt/unattended-media
> +cp /mnt/unattended-media<xsl:value-of select="config/avatar-location"/> /home/<xsl:value-of select="config/user-login"/>/.face
> +umount /mnt/unattended-media
> +fi
> +
> +# Enable autologin
> +echo "[daemon]
> +AutomaticLoginEnable=true
> +AutomaticLogin=<xsl:value-of select="config/user-login"/>
> +
> +[security]
> +
> +[xdmcp]
> +
> +[greeter]
> +
> +[chooser]
> +
> +[debug]
> +" > /etc/gdm/custom.conf
> +
> +%end
> +       </xsl:template>
> +      </xsl:stylesheet>
> +    </template>
> +  </install-script>
> +
> +</libosinfo>
> diff --git a/data/oses/rhel.xml.in b/data/oses/rhel.xml.in
> index 1b34704..7e0db5b 100644
> --- a/data/oses/rhel.xml.in
> +++ b/data/oses/rhel.xml.in
> @@ -708,6 +708,11 @@
>          <storage>9663676416</storage>
>        </recommended>
>      </resources>
> +
> +    <installer>
> +      <script id='http://redhat.com/scripts/rhel/jeos'/>
> +      <script id='http://redhat.com/scripts/rhel/desktop'/>
> +    </installer>
>    </os>
>
>    <os id="http://redhat.com/rhel/6.1">
> @@ -753,6 +758,11 @@
>          <storage>9663676416</storage>
>        </recommended>
>      </resources>
> +
> +    <installer>
> +      <script id='http://redhat.com/scripts/rhel/jeos'/>
> +      <script id='http://redhat.com/scripts/rhel/desktop'/>
> +    </installer>
>    </os>
>
>    <os id="http://redhat.com/rhel/6.2">
> @@ -798,6 +808,11 @@
>          <storage>9663676416</storage>
>        </recommended>
>      </resources>
> +
> +    <installer>
> +      <script id='http://redhat.com/scripts/rhel/jeos'/>
> +      <script id='http://redhat.com/scripts/rhel/desktop'/>
> +    </installer>
>    </os>
>
>    <os id="http://redhat.com/rhel/6.3">
> @@ -843,5 +858,10 @@
>          <storage>9663676416</storage>
>        </recommended>
>      </resources>
> +
> +    <installer>
> +      <script id='http://redhat.com/scripts/rhel/jeos'/>
> +      <script id='http://redhat.com/scripts/rhel/desktop'/>
> +    </installer>
>    </os>
>  </libosinfo>
> --
> 1.8.0.2
>
> _______________________________________________
> Libosinfo mailing list
> Libosinfo at redhat.com
> https://www.redhat.com/mailman/listinfo/libosinfo


Best Regards,
--
Fabiano Fidêncio




More information about the Libosinfo mailing list