From mboxrd@z Thu Jan 1 00:00:00 1970 X-GM-THRID: 6558749580291211264 X-Received: by 2002:a50:fb0e:: with SMTP id d14-v6mr1001533edq.1.1527681010129; Wed, 30 May 2018 04:50:10 -0700 (PDT) X-BeenThere: isar-users@googlegroups.com Received: by 2002:aa7:d351:: with SMTP id m17-v6ls19979527edr.3.gmail; Wed, 30 May 2018 04:50:09 -0700 (PDT) X-Google-Smtp-Source: ADUXVKLDFa/FIkf24mYFZqeCzYZRD80rwYln7fnr7jYEBJbaDmBMKErBhekOO6DmkvchHfTcaIHk X-Received: by 2002:a50:8e14:: with SMTP id 20-v6mr1000134edw.3.1527681009761; Wed, 30 May 2018 04:50:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527681009; cv=none; d=google.com; s=arc-20160816; b=uqqh0AvetLzes2yIzW7pXRuVxQJofDkt6Ky9QGjkEXGKmI8zN89kd93jOl5S3dhuz3 qnsDHLSUTJzPwQxUQdqoGAE3ET7/Tr98rbJbzf3Rxm1VZJWhCHqMMlYLqCOjCN4XCMme tJUtOoiNpTv10yOTSf7s9gY/KOeT1CECFgfydm1GhSUizVeXlyljMCL1Q/tffqBwEUdu LiSwz7lRMX91qB2gl3Szvmx0PgzX12slgfm0Uydg6XROTWcLiVnzcXgp53P6Iu+9MDpt h4OnHihX2je7GlBnkG+BJoRTgcQ8RjwdENwlY3Q+D/g5Ey+CfQFbH8o1bbTJdso/F81/ +xxw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=beXacxjhh/ac98JSluJaxOTmOyyYMsMMBdjNepdtJcw=; b=BlQg3sj9b6jqx5QWihCA9MTLsDUtaqDYSbDL+aALhJPaY8gFZOSdFyUvTaIFVD4KqG 8CbmRrWxaS2+rsAbEXOtvvd8noPdLSnahFg/bwcwtac8bmC7yhxusMpNu4IdN4kZmgun FbFWBlS9drP56pD9v+BuGl+Y5egbadT1xH8NmtTHDn9WQT5IxIHFBtXlSJsLgKWNGOfH e8GQ+ZcMOyO+xfSdUtf1xQ6Znj8eYKzmZPxTAeTu1edeqTMBn7jJbOCJU8QQxor6xOqG iGdUuea6PdGUVc3n9IaDb31yn/WNG9k2wTTNHJaI0wYqvUzwHAG41uxoQw/0GUL7Votv nZ3Q== ARC-Authentication-Results: i=1; gmr-mx.google.com; spf=pass (google.com: domain of claudius.heine.ext@siemens.com designates 194.138.37.40 as permitted sender) smtp.mailfrom=claudius.heine.ext@siemens.com Return-Path: Received: from gecko.sbs.de (gecko.sbs.de. [194.138.37.40]) by gmr-mx.google.com with ESMTPS id u9-v6si1550865edp.3.2018.05.30.04.50.09 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 30 May 2018 04:50:09 -0700 (PDT) Received-SPF: pass (google.com: domain of claudius.heine.ext@siemens.com designates 194.138.37.40 as permitted sender) client-ip=194.138.37.40; Authentication-Results: gmr-mx.google.com; spf=pass (google.com: domain of claudius.heine.ext@siemens.com designates 194.138.37.40 as permitted sender) smtp.mailfrom=claudius.heine.ext@siemens.com Received: from mail2.sbs.de (mail2.sbs.de [192.129.41.66]) by gecko.sbs.de (8.15.2/8.15.2) with ESMTPS id w4UBo8au019966 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 30 May 2018 13:50:08 +0200 Received: from ring.ppmd.siemens.net (linux-ses-ext02.ppmd.siemens.net [139.25.69.69]) by mail2.sbs.de (8.15.2/8.15.2) with ESMTP id w4UBo7F3014220; Wed, 30 May 2018 13:50:08 +0200 From: claudius.heine.ext@siemens.com To: isar-users@googlegroups.com Cc: Claudius Heine Subject: [PATCH v6 2/4] meta/isar-cfg-localepurge: added locale purge recipe Date: Wed, 30 May 2018 13:49:58 +0200 Message-Id: <20180530115000.14424-3-claudius.heine.ext@siemens.com> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180530115000.14424-1-claudius.heine.ext@siemens.com> References: <20180530115000.14424-1-claudius.heine.ext@siemens.com> X-TUID: hsBAPWG5xLHL From: Claudius Heine The package 'isar-cfg-localepurge' is used to set the locales of the root file system and purge all not required locales. The variables used to configure the locale with this package are `LOCALE_GEN` which is basically the content of the desired `/etc/locale.gen` with each line seperated by '\n' and `LOCALE_DEFAULT` which sets the global default locale of the system. Signed-off-by: Claudius Heine --- .../isar-cfg-localepurge/files/postinst | 13 ++++ .../isar-cfg-localepurge.bb | 65 +++++++++++++++++++ 2 files changed, 78 insertions(+) create mode 100644 meta/recipes-support/isar-cfg-localepurge/files/postinst create mode 100644 meta/recipes-support/isar-cfg-localepurge/isar-cfg-localepurge.bb diff --git a/meta/recipes-support/isar-cfg-localepurge/files/postinst b/meta/recipes-support/isar-cfg-localepurge/files/postinst new file mode 100644 index 0000000..c5f1c51 --- /dev/null +++ b/meta/recipes-support/isar-cfg-localepurge/files/postinst @@ -0,0 +1,13 @@ +#!/bin/sh +set -e + +cat /usr/lib/isar-cfg-localepurge/locale.gen \ + >> /etc/locale.gen +cat /usr/lib/isar-cfg-localepurge/locale.nopurge \ + > /etc/locale.nopurge + +debconf-set-selections /usr/lib/isar-cfg-localepurge/locale.debconf + +dpkg-reconfigure -f noninteractive locales + +localepurge diff --git a/meta/recipes-support/isar-cfg-localepurge/isar-cfg-localepurge.bb b/meta/recipes-support/isar-cfg-localepurge/isar-cfg-localepurge.bb new file mode 100644 index 0000000..bdbc2b1 --- /dev/null +++ b/meta/recipes-support/isar-cfg-localepurge/isar-cfg-localepurge.bb @@ -0,0 +1,65 @@ +# This software is a part of ISAR. + +DESCRIPTION = "Isar configuration package for locale and localepurge" +MAINTAINER = "isar-users " +DEBIAN_DEPENDS = "localepurge" + +SRC_URI = "file://postinst" + +inherit dpkg-raw + +LOCALE_GEN ?= "en_US.UTF-8 UTF-8\n\ + en_US ISO-8859-1\n" +LOCALE_DEFAULT ?= "en_US.UTF-8" + +def get_locale_gen(d): + locale_gen = d.getVar("LOCALE_GEN", True) or "" + return '\n'.join(sorted(set(i.strip() + for i in locale_gen.split('\\n') + if i.strip()))) + +def get_dc_locale_gen(d): + locale_gen = d.getVar("LOCALE_GEN", True) or "" + return ', '.join(sorted(set(i.strip() + for i in locale_gen.split('\\n') + if i.strip()))) + +def get_nopurge(d): + locale_gen = d.getVar("LOCALE_GEN", True) or "" + return '\n'.join(sorted(set(i.strip() + for j in locale_gen.split('\\n') + if j.strip() + for i in (j.split()[0].split("_")[0], + j.split()[0].split(".")[0], + j.split()[0])))) + +do_gen_config[stamp-extra-info] = "${DISTRO}-${DISTRO_ARCH}" +do_gen_config() { + cat<<-__EOF__ > ${WORKDIR}/locale.gen + ${@get_locale_gen(d)} + __EOF__ + cat<<-__EOF__ > ${WORKDIR}/locale.debconf + locales locales/locales_to_be_generated multiselect ${@get_dc_locale_gen(d)} + locales locales/default_environment_locale select ${LOCALE_DEFAULT} + __EOF__ + cat<<-__EOF__ > ${WORKDIR}/locale.nopurge + #USE_DPKG + MANDELETE + DONTBOTHERNEWLOCALE + #SHOWFREEDSPACE + #QUICKNDIRTYCALC + #VERBOSE + ${@get_nopurge(d)} + __EOF__ +} +addtask gen_config after do_unpack before do_install + +do_install() { + install -v -d ${D}/usr/lib/${PN} + install -v -m 644 ${WORKDIR}/locale.debconf \ + ${D}/usr/lib/${PN}/locale.debconf + install -v -m 644 ${WORKDIR}/locale.gen \ + ${D}/usr/lib/${PN}/locale.gen + install -v -m 644 ${WORKDIR}/locale.nopurge \ + ${D}/usr/lib/${PN}/locale.nopurge +} -- 2.17.0