Commit b9e2d21d authored by Jonas Smedegaard's avatar Jonas Smedegaard

Add patch to have localed set and rebuild locale.gen stuff (hack - needs...

Add patch to have localed set and rebuild locale.gen stuff (hack - needs better solution later). Closes: PureOS:T245.
parent fe4dcaa7
......@@ -45,6 +45,7 @@ Depends: ${shlibs:Depends},
policykit-1 (>= 0.103),
adduser,
gnome-settings-daemon (>= 3.24),
python3,
${misc:Depends}
Recommends: gnome-getting-started-docs
Description: Initial GNOME system setup helper
......
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import os
import sys
from subprocess import call
def install_locale(locale):
lgen = []
# toggle the selected locale in the locale.gen list
with open('/etc/locale.gen', 'r') as lf:
lgen = lf.read().split('\n')
for i in range(0, len(lgen)):
parts = lgen[i].split(' ')
if len(parts) != 3:
if len(parts) == 2:
if parts[0].startswith('en_US') or parts[0].startswith('en_DK'):
# ignore default locale
continue
lgen[i] = '# ' + lgen[i]
continue
if parts[1] == locale:
lgen[i] = ' '.join(parts[1:])
with open('/etc/locale.gen', 'w') as lf:
lf.write('\n'.join(lgen))
# run locale-gen to actually activate the changes
call(['locale-gen'])
return 0
if __name__ == '__main__':
if len(sys.argv) != 2:
raise Exception('Invalid number of arguments passed.')
r = install_locale(sys.argv[1])
sys.exit(r)
[Allow the gnome-initial-setup user to mount disks, set the locale, keyboard, date/time, control the network and create users without prompting]
Identity=unix-user:gnome-initial-setup
Action=org.freedesktop.udisks2.filesystem-mount-system;org.freedesktop.hostname1.*;org.freedesktop.NetworkManager.*;org.freedesktop.locale1.*;org.freedesktop.accounts.*;org.freedesktop.timedate1.*;org.freedesktop.realmd.*;org.freedesktop.RealtimeKit1.*
Action=org.freedesktop.policykit.exec;org.freedesktop.udisks2.filesystem-mount-system;org.freedesktop.hostname1.*;org.freedesktop.NetworkManager.*;org.freedesktop.locale1.*;org.freedesktop.accounts.*;org.freedesktop.timedate1.*;org.freedesktop.realmd.*;org.freedesktop.RealtimeKit1.*
ResultAny=no
ResultInactive=no
ResultActive=yes
debian/gnome-initial-setup.pkla /var/lib/polkit-1/localauthority/10-vendor.d/
debian/extra/install-locale.py /usr/lib/gnome-initial-setup/
Description: Have localed set and rebuild locale.gen stuff.
Hack to set and rebuild locale.gen stuff so the locale set by localed
is actually installed (we need to solve this in a better way later).
Author: Matthias Klumpp <matthias.klumpp@puri.sm>
Last-Update: 2017-05-30
---
This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
--- a/gnome-initial-setup/pages/language/gis-language-page.c
+++ b/gnome-initial-setup/pages/language/gis-language-page.c
@@ -62,6 +62,7 @@
GisLanguagePagePrivate *priv = gis_language_page_get_instance_private (self);
GVariantBuilder *b;
gchar *s;
+ g_autofree gchar *tmp = NULL;
b = g_variant_builder_new (G_VARIANT_TYPE ("as"));
s = g_strconcat ("LANG=", priv->new_locale_id, NULL);
@@ -74,6 +75,10 @@
G_DBUS_CALL_FLAGS_NONE,
-1, NULL, NULL, NULL);
g_variant_builder_unref (b);
+
+ /* an absolutely awful hack, but it will do for now - however, we should not keep this */
+ tmp = g_strdup_printf ("pkexec /usr/lib/gnome-initial-setup/install-locale.py %s", priv->new_locale_id);
+ g_spawn_command_line_sync (tmp, NULL, NULL, NULL, NULL);
}
static void
......@@ -11,3 +11,7 @@ override_dh_auto_configure:
dh_auto_configure -- \
--libexecdir=/usr/lib/gnome-initial-setup \
--disable-software-sources
override_dh_install:
dh_install
chmod +x $(CURDIR)/debian/gnome-initial-setup/usr/lib/gnome-initial-setup/install-locale.py
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment