Message ID | 20250211085125.22154-2-Quirin.Gylstorff@siemens.com (mailing list archive) |
---|---|
State | New |
Headers | show |
Series | Make /home partition optional | expand |
On 11.02.25 09:49, Quirin Gylstorff wrote: > From: Quirin Gylstorff <quirin.gylstorff@siemens.com> > > This allows the user to set the variable IMMUTABLE_DATA_DIR. > > This allows to set directory as requested by issue #124. > > https://gitlab.com/cip-project/cip-core/isar-cip-core/-/issues/124 > Signed-off-by: Quirin Gylstorff <quirin.gylstorff@siemens.com> > --- > classes/read-only-rootfs.bbclass | 4 +++- > .../immutable-rootfs/files/immutable-rootfs.tmpfiles | 2 -- > .../immutable-rootfs/files/immutable-rootfs.tmpfiles.tmpl | 2 ++ > recipes-core/immutable-rootfs/immutable-rootfs_0.1.bb | 6 +++++- > 4 files changed, 10 insertions(+), 4 deletions(-) > delete mode 100644 recipes-core/immutable-rootfs/files/immutable-rootfs.tmpfiles > create mode 100644 recipes-core/immutable-rootfs/files/immutable-rootfs.tmpfiles.tmpl > > diff --git a/classes/read-only-rootfs.bbclass b/classes/read-only-rootfs.bbclass > index 35a3ab3..acc04e0 100644 > --- a/classes/read-only-rootfs.bbclass > +++ b/classes/read-only-rootfs.bbclass > @@ -28,8 +28,10 @@ IMAGE_INSTALL:remove:bullseye = " immutable-rootfs" > ROOTFS_POSTPROCESS_COMMAND:append =" copy_dpkg_state" > ROOTFS_POSTPROCESS_COMMAND:remove:buster =" copy_dpkg_state" > ROOTFS_POSTPROCESS_COMMAND:remove:bullseye =" copy_dpkg_state" > + > +IMMUTABLE_DATA_DIR ??= "usr/share/immutable-data" "/usr/..." - better readable. And you can drop the leading slashes below. > copy_dpkg_state() { > - IMMUTABLE_VAR_LIB="${ROOTFSDIR}/usr/share/immutable-data/var/lib" > + IMMUTABLE_VAR_LIB="${ROOTFSDIR}/${IMMUTABLE_DATA_DIR}/var/lib" > sudo mkdir -p "$IMMUTABLE_VAR_LIB" > sudo cp -a ${ROOTFSDIR}/var/lib/dpkg "$IMMUTABLE_VAR_LIB/" > } > diff --git a/recipes-core/immutable-rootfs/files/immutable-rootfs.tmpfiles b/recipes-core/immutable-rootfs/files/immutable-rootfs.tmpfiles > deleted file mode 100644 > index 2f7c338..0000000 > --- a/recipes-core/immutable-rootfs/files/immutable-rootfs.tmpfiles > +++ /dev/null > @@ -1,2 +0,0 @@ > -L /var/lib/dpkg - - - - /usr/share/immutable-data/var/lib/dpkg > -d /var/log/audit 0700 root adm - > diff --git a/recipes-core/immutable-rootfs/files/immutable-rootfs.tmpfiles.tmpl b/recipes-core/immutable-rootfs/files/immutable-rootfs.tmpfiles.tmpl > new file mode 100644 > index 0000000..de8a238 > --- /dev/null > +++ b/recipes-core/immutable-rootfs/files/immutable-rootfs.tmpfiles.tmpl > @@ -0,0 +1,2 @@ > +L /var/lib/dpkg - - - - /${IMMUTABLE_DATA_DIR}/var/lib/dpkg > +d /var/log/audit 0700 root adm - > diff --git a/recipes-core/immutable-rootfs/immutable-rootfs_0.1.bb b/recipes-core/immutable-rootfs/immutable-rootfs_0.1.bb > index 2dbda6d..c61005c 100644 > --- a/recipes-core/immutable-rootfs/immutable-rootfs_0.1.bb > +++ b/recipes-core/immutable-rootfs/immutable-rootfs_0.1.bb PR += 0.1 in case of such changes. > @@ -15,9 +15,13 @@ inherit dpkg-raw > MAINTAINER = "Felix Moessbauer <felix.moessbauer@siemens.com>" > DESCRIPTION = "Config to link volatile data to immutable copies" > > -SRC_URI = "file://${BPN}.tmpfiles" > +SRC_URI = "file://${BPN}.tmpfiles.tmpl" > DPKG_ARCH = "all" > > +IMMUTABLE_DATA_DIR ??= "usr/share/immutable-data" > +TEMPLATE_VARS = "IMMUTABLE_DATA_DIR" > +TEMPLATE_FILES += "${BPN}.tmpfiles.tmpl" > + > do_prepare_build:append() { > cp ${WORKDIR}/${BPN}.tmpfiles ${S}/debian/ > } Jan
diff --git a/classes/read-only-rootfs.bbclass b/classes/read-only-rootfs.bbclass index 35a3ab3..acc04e0 100644 --- a/classes/read-only-rootfs.bbclass +++ b/classes/read-only-rootfs.bbclass @@ -28,8 +28,10 @@ IMAGE_INSTALL:remove:bullseye = " immutable-rootfs" ROOTFS_POSTPROCESS_COMMAND:append =" copy_dpkg_state" ROOTFS_POSTPROCESS_COMMAND:remove:buster =" copy_dpkg_state" ROOTFS_POSTPROCESS_COMMAND:remove:bullseye =" copy_dpkg_state" + +IMMUTABLE_DATA_DIR ??= "usr/share/immutable-data" copy_dpkg_state() { - IMMUTABLE_VAR_LIB="${ROOTFSDIR}/usr/share/immutable-data/var/lib" + IMMUTABLE_VAR_LIB="${ROOTFSDIR}/${IMMUTABLE_DATA_DIR}/var/lib" sudo mkdir -p "$IMMUTABLE_VAR_LIB" sudo cp -a ${ROOTFSDIR}/var/lib/dpkg "$IMMUTABLE_VAR_LIB/" } diff --git a/recipes-core/immutable-rootfs/files/immutable-rootfs.tmpfiles b/recipes-core/immutable-rootfs/files/immutable-rootfs.tmpfiles deleted file mode 100644 index 2f7c338..0000000 --- a/recipes-core/immutable-rootfs/files/immutable-rootfs.tmpfiles +++ /dev/null @@ -1,2 +0,0 @@ -L /var/lib/dpkg - - - - /usr/share/immutable-data/var/lib/dpkg -d /var/log/audit 0700 root adm - diff --git a/recipes-core/immutable-rootfs/files/immutable-rootfs.tmpfiles.tmpl b/recipes-core/immutable-rootfs/files/immutable-rootfs.tmpfiles.tmpl new file mode 100644 index 0000000..de8a238 --- /dev/null +++ b/recipes-core/immutable-rootfs/files/immutable-rootfs.tmpfiles.tmpl @@ -0,0 +1,2 @@ +L /var/lib/dpkg - - - - /${IMMUTABLE_DATA_DIR}/var/lib/dpkg +d /var/log/audit 0700 root adm - diff --git a/recipes-core/immutable-rootfs/immutable-rootfs_0.1.bb b/recipes-core/immutable-rootfs/immutable-rootfs_0.1.bb index 2dbda6d..c61005c 100644 --- a/recipes-core/immutable-rootfs/immutable-rootfs_0.1.bb +++ b/recipes-core/immutable-rootfs/immutable-rootfs_0.1.bb @@ -15,9 +15,13 @@ inherit dpkg-raw MAINTAINER = "Felix Moessbauer <felix.moessbauer@siemens.com>" DESCRIPTION = "Config to link volatile data to immutable copies" -SRC_URI = "file://${BPN}.tmpfiles" +SRC_URI = "file://${BPN}.tmpfiles.tmpl" DPKG_ARCH = "all" +IMMUTABLE_DATA_DIR ??= "usr/share/immutable-data" +TEMPLATE_VARS = "IMMUTABLE_DATA_DIR" +TEMPLATE_FILES += "${BPN}.tmpfiles.tmpl" + do_prepare_build:append() { cp ${WORKDIR}/${BPN}.tmpfiles ${S}/debian/ }