public inbox for isar-users@googlegroups.com
 help / color / mirror / Atom feed
* [PATCH v2 0/3] One-shot configuration packages
@ 2018-05-23 13:12 claudius.heine.ext
  2018-05-23 13:12 ` [PATCH v2 1/3] isar-bootstrap|configscript: implement one shot config option claudius.heine.ext
                   ` (3 more replies)
  0 siblings, 4 replies; 11+ messages in thread
From: claudius.heine.ext @ 2018-05-23 13:12 UTC (permalink / raw)
  To: isar-users; +Cc: Claudius Heine

From: Claudius Heine <ch@denx.de>

Hi,

here is the rebased patchset that removes the issue with the global
localepurge configuration as well.

Claudius

Changes from v1:
 - rebased to current next
 - removed locale.nopurge setup in isar-bootstrap

Claudius Heine (3):
  isar-bootstrap|configscript: implement one shot config option
  meta/isar-cfg-localepurge: added locale purge recipe
  meta-isar/isar-image-base: switch use isar-cfg-localepurge

 .../images/files/debian-configscript.sh       |  9 ------
 .../images/files/raspbian-configscript.sh     |  8 -----
 .../recipes-core/images/isar-image-base.bb    |  6 ++--
 meta/classes/isar-bootstrap-helper.bbclass    | 23 +++++++++++---
 .../isar-bootstrap/files/locale.nopurge       | 10 -------
 .../isar-bootstrap/isar-bootstrap.bb          |  4 +--
 .../isar-cfg-localepurge/files/locale.debconf | 12 ++++++++
 .../isar-cfg-localepurge/files/locale.gen     |  1 +
 .../isar-cfg-localepurge/files/postinst       | 30 +++++++++++++++++++
 .../isar-cfg-localepurge.bb                   | 19 ++++++++++++
 10 files changed, 85 insertions(+), 37 deletions(-)
 delete mode 100644 meta/recipes-core/isar-bootstrap/files/locale.nopurge
 create mode 100644 meta/recipes-support/isar-cfg-localepurge/files/locale.debconf
 create mode 100644 meta/recipes-support/isar-cfg-localepurge/files/locale.gen
 create mode 100644 meta/recipes-support/isar-cfg-localepurge/files/postinst
 create mode 100644 meta/recipes-support/isar-cfg-localepurge/isar-cfg-localepurge.bb

-- 
2.17.0


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH v2 1/3] isar-bootstrap|configscript: implement one shot config option
  2018-05-23 13:12 [PATCH v2 0/3] One-shot configuration packages claudius.heine.ext
@ 2018-05-23 13:12 ` claudius.heine.ext
  2018-05-23 14:06   ` Henning Schild
  2018-05-23 13:12 ` [PATCH v2 2/3] meta/isar-cfg-localepurge: added locale purge recipe claudius.heine.ext
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 11+ messages in thread
From: claudius.heine.ext @ 2018-05-23 13:12 UTC (permalink / raw)
  To: isar-users; +Cc: Claudius Heine

From: Claudius Heine <ch@denx.de>

Some configuration tasks on the image require certain other packages,
but those packages might not be required on the final image.

One way to solve this is use a special package that is installed to the
image and then removed again. When installing it makes certain that all
required packages are installed to the image as well. Then the image
can be configured in the postinst hook. When this package is removed and
all unused dependencies are removed as well, no not required packages
used by this package should remain on the image.

Signed-off-by: Claudius Heine <ch@denx.de>
---
 .../images/files/debian-configscript.sh       |  1 -
 .../images/files/raspbian-configscript.sh     |  1 -
 meta/classes/isar-bootstrap-helper.bbclass    | 23 +++++++++++++++----
 3 files changed, 19 insertions(+), 6 deletions(-)

diff --git a/meta-isar/recipes-core/images/files/debian-configscript.sh b/meta-isar/recipes-core/images/files/debian-configscript.sh
index 7ca0562..9b3ff30 100755
--- a/meta-isar/recipes-core/images/files/debian-configscript.sh
+++ b/meta-isar/recipes-core/images/files/debian-configscript.sh
@@ -40,4 +40,3 @@ fi
 
 # Purge unused locale and installed packages' .deb files
 localepurge
-apt-get clean
diff --git a/meta-isar/recipes-core/images/files/raspbian-configscript.sh b/meta-isar/recipes-core/images/files/raspbian-configscript.sh
index b240de9..448dea5 100644
--- a/meta-isar/recipes-core/images/files/raspbian-configscript.sh
+++ b/meta-isar/recipes-core/images/files/raspbian-configscript.sh
@@ -40,4 +40,3 @@ kernel=$KERNEL_IMAGE
 EOF
 
 localepurge
-apt-get clean
diff --git a/meta/classes/isar-bootstrap-helper.bbclass b/meta/classes/isar-bootstrap-helper.bbclass
index 4284d02..76e20f6 100644
--- a/meta/classes/isar-bootstrap-helper.bbclass
+++ b/meta/classes/isar-bootstrap-helper.bbclass
@@ -5,15 +5,17 @@
 #
 # SPDX-License-Identifier: MIT
 
+IMAGE_CFG_PACKAGE ??= ""
+
 setup_root_file_system() {
     ROOTFSDIR="$1"
-    CLEANHOSTLEAK="$2"
+    CLEAN="$2"
     shift
     shift
     PACKAGES="$@"
     APT_ARGS="install --yes --allow-unauthenticated \
               -o Debug::pkgProblemResolver=yes"
-    CLEANHOSTLEAK_FILES="${ROOTFSDIR}/etc/hostname ${ROOTFSDIR}/etc/resolv.conf"
+    CLEAN_FILES="${ROOTFSDIR}/etc/hostname ${ROOTFSDIR}/etc/resolv.conf"
 
     sudo cp -Trpfx \
         "${DEPLOY_DIR_IMAGE}/isar-bootstrap-${DISTRO}-${DISTRO_ARCH}/" \
@@ -41,8 +43,21 @@ setup_root_file_system() {
         -o Dir::Etc::sourceparts="-" \
         -o APT::Get::List-Cleanup="0"
     sudo -E chroot "$ROOTFSDIR" \
-        /usr/bin/apt-get ${APT_ARGS} --download-only $PACKAGES
-    [ "clean" = ${CLEANHOSTLEAK} ] && sudo rm -f ${CLEANHOSTLEAK_FILES}
+        /usr/bin/apt-get ${APT_ARGS} --download-only $PACKAGES \
+            ${IMAGE_CFG_PACKAGE}
+    [ "clean" = ${CLEAN} ] && sudo rm -f ${CLEAN_FILES}
     sudo -E chroot "$ROOTFSDIR" \
         /usr/bin/apt-get ${APT_ARGS} $PACKAGES
+    if [ -n "${IMAGE_CFG_PACKAGE}" ]; then
+        sudo -E chroot "$ROOTFSDIR" \
+            /usr/bin/apt-get ${APT_ARGS} ${IMAGE_CFG_PACKAGE}
+        sudo -E chroot "$ROOTFSDIR" \
+            /usr/bin/apt-get purge -y ${IMAGE_CFG_PACKAGE}
+    fi
+    if [ "clean" = ${CLEAN} ]; then
+        sudo -E chroot "$ROOTFSDIR" \
+            /usr/bin/apt-get autoremove --purge -y
+        sudo -E chroot "$ROOTFSDIR" \
+            /usr/bin/apt-get clean
+    fi
 }
-- 
2.17.0


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH v2 2/3] meta/isar-cfg-localepurge: added locale purge recipe
  2018-05-23 13:12 [PATCH v2 0/3] One-shot configuration packages claudius.heine.ext
  2018-05-23 13:12 ` [PATCH v2 1/3] isar-bootstrap|configscript: implement one shot config option claudius.heine.ext
@ 2018-05-23 13:12 ` claudius.heine.ext
  2018-05-23 14:16   ` Henning Schild
  2018-05-23 13:12 ` [PATCH v2 3/3] meta-isar/isar-image-base: switch use isar-cfg-localepurge claudius.heine.ext
  2018-05-23 14:03 ` [PATCH v2 0/3] One-shot configuration packages Henning Schild
  3 siblings, 1 reply; 11+ messages in thread
From: claudius.heine.ext @ 2018-05-23 13:12 UTC (permalink / raw)
  To: isar-users; +Cc: Claudius Heine

From: Claudius Heine <ch@denx.de>

The package 'isar-cfg-localepurge' is used to set the locales of the
root file system and purge all not required locales.

Signed-off-by: Claudius Heine <ch@denx.de>
---
 .../isar-cfg-localepurge/files/locale.debconf | 12 ++++++++
 .../isar-cfg-localepurge/files/locale.gen     |  1 +
 .../isar-cfg-localepurge/files/postinst       | 30 +++++++++++++++++++
 .../isar-cfg-localepurge.bb                   | 19 ++++++++++++
 4 files changed, 62 insertions(+)
 create mode 100644 meta/recipes-support/isar-cfg-localepurge/files/locale.debconf
 create mode 100644 meta/recipes-support/isar-cfg-localepurge/files/locale.gen
 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/locale.debconf b/meta/recipes-support/isar-cfg-localepurge/files/locale.debconf
new file mode 100644
index 0000000..169c071
--- /dev/null
+++ b/meta/recipes-support/isar-cfg-localepurge/files/locale.debconf
@@ -0,0 +1,12 @@
+locales	locales/locales_to_be_generated	multiselect	en_US.UTF-8 UTF-8
+locales	locales/default_environment_locale	select	en_US.UTF-8
+
+localepurge	localepurge/dontbothernew	boolean	true
+localepurge	localepurge/nopurge	multiselect	en, en_US, en_US.UTF-8
+localepurge	localepurge/use-dpkg-feature	boolean	false
+localepurge	localepurge/verbose	boolean	false
+localepurge	localepurge/showfreedspace	boolean	false
+localepurge	localepurge/none_selected	boolean	false
+localepurge	localepurge/mandelete	boolean	true
+localepurge	localepurge/quickndirtycalc	boolean	false
+localepurge	localepurge/remove_no	note
diff --git a/meta/recipes-support/isar-cfg-localepurge/files/locale.gen b/meta/recipes-support/isar-cfg-localepurge/files/locale.gen
new file mode 100644
index 0000000..a66d814
--- /dev/null
+++ b/meta/recipes-support/isar-cfg-localepurge/files/locale.gen
@@ -0,0 +1 @@
+en_US.UTF-8 UTF-8
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..3ef93cd
--- /dev/null
+++ b/meta/recipes-support/isar-cfg-localepurge/files/postinst
@@ -0,0 +1,30 @@
+#!/bin/sh
+set -e
+
+cat /usr/local/etc/isar-cfg-localepurge/locale.gen \
+	>> /etc/locale.gen
+
+debconf-set-selections /usr/local/etc/isar-cfg-localepurge/locale.debconf
+
+# locale.nopurge needs to be removed before localepurge is reconfigured.
+# Otherwise it would set the debconf to the values from the locale.nopurge
+# file again.
+rm -rf /etc/locale.nopurge
+dpkg-reconfigure -f noninteractive locales localepurge
+
+# When /etc/locale.nopurge was removed before dpkg-reconfigure, it writes
+# the new configuration with the '.ucf-dist' postfix
+mv /etc/locale.nopurge.ucf-dist /etc/locale.nopurge
+
+# Now reconfigure it localpurge again, because otherwise it would complain:
+#     Some new locales have appeared on your system:
+#
+#     bal be@latin en@boldquot en@quot sr@latin
+#
+#     They will not be touched until you reconfigure localepurge
+#     with the following command:
+#
+#         dpkg-reconfigure localepurge
+dpkg-reconfigure -f noninteractive localepurge
+
+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..b68a6d0
--- /dev/null
+++ b/meta/recipes-support/isar-cfg-localepurge/isar-cfg-localepurge.bb
@@ -0,0 +1,19 @@
+# This software is a part of ISAR.
+
+DESCRIPTION = "Isar configuration package for locale and localepurge"
+MAINTAINER = "isar-users <isar-users@googlegroups.com>"
+DEBIAN_DEPENDS = "localepurge"
+
+SRC_URI = "file://locale.debconf \
+	   file://locale.gen \
+	   file://postinst"
+
+inherit dpkg-raw
+
+do_install() {
+	install -v -d ${D}/usr/local/etc/${PN}
+	install -v -m 644 ${WORKDIR}/locale.debconf \
+                          ${D}/usr/local/etc/${PN}/locale.debconf
+	install -v -m 644 ${WORKDIR}/locale.gen \
+                          ${D}/usr/local/etc/${PN}/locale.gen
+}
-- 
2.17.0


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH v2 3/3] meta-isar/isar-image-base: switch use isar-cfg-localepurge
  2018-05-23 13:12 [PATCH v2 0/3] One-shot configuration packages claudius.heine.ext
  2018-05-23 13:12 ` [PATCH v2 1/3] isar-bootstrap|configscript: implement one shot config option claudius.heine.ext
  2018-05-23 13:12 ` [PATCH v2 2/3] meta/isar-cfg-localepurge: added locale purge recipe claudius.heine.ext
@ 2018-05-23 13:12 ` claudius.heine.ext
  2018-05-23 14:03 ` [PATCH v2 0/3] One-shot configuration packages Henning Schild
  3 siblings, 0 replies; 11+ messages in thread
From: claudius.heine.ext @ 2018-05-23 13:12 UTC (permalink / raw)
  To: isar-users; +Cc: Claudius Heine

From: Claudius Heine <ch@denx.de>

This patch removes the locale setting from the *-configscripts and
instead uses the isar-cfg-localepurge configuration package.

The advantange is that the package 'localepurge' is no longer installed
on every image and locale settings is done in a central place.

Signed-off-by: Claudius Heine <ch@denx.de>
---
 .../recipes-core/images/files/debian-configscript.sh   |  8 --------
 .../recipes-core/images/files/raspbian-configscript.sh |  7 -------
 meta-isar/recipes-core/images/isar-image-base.bb       |  6 +++---
 meta/recipes-core/isar-bootstrap/files/locale.nopurge  | 10 ----------
 meta/recipes-core/isar-bootstrap/isar-bootstrap.bb     |  4 +---
 5 files changed, 4 insertions(+), 31 deletions(-)
 delete mode 100644 meta/recipes-core/isar-bootstrap/files/locale.nopurge

diff --git a/meta-isar/recipes-core/images/files/debian-configscript.sh b/meta-isar/recipes-core/images/files/debian-configscript.sh
index 9b3ff30..136918c 100755
--- a/meta-isar/recipes-core/images/files/debian-configscript.sh
+++ b/meta-isar/recipes-core/images/files/debian-configscript.sh
@@ -10,11 +10,6 @@ readonly BAUDRATE_TTY="$2"
 readonly ROOTFS_DEV="$3"
 readonly ROOTFS_TYPE="$4"
 
-debconf-set-selections <<END
-locales locales/locales_to_be_generated multiselect en_US.UTF-8 UTF-8
-locales locales/default_environment_locale select en_US.UTF-8
-END
-
 cat > /etc/fstab << EOF
 # Begin /etc/fstab
 /dev/$ROOTFS_DEV	/		$ROOTFS_TYPE		defaults		1	1
@@ -37,6 +32,3 @@ if [ -f /etc/inittab ]; then
     echo "T0:23:respawn:/sbin/getty -L $MACHINE_SERIAL $BAUDRATE_TTY vt100" \
         >> /etc/inittab
 fi
-
-# Purge unused locale and installed packages' .deb files
-localepurge
diff --git a/meta-isar/recipes-core/images/files/raspbian-configscript.sh b/meta-isar/recipes-core/images/files/raspbian-configscript.sh
index 448dea5..04ea571 100644
--- a/meta-isar/recipes-core/images/files/raspbian-configscript.sh
+++ b/meta-isar/recipes-core/images/files/raspbian-configscript.sh
@@ -10,11 +10,6 @@ readonly BAUDRATE_TTY="$2"
 readonly ROOTFS_DEV="$3"
 readonly ROOTFS_TYPE="$4"
 
-debconf-set-selections <<END
-locales locales/locales_to_be_generated multiselect en_US.UTF-8 UTF-8
-locales locales/default_environment_locale select en_US.UTF-8
-END
-
 cat > /etc/fstab << EOF
 # Begin /etc/fstab
 /dev/$ROOTFS_DEV	/		$ROOTFS_TYPE		defaults		1	1
@@ -38,5 +33,3 @@ KERNEL_IMAGE=`ls /boot | grep vmlinuz`
 cat > /boot/config.txt << EOF
 kernel=$KERNEL_IMAGE
 EOF
-
-localepurge
diff --git a/meta-isar/recipes-core/images/isar-image-base.bb b/meta-isar/recipes-core/images/isar-image-base.bb
index baac531..beb6f14 100644
--- a/meta-isar/recipes-core/images/isar-image-base.bb
+++ b/meta-isar/recipes-core/images/isar-image-base.bb
@@ -16,11 +16,11 @@ PV = "1.0"
 inherit image
 inherit isar-bootstrap-helper
 
-DEPENDS += "${IMAGE_INSTALL}"
+DEPENDS += "${IMAGE_INSTALL} ${IMAGE_CFG_PACKAGE}"
 
 IMAGE_PREINSTALL += "apt \
-                     dbus \
-                     localepurge"
+                     dbus"
+IMAGE_CFG_PACKAGE += "isar-cfg-localepurge"
 
 WORKDIR = "${TMPDIR}/work/${DISTRO}-${DISTRO_ARCH}/${PN}"
 
diff --git a/meta/recipes-core/isar-bootstrap/files/locale.nopurge b/meta/recipes-core/isar-bootstrap/files/locale.nopurge
deleted file mode 100644
index 510d40c..0000000
--- a/meta/recipes-core/isar-bootstrap/files/locale.nopurge
+++ /dev/null
@@ -1,10 +0,0 @@
-# Remove localized man pages
-MANDELETE
-
-# Delete new locales which appear on the system without bothering you
-DONTBOTHERNEWLOCALE
-
-# Keep these locales after package installations via apt-get(8)
-en
-en_US
-en_US.UTF-8
diff --git a/meta/recipes-core/isar-bootstrap/isar-bootstrap.bb b/meta/recipes-core/isar-bootstrap/isar-bootstrap.bb
index f894821..bb3992b 100644
--- a/meta/recipes-core/isar-bootstrap/isar-bootstrap.bb
+++ b/meta/recipes-core/isar-bootstrap/isar-bootstrap.bb
@@ -13,8 +13,7 @@ FILESPATH_prepend := "${THISDIR}/files:"
 SRC_URI = " \
     file://isar-apt.conf \
     file://isar-apt-fallback.conf \
-    file://locale \
-    file://locale.nopurge"
+    file://locale"
 PV = "1.0"
 
 WORKDIR = "${TMPDIR}/work/${DISTRO}-${DISTRO_ARCH}/${PN}"
@@ -196,7 +195,6 @@ addtask bootstrap before do_build after do_generate_keyring
 
 do_set_locale() {
     sudo install -v -m644 "${WORKDIR}/locale" "${ROOTFSDIR}/etc/locale"
-    sudo install -v -m644 "${WORKDIR}/locale.nopurge" "${ROOTFSDIR}/etc/locale.nopurge"
 
     sudo sed -i '/en_US.UTF-8 UTF-8/s/^#//g' "${ROOTFSDIR}/etc/locale.gen"
     sudo -E chroot "${ROOTFSDIR}" /usr/sbin/locale-gen
-- 
2.17.0


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH v2 0/3] One-shot configuration packages
  2018-05-23 13:12 [PATCH v2 0/3] One-shot configuration packages claudius.heine.ext
                   ` (2 preceding siblings ...)
  2018-05-23 13:12 ` [PATCH v2 3/3] meta-isar/isar-image-base: switch use isar-cfg-localepurge claudius.heine.ext
@ 2018-05-23 14:03 ` Henning Schild
  2018-05-24  8:38   ` Claudius Heine
  3 siblings, 1 reply; 11+ messages in thread
From: Henning Schild @ 2018-05-23 14:03 UTC (permalink / raw)
  To: [ext] claudius.heine.ext@siemens.com; +Cc: isar-users, Claudius Heine

Nice patchset. It follows the "everything that enters the rootfs should
come from a package" approach. And it introduced a nice hack to execute
scripts in the "last package", switching from the chrootable folder to
the image.
Things like removing qemu, resolv.conf etc could also be done in such a
"final" package postrm.

Henning

Am Wed, 23 May 2018 15:12:45 +0200
schrieb "[ext] claudius.heine.ext@siemens.com"
<claudius.heine.ext@siemens.com>:

> From: Claudius Heine <ch@denx.de>
> 
> Hi,
> 
> here is the rebased patchset that removes the issue with the global
> localepurge configuration as well.
> 
> Claudius
> 
> Changes from v1:
>  - rebased to current next
>  - removed locale.nopurge setup in isar-bootstrap
> 
> Claudius Heine (3):
>   isar-bootstrap|configscript: implement one shot config option
>   meta/isar-cfg-localepurge: added locale purge recipe
>   meta-isar/isar-image-base: switch use isar-cfg-localepurge
> 
>  .../images/files/debian-configscript.sh       |  9 ------
>  .../images/files/raspbian-configscript.sh     |  8 -----
>  .../recipes-core/images/isar-image-base.bb    |  6 ++--
>  meta/classes/isar-bootstrap-helper.bbclass    | 23 +++++++++++---
>  .../isar-bootstrap/files/locale.nopurge       | 10 -------
>  .../isar-bootstrap/isar-bootstrap.bb          |  4 +--
>  .../isar-cfg-localepurge/files/locale.debconf | 12 ++++++++
>  .../isar-cfg-localepurge/files/locale.gen     |  1 +
>  .../isar-cfg-localepurge/files/postinst       | 30
> +++++++++++++++++++ .../isar-cfg-localepurge.bb                   |
> 19 ++++++++++++ 10 files changed, 85 insertions(+), 37 deletions(-)
>  delete mode 100644
> meta/recipes-core/isar-bootstrap/files/locale.nopurge create mode
> 100644 meta/recipes-support/isar-cfg-localepurge/files/locale.debconf
> create mode 100644
> meta/recipes-support/isar-cfg-localepurge/files/locale.gen create
> mode 100644 meta/recipes-support/isar-cfg-localepurge/files/postinst
> create mode 100644
> meta/recipes-support/isar-cfg-localepurge/isar-cfg-localepurge.bb
> 


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH v2 1/3] isar-bootstrap|configscript: implement one shot config option
  2018-05-23 13:12 ` [PATCH v2 1/3] isar-bootstrap|configscript: implement one shot config option claudius.heine.ext
@ 2018-05-23 14:06   ` Henning Schild
  2018-05-24  7:06     ` Claudius Heine
  0 siblings, 1 reply; 11+ messages in thread
From: Henning Schild @ 2018-05-23 14:06 UTC (permalink / raw)
  To: [ext] claudius.heine.ext@siemens.com; +Cc: isar-users, Claudius Heine

Am Wed, 23 May 2018 15:12:46 +0200
schrieb "[ext] claudius.heine.ext@siemens.com"
<claudius.heine.ext@siemens.com>:

> From: Claudius Heine <ch@denx.de>
> 
> Some configuration tasks on the image require certain other packages,
> but those packages might not be required on the final image.
> 
> One way to solve this is use a special package that is installed to
> the image and then removed again. When installing it makes certain
> that all required packages are installed to the image as well. Then
> the image can be configured in the postinst hook. When this package
> is removed and all unused dependencies are removed as well, no not
> required packages used by this package should remain on the image.
> 
> Signed-off-by: Claudius Heine <ch@denx.de>
> ---
>  .../images/files/debian-configscript.sh       |  1 -
>  .../images/files/raspbian-configscript.sh     |  1 -
>  meta/classes/isar-bootstrap-helper.bbclass    | 23
> +++++++++++++++---- 3 files changed, 19 insertions(+), 6 deletions(-)
> 
> diff --git
> a/meta-isar/recipes-core/images/files/debian-configscript.sh
> b/meta-isar/recipes-core/images/files/debian-configscript.sh index
> 7ca0562..9b3ff30 100755 ---
> a/meta-isar/recipes-core/images/files/debian-configscript.sh +++
> b/meta-isar/recipes-core/images/files/debian-configscript.sh @@ -40,4
> +40,3 @@ fi # Purge unused locale and installed packages' .deb files
>  localepurge
> -apt-get clean
> diff --git
> a/meta-isar/recipes-core/images/files/raspbian-configscript.sh
> b/meta-isar/recipes-core/images/files/raspbian-configscript.sh index
> b240de9..448dea5 100644 ---
> a/meta-isar/recipes-core/images/files/raspbian-configscript.sh +++
> b/meta-isar/recipes-core/images/files/raspbian-configscript.sh @@
> -40,4 +40,3 @@ kernel=$KERNEL_IMAGE EOF 
>  localepurge
> -apt-get clean
> diff --git a/meta/classes/isar-bootstrap-helper.bbclass
> b/meta/classes/isar-bootstrap-helper.bbclass index 4284d02..76e20f6
> 100644 --- a/meta/classes/isar-bootstrap-helper.bbclass
> +++ b/meta/classes/isar-bootstrap-helper.bbclass
> @@ -5,15 +5,17 @@
>  #
>  # SPDX-License-Identifier: MIT
>  
> +IMAGE_CFG_PACKAGE ??= ""
> +
>  setup_root_file_system() {
>      ROOTFSDIR="$1"
> -    CLEANHOSTLEAK="$2"
> +    CLEAN="$2"
>      shift
>      shift
>      PACKAGES="$@"
>      APT_ARGS="install --yes --allow-unauthenticated \
>                -o Debug::pkgProblemResolver=yes"

I guess if you take the "install" out you can reuse that a few more
times.

> -    CLEANHOSTLEAK_FILES="${ROOTFSDIR}/etc/hostname
> ${ROOTFSDIR}/etc/resolv.conf"
> +    CLEAN_FILES="${ROOTFSDIR}/etc/hostname
> ${ROOTFSDIR}/etc/resolv.conf" 
>      sudo cp -Trpfx \
>          "${DEPLOY_DIR_IMAGE}/isar-bootstrap-${DISTRO}-${DISTRO_ARCH}/"
> \ @@ -41,8 +43,21 @@ setup_root_file_system() {
>          -o Dir::Etc::sourceparts="-" \
>          -o APT::Get::List-Cleanup="0"
>      sudo -E chroot "$ROOTFSDIR" \
> -        /usr/bin/apt-get ${APT_ARGS} --download-only $PACKAGES
> -    [ "clean" = ${CLEANHOSTLEAK} ] && sudo rm -f
> ${CLEANHOSTLEAK_FILES}
> +        /usr/bin/apt-get ${APT_ARGS} --download-only $PACKAGES \
> +            ${IMAGE_CFG_PACKAGE}
> +    [ "clean" = ${CLEAN} ] && sudo rm -f ${CLEAN_FILES}
>      sudo -E chroot "$ROOTFSDIR" \
>          /usr/bin/apt-get ${APT_ARGS} $PACKAGES
> +    if [ -n "${IMAGE_CFG_PACKAGE}" ]; then
> +        sudo -E chroot "$ROOTFSDIR" \
> +            /usr/bin/apt-get ${APT_ARGS} ${IMAGE_CFG_PACKAGE}

Say we have multiple packages here, are we sure apt-get will get the
order right?
Would it make sense to use a loop to deal with potential lists and
their order?

Henning

> +        sudo -E chroot "$ROOTFSDIR" \
> +            /usr/bin/apt-get purge -y ${IMAGE_CFG_PACKAGE}
> +    fi
> +    if [ "clean" = ${CLEAN} ]; then
> +        sudo -E chroot "$ROOTFSDIR" \
> +            /usr/bin/apt-get autoremove --purge -y
> +        sudo -E chroot "$ROOTFSDIR" \
> +            /usr/bin/apt-get clean
> +    fi
>  }


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH v2 2/3] meta/isar-cfg-localepurge: added locale purge recipe
  2018-05-23 13:12 ` [PATCH v2 2/3] meta/isar-cfg-localepurge: added locale purge recipe claudius.heine.ext
@ 2018-05-23 14:16   ` Henning Schild
  2018-05-23 14:39     ` Claudius Heine
  0 siblings, 1 reply; 11+ messages in thread
From: Henning Schild @ 2018-05-23 14:16 UTC (permalink / raw)
  To: [ext] claudius.heine.ext@siemens.com; +Cc: isar-users, Claudius Heine

Am Wed, 23 May 2018 15:12:47 +0200
schrieb "[ext] claudius.heine.ext@siemens.com"
<claudius.heine.ext@siemens.com>:

> From: Claudius Heine <ch@denx.de>
> 
> The package 'isar-cfg-localepurge' is used to set the locales of the
> root file system and purge all not required locales.
> 
> Signed-off-by: Claudius Heine <ch@denx.de>
> ---
>  .../isar-cfg-localepurge/files/locale.debconf | 12 ++++++++
>  .../isar-cfg-localepurge/files/locale.gen     |  1 +
>  .../isar-cfg-localepurge/files/postinst       | 30
> +++++++++++++++++++ .../isar-cfg-localepurge.bb                   |
> 19 ++++++++++++ 4 files changed, 62 insertions(+)
>  create mode 100644
> meta/recipes-support/isar-cfg-localepurge/files/locale.debconf create
> mode 100644
> meta/recipes-support/isar-cfg-localepurge/files/locale.gen 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/locale.debconf
> b/meta/recipes-support/isar-cfg-localepurge/files/locale.debconf new
> file mode 100644 index 0000000..169c071 --- /dev/null
> +++ b/meta/recipes-support/isar-cfg-localepurge/files/locale.debconf
> @@ -0,0 +1,12 @@
> +locales	locales/locales_to_be_generated
> multiselect	en_US.UTF-8 UTF-8 +locales
> locales/default_environment_locale	select	en_US.UTF-8 +
> +localepurge	localepurge/dontbothernew	boolean
> true +localepurge	localepurge/nopurge
> multiselect	en, en_US, en_US.UTF-8 +localepurge
> localepurge/use-dpkg-feature	boolean	false
> +localepurge	localepurge/verbose	boolean	false
> +localepurge	localepurge/showfreedspace	boolean
> false +localepurge	localepurge/none_selected
> boolean	false +localepurge	localepurge/mandelete
> boolean	true +localepurge
> localepurge/quickndirtycalc	boolean	false
> +localepurge	localepurge/remove_no	note diff --git
> a/meta/recipes-support/isar-cfg-localepurge/files/locale.gen
> b/meta/recipes-support/isar-cfg-localepurge/files/locale.gen new file
> mode 100644 index 0000000..a66d814 --- /dev/null +++
> b/meta/recipes-support/isar-cfg-localepurge/files/locale.gen @@ -0,0
> +1 @@ +en_US.UTF-8 UTF-8
> 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..3ef93cd
> --- /dev/null
> +++ b/meta/recipes-support/isar-cfg-localepurge/files/postinst
> @@ -0,0 +1,30 @@
> +#!/bin/sh
> +set -e
> +
> +cat /usr/local/etc/isar-cfg-localepurge/locale.gen \
> +	>> /etc/locale.gen

All of this is pretty evil. This package is installed last, so if i had
any package before it dealing with locales ... Would i need to remember
to clear IMAGE_CFG_PACKAGE?
I guess some checking should be done before proceeding here.

And thinking about it, do we not need to set the locales very early? I
remember all the perl warning in buildchroot.

> +debconf-set-selections /usr/local/etc/isar-cfg-localepurge/locale.debconf
> +
> +# locale.nopurge needs to be removed before localepurge is
> reconfigured. +# Otherwise it would set the debconf to the values
> from the locale.nopurge +# file again.
> +rm -rf /etc/locale.nopurge
> +dpkg-reconfigure -f noninteractive locales localepurge
> +
> +# When /etc/locale.nopurge was removed before dpkg-reconfigure, it
> writes +# the new configuration with the '.ucf-dist' postfix
> +mv /etc/locale.nopurge.ucf-dist /etc/locale.nopurge
> +
> +# Now reconfigure it localpurge again, because otherwise it would
> complain: +#     Some new locales have appeared on your system:
> +#
> +#     bal be@latin en@boldquot en@quot sr@latin
> +#
> +#     They will not be touched until you reconfigure localepurge
> +#     with the following command:
> +#
> +#         dpkg-reconfigure localepurge
> +dpkg-reconfigure -f noninteractive localepurge
> +
> +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..b68a6d0 --- /dev/null
> +++
> b/meta/recipes-support/isar-cfg-localepurge/isar-cfg-localepurge.bb
> @@ -0,0 +1,19 @@ +# This software is a part of ISAR.
> +
> +DESCRIPTION = "Isar configuration package for locale and localepurge"
> +MAINTAINER = "isar-users <isar-users@googlegroups.com>"
> +DEBIAN_DEPENDS = "localepurge"
> +
> +SRC_URI = "file://locale.debconf \
> +	   file://locale.gen \
> +	   file://postinst"
> +
> +inherit dpkg-raw
> +
> +do_install() {
> +	install -v -d ${D}/usr/local/etc/${PN}
> +	install -v -m 644 ${WORKDIR}/locale.debconf \
> +                          ${D}/usr/local/etc/${PN}/locale.debconf

/usr/local/ suggests that we are not under package manager regime here,
i googled it for a similar need and came to the conclusion
that /usr/lib/${PN} would be the right place for such files. Or pack
them into postinst as self extracting tar to gain a "staging area". In
your case the package gets removed so you do not have to worry about
potential copies. Still the location should not be /usr/local/...

Henning

> +	install -v -m 644 ${WORKDIR}/locale.gen \
> +                          ${D}/usr/local/etc/${PN}/locale.gen
> +}


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH v2 2/3] meta/isar-cfg-localepurge: added locale purge recipe
  2018-05-23 14:16   ` Henning Schild
@ 2018-05-23 14:39     ` Claudius Heine
  0 siblings, 0 replies; 11+ messages in thread
From: Claudius Heine @ 2018-05-23 14:39 UTC (permalink / raw)
  To: Henning Schild; +Cc: isar-users, Claudius Heine

Hi Henning,

On 2018-05-23 16:16, Henning Schild wrote:
> Am Wed, 23 May 2018 15:12:47 +0200
> schrieb "[ext] claudius.heine.ext@siemens.com"
> <claudius.heine.ext@siemens.com>:
> 
>> From: Claudius Heine <ch@denx.de>
>>
>> The package 'isar-cfg-localepurge' is used to set the locales of the
>> root file system and purge all not required locales.
>>
>> Signed-off-by: Claudius Heine <ch@denx.de>
>> ---
>>   .../isar-cfg-localepurge/files/locale.debconf | 12 ++++++++
>>   .../isar-cfg-localepurge/files/locale.gen     |  1 +
>>   .../isar-cfg-localepurge/files/postinst       | 30
>> +++++++++++++++++++ .../isar-cfg-localepurge.bb                   |
>> 19 ++++++++++++ 4 files changed, 62 insertions(+)
>>   create mode 100644
>> meta/recipes-support/isar-cfg-localepurge/files/locale.debconf create
>> mode 100644
>> meta/recipes-support/isar-cfg-localepurge/files/locale.gen 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/locale.debconf
>> b/meta/recipes-support/isar-cfg-localepurge/files/locale.debconf new
>> file mode 100644 index 0000000..169c071 --- /dev/null
>> +++ b/meta/recipes-support/isar-cfg-localepurge/files/locale.debconf
>> @@ -0,0 +1,12 @@
>> +locales	locales/locales_to_be_generated
>> multiselect	en_US.UTF-8 UTF-8 +locales
>> locales/default_environment_locale	select	en_US.UTF-8 +
>> +localepurge	localepurge/dontbothernew	boolean
>> true +localepurge	localepurge/nopurge
>> multiselect	en, en_US, en_US.UTF-8 +localepurge
>> localepurge/use-dpkg-feature	boolean	false
>> +localepurge	localepurge/verbose	boolean	false
>> +localepurge	localepurge/showfreedspace	boolean
>> false +localepurge	localepurge/none_selected
>> boolean	false +localepurge	localepurge/mandelete
>> boolean	true +localepurge
>> localepurge/quickndirtycalc	boolean	false
>> +localepurge	localepurge/remove_no	note diff --git
>> a/meta/recipes-support/isar-cfg-localepurge/files/locale.gen
>> b/meta/recipes-support/isar-cfg-localepurge/files/locale.gen new file
>> mode 100644 index 0000000..a66d814 --- /dev/null +++
>> b/meta/recipes-support/isar-cfg-localepurge/files/locale.gen @@ -0,0
>> +1 @@ +en_US.UTF-8 UTF-8
>> 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..3ef93cd
>> --- /dev/null
>> +++ b/meta/recipes-support/isar-cfg-localepurge/files/postinst
>> @@ -0,0 +1,30 @@
>> +#!/bin/sh
>> +set -e
>> +
>> +cat /usr/local/etc/isar-cfg-localepurge/locale.gen \
>> +	>> /etc/locale.gen
> 
> All of this is pretty evil. This package is installed last, so if i had
> any package before it dealing with locales ... Would i need to remember
> to clear IMAGE_CFG_PACKAGE?
> I guess some checking should be done before proceeding here.
> 
> And thinking about it, do we not need to set the locales very early? I
> remember all the perl warning in buildchroot.

I would still like to set the base locale in isar-bootstrap like its 
done in Alexs patchset. This avoids perl warnings. But that should just 
be a 'default' locale. The final locale should be done in a package like 
this.

Maybe we can generate some these settings by bitbake variables. 
Otherwise you could just overwrite the postinst script in your own 
bbappend to this recipe.

All your other suggestions are good and I will prepare a v2 with them.

Thanks a lot!
Claudius

> 
>> +debconf-set-selections /usr/local/etc/isar-cfg-localepurge/locale.debconf
>> +
>> +# locale.nopurge needs to be removed before localepurge is
>> reconfigured. +# Otherwise it would set the debconf to the values
>> from the locale.nopurge +# file again.
>> +rm -rf /etc/locale.nopurge
>> +dpkg-reconfigure -f noninteractive locales localepurge
>> +
>> +# When /etc/locale.nopurge was removed before dpkg-reconfigure, it
>> writes +# the new configuration with the '.ucf-dist' postfix
>> +mv /etc/locale.nopurge.ucf-dist /etc/locale.nopurge
>> +
>> +# Now reconfigure it localpurge again, because otherwise it would
>> complain: +#     Some new locales have appeared on your system:
>> +#
>> +#     bal be@latin en@boldquot en@quot sr@latin
>> +#
>> +#     They will not be touched until you reconfigure localepurge
>> +#     with the following command:
>> +#
>> +#         dpkg-reconfigure localepurge
>> +dpkg-reconfigure -f noninteractive localepurge
>> +
>> +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..b68a6d0 --- /dev/null
>> +++
>> b/meta/recipes-support/isar-cfg-localepurge/isar-cfg-localepurge.bb
>> @@ -0,0 +1,19 @@ +# This software is a part of ISAR.
>> +
>> +DESCRIPTION = "Isar configuration package for locale and localepurge"
>> +MAINTAINER = "isar-users <isar-users@googlegroups.com>"
>> +DEBIAN_DEPENDS = "localepurge"
>> +
>> +SRC_URI = "file://locale.debconf \
>> +	   file://locale.gen \
>> +	   file://postinst"
>> +
>> +inherit dpkg-raw
>> +
>> +do_install() {
>> +	install -v -d ${D}/usr/local/etc/${PN}
>> +	install -v -m 644 ${WORKDIR}/locale.debconf \
>> +                          ${D}/usr/local/etc/${PN}/locale.debconf
> 
> /usr/local/ suggests that we are not under package manager regime here,
> i googled it for a similar need and came to the conclusion
> that /usr/lib/${PN} would be the right place for such files. Or pack
> them into postinst as self extracting tar to gain a "staging area". In
> your case the package gets removed so you do not have to worry about
> potential copies. Still the location should not be /usr/local/... >
> Henning
> 
>> +	install -v -m 644 ${WORKDIR}/locale.gen \
>> +                          ${D}/usr/local/etc/${PN}/locale.gen
>> +}
> 

-- 
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-54 Fax: (+49)-8142-66989-80 Email: ch@denx.de

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH v2 1/3] isar-bootstrap|configscript: implement one shot config option
  2018-05-23 14:06   ` Henning Schild
@ 2018-05-24  7:06     ` Claudius Heine
  2018-05-24  8:57       ` Henning Schild
  0 siblings, 1 reply; 11+ messages in thread
From: Claudius Heine @ 2018-05-24  7:06 UTC (permalink / raw)
  To: Henning Schild; +Cc: isar-users, Claudius Heine

Hi Henning,

On 2018-05-23 16:06, Henning Schild wrote:
> Am Wed, 23 May 2018 15:12:46 +0200
> schrieb "[ext] claudius.heine.ext@siemens.com"
> <claudius.heine.ext@siemens.com>:
> 
>> From: Claudius Heine <ch@denx.de>
>>
>> Some configuration tasks on the image require certain other packages,
>> but those packages might not be required on the final image.
>>
>> One way to solve this is use a special package that is installed to
>> the image and then removed again. When installing it makes certain
>> that all required packages are installed to the image as well. Then
>> the image can be configured in the postinst hook. When this package
>> is removed and all unused dependencies are removed as well, no not
>> required packages used by this package should remain on the image.
>>
>> Signed-off-by: Claudius Heine <ch@denx.de>
>> ---
>>   .../images/files/debian-configscript.sh       |  1 -
>>   .../images/files/raspbian-configscript.sh     |  1 -
>>   meta/classes/isar-bootstrap-helper.bbclass    | 23
>> +++++++++++++++---- 3 files changed, 19 insertions(+), 6 deletions(-)
>>
>> diff --git
>> a/meta-isar/recipes-core/images/files/debian-configscript.sh
>> b/meta-isar/recipes-core/images/files/debian-configscript.sh index
>> 7ca0562..9b3ff30 100755 ---
>> a/meta-isar/recipes-core/images/files/debian-configscript.sh +++
>> b/meta-isar/recipes-core/images/files/debian-configscript.sh @@ -40,4
>> +40,3 @@ fi # Purge unused locale and installed packages' .deb files
>>   localepurge
>> -apt-get clean
>> diff --git
>> a/meta-isar/recipes-core/images/files/raspbian-configscript.sh
>> b/meta-isar/recipes-core/images/files/raspbian-configscript.sh index
>> b240de9..448dea5 100644 ---
>> a/meta-isar/recipes-core/images/files/raspbian-configscript.sh +++
>> b/meta-isar/recipes-core/images/files/raspbian-configscript.sh @@
>> -40,4 +40,3 @@ kernel=$KERNEL_IMAGE EOF
>>   localepurge
>> -apt-get clean
>> diff --git a/meta/classes/isar-bootstrap-helper.bbclass
>> b/meta/classes/isar-bootstrap-helper.bbclass index 4284d02..76e20f6
>> 100644 --- a/meta/classes/isar-bootstrap-helper.bbclass
>> +++ b/meta/classes/isar-bootstrap-helper.bbclass
>> @@ -5,15 +5,17 @@
>>   #
>>   # SPDX-License-Identifier: MIT
>>   
>> +IMAGE_CFG_PACKAGE ??= ""
>> +
>>   setup_root_file_system() {
>>       ROOTFSDIR="$1"
>> -    CLEANHOSTLEAK="$2"
>> +    CLEAN="$2"
>>       shift
>>       shift
>>       PACKAGES="$@"
>>       APT_ARGS="install --yes --allow-unauthenticated \
>>                 -o Debug::pkgProblemResolver=yes"
> 
> I guess if you take the "install" out you can reuse that a few more
> times.

Where? I only see purge and autoremove that doesn't use it already. 
Replaceing '-y' with '${APT_ARGS}' there does seem like an overkill, 
does it not? The other options in it don't do much for purge and 
autoremove AFAIK.

If you think of this as a general improvement to have the command 
outside of the 'APT_ARGS' variable for readability reasons, then I 
agree, but that would be a different patch.

> 
>> -    CLEANHOSTLEAK_FILES="${ROOTFSDIR}/etc/hostname
>> ${ROOTFSDIR}/etc/resolv.conf"
>> +    CLEAN_FILES="${ROOTFSDIR}/etc/hostname
>> ${ROOTFSDIR}/etc/resolv.conf"
>>       sudo cp -Trpfx \
>>           "${DEPLOY_DIR_IMAGE}/isar-bootstrap-${DISTRO}-${DISTRO_ARCH}/"
>> \ @@ -41,8 +43,21 @@ setup_root_file_system() {
>>           -o Dir::Etc::sourceparts="-" \
>>           -o APT::Get::List-Cleanup="0"
>>       sudo -E chroot "$ROOTFSDIR" \
>> -        /usr/bin/apt-get ${APT_ARGS} --download-only $PACKAGES
>> -    [ "clean" = ${CLEANHOSTLEAK} ] && sudo rm -f
>> ${CLEANHOSTLEAK_FILES}
>> +        /usr/bin/apt-get ${APT_ARGS} --download-only $PACKAGES \
>> +            ${IMAGE_CFG_PACKAGE}
>> +    [ "clean" = ${CLEAN} ] && sudo rm -f ${CLEAN_FILES}
>>       sudo -E chroot "$ROOTFSDIR" \
>>           /usr/bin/apt-get ${APT_ARGS} $PACKAGES
>> +    if [ -n "${IMAGE_CFG_PACKAGE}" ]; then
>> +        sudo -E chroot "$ROOTFSDIR" \
>> +            /usr/bin/apt-get ${APT_ARGS} ${IMAGE_CFG_PACKAGE}
> 
> Say we have multiple packages here, are we sure apt-get will get the
> order right?
> Would it make sense to use a loop to deal with potential lists and
> their order?
> 
> Henning
> 
>> +        sudo -E chroot "$ROOTFSDIR" \
>> +            /usr/bin/apt-get purge -y ${IMAGE_CFG_PACKAGE}
>> +    fi
>> +    if [ "clean" = ${CLEAN} ]; then
>> +        sudo -E chroot "$ROOTFSDIR" \
>> +            /usr/bin/apt-get autoremove --purge -y
>> +        sudo -E chroot "$ROOTFSDIR" \
>> +            /usr/bin/apt-get clean
>> +    fi
>>   }
> 

-- 
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-54 Fax: (+49)-8142-66989-80 Email: ch@denx.de

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH v2 0/3] One-shot configuration packages
  2018-05-23 14:03 ` [PATCH v2 0/3] One-shot configuration packages Henning Schild
@ 2018-05-24  8:38   ` Claudius Heine
  0 siblings, 0 replies; 11+ messages in thread
From: Claudius Heine @ 2018-05-24  8:38 UTC (permalink / raw)
  To: Henning Schild; +Cc: isar-users, Claudius Heine

Hi Henning,

On 2018-05-23 16:03, Henning Schild wrote:
> Nice patchset. It follows the "everything that enters the rootfs should
> come from a package" approach. And it introduced a nice hack to execute
> scripts in the "last package", switching from the chrootable folder to
> the image.
> Things like removing qemu, resolv.conf etc could also be done in such a
> "final" package postrm.

I initially liked the idea about removing qemu with a package, but I 
don't think that is possible. After removal of this binary no commands 
can be executed in the chroot environment, and we still need to purge 
the package and cleanup the dependencies/cache etc. AFAIK it needs to be 
done from outside.

For removal of for hostname and resolv.conf I am not so sure. IMO that 
should be done before any custom package is installed. This way the 
deployment of those files can be done by any package and those files are 
managed by dpkg.

I currently cannot think of anything that should/could be 
installed/executed/removed this way apart from localepurge. But there 
might be more administrative tasks that could be done this way.

I thought about moving the locale config outside the 
isar-cfg-localepurge package, but since I don't actually deploy any 
locale config files, and just modify the debconf + reconfigure the 
locales package its ok here IMO. And it might be useful to have the 
whole locales configuration in one place.

Claudius

> 
> Henning
> 
> Am Wed, 23 May 2018 15:12:45 +0200
> schrieb "[ext] claudius.heine.ext@siemens.com"
> <claudius.heine.ext@siemens.com>:
> 
>> From: Claudius Heine <ch@denx.de>
>>
>> Hi,
>>
>> here is the rebased patchset that removes the issue with the global
>> localepurge configuration as well.
>>
>> Claudius
>>
>> Changes from v1:
>>   - rebased to current next
>>   - removed locale.nopurge setup in isar-bootstrap
>>
>> Claudius Heine (3):
>>    isar-bootstrap|configscript: implement one shot config option
>>    meta/isar-cfg-localepurge: added locale purge recipe
>>    meta-isar/isar-image-base: switch use isar-cfg-localepurge
>>
>>   .../images/files/debian-configscript.sh       |  9 ------
>>   .../images/files/raspbian-configscript.sh     |  8 -----
>>   .../recipes-core/images/isar-image-base.bb    |  6 ++--
>>   meta/classes/isar-bootstrap-helper.bbclass    | 23 +++++++++++---
>>   .../isar-bootstrap/files/locale.nopurge       | 10 -------
>>   .../isar-bootstrap/isar-bootstrap.bb          |  4 +--
>>   .../isar-cfg-localepurge/files/locale.debconf | 12 ++++++++
>>   .../isar-cfg-localepurge/files/locale.gen     |  1 +
>>   .../isar-cfg-localepurge/files/postinst       | 30
>> +++++++++++++++++++ .../isar-cfg-localepurge.bb                   |
>> 19 ++++++++++++ 10 files changed, 85 insertions(+), 37 deletions(-)
>>   delete mode 100644
>> meta/recipes-core/isar-bootstrap/files/locale.nopurge create mode
>> 100644 meta/recipes-support/isar-cfg-localepurge/files/locale.debconf
>> create mode 100644
>> meta/recipes-support/isar-cfg-localepurge/files/locale.gen create
>> mode 100644 meta/recipes-support/isar-cfg-localepurge/files/postinst
>> create mode 100644
>> meta/recipes-support/isar-cfg-localepurge/isar-cfg-localepurge.bb
>>
> 

-- 
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-54 Fax: (+49)-8142-66989-80 Email: ch@denx.de

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH v2 1/3] isar-bootstrap|configscript: implement one shot config option
  2018-05-24  7:06     ` Claudius Heine
@ 2018-05-24  8:57       ` Henning Schild
  0 siblings, 0 replies; 11+ messages in thread
From: Henning Schild @ 2018-05-24  8:57 UTC (permalink / raw)
  To: Claudius Heine; +Cc: isar-users, Claudius Heine

Am Thu, 24 May 2018 09:06:56 +0200
schrieb Claudius Heine <claudius.heine.ext@siemens.com>:

> Hi Henning,
> 
> On 2018-05-23 16:06, Henning Schild wrote:
> > Am Wed, 23 May 2018 15:12:46 +0200
> > schrieb "[ext] claudius.heine.ext@siemens.com"
> > <claudius.heine.ext@siemens.com>:
> >   
> >> From: Claudius Heine <ch@denx.de>
> >>
> >> Some configuration tasks on the image require certain other
> >> packages, but those packages might not be required on the final
> >> image.
> >>
> >> One way to solve this is use a special package that is installed to
> >> the image and then removed again. When installing it makes certain
> >> that all required packages are installed to the image as well. Then
> >> the image can be configured in the postinst hook. When this package
> >> is removed and all unused dependencies are removed as well, no not
> >> required packages used by this package should remain on the image.
> >>
> >> Signed-off-by: Claudius Heine <ch@denx.de>
> >> ---
> >>   .../images/files/debian-configscript.sh       |  1 -
> >>   .../images/files/raspbian-configscript.sh     |  1 -
> >>   meta/classes/isar-bootstrap-helper.bbclass    | 23
> >> +++++++++++++++---- 3 files changed, 19 insertions(+), 6
> >> deletions(-)
> >>
> >> diff --git
> >> a/meta-isar/recipes-core/images/files/debian-configscript.sh
> >> b/meta-isar/recipes-core/images/files/debian-configscript.sh index
> >> 7ca0562..9b3ff30 100755 ---
> >> a/meta-isar/recipes-core/images/files/debian-configscript.sh +++
> >> b/meta-isar/recipes-core/images/files/debian-configscript.sh @@
> >> -40,4 +40,3 @@ fi # Purge unused locale and installed
> >> packages' .deb files localepurge
> >> -apt-get clean
> >> diff --git
> >> a/meta-isar/recipes-core/images/files/raspbian-configscript.sh
> >> b/meta-isar/recipes-core/images/files/raspbian-configscript.sh
> >> index b240de9..448dea5 100644 ---
> >> a/meta-isar/recipes-core/images/files/raspbian-configscript.sh +++
> >> b/meta-isar/recipes-core/images/files/raspbian-configscript.sh @@
> >> -40,4 +40,3 @@ kernel=$KERNEL_IMAGE EOF
> >>   localepurge
> >> -apt-get clean
> >> diff --git a/meta/classes/isar-bootstrap-helper.bbclass
> >> b/meta/classes/isar-bootstrap-helper.bbclass index 4284d02..76e20f6
> >> 100644 --- a/meta/classes/isar-bootstrap-helper.bbclass
> >> +++ b/meta/classes/isar-bootstrap-helper.bbclass
> >> @@ -5,15 +5,17 @@
> >>   #
> >>   # SPDX-License-Identifier: MIT
> >>   
> >> +IMAGE_CFG_PACKAGE ??= ""
> >> +
> >>   setup_root_file_system() {
> >>       ROOTFSDIR="$1"
> >> -    CLEANHOSTLEAK="$2"
> >> +    CLEAN="$2"
> >>       shift
> >>       shift
> >>       PACKAGES="$@"
> >>       APT_ARGS="install --yes --allow-unauthenticated \
> >>                 -o Debug::pkgProblemResolver=yes"  
> > 
> > I guess if you take the "install" out you can reuse that a few more
> > times.  
> 
> Where? I only see purge and autoremove that doesn't use it already. 
> Replaceing '-y' with '${APT_ARGS}' there does seem like an overkill, 
> does it not? The other options in it don't do much for purge and 
> autoremove AFAIK.

I did not check whether the rest is usefull for purge etc. In that case
i would suggest to stick with "--yes" instead of "-y" just for
consistency.

Henning

> If you think of this as a general improvement to have the command 
> outside of the 'APT_ARGS' variable for readability reasons, then I 
> agree, but that would be a different patch.
> 
> >   
> >> -    CLEANHOSTLEAK_FILES="${ROOTFSDIR}/etc/hostname
> >> ${ROOTFSDIR}/etc/resolv.conf"
> >> +    CLEAN_FILES="${ROOTFSDIR}/etc/hostname
> >> ${ROOTFSDIR}/etc/resolv.conf"
> >>       sudo cp -Trpfx \
> >>           "${DEPLOY_DIR_IMAGE}/isar-bootstrap-${DISTRO}-${DISTRO_ARCH}/"
> >> \ @@ -41,8 +43,21 @@ setup_root_file_system() {
> >>           -o Dir::Etc::sourceparts="-" \
> >>           -o APT::Get::List-Cleanup="0"
> >>       sudo -E chroot "$ROOTFSDIR" \
> >> -        /usr/bin/apt-get ${APT_ARGS} --download-only $PACKAGES
> >> -    [ "clean" = ${CLEANHOSTLEAK} ] && sudo rm -f
> >> ${CLEANHOSTLEAK_FILES}
> >> +        /usr/bin/apt-get ${APT_ARGS} --download-only $PACKAGES \
> >> +            ${IMAGE_CFG_PACKAGE}
> >> +    [ "clean" = ${CLEAN} ] && sudo rm -f ${CLEAN_FILES}
> >>       sudo -E chroot "$ROOTFSDIR" \
> >>           /usr/bin/apt-get ${APT_ARGS} $PACKAGES
> >> +    if [ -n "${IMAGE_CFG_PACKAGE}" ]; then
> >> +        sudo -E chroot "$ROOTFSDIR" \
> >> +            /usr/bin/apt-get ${APT_ARGS} ${IMAGE_CFG_PACKAGE}  
> > 
> > Say we have multiple packages here, are we sure apt-get will get the
> > order right?
> > Would it make sense to use a loop to deal with potential lists and
> > their order?
> > 
> > Henning
> >   
> >> +        sudo -E chroot "$ROOTFSDIR" \
> >> +            /usr/bin/apt-get purge -y ${IMAGE_CFG_PACKAGE}
> >> +    fi
> >> +    if [ "clean" = ${CLEAN} ]; then
> >> +        sudo -E chroot "$ROOTFSDIR" \
> >> +            /usr/bin/apt-get autoremove --purge -y
> >> +        sudo -E chroot "$ROOTFSDIR" \
> >> +            /usr/bin/apt-get clean
> >> +    fi
> >>   }  
> >   
> 


^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2018-05-24  8:57 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-05-23 13:12 [PATCH v2 0/3] One-shot configuration packages claudius.heine.ext
2018-05-23 13:12 ` [PATCH v2 1/3] isar-bootstrap|configscript: implement one shot config option claudius.heine.ext
2018-05-23 14:06   ` Henning Schild
2018-05-24  7:06     ` Claudius Heine
2018-05-24  8:57       ` Henning Schild
2018-05-23 13:12 ` [PATCH v2 2/3] meta/isar-cfg-localepurge: added locale purge recipe claudius.heine.ext
2018-05-23 14:16   ` Henning Schild
2018-05-23 14:39     ` Claudius Heine
2018-05-23 13:12 ` [PATCH v2 3/3] meta-isar/isar-image-base: switch use isar-cfg-localepurge claudius.heine.ext
2018-05-23 14:03 ` [PATCH v2 0/3] One-shot configuration packages Henning Schild
2018-05-24  8:38   ` Claudius Heine

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox