Merge ~gunnarhj/casper:localized-desktop-dir into casper:main

Proposed by Gunnar Hjalmarsson
Status: Needs review
Proposed branch: ~gunnarhj/casper:localized-desktop-dir
Merge into: casper:main
Diff against target: 51 lines (+17/-5)
2 files modified
debian/changelog (+8/-0)
scripts/casper-bottom/25adduser (+9/-5)
Reviewer Review Type Date Requested Status
Ubuntu Installer Team Pending
Review via email: mp+400294@code.staging.launchpad.net

Description of the change

Caveat: Not tested

Provided that the user selected language is reflected in the environment when the proposed gettext() command is run, it ought to address the bug.

To post a comment you must log in.
Revision history for this message
Michael Hudson-Doyle (mwhudson) wrote :

I sort of doubt the translations are available in the initramfs, which is where this runs from. It might be necessary to have this script create a oneshot systemd service that does the addusering, or something like that.

Revision history for this message
Gunnar Hjalmarsson (gunnarhj) wrote :

Thanks for your comment, Michael. It's the translations provided by the xdg-user-dirs package that gettext would need for its lookup.

Could it possibly help to change

DESKTOPDIR=$(gettext -d xdg-user-dirs Desktop)

to

DESKTOPDIR=$(chroot /root gettext -d xdg-user-dirs Desktop)

? I'm guessing wildly here (don't know how to test).

Revision history for this message
Michael Hudson-Doyle (mwhudson) wrote :

Oh yes that might work. BTW to test this:

1) download an ISO, mount it at say /mnt
2) mkdir -p ~/tmp/initrd; cd ~/tmp/initrd
3) unpack the initramfs with (cpio -t; cpio -t; lz4cat | cpio -i) < /mnt/casper/initrd
4) copy your version of 25adduser over the unpacked one
5) repack the initrd with find . | LC_ALL=C sort | cpio -R 0:0 -o -H newc | gzip > ../casper-initrd.gz
6) boot it in kvm with something like truncate -s 10G image.img && kvm -m 4096 -smp 2 -drive file=~/images/image.img,format=raw,cache=none,if=virtio -kernel /mnt/casper/vmlinuz -initrd ~/tmp/casper-initrd.gz -cdrom /path/to.iso

Probably these instructions should be in the casper source tree somewhere...

Revision history for this message
Gunnar Hjalmarsson (gunnarhj) wrote :

That is far over my skill level. :( It would take me a month to make sense of those instructions.

Any chance you have it set up, and can help to test a non-English "Try Ubuntu" using the modified 25adduser?

Revision history for this message
Gunnar Hjalmarsson (gunnarhj) wrote :

I added "chroot /root", but it's still an untested theory.

Revision history for this message
Gunnar Hjalmarsson (gunnarhj) wrote :

@Michael: I started a live session successfully using your steps. It didn't take a month - rather a few minutes. :) Thanks!

However, it resulted in an English session (the C.UTF-8 locale). So what I could confirm was that my modified 25adduser didn't screw it up, i.e. the ubiquity.desktop file was located in the ~/Desktop directory. Possibly that is sufficient to commit/upload and study the behavior in a real daily build.

What remains to see is whether the gettext command is run using the user selected locale, so the directory is named ~/Bureau if the user selects French etc.

Revision history for this message
Michael Hudson-Doyle (mwhudson) wrote :

Oops neglected this for far too long, sorry. Anyway, I still think this runs too early -- there's no opportunity to choose a language before this code runs is there? Is there any other way to choose a language in a live session other than starting ubiquity and choosing a language there?

Revision history for this message
Gunnar Hjalmarsson (gunnarhj) wrote :

On 2021-10-19 03:17, Michael Hudson-Doyle wrote:
> I still think this runs too early

Well, it depends on what you mean. When you select a language in ubiquity, it instantly changes the UI, so somehow the selected language is stored in memory or disk before you click the "Try Ubuntu" button.

While it may be true that it runs too early to see the environment of the live session, it should be safe to do it like this instead:

selected_lang=[grab the selected language somehow]
DESKTOPDIR=$(LANGUAGE=$selected_lang gettext -d xdg-user-dirs Desktop)

I haven't figured out how/where the selected language is available — am kind of hoping that someone in the installer team can help with that. ;)

But with that said, the timing to deal with this 10 years old bug may not be optimal considering that ubiquity is about to be replaced with the new desktop installer. So maybe we'd better figure out how to grab the selected language in the context of the new installer.

There was an error fetching revisions from git servers. Please try again in a few minutes. If the problem persists, contact Launchpad support.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
The diff is not available at this time. You can reload the page or download it.

Subscribers

People subscribed via source and target branches