[Libosinfo] [osinfo-db PATCH 14/15] install-script, centos, desktop: Add avatar-disk template

Fabiano Fidêncio fidencio at redhat.com
Thu Jun 13 11:48:33 UTC 2019


Let's add the avatar disk template, which considers that the avatar file
is stored together with the install scripts files, so we don't actually
require the apps to set it (but, if they do, the value set will be
used).

Signed-off-by: Fabiano Fidêncio <fidencio at redhat.com>
---
 .../centos.org/centos-kickstart-desktop.xml.in | 18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)

diff --git a/data/install-script/centos.org/centos-kickstart-desktop.xml.in b/data/install-script/centos.org/centos-kickstart-desktop.xml.in
index 76c747a..427a124 100644
--- a/data/install-script/centos.org/centos-kickstart-desktop.xml.in
+++ b/data/install-script/centos.org/centos-kickstart-desktop.xml.in
@@ -64,6 +64,22 @@
           <xsl:value-of select="substring-after($script-disk, '/dev/')"/>
         </xsl:template>
 
+        <!-- The default values of avatar-disk consider the avatar is stored
+             in the same disk as the installation scripts. -->
+        <xsl:template name="avatar-disk">
+          <xsl:choose>
+            <xsl:when test="config/avatar-disk != ''">
+              <xsl:value-of select="config/avatar-disk"/>
+            </xsl:when>
+            <xsl:when test="os/version > 5.5">
+              <xsl:text>/dev/sda</xsl:text>
+            </xsl:when>
+            <xsl:otherwise>
+              <xsl:text>/dev/sdb</xsl:text>
+            </xsl:otherwise>
+          </xsl:choose>
+        </xsl:template>
+
         <xsl:template match="/command-line">
           <xsl:text>ks=</xsl:text>
           <xsl:choose>
@@ -195,7 +211,7 @@ 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
+mount <xsl:call-template name="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
-- 
2.21.0




More information about the Libosinfo mailing list