[PATCH] Provide useful hints on TTY1 during the installation

Vratislav Podzimek vpodzime at redhat.com
Tue Nov 18 07:53:11 UTC 2014


On Fri, 2014-11-14 at 21:30 +0100, Martin Kolman wrote:
> Until now TTY1 was not really used for anything other than printing
> current Anaconda version. This has been changed and the Anaconda
> version is now followed by useful hints for Anaconda users with
> special emphasis of Anaconda debugging (where are the log files stored,
> how can I get a shell, etc.).
> 
> The hints are also parametrized to be displayed only when appropriate
> (no need to tell users that Anaconda has a text mode if they already
> are in textmode) and are translatable.
> 
> Signed-off-by: Martin Kolman <mkolman at redhat.com>
> ---
>  anaconda | 28 ++++++++++++++++++++++++++++
>  1 file changed, 28 insertions(+)
> 
> diff --git a/anaconda b/anaconda
> index a3f527c..c61dc71 100755
> --- a/anaconda
> +++ b/anaconda
> @@ -988,11 +988,39 @@ if __name__ == "__main__":
>  
>      verdesc = "%s for %s %s" % (getAnacondaVersionString(),
>                                  product.productName, product.productVersion)
> +
> +    logs_note = _(" * installation log files are stored in /tmp during the installation")
> +    shell_note = _(" * shell is available on TTY2 and in second TMUX pane (ctrl+b, then press 2)")
> +    tmux_only_note = _(" * shell is available in second TMUX pane (ctrl+b, then press 2)")
> +    text_mode_note = _(" * if the graphical installation interface fails to start, try again with the\n\
> +   inst.text bootoption to start text installation")
You can put two strings next to each other and they get concatenated, so
something like 

("first part "
 "second part")

which would be nicer here than the backslash at the end of the line.

> +    separate_attachements_note = _(" * when reporting a bug attach logs as separate text/plain attachments")
> +
>      if product.isFinal:
>          print("anaconda %s started." % verdesc)
>      else:
>          print("anaconda %s (pre-release) started." % verdesc)
>  
> +    # we are past the --version and --help shortcut so we can import Blivet
> +    # now without slowing down anything critical
> +
> +    # pylint: disable=import-error
> +    from blivet import arch
> +
> +    if not opts.images and not opts.dirinstall:
> +        print(logs_note)
> +        # no fancy stuff like TTYs on a s390...
> +        if not arch.isS390():
> +            print(shell_note)
> +        # ...but there is apparently TMUX during the manual installation!
> +        elif not opts.ksfile:
> +            print(tmux_only_note)
> +        # no need to tell users how to switch to text mode
> +        # if already in text mode
> +        if opts.display_mode == 'g':
> +            print(text_mode_note)
> +        print(separate_attachements_note)
> +
>      from pyanaconda.anaconda import Anaconda
>      anaconda = Anaconda()
>      iutil.setup_translations(gettext)
As mulhern pointed out, you need to put all these prints after this line
so that they actually appear translated. However, it seems that user has
no chance to change the language before the execution comes to this
place so it may be better to remove the _() calls in the end. 

-- 
Vratislav Podzimek

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




More information about the anaconda-patches mailing list