* [PATCH] wic: Add include-dir option
@ 2020-02-27 4:26 Armin Kuster
2020-02-27 8:12 ` Martin Hundebøll
0 siblings, 1 reply; 5+ messages in thread
From: Armin Kuster @ 2020-02-27 4:26 UTC (permalink / raw)
To: openembedded-core
This option allows for the inclusion of a single directory
for a partition.
Signed-off-by: Armin Kuster <akuster808@gmail.com>
---
scripts/lib/wic/help.py | 3 +++
scripts/lib/wic/ksparser.py | 1 +
scripts/lib/wic/partition.py | 1 +
scripts/lib/wic/plugins/source/rootfs.py | 10 ++++++++--
4 files changed, 13 insertions(+), 2 deletions(-)
diff --git a/scripts/lib/wic/help.py b/scripts/lib/wic/help.py
index 4d342fcf05..517f68e11e 100644
--- a/scripts/lib/wic/help.py
+++ b/scripts/lib/wic/help.py
@@ -979,6 +979,9 @@ DESCRIPTION
copies. This option only has an effect with the rootfs
source plugin.
+ --include-dir: This option is specific to wic. It adds the contents
+ of the given directory to the resulting partition.
+
--extra-space: This option is specific to wic. It adds extra
space after the space filled by the content
of the partition. The final size can go
diff --git a/scripts/lib/wic/ksparser.py b/scripts/lib/wic/ksparser.py
index 650b976223..b8abc33c87 100644
--- a/scripts/lib/wic/ksparser.py
+++ b/scripts/lib/wic/ksparser.py
@@ -138,6 +138,7 @@ class KickStart():
part.add_argument('--align', type=int)
part.add_argument('--exclude-path', nargs='+')
part.add_argument('--include-path', nargs='+')
+ part.add_argument('--include-dir')
part.add_argument("--extra-space", type=sizetype)
part.add_argument('--fsoptions', dest='fsopts')
part.add_argument('--fstype', default='vfat',
diff --git a/scripts/lib/wic/partition.py b/scripts/lib/wic/partition.py
index 2d95f78439..0b735fffd9 100644
--- a/scripts/lib/wic/partition.py
+++ b/scripts/lib/wic/partition.py
@@ -31,6 +31,7 @@ class Partition():
self.extra_space = args.extra_space
self.exclude_path = args.exclude_path
self.include_path = args.include_path
+ self.include_dir = args.include_dir
self.fsopts = args.fsopts
self.fstype = args.fstype
self.label = args.label
diff --git a/scripts/lib/wic/plugins/source/rootfs.py b/scripts/lib/wic/plugins/source/rootfs.py
index 705aeb5563..d1c59cab8a 100644
--- a/scripts/lib/wic/plugins/source/rootfs.py
+++ b/scripts/lib/wic/plugins/source/rootfs.py
@@ -71,7 +71,7 @@ class RootfsPlugin(SourcePlugin):
new_rootfs = None
# Handle excluded paths.
- if part.exclude_path or part.include_path:
+ if part.exclude_path or part.include_path or part.include_dir:
# We need a new rootfs directory we can delete files from. Copy to
# workdir.
new_rootfs = os.path.realpath(os.path.join(cr_workdir, "rootfs%d" % part.lineno))
@@ -79,7 +79,13 @@ class RootfsPlugin(SourcePlugin):
if os.path.lexists(new_rootfs):
shutil.rmtree(os.path.join(new_rootfs))
- copyhardlinktree(part.rootfs_dir, new_rootfs)
+ if part.include_dir:
+ src = os.path.realpath(os.path.join(part.rootfs_dir, part.include_dir))
+ dst = os.path.realpath(os.path.join(new_rootfs, part.include_dir))
+ copyhardlinktree(src, dst)
+
+ else:
+ copyhardlinktree(part.rootfs_dir, new_rootfs)
for path in part.include_path or []:
copyhardlinktree(path, new_rootfs)
--
2.17.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] wic: Add include-dir option
2020-02-27 4:26 [PATCH] wic: Add include-dir option Armin Kuster
@ 2020-02-27 8:12 ` Martin Hundebøll
2020-02-27 19:43 ` akuster808
0 siblings, 1 reply; 5+ messages in thread
From: Martin Hundebøll @ 2020-02-27 8:12 UTC (permalink / raw)
To: Armin Kuster, openembedded-core
Hi Armin,
On 27/02/2020 05.26, Armin Kuster wrote:
> This option allows for the inclusion of a single directory
> for a partition.
I am unsure how this is used in a .wks file.
From the code it looks similar to the include-path option, but relative
to the rootfs source dir instead of the wic working dir?
But the include-dir value is also used in the destination path?
Thanks,
Martin
> Signed-off-by: Armin Kuster <akuster808@gmail.com>
> ---
> scripts/lib/wic/help.py | 3 +++
> scripts/lib/wic/ksparser.py | 1 +
> scripts/lib/wic/partition.py | 1 +
> scripts/lib/wic/plugins/source/rootfs.py | 10 ++++++++--
> 4 files changed, 13 insertions(+), 2 deletions(-)
>
> diff --git a/scripts/lib/wic/help.py b/scripts/lib/wic/help.py
> index 4d342fcf05..517f68e11e 100644
> --- a/scripts/lib/wic/help.py
> +++ b/scripts/lib/wic/help.py
> @@ -979,6 +979,9 @@ DESCRIPTION
> copies. This option only has an effect with the rootfs
> source plugin.
>
> + --include-dir: This option is specific to wic. It adds the contents
> + of the given directory to the resulting partition.
> +
> --extra-space: This option is specific to wic. It adds extra
> space after the space filled by the content
> of the partition. The final size can go
> diff --git a/scripts/lib/wic/ksparser.py b/scripts/lib/wic/ksparser.py
> index 650b976223..b8abc33c87 100644
> --- a/scripts/lib/wic/ksparser.py
> +++ b/scripts/lib/wic/ksparser.py
> @@ -138,6 +138,7 @@ class KickStart():
> part.add_argument('--align', type=int)
> part.add_argument('--exclude-path', nargs='+')
> part.add_argument('--include-path', nargs='+')
> + part.add_argument('--include-dir')
> part.add_argument("--extra-space", type=sizetype)
> part.add_argument('--fsoptions', dest='fsopts')
> part.add_argument('--fstype', default='vfat',
> diff --git a/scripts/lib/wic/partition.py b/scripts/lib/wic/partition.py
> index 2d95f78439..0b735fffd9 100644
> --- a/scripts/lib/wic/partition.py
> +++ b/scripts/lib/wic/partition.py
> @@ -31,6 +31,7 @@ class Partition():
> self.extra_space = args.extra_space
> self.exclude_path = args.exclude_path
> self.include_path = args.include_path
> + self.include_dir = args.include_dir
> self.fsopts = args.fsopts
> self.fstype = args.fstype
> self.label = args.label
> diff --git a/scripts/lib/wic/plugins/source/rootfs.py b/scripts/lib/wic/plugins/source/rootfs.py
> index 705aeb5563..d1c59cab8a 100644
> --- a/scripts/lib/wic/plugins/source/rootfs.py
> +++ b/scripts/lib/wic/plugins/source/rootfs.py
> @@ -71,7 +71,7 @@ class RootfsPlugin(SourcePlugin):
>
> new_rootfs = None
> # Handle excluded paths.
> - if part.exclude_path or part.include_path:
> + if part.exclude_path or part.include_path or part.include_dir:
> # We need a new rootfs directory we can delete files from. Copy to
> # workdir.
> new_rootfs = os.path.realpath(os.path.join(cr_workdir, "rootfs%d" % part.lineno))
> @@ -79,7 +79,13 @@ class RootfsPlugin(SourcePlugin):
> if os.path.lexists(new_rootfs):
> shutil.rmtree(os.path.join(new_rootfs))
>
> - copyhardlinktree(part.rootfs_dir, new_rootfs)
> + if part.include_dir:
> + src = os.path.realpath(os.path.join(part.rootfs_dir, part.include_dir))
> + dst = os.path.realpath(os.path.join(new_rootfs, part.include_dir))
> + copyhardlinktree(src, dst)
> +
> + else:
> + copyhardlinktree(part.rootfs_dir, new_rootfs)
>
> for path in part.include_path or []:
> copyhardlinktree(path, new_rootfs)
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] wic: Add include-dir option
2020-02-27 8:12 ` Martin Hundebøll
@ 2020-02-27 19:43 ` akuster808
2020-02-27 19:50 ` Paul Barker
0 siblings, 1 reply; 5+ messages in thread
From: akuster808 @ 2020-02-27 19:43 UTC (permalink / raw)
To: Martin Hundebøll, openembedded-core
On 2/27/20 12:12 AM, Martin Hundebøll wrote:
> Hi Armin,
>
> On 27/02/2020 05.26, Armin Kuster wrote:
>> This option allows for the inclusion of a single directory
>> for a partition.
>
> I am unsure how this is used in a .wks file.
Yeah, the documentation does not cover this.
This is what I used to verified it works
part / --source rootfs --ondisk mmcblk1 --fstype=ext4 --label rootfs
--align 4096 --exclude-path=var
part /var --source rootfs --ondisk mmcblk1 --fstype=ext4 --label var
--align 4096 --include-dir=var
>
> From the code it looks similar to the include-path option, but
> relative to the rootfs source dir instead of the wic working dir?
the --include-path adds an entire rootfs to the partition. I don't want
the another rootfs. The help file even says that. I want on directory.
--exclude-dir allows me to "exclude" a dir .
I used wic ls {path to partition}:{partition number} to view the
contents of the partition.
>
> But the include-dir value is also used in the destination path?
Then please document it and I don't mean the "help" file which is unclear.
So how would you have "home" or "var" be in their own partitions? Please
show an example.
- armin
>
> Thanks,
> Martin
>
>> Signed-off-by: Armin Kuster <akuster808@gmail.com>
>> ---
>> scripts/lib/wic/help.py | 3 +++
>> scripts/lib/wic/ksparser.py | 1 +
>> scripts/lib/wic/partition.py | 1 +
>> scripts/lib/wic/plugins/source/rootfs.py | 10 ++++++++--
>> 4 files changed, 13 insertions(+), 2 deletions(-)
>>
>> diff --git a/scripts/lib/wic/help.py b/scripts/lib/wic/help.py
>> index 4d342fcf05..517f68e11e 100644
>> --- a/scripts/lib/wic/help.py
>> +++ b/scripts/lib/wic/help.py
>> @@ -979,6 +979,9 @@ DESCRIPTION
>> copies. This option only has an effect
>> with the rootfs
>> source plugin.
>> + --include-dir: This option is specific to wic. It adds
>> the contents
>> + of the given directory to the resulting
>> partition.
>> +
>> --extra-space: This option is specific to wic. It adds extra
>> space after the space filled by the content
>> of the partition. The final size can go
>> diff --git a/scripts/lib/wic/ksparser.py b/scripts/lib/wic/ksparser.py
>> index 650b976223..b8abc33c87 100644
>> --- a/scripts/lib/wic/ksparser.py
>> +++ b/scripts/lib/wic/ksparser.py
>> @@ -138,6 +138,7 @@ class KickStart():
>> part.add_argument('--align', type=int)
>> part.add_argument('--exclude-path', nargs='+')
>> part.add_argument('--include-path', nargs='+')
>> + part.add_argument('--include-dir')
>> part.add_argument("--extra-space", type=sizetype)
>> part.add_argument('--fsoptions', dest='fsopts')
>> part.add_argument('--fstype', default='vfat',
>> diff --git a/scripts/lib/wic/partition.py b/scripts/lib/wic/partition.py
>> index 2d95f78439..0b735fffd9 100644
>> --- a/scripts/lib/wic/partition.py
>> +++ b/scripts/lib/wic/partition.py
>> @@ -31,6 +31,7 @@ class Partition():
>> self.extra_space = args.extra_space
>> self.exclude_path = args.exclude_path
>> self.include_path = args.include_path
>> + self.include_dir = args.include_dir
>> self.fsopts = args.fsopts
>> self.fstype = args.fstype
>> self.label = args.label
>> diff --git a/scripts/lib/wic/plugins/source/rootfs.py
>> b/scripts/lib/wic/plugins/source/rootfs.py
>> index 705aeb5563..d1c59cab8a 100644
>> --- a/scripts/lib/wic/plugins/source/rootfs.py
>> +++ b/scripts/lib/wic/plugins/source/rootfs.py
>> @@ -71,7 +71,7 @@ class RootfsPlugin(SourcePlugin):
>> new_rootfs = None
>> # Handle excluded paths.
>> - if part.exclude_path or part.include_path:
>> + if part.exclude_path or part.include_path or part.include_dir:
>> # We need a new rootfs directory we can delete files
>> from. Copy to
>> # workdir.
>> new_rootfs = os.path.realpath(os.path.join(cr_workdir,
>> "rootfs%d" % part.lineno))
>> @@ -79,7 +79,13 @@ class RootfsPlugin(SourcePlugin):
>> if os.path.lexists(new_rootfs):
>> shutil.rmtree(os.path.join(new_rootfs))
>> - copyhardlinktree(part.rootfs_dir, new_rootfs)
>> + if part.include_dir:
>> + src = os.path.realpath(os.path.join(part.rootfs_dir,
>> part.include_dir))
>> + dst = os.path.realpath(os.path.join(new_rootfs,
>> part.include_dir))
>> + copyhardlinktree(src, dst)
>> +
>> + else:
>> + copyhardlinktree(part.rootfs_dir, new_rootfs)
>> for path in part.include_path or []:
>> copyhardlinktree(path, new_rootfs)
>>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] wic: Add include-dir option
2020-02-27 19:43 ` akuster808
@ 2020-02-27 19:50 ` Paul Barker
2020-02-28 4:18 ` akuster808
0 siblings, 1 reply; 5+ messages in thread
From: Paul Barker @ 2020-02-27 19:50 UTC (permalink / raw)
To: akuster808; +Cc: openembedded-core
On Thu, 27 Feb 2020 at 19:43, akuster808 <akuster808@gmail.com> wrote:
>
>
>
> On 2/27/20 12:12 AM, Martin Hundebøll wrote:
> > Hi Armin,
> >
> > On 27/02/2020 05.26, Armin Kuster wrote:
> >> This option allows for the inclusion of a single directory
> >> for a partition.
> >
> > I am unsure how this is used in a .wks file.
> Yeah, the documentation does not cover this.
>
> This is what I used to verified it works
>
> part / --source rootfs --ondisk mmcblk1 --fstype=ext4 --label rootfs
> --align 4096 --exclude-path=var
> part /var --source rootfs --ondisk mmcblk1 --fstype=ext4 --label var
> --align 4096 --include-dir=var
>
>
> >
> > From the code it looks similar to the include-path option, but
> > relative to the rootfs source dir instead of the wic working dir?
>
> the --include-path adds an entire rootfs to the partition. I don't want
> the another rootfs. The help file even says that. I want on directory.
> --exclude-dir allows me to "exclude" a dir .
>
>
> I used wic ls {path to partition}:{partition number} to view the
> contents of the partition.
>
> >
> > But the include-dir value is also used in the destination path?
> Then please document it and I don't mean the "help" file which is unclear.
>
> So how would you have "home" or "var" be in their own partitions? Please
> show an example.
IIRC,
part / --source rootfs --ondisk mmcblk1 --fstype=ext4 --label rootfs
--align 4096 --exclude-path=var
part /var --source rootfs --ondisk mmcblk1 --fstype=ext4 --label var
--align 4096 --rootfs-dir=${IMAGE_ROOTFS}/var
For an example see scripts/lib/wic/canned-wks/efi-bootdisk.wks.in
Thanks,
Paul
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] wic: Add include-dir option
2020-02-27 19:50 ` Paul Barker
@ 2020-02-28 4:18 ` akuster808
0 siblings, 0 replies; 5+ messages in thread
From: akuster808 @ 2020-02-28 4:18 UTC (permalink / raw)
To: Paul Barker; +Cc: openembedded-core
Paul,
On 2/27/20 11:50 AM, Paul Barker wrote:
> On Thu, 27 Feb 2020 at 19:43, akuster808 <akuster808@gmail.com> wrote:
>>
>>
>> On 2/27/20 12:12 AM, Martin Hundebøll wrote:
>>> Hi Armin,
>>>
>>> On 27/02/2020 05.26, Armin Kuster wrote:
>>>> This option allows for the inclusion of a single directory
>>>> for a partition.
>>> I am unsure how this is used in a .wks file.
>> Yeah, the documentation does not cover this.
>>
>> This is what I used to verified it works
>>
>> part / --source rootfs --ondisk mmcblk1 --fstype=ext4 --label rootfs
>> --align 4096 --exclude-path=var
>> part /var --source rootfs --ondisk mmcblk1 --fstype=ext4 --label var
>> --align 4096 --include-dir=var
>>
>>
>>> From the code it looks similar to the include-path option, but
>>> relative to the rootfs source dir instead of the wic working dir?
>> the --include-path adds an entire rootfs to the partition. I don't want
>> the another rootfs. The help file even says that. I want on directory.
>> --exclude-dir allows me to "exclude" a dir .
>>
>>
>> I used wic ls {path to partition}:{partition number} to view the
>> contents of the partition.
>>
>>> But the include-dir value is also used in the destination path?
>> Then please document it and I don't mean the "help" file which is unclear.
>>
>> So how would you have "home" or "var" be in their own partitions? Please
>> show an example.
> IIRC,
>
> part / --source rootfs --ondisk mmcblk1 --fstype=ext4 --label rootfs
> --align 4096 --exclude-path=var
> part /var --source rootfs --ondisk mmcblk1 --fstype=ext4 --label var
> --align 4096 --rootfs-dir=${IMAGE_ROOTFS}/var
>
> For an example see scripts/lib/wic/canned-wks/efi-bootdisk.wks.in
Yeah, I looked all the wks files an nothing jumped out at me. The
"--rootfs-dir" is not intuitive for selecting a single dir but I see
that it does address my issue.
thanks,
Armin
>
> Thanks,
> Paul
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2020-02-28 4:18 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-27 4:26 [PATCH] wic: Add include-dir option Armin Kuster
2020-02-27 8:12 ` Martin Hundebøll
2020-02-27 19:43 ` akuster808
2020-02-27 19:50 ` Paul Barker
2020-02-28 4:18 ` akuster808
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.