Message ID | 20250409082659.3828643-1-felix.moessbauer@siemens.com (mailing list archive) |
---|---|
State | New |
Headers | show |
Series | [isar-cip-core,1/1] immutable-home: create relative symlink in rootfs_postprocess | expand |
On 09.04.25 10:26, Felix Moessbauer wrote: > The Debian policy 10.5 states that symlinks within the top-level > directory shall be realtive. Further, symlinks shall not be dead at any > point in time. > > We now make the symlink relative and create the target directory. While > changing this, we also drop the unnecessary chrooting and make the path > to IMMUTABLE_DATA_DIR canonical. > > Fixes: 786ddaa ("Move content of home to IMMUTABLE_DATA_DIR") > Signed-off-by: Felix Moessbauer <felix.moessbauer@siemens.com> > --- > I decided to add the fixes tag, as I consider violations of the Debian policy > a bug. However, from a runtime POV this does not change anything (hence is not > a bug). Feel free to drop the tag while merging. > > Best regards, > Felix > > classes/read-only-rootfs.bbclass | 5 +++-- > 1 file changed, 3 insertions(+), 2 deletions(-) > > diff --git a/classes/read-only-rootfs.bbclass b/classes/read-only-rootfs.bbclass > index f1db4ae..e81084d 100644 > --- a/classes/read-only-rootfs.bbclass > +++ b/classes/read-only-rootfs.bbclass > @@ -45,12 +45,13 @@ copy_dpkg_state() { > ROOTFS_POSTPROCESS_COMMAND:append = " copy_home_to_immutable_data" > ROOTFS_POSTPROCESS_COMMAND:remove:separate-home-part = " copy_home_to_immutable_data" > copy_home_to_immutable_data() { > - IMMUTABLE_HOME_DIR="${ROOTFSDIR}${IMMUTABLE_DATA_DIR}/" > + IMMUTABLE_HOME_DIR="${ROOTFSDIR}${IMMUTABLE_DATA_DIR}" > sudo mkdir -p "$IMMUTABLE_HOME_DIR" > sudo mv ${ROOTFSDIR}/home "$IMMUTABLE_HOME_DIR/" > # as the rootfs is read-only we need to create the link > # between /var/home and /home during creation. > - sudo chroot ${IMAGE_ROOTFS} ln -s /var/home /home > + sudo ln -s var/home ${IMAGE_ROOTFS}/home > + sudo mkdir -p ${IMAGE_ROOTFS}/var/home > } > > RO_ROOTFS_EXCLUDE_DIRS ??= "" Thanks, applied. Jan
diff --git a/classes/read-only-rootfs.bbclass b/classes/read-only-rootfs.bbclass index f1db4ae..e81084d 100644 --- a/classes/read-only-rootfs.bbclass +++ b/classes/read-only-rootfs.bbclass @@ -45,12 +45,13 @@ copy_dpkg_state() { ROOTFS_POSTPROCESS_COMMAND:append = " copy_home_to_immutable_data" ROOTFS_POSTPROCESS_COMMAND:remove:separate-home-part = " copy_home_to_immutable_data" copy_home_to_immutable_data() { - IMMUTABLE_HOME_DIR="${ROOTFSDIR}${IMMUTABLE_DATA_DIR}/" + IMMUTABLE_HOME_DIR="${ROOTFSDIR}${IMMUTABLE_DATA_DIR}" sudo mkdir -p "$IMMUTABLE_HOME_DIR" sudo mv ${ROOTFSDIR}/home "$IMMUTABLE_HOME_DIR/" # as the rootfs is read-only we need to create the link # between /var/home and /home during creation. - sudo chroot ${IMAGE_ROOTFS} ln -s /var/home /home + sudo ln -s var/home ${IMAGE_ROOTFS}/home + sudo mkdir -p ${IMAGE_ROOTFS}/var/home } RO_ROOTFS_EXCLUDE_DIRS ??= ""
The Debian policy 10.5 states that symlinks within the top-level directory shall be realtive. Further, symlinks shall not be dead at any point in time. We now make the symlink relative and create the target directory. While changing this, we also drop the unnecessary chrooting and make the path to IMMUTABLE_DATA_DIR canonical. Fixes: 786ddaa ("Move content of home to IMMUTABLE_DATA_DIR") Signed-off-by: Felix Moessbauer <felix.moessbauer@siemens.com> --- I decided to add the fixes tag, as I consider violations of the Debian policy a bug. However, from a runtime POV this does not change anything (hence is not a bug). Feel free to drop the tag while merging. Best regards, Felix classes/read-only-rootfs.bbclass | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)