[PATCH] debian,installer: Set user avatar

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Set user avatar in the desktop installation's profile based on what is
done in Fedora and openSUSE scripts.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1336112

Signed-off-by: Fabiano Fidêncio <fidencio@xxxxxxxxxx>
---
 .../debian.org/debian-preseed-desktop.xml.in       | 28 ++++++++++++++++++++++
 1 file changed, 28 insertions(+)

diff --git a/data/install-script/debian.org/debian-preseed-desktop.xml.in b/data/install-script/debian.org/debian-preseed-desktop.xml.in
index e4579dc..fd69bf2 100644
--- a/data/install-script/debian.org/debian-preseed-desktop.xml.in
+++ b/data/install-script/debian.org/debian-preseed-desktop.xml.in
@@ -14,6 +14,8 @@
       <param name="user-fullname" policy="optional"/>
       <param name="user-password" policy="optional"/>
       <param name="admin-password" policy="optional"/>
+      <param name="avatar-location" policy="optional"/>
+      <param name="avatar-disk" policy="optional"/>
 
       <!-- Misc -->
       <param name="hostname" policy="optional"/>
@@ -40,6 +42,17 @@
           </xsl:choose>
         </xsl:template>
 
+        <xsl:template name="avatar-disk">
+          <xsl:choose>
+            <xsl:when test="config/avatar-disk != ''">
+              <xsl:value-of select="config/avatar-disk"/>
+            </xsl:when>
+            <xsl:otherwise>
+              <xsl:text>/dev/sda</xsl:text>
+            </xsl:otherwise>
+          </xsl:choose>
+        </xsl:template>
+
         <xsl:template name="hostname">
           <xsl:choose>
             <xsl:when test="config/hostname != ''">
@@ -205,6 +218,21 @@ d-i preseed/late_command string in-target passwd -d <xsl:value-of select="config
 ### Remove the installation DVD from the apt-get's sources.list
 d-i preseed/late_command string in-target sed -i '/cdrom/d' /etc/apt/sources.list
 
+<xsl:choose>
+ <xsl:when test="config/avatar-location != ''">
+### Set user avatar
+d-i preseed/late_command string \
+    mkdir /mnt/unattended-media ; \
+    mount <xsl:call-template name="avatar-disk"/> /mnt/unattended-media ; \
+    cp /mnt/unattended-media/<xsl:value-of select="config/avatar-location"/> /target/var/lib/AccountsService/icons/<xsl:value-of select="config/user-login"/> ; \
+    umount /mnt/unattended-media ; \
+    echo "[User]" >> /target/var/lib/AccountsService/users/<xsl:value-of select="config/user-login"/> ; \
+    echo "Language=<xsl:value-of select="config/l10n-language"/>.UTF-8" >> /target/var/lib/AccountsService/users/<xsl:value-of select="config/user-login"/> ;\
+    echo "XSession=gnome" >> /target/var/lib/AccountsService/users/<xsl:value-of select="config/user-login"/> ; \
+    echo "Icon=/var/lib/AccountsService/icons/<xsl:value-of select="config/user-login"/>" >> /target/var/lib/AccountsService/users/<xsl:value-of select="config/user-login"/>
+  </xsl:when>
+</xsl:choose>
+
 </xsl:template>
       </xsl:stylesheet>
     </template>
-- 
2.7.4

_______________________________________________
Libosinfo mailing list
Libosinfo@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libosinfo




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Fedora Users]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]

  Powered by Linux