Skip to content

Commit

Permalink
Make --persist an alias to --upper
Browse files Browse the repository at this point in the history
And make --persist imply --writeable.

Signed-off-by: Serge Hallyn <[email protected]>
  • Loading branch information
hallyn committed Sep 7, 2023
1 parent 21ccd8d commit 95acfbe
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 11 deletions.
3 changes: 1 addition & 2 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
18 changes: 9 additions & 9 deletions mount.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 95acfbe

Please sign in to comment.