[PATCH] Use an alternative image if logo is missing

Vratislav Podzimek vpodzime at redhat.com
Tue Mar 25 10:50:08 UTC 2014


On Mon, 2014-03-24 at 16:00 +0100, Martin Kolman wrote:
> If the logo in upper left is missing GTK will start spamming
> TT1, making it completely unusable. The image is specified in a CSS
> and needs to be present on the given path before the GUI is started.
> Therefore we need to check if the logo image is present and symlink
> a replacement image to the logo path if the logo image is missing.
> 
> By default an Anaconda Fedora header image will be used that looks
> quite OK, but might not be always present (comes from the fedora-logos package).
> So there is a fallback to a GTK icon, which should be always available as we use
> GTK icons for Anaconda UI elements.
> 
> Signed-off-by: Martin Kolman <mkolman at redhat.com>
> ---
>  anaconda | 21 +++++++++++++++++++++
>  1 file changed, 21 insertions(+)
> 
> diff --git a/anaconda b/anaconda
> index 7e84cf5..42ac732 100755
> --- a/anaconda
> +++ b/anaconda
> @@ -142,6 +142,27 @@ def doStartupX11Actions():
>  
>      global wm_pid # pid of the anaconda fork where the window manager is running
>  
> +    # make sure there is a logo image present,
> +    # otherwise TTY1 will get spammed by errors
> +    import os
> +    replacement_image_path = None
> +    logo_path = "/usr/share/anaconda/pixmaps/logo.png"
> +    header_path = "/usr/share/anaconda/pixmaps/anaconda_header.png"
> +    sad_smiley_path = "/usr/share/icons/gnome/48x48/emotes/face-crying.png"
> +    if not os.path.exists(logo_path):
> +        # first try to replace the missing logo with the Anaconda header image
> +        if os.path.exists(header_path):
> +            replacement_image_path = header_path
> +        # if the header image is not present, use a sad smiley from GTK icons
> +        elif os.path.exists(sad_smiley_path):
> +            replacement_image_path = sad_smiley_path
> +
> +        if replacement_image_path:
> +            log.warning("logo image is missing, using a substitute")
> +            os.symlink(replacement_image_path, logo_path)
> +        else:
> +            log.warning("logo image is missing")
I'd put this code into a separate function and just call it from
doXdoStartupX11Actions. Otherwise this looks good to me. Thanks for
working on this! Applying to my master branch right now.

-- 
Vratislav Podzimek

Anaconda Rider | Red Hat, Inc. | Brno - Czech Republic



More information about the anaconda-patches mailing list