Merge ~gunnarhj/ubuntu-release-upgrader:more-temp-font into ubuntu-release-upgrader:ubuntu/main

Proposed by Gunnar Hjalmarsson
Status: Merged
Merged at revision: fae22f5c668295cfa181e46035a83d8539bea8ac
Proposed branch: ~gunnarhj/ubuntu-release-upgrader:more-temp-font
Merge into: ubuntu-release-upgrader:ubuntu/main
Diff against target: 52 lines (+15/-12)
1 file modified
DistUpgrade/DistUpgradeQuirks.py (+15/-12)
Reviewer Review Type Date Requested Status
Nick Rosbrook Approve
Ubuntu Core Development Team Pending
Review via email: mp+453593@code.launchpad.net

Description of the change

* Fixes 'the unreadable text issue' for Ubuntu Cinnamon
* Use an autostart file for more flavors

To post a comment you must log in.
Revision history for this message
Nick Rosbrook (enr0n) wrote :

Thanks for looking into all of these flavors. I think the approach here makes sense, I just left some minor comments on the diff.

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

I don't think there is any specification of XDG_CURRENT_DESKTOP in the sense you ask for. I have learnt to not rely on the elements in the list coming in a particular order. For most flavors there is only one element, and Unity can serve as another example to make the point:

Unity:Unity7:ubuntu

But I made use of your oneliner to decide if autostart should be used.

Revision history for this message
Nick Rosbrook (enr0n) wrote :

Ack, thanks for that explanation. LGTM.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/DistUpgrade/DistUpgradeQuirks.py b/DistUpgrade/DistUpgradeQuirks.py
2index 3ba9fc7..f8fe3de 100644
3--- a/DistUpgrade/DistUpgradeQuirks.py
4+++ b/DistUpgrade/DistUpgradeQuirks.py
5@@ -1475,15 +1475,6 @@ class DistUpgradeQuirks(object):
6 'not change font'
7 )
8 return
9-
10- desktops = os.getenv('XDG_CURRENT_DESKTOP', '').split(':')
11- if 'MATE' in desktops:
12- schema = 'org.mate.interface'
13- is_mate = True
14- else:
15- schema = 'org.gnome.desktop.interface'
16- is_mate = False
17-
18 try:
19 uid = int(os.getenv('SUDO_UID', os.getenv('PKEXEC_UID')))
20 pwuid = pwd.getpwuid(uid)
21@@ -1493,6 +1484,20 @@ class DistUpgradeQuirks(object):
22 )
23 return
24
25+ schema = 'org.gnome.desktop.interface'
26+
27+ desktops = os.getenv('XDG_CURRENT_DESKTOP', '').split(':')
28+
29+ # Some flavors use other schemas for the desktop font.
30+ if 'MATE' in desktops or 'UKUI' in desktops:
31+ schema = 'org.mate.interface'
32+ elif 'X-Cinnamon' in desktops:
33+ schema = 'org.cinnamon.desktop.interface'
34+
35+ # Some flavors lack the systemd integration needed for a
36+ # user service, so we create an autostart file instead.
37+ use_autostart = set(['Budgie', 'LXQt', 'MATE', 'UKUI', 'X-Cinnamon', 'XFCE']) & set(desktops)
38+
39 r = subprocess.run(
40 ['systemd-run', '--user', '-M', f'{pwuid.pw_name}@.host',
41 '--wait', '--pipe', '-q', '--',
42@@ -1533,9 +1538,7 @@ class DistUpgradeQuirks(object):
43 pathlib.Path(need_font_restore_file).touch(mode=0o666)
44 os.chown(need_font_restore_file, pwuid.pw_uid, pwuid.pw_gid)
45
46- if is_mate:
47- # For MATE we create an autostart file instead of a service, since
48- # MATE hasn't enabled systemd integration.
49+ if use_autostart:
50 autostart_file = '/etc/xdg/autostart/upgrade-restore-font.desktop'
51 os.makedirs(os.path.dirname(autostart_file), exist_ok=True)
52 flag = '$HOME/.config/upgrade-need-font-restore'

Subscribers

People subscribed via source and target branches