From 95acfbe9904728c2149faa4651cd9639dd5d4d38 Mon Sep 17 00:00:00 2001 From: Serge Hallyn Date: Thu, 7 Sep 2023 14:34:22 -0500 Subject: [PATCH] Make --persist an alias to --upper And make --persist imply --writeable. Signed-off-by: Serge Hallyn --- .github/workflows/build.yaml | 3 +-- mount.go | 18 +++++++++--------- 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 7ba05f5..4ecdb2d 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -66,9 +66,8 @@ jobs: run: | export PATH=~/bin:$PATH skopeo copy docker://zothub.io/machine/bootkit/bootkit:v0.0.16.230901-squashfs oci:oci:bootkit-squashfs - mkdir upper lxc-usernsexec -s << EOF - atomfs mount --writeable --upperdir=upper oci:bootkit-squashfs dest + atomfs mount --persist=upper oci:bootkit-squashfs dest [ -d dest/bootkit ] touch dest/zz atomfs umount dest diff --git a/mount.go b/mount.go index 3a3fddf..0f56562 100644 --- a/mount.go +++ b/mount.go @@ -20,18 +20,18 @@ var mountCmd = cli.Command{ Action: doMount, Flags: []cli.Flag{ cli.StringFlag{ - Name: "upper, upperdir", - Usage: "Directory to use as writeable overlay", + Name: "persist, upper, upperdir", + Usage: "Specify a directory to use as writeable overlay (implies --writeable)", }, cli.BoolFlag{ - Name: "writeable", - Usage: "Make writeable using an overlay", + Name: "writeable, writable", + Usage: "Make the mount writeable using an overlay (ephemeral by default)", }, }, } func mountUsage(me string) error { - return fmt.Errorf("Usage: atomfs mount [--writeable [--upper=/tmp/upperdir]] ocidir:tag target") + return fmt.Errorf("Usage: atomfs mount [--writeable] [--persist=/tmp/upperdir] ocidir:tag target") } func findImage(ctx *cli.Context) (string, string, error) { @@ -104,7 +104,7 @@ func doMount(ctx *cli.Context) error { return err } - if ctx.Bool("writeable") { + if ctx.Bool("writeable") || ctx.IsSet("persist") { err = overlay(target, rodest, metadir, ctx) } else { err = bind(target, rodest) @@ -180,9 +180,9 @@ func overlay(target, rodest, metadir string, ctx *cli.Context) error { if err := EnsureDir(workdir); err != nil { return err } - upperdir := filepath.Join(metadir, "upper") - if ctx.IsSet("upper") { - upperdir = ctx.String("upper") + upperdir := filepath.Join(metadir, "persist") + if ctx.IsSet("persist") { + upperdir = ctx.String("persist") } if err := EnsureDir(upperdir); err != nil { return err