Message ID | 20231215195526.1117565-1-Quirin.Gylstorff@siemens.com (mailing list archive) |
---|---|
State | Accepted |
Headers | show |
Series | [isar-cip-core] initramfs-overlay-hook: Get Storage mount point from INITRAMFS_OVERLAY_STORAGE_PATH | expand |
On Fri, 2023-12-15 at 20:54 +0100, Quirin Gylstorff wrote: > From: Quirin Gylstorff <quirin.gylstorff@siemens.com> > > This allows to set the overlay storage to another root directory for > example to store the overlay is /overlays. typo --------------------------| > > This restores a similar behaviour as from before: > 725dbc99cf9c4956fe7eb04d3932423782b7ce57. Hi Quirin, thanks for fixing this. Back then I was not aware that there is a use-case to change the overlay path (I considered these variables to be internal). Anyways, a bit more documentation would have avoided this confusion. Could you please add a comment per variable what to put in there. > > > Signed-off-by: Quirin Gylstorff <quirin.gylstorff@siemens.com> > --- > .../initramfs-overlay-hook/files/overlay.script.tmpl | 8 +++++- > -- > 1 file changed, 5 insertions(+), 3 deletions(-) > > diff --git a/recipes-initramfs/initramfs-overlay- > hook/files/overlay.script.tmpl b/recipes-initramfs/initramfs-overlay- > hook/files/overlay.script.tmpl > index d7da6fb..e9a5e40 100644 > --- a/recipes-initramfs/initramfs-overlay- > hook/files/overlay.script.tmpl > +++ b/recipes-initramfs/initramfs-overlay- > hook/files/overlay.script.tmpl > @@ -1,4 +1,5 @@ > #!/bin/sh > +# vim: ft=sh Either we add this to all scripts, or we don't. We should keep it consistent. > # > # CIP Core, generic profile > # > @@ -32,12 +33,13 @@ > ovl_storage_path="${INITRAMFS_OVERLAY_STORAGE_PATH}" > ovl_lower_dirs="${INITRAMFS_OVERLAY_PATHS}" > > root_mount_storage=${rootmnt}${ovl_storage_path} > +storage_mount_point="$(echo "${ovl_storage_path}" | awk -F/ '{print > FS$2}' )" How about subdirectories? Is this also supported, or would it break here? Felix > > -if ! mountpoint -q "${rootmnt}/var"; then > +if ! mountpoint -q "${rootmnt}${storage_mount_point}"; then > if ! mount -t $(get_fstype ${ovl_partition_device}) \ > ${ovl_partition_device} \ > - ${rootmnt}/var; then > - panic "Can't mount /var partition - overlay will not > work!" > + ${rootmnt}${storage_mount_point}; then > + panic "Can't mount ${storage_mount_point} partition - > overlay will not work!" > fi > fi >
On 12/17/23 07:58, Moessbauer Felix wrote: > On Fri, 2023-12-15 at 20:54 +0100, Quirin Gylstorff wrote: >> From: Quirin Gylstorff <quirin.gylstorff@siemens.com> >> >> This allows to set the overlay storage to another root directory for >> example to store the overlay is /overlays. > typo --------------------------| > >> >> This restores a similar behaviour as from before: >> 725dbc99cf9c4956fe7eb04d3932423782b7ce57. > > Hi Quirin, thanks for fixing this. Back then I was not aware that there > is a use-case to change the overlay path (I considered these variables > to be internal). > > Anyways, a bit more documentation would have avoided this confusion. > Could you please add a comment per variable what to put in there. > I will add an comment. The issue in this case was the we derived the mountpoint directory from the variable `INITRAMFS_OVERLAY_STORAGE_LABEL`. >> >> >> Signed-off-by: Quirin Gylstorff <quirin.gylstorff@siemens.com> >> --- >> .../initramfs-overlay-hook/files/overlay.script.tmpl | 8 +++++- >> -- >> 1 file changed, 5 insertions(+), 3 deletions(-) >> >> diff --git a/recipes-initramfs/initramfs-overlay- >> hook/files/overlay.script.tmpl b/recipes-initramfs/initramfs-overlay- >> hook/files/overlay.script.tmpl >> index d7da6fb..e9a5e40 100644 >> --- a/recipes-initramfs/initramfs-overlay- >> hook/files/overlay.script.tmpl >> +++ b/recipes-initramfs/initramfs-overlay- >> hook/files/overlay.script.tmpl >> @@ -1,4 +1,5 @@ >> #!/bin/sh >> +# vim: ft=sh > > Either we add this to all scripts, or we don't. We should keep it > consistent. > I will remove it in v2. >> # >> # CIP Core, generic profile >> # >> @@ -32,12 +33,13 @@ >> ovl_storage_path="${INITRAMFS_OVERLAY_STORAGE_PATH}" >> ovl_lower_dirs="${INITRAMFS_OVERLAY_PATHS}" >> >> root_mount_storage=${rootmnt}${ovl_storage_path} >> +storage_mount_point="$(echo "${ovl_storage_path}" | awk -F/ '{print >> FS$2}' )" > > How about subdirectories? Is this also supported, or would it break > here? Currently we only restore the previous behavior that it mounts on /<storage_mountpoint>. If the user sets OVERLAY_STORAGE_PATH to `/overlay/local/foo/bar/` this works. If we want to support the mount point as a subdirectory an additional variable would be necessary. Quirin > > Felix > >> >> -if ! mountpoint -q "${rootmnt}/var"; then >> +if ! mountpoint -q "${rootmnt}${storage_mount_point}"; then >> if ! mount -t $(get_fstype ${ovl_partition_device}) \ >> ${ovl_partition_device} \ >> - ${rootmnt}/var; then >> - panic "Can't mount /var partition - overlay will not >> work!" >> + ${rootmnt}${storage_mount_point}; then >> + panic "Can't mount ${storage_mount_point} partition - >> overlay will not work!" >> fi >> fi >> >
diff --git a/recipes-initramfs/initramfs-overlay-hook/files/overlay.script.tmpl b/recipes-initramfs/initramfs-overlay-hook/files/overlay.script.tmpl index d7da6fb..e9a5e40 100644 --- a/recipes-initramfs/initramfs-overlay-hook/files/overlay.script.tmpl +++ b/recipes-initramfs/initramfs-overlay-hook/files/overlay.script.tmpl @@ -1,4 +1,5 @@ #!/bin/sh +# vim: ft=sh # # CIP Core, generic profile # @@ -32,12 +33,13 @@ ovl_storage_path="${INITRAMFS_OVERLAY_STORAGE_PATH}" ovl_lower_dirs="${INITRAMFS_OVERLAY_PATHS}" root_mount_storage=${rootmnt}${ovl_storage_path} +storage_mount_point="$(echo "${ovl_storage_path}" | awk -F/ '{print FS$2}' )" -if ! mountpoint -q "${rootmnt}/var"; then +if ! mountpoint -q "${rootmnt}${storage_mount_point}"; then if ! mount -t $(get_fstype ${ovl_partition_device}) \ ${ovl_partition_device} \ - ${rootmnt}/var; then - panic "Can't mount /var partition - overlay will not work!" + ${rootmnt}${storage_mount_point}; then + panic "Can't mount ${storage_mount_point} partition - overlay will not work!" fi fi