* [PATCH v3 0/3] One-shot configuration packages
@ 2018-05-24 14:26 claudius.heine.ext
2018-05-24 14:26 ` [PATCH v3 1/3] isar-bootstrap|configscript: implement one shot config option claudius.heine.ext
` (2 more replies)
0 siblings, 3 replies; 7+ messages in thread
From: claudius.heine.ext @ 2018-05-24 14:26 UTC (permalink / raw)
To: isar-users; +Cc: Claudius Heine
From: Claudius Heine <ch@denx.de>
Hi,
here is the new version of this patchset. I integrated most of Hennings
suggestions.
Claudius
Changes from v2:
- Install one-shot package with a loop
- Rename '-y' apt parameter to '--yes'
- Move isar-cfg-localepurge files from /usr/local/etc to /usr/lib/
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] 7+ messages in thread
* [PATCH v3 1/3] isar-bootstrap|configscript: implement one shot config option
2018-05-24 14:26 [PATCH v3 0/3] One-shot configuration packages claudius.heine.ext
@ 2018-05-24 14:26 ` claudius.heine.ext
2018-05-24 15:45 ` Henning Schild
2018-05-24 14:26 ` [PATCH v3 2/3] meta/isar-cfg-localepurge: added locale purge recipe claudius.heine.ext
2018-05-24 14:26 ` [PATCH v3 3/3] meta-isar/isar-image-base: switch use isar-cfg-localepurge claudius.heine.ext
2 siblings, 1 reply; 7+ messages in thread
From: claudius.heine.ext @ 2018-05-24 14:26 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..1d21831 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
+ for pkg in ${IMAGE_CFG_PACKAGE}; do
+ sudo -E chroot "$ROOTFSDIR" \
+ /usr/bin/apt-get ${APT_ARGS} $pkg
+ sudo -E chroot "$ROOTFSDIR" \
+ /usr/bin/apt-get purge --yes $pkg
+ done
+ if [ "clean" = ${CLEAN} ]; then
+ sudo -E chroot "$ROOTFSDIR" \
+ /usr/bin/apt-get autoremove --purge --yes
+ sudo -E chroot "$ROOTFSDIR" \
+ /usr/bin/apt-get clean
+ fi
}
--
2.17.0
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH v3 2/3] meta/isar-cfg-localepurge: added locale purge recipe
2018-05-24 14:26 [PATCH v3 0/3] One-shot configuration packages claudius.heine.ext
2018-05-24 14:26 ` [PATCH v3 1/3] isar-bootstrap|configscript: implement one shot config option claudius.heine.ext
@ 2018-05-24 14:26 ` claudius.heine.ext
2018-05-24 14:26 ` [PATCH v3 3/3] meta-isar/isar-image-base: switch use isar-cfg-localepurge claudius.heine.ext
2 siblings, 0 replies; 7+ messages in thread
From: claudius.heine.ext @ 2018-05-24 14:26 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..092f12e
--- /dev/null
+++ b/meta/recipes-support/isar-cfg-localepurge/files/postinst
@@ -0,0 +1,30 @@
+#!/bin/sh
+set -e
+
+cat /usr/lib/isar-cfg-localepurge/locale.gen \
+ >> /etc/locale.gen
+
+debconf-set-selections /usr/lib/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..d2cf1f3
--- /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/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
+}
--
2.17.0
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH v3 3/3] meta-isar/isar-image-base: switch use isar-cfg-localepurge
2018-05-24 14:26 [PATCH v3 0/3] One-shot configuration packages claudius.heine.ext
2018-05-24 14:26 ` [PATCH v3 1/3] isar-bootstrap|configscript: implement one shot config option claudius.heine.ext
2018-05-24 14:26 ` [PATCH v3 2/3] meta/isar-cfg-localepurge: added locale purge recipe claudius.heine.ext
@ 2018-05-24 14:26 ` claudius.heine.ext
2 siblings, 0 replies; 7+ messages in thread
From: claudius.heine.ext @ 2018-05-24 14:26 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 1239f72..0d46d74 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] 7+ messages in thread
* Re: [PATCH v3 1/3] isar-bootstrap|configscript: implement one shot config option
2018-05-24 14:26 ` [PATCH v3 1/3] isar-bootstrap|configscript: implement one shot config option claudius.heine.ext
@ 2018-05-24 15:45 ` Henning Schild
2018-05-25 12:25 ` Maxim Yu. Osipov
0 siblings, 1 reply; 7+ messages in thread
From: Henning Schild @ 2018-05-24 15:45 UTC (permalink / raw)
To: [ext] claudius.heine.ext@siemens.com; +Cc: isar-users, Claudius Heine
Am Thu, 24 May 2018 16:26:33 +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..1d21831
> 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
> + for pkg in ${IMAGE_CFG_PACKAGE}; do
> + sudo -E chroot "$ROOTFSDIR" \
> + /usr/bin/apt-get ${APT_ARGS} $pkg
> + sudo -E chroot "$ROOTFSDIR" \
> + /usr/bin/apt-get purge --yes $pkg
> + done
Sorry for not pointing that out the first time. But if we loop we
should probably do that twice, on the purge in reverse order.
Henning
> + if [ "clean" = ${CLEAN} ]; then
> + sudo -E chroot "$ROOTFSDIR" \
> + /usr/bin/apt-get autoremove --purge --yes
> + sudo -E chroot "$ROOTFSDIR" \
> + /usr/bin/apt-get clean
> + fi
> }
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v3 1/3] isar-bootstrap|configscript: implement one shot config option
2018-05-24 15:45 ` Henning Schild
@ 2018-05-25 12:25 ` Maxim Yu. Osipov
2018-05-25 17:17 ` Claudius Heine
0 siblings, 1 reply; 7+ messages in thread
From: Maxim Yu. Osipov @ 2018-05-25 12:25 UTC (permalink / raw)
To: Henning Schild, [ext] claudius.heine.ext@siemens.com
Cc: isar-users, Claudius Heine
Hi Claudius,
I've a short question and suggestion before I can start procedure of
testing/applying this patch set to the tree.
Are you going to correct looping order when purging (as Henning pointed
out see his email below) in the next version of series or provide this
later as a separate patch?
In any case it would be better to rename IMAGE_CFG_PACKAGE to
IMAGE_CFG_PACKAGES and add short description (like purpose of this
variable) to definition of IMAGE_CFG_PACKAGE(S) in
isar-bootstrap-helper.bbclass. Let's improve code readability for other
people.
Kind regards,
Maxim.
On 05/24/2018 05:45 PM, Henning Schild wrote:
> Am Thu, 24 May 2018 16:26:33 +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..1d21831
>> 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
>> + for pkg in ${IMAGE_CFG_PACKAGE}; do
>> + sudo -E chroot "$ROOTFSDIR" \
>> + /usr/bin/apt-get ${APT_ARGS} $pkg
>> + sudo -E chroot "$ROOTFSDIR" \
>> + /usr/bin/apt-get purge --yes $pkg
>> + done
>
> Sorry for not pointing that out the first time. But if we loop we
> should probably do that twice, on the purge in reverse order.
>
> Henning
>
>> + if [ "clean" = ${CLEAN} ]; then
>> + sudo -E chroot "$ROOTFSDIR" \
>> + /usr/bin/apt-get autoremove --purge --yes
>> + sudo -E chroot "$ROOTFSDIR" \
>> + /usr/bin/apt-get clean
>> + fi
>> }
>
--
Maxim Osipov
ilbers GmbH
Maria-Merian-Str. 8
85521 Ottobrunn
Germany
+49 (151) 6517 6917
mosipov@ilbers.de
http://ilbers.de/
Commercial register Munich, HRB 214197
General Manager: Baurzhan Ismagulov
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v3 1/3] isar-bootstrap|configscript: implement one shot config option
2018-05-25 12:25 ` Maxim Yu. Osipov
@ 2018-05-25 17:17 ` Claudius Heine
0 siblings, 0 replies; 7+ messages in thread
From: Claudius Heine @ 2018-05-25 17:17 UTC (permalink / raw)
To: Maxim Yu. Osipov, Henning Schild, [ext] claudius.heine.ext@siemens.com
Cc: isar-users
[-- Attachment #1: Type: text/plain, Size: 5785 bytes --]
Hi Maxim,
On Fri, 2018-05-25 at 14:25 +0200, Maxim Yu. Osipov wrote:
> Hi Claudius,
>
> I've a short question and suggestion before I can start procedure of
> testing/applying this patch set to the tree.
>
> Are you going to correct looping order when purging (as Henning
> pointed
> out see his email below) in the next version of series or provide
> this
> later as a separate patch?
Yes I planned to do that next week.
>
> In any case it would be better to rename IMAGE_CFG_PACKAGE to
> IMAGE_CFG_PACKAGES and add short description (like purpose of this
> variable) to definition of IMAGE_CFG_PACKAGE(S) in
> isar-bootstrap-helper.bbclass. Let's improve code readability for
> other
> people.
Yes I can do that as well. Thanks for the suggestion!
Claudius
P.S.: Also, please avoid top posting in mailing lists and prefer
interleaved style.
>
> Kind regards,
> Maxim.
>
> On 05/24/2018 05:45 PM, Henning Schild wrote:
> > Am Thu, 24 May 2018 16:26:33 +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..1d21831
> > > 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
> > > + for pkg in ${IMAGE_CFG_PACKAGE}; do
> > > + sudo -E chroot "$ROOTFSDIR" \
> > > + /usr/bin/apt-get ${APT_ARGS} $pkg
> > > + sudo -E chroot "$ROOTFSDIR" \
> > > + /usr/bin/apt-get purge --yes $pkg
> > > + done
> >
> > Sorry for not pointing that out the first time. But if we loop we
> > should probably do that twice, on the purge in reverse order.
> >
> > Henning
> >
> > > + if [ "clean" = ${CLEAN} ]; then
> > > + sudo -E chroot "$ROOTFSDIR" \
> > > + /usr/bin/apt-get autoremove --purge --yes
> > > + 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
PGP key: 6FF2 E59F 00C6 BC28 31D8 64C1 1173 CB19 9808 B153
Keyserver: hkp://pool.sks-keyservers.net
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2018-05-25 17:17 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-05-24 14:26 [PATCH v3 0/3] One-shot configuration packages claudius.heine.ext
2018-05-24 14:26 ` [PATCH v3 1/3] isar-bootstrap|configscript: implement one shot config option claudius.heine.ext
2018-05-24 15:45 ` Henning Schild
2018-05-25 12:25 ` Maxim Yu. Osipov
2018-05-25 17:17 ` Claudius Heine
2018-05-24 14:26 ` [PATCH v3 2/3] meta/isar-cfg-localepurge: added locale purge recipe claudius.heine.ext
2018-05-24 14:26 ` [PATCH v3 3/3] meta-isar/isar-image-base: switch use isar-cfg-localepurge claudius.heine.ext
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox