* [gentoo-catalyst] [PATCH 1/3] catalyst: Rename shmfs -> shm
@ 2020-05-15 6:37 Matt Turner
2020-05-15 6:37 ` [gentoo-catalyst] [PATCH 2/3] catalyst: Factor out mount/source/target in bind() Matt Turner
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: Matt Turner @ 2020-05-15 6:37 UTC (permalink / raw
To: gentoo-catalyst; +Cc: Matt Turner
This will allow us to factor out the ['source', 'target'] from each
case.
Signed-off-by: Matt Turner <mattst88@gentoo.org>
---
catalyst/base/stagebase.py | 4 ++--
catalyst/defaults.py | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/catalyst/base/stagebase.py b/catalyst/base/stagebase.py
index 68945da8..52f9cd5b 100644
--- a/catalyst/base/stagebase.py
+++ b/catalyst/base/stagebase.py
@@ -864,9 +864,9 @@ class StageBase(TargetBase, ClearBase, GenBase):
target]
elif source == 'tmpfs':
_cmd = ['mount', '-t', 'tmpfs', source, target]
- elif source == 'shmfs':
+ elif source == 'shm':
_cmd = ['mount', '-t', 'tmpfs', '-o', 'noexec,nosuid,nodev',
- 'shm', target]
+ source, target]
else:
_cmd = ['mount', source, target]
diff --git a/catalyst/defaults.py b/catalyst/defaults.py
index 9d5771d5..404f4892 100644
--- a/catalyst/defaults.py
+++ b/catalyst/defaults.py
@@ -99,7 +99,7 @@ MOUNT_DEFAULTS = OrderedDict([
}),
('shm', {
'enable': True,
- 'source': 'shmfs',
+ 'source': 'shm',
'target': '/dev/shm',
}),
('run', {
--
2.26.2
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [gentoo-catalyst] [PATCH 2/3] catalyst: Factor out mount/source/target in bind()
2020-05-15 6:37 [gentoo-catalyst] [PATCH 1/3] catalyst: Rename shmfs -> shm Matt Turner
@ 2020-05-15 6:37 ` Matt Turner
2020-05-15 6:37 ` [gentoo-catalyst] [PATCH 3/3] catalyst: Mount squashfs with -o ro Matt Turner
2020-05-16 1:45 ` [gentoo-catalyst] [PATCH 1/3] catalyst: Rename shmfs -> shm Brian Dolbec
2 siblings, 0 replies; 5+ messages in thread
From: Matt Turner @ 2020-05-15 6:37 UTC (permalink / raw
To: gentoo-catalyst; +Cc: Matt Turner
This simplifies things, and lets us only append to the end of the list.
It also enables us to simply add multiple args (in the next commit).
Signed-off-by: Matt Turner <mattst88@gentoo.org>
---
catalyst/base/stagebase.py | 23 ++++++++++-------------
1 file changed, 10 insertions(+), 13 deletions(-)
diff --git a/catalyst/base/stagebase.py b/catalyst/base/stagebase.py
index 52f9cd5b..55d1032d 100644
--- a/catalyst/base/stagebase.py
+++ b/catalyst/base/stagebase.py
@@ -852,6 +852,7 @@ class StageBase(TargetBase, ClearBase, GenBase):
source = str(self.mount[x]['source'])
target = self.settings['chroot_path'] + str(self.mount[x]['target'])
+ mount = ['mount']
log.debug('bind %s: "%s" -> "%s"', x, source, target)
@@ -859,29 +860,25 @@ class StageBase(TargetBase, ClearBase, GenBase):
if 'var_tmpfs_portage' not in self.settings:
continue
- _cmd = ['mount', '-t', 'tmpfs', '-o', 'size=' +
- self.settings['var_tmpfs_portage'] + 'G', source,
- target]
+ mount += ['-t', 'tmpfs', '-o', 'size=' +
+ self.settings['var_tmpfs_portage'] + 'G']
elif source == 'tmpfs':
- _cmd = ['mount', '-t', 'tmpfs', source, target]
+ mount += ['-t', 'tmpfs']
elif source == 'shm':
- _cmd = ['mount', '-t', 'tmpfs', '-o', 'noexec,nosuid,nodev',
- source, target]
+ mount += ['-t', 'tmpfs', '-o', 'noexec,nosuid,nodev']
else:
- _cmd = ['mount', source, target]
-
- source = Path(self.mount[x]['source'])
- if source.suffix != '.sqfs':
- _cmd.insert(1, '--bind')
+ source_path = Path(self.mount[x]['source'])
+ if source_path.suffix != '.sqfs':
+ mount.append('--bind')
# We may need to create the source of the bind mount. E.g., in the
# case of an empty package cache we must create the directory that
# the binary packages will be stored into.
- source.mkdir(mode=0o755, exist_ok=True)
+ source_path.mkdir(mode=0o755, exist_ok=True)
Path(target).mkdir(mode=0o755, parents=True, exist_ok=True)
- cmd(_cmd, env=self.env, fail_func=self.unbind)
+ cmd(mount + [source, target], env=self.env, fail_func=self.unbind)
def unbind(self):
ouch = 0
--
2.26.2
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [gentoo-catalyst] [PATCH 3/3] catalyst: Mount squashfs with -o ro
2020-05-15 6:37 [gentoo-catalyst] [PATCH 1/3] catalyst: Rename shmfs -> shm Matt Turner
2020-05-15 6:37 ` [gentoo-catalyst] [PATCH 2/3] catalyst: Factor out mount/source/target in bind() Matt Turner
@ 2020-05-15 6:37 ` Matt Turner
2020-05-16 1:48 ` Brian Dolbec
2020-05-16 1:45 ` [gentoo-catalyst] [PATCH 1/3] catalyst: Rename shmfs -> shm Brian Dolbec
2 siblings, 1 reply; 5+ messages in thread
From: Matt Turner @ 2020-05-15 6:37 UTC (permalink / raw
To: gentoo-catalyst; +Cc: Matt Turner
Even though squashfs is not writeable, it must be mounted with -o ro in
order to be mounted multiple times. This allows, for example, the same
snapshot to be mounted simultaneously in multiple catalyst chroots.
Signed-off-by: Matt Turner <mattst88@gentoo.org>
---
catalyst/base/stagebase.py | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/catalyst/base/stagebase.py b/catalyst/base/stagebase.py
index 55d1032d..651bf4e4 100644
--- a/catalyst/base/stagebase.py
+++ b/catalyst/base/stagebase.py
@@ -868,7 +868,9 @@ class StageBase(TargetBase, ClearBase, GenBase):
mount += ['-t', 'tmpfs', '-o', 'noexec,nosuid,nodev']
else:
source_path = Path(self.mount[x]['source'])
- if source_path.suffix != '.sqfs':
+ if source_path.suffix == '.sqfs':
+ mount += ['-o', 'ro']
+ else:
mount.append('--bind')
# We may need to create the source of the bind mount. E.g., in the
--
2.26.2
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [gentoo-catalyst] [PATCH 1/3] catalyst: Rename shmfs -> shm
2020-05-15 6:37 [gentoo-catalyst] [PATCH 1/3] catalyst: Rename shmfs -> shm Matt Turner
2020-05-15 6:37 ` [gentoo-catalyst] [PATCH 2/3] catalyst: Factor out mount/source/target in bind() Matt Turner
2020-05-15 6:37 ` [gentoo-catalyst] [PATCH 3/3] catalyst: Mount squashfs with -o ro Matt Turner
@ 2020-05-16 1:45 ` Brian Dolbec
2 siblings, 0 replies; 5+ messages in thread
From: Brian Dolbec @ 2020-05-16 1:45 UTC (permalink / raw
To: gentoo-catalyst
On Thu, 14 May 2020 23:37:28 -0700
Matt Turner <mattst88@gentoo.org> wrote:
> This will allow us to factor out the ['source', 'target'] from each
> case.
>
> Signed-off-by: Matt Turner <mattst88@gentoo.org>
> ---
> catalyst/base/stagebase.py | 4 ++--
> catalyst/defaults.py | 2 +-
> 2 files changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/catalyst/base/stagebase.py b/catalyst/base/stagebase.py
> index 68945da8..52f9cd5b 100644
> --- a/catalyst/base/stagebase.py
> +++ b/catalyst/base/stagebase.py
> @@ -864,9 +864,9 @@ class StageBase(TargetBase, ClearBase, GenBase):
> target]
> elif source == 'tmpfs':
> _cmd = ['mount', '-t', 'tmpfs', source, target]
> - elif source == 'shmfs':
> + elif source == 'shm':
> _cmd = ['mount', '-t', 'tmpfs', '-o',
> 'noexec,nosuid,nodev',
> - 'shm', target]
> + source, target]
> else:
> _cmd = ['mount', source, target]
>
> diff --git a/catalyst/defaults.py b/catalyst/defaults.py
> index 9d5771d5..404f4892 100644
> --- a/catalyst/defaults.py
> +++ b/catalyst/defaults.py
> @@ -99,7 +99,7 @@ MOUNT_DEFAULTS = OrderedDict([
> }),
> ('shm', {
> 'enable': True,
> - 'source': 'shmfs',
> + 'source': 'shm',
> 'target': '/dev/shm',
> }),
> ('run', {
Looks fine
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [gentoo-catalyst] [PATCH 3/3] catalyst: Mount squashfs with -o ro
2020-05-15 6:37 ` [gentoo-catalyst] [PATCH 3/3] catalyst: Mount squashfs with -o ro Matt Turner
@ 2020-05-16 1:48 ` Brian Dolbec
0 siblings, 0 replies; 5+ messages in thread
From: Brian Dolbec @ 2020-05-16 1:48 UTC (permalink / raw
To: gentoo-catalyst
On Thu, 14 May 2020 23:37:30 -0700
Matt Turner <mattst88@gentoo.org> wrote:
> Even though squashfs is not writeable, it must be mounted with -o ro
> in order to be mounted multiple times. This allows, for example, the
> same snapshot to be mounted simultaneously in multiple catalyst
> chroots.
>
> Signed-off-by: Matt Turner <mattst88@gentoo.org>
> ---
> catalyst/base/stagebase.py | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/catalyst/base/stagebase.py b/catalyst/base/stagebase.py
> index 55d1032d..651bf4e4 100644
> --- a/catalyst/base/stagebase.py
> +++ b/catalyst/base/stagebase.py
> @@ -868,7 +868,9 @@ class StageBase(TargetBase, ClearBase, GenBase):
> mount += ['-t', 'tmpfs', '-o', 'noexec,nosuid,nodev']
> else:
> source_path = Path(self.mount[x]['source'])
> - if source_path.suffix != '.sqfs':
> + if source_path.suffix == '.sqfs':
> + mount += ['-o', 'ro']
> + else:
> mount.append('--bind')
>
> # We may need to create the source of the bind
> mount. E.g., in the
Yes to patch #2 and #3
Please make a header email for multiple commits series, Is easier to
approve all with one email ;)
I don't know why but I'm getting yours out of numerical order in
claws-mail...
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2020-05-16 1:48 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-05-15 6:37 [gentoo-catalyst] [PATCH 1/3] catalyst: Rename shmfs -> shm Matt Turner
2020-05-15 6:37 ` [gentoo-catalyst] [PATCH 2/3] catalyst: Factor out mount/source/target in bind() Matt Turner
2020-05-15 6:37 ` [gentoo-catalyst] [PATCH 3/3] catalyst: Mount squashfs with -o ro Matt Turner
2020-05-16 1:48 ` Brian Dolbec
2020-05-16 1:45 ` [gentoo-catalyst] [PATCH 1/3] catalyst: Rename shmfs -> shm Brian Dolbec
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox