Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions container/container.go
Original file line number Diff line number Diff line change
Expand Up @@ -136,10 +136,8 @@ func (c *Container) Execute(args string, stdin io.Reader) error {
}

// we want to be sure to remove the /stacker from the generated
// filesystem after execution. TODO: parameterize this by storage
// backend? it will always be "rootfs" for btrfs and "overlay" for the
// overlay backend. Maybe this shouldn't even live here.
defer os.Remove(path.Join(c.sc.RootFSDir, c.c.Name(), "rootfs", "stacker"))
// filesystem after execution. we should probably parameterize this in
// the storage API.
defer os.Remove(path.Join(c.sc.RootFSDir, c.c.Name(), "overlay", "stacker"))

cmd, cleanup, err := embed_exec.GetCommand(
Expand Down
3 changes: 1 addition & 2 deletions doc/install.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ packages:

To run `make check` you will also need:

sudo apt install bats btrfs-progs jq libbtrfs-dev tree
sudo apt install bats jq tree

umoci - https://github.com/opencontainers/umoci
squashtool - https://github.com/project-stacker/squashfs
Expand All @@ -53,7 +53,6 @@ The other build dependencies can be satisfied with the following command and
packages:

sudo dnf install lxc-devel libcap-devel libacl-devel gpgme-devel
sudo dnf install btrfs-progs
sudo dnf install bats jq

### Building the Stacker Binary
Expand Down
9 changes: 0 additions & 9 deletions doc/running.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,3 @@ released in 5.11.
Stacker has checks to ensure that it can run with all these environment
requirements, and will fail fast if it can't do something it should be able to
do.

#### Importing squashfs images

In order to correctly import squashfs-based images using the btrfs backend,
[squashtool](https://github.com/project-stacker/squashfs) is also required in `$PATH`. This
is required because tools like unsquashfs don't understand OCI style whiteouts,
and so will not extract them correctly. (One could fix this by implementing a
subsequent extrat pass to fix up overlay style whiteouts, but it would be
better to just use the overlay backend in this case.)
35 changes: 0 additions & 35 deletions mount/filesystems.go

This file was deleted.

93 changes: 0 additions & 93 deletions mount/filesystems_test.go

This file was deleted.

42 changes: 3 additions & 39 deletions squashfs/squashfs.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import (
"sync"

"github.com/pkg/errors"
"golang.org/x/sys/unix"
)

var checkZstdSupported sync.Once
Expand Down Expand Up @@ -168,16 +167,10 @@ func ExtractSingleSquash(squashFile string, extractDir string, storageType strin
}

var uCmd []string
if storageType == "btrfs" {
if which("squashtool") == "" {
return errors.Errorf("must have squashtool (https://github.com/anuvu/squashfs) to correctly extract squashfs using btrfs storage backend")
}

uCmd = []string{"squashtool", "extract", "--whiteouts", "--perms",
"--devs", "--sockets", "--owners"}
uCmd = append(uCmd, squashFile, extractDir)
} else {
if storageType == "overlay" {
uCmd = []string{"unsquashfs", "-f", "-d", extractDir, squashFile}
} else {
return errors.Errorf("unknown storage type %v", storageType)
}

cmd := exec.Command(uCmd[0], uCmd[1:]...)
Expand All @@ -187,35 +180,6 @@ func ExtractSingleSquash(squashFile string, extractDir string, storageType strin
return cmd.Run()
}

func which(name string) string {
return whichSearch(name, strings.Split(os.Getenv("PATH"), ":"))
}

func whichSearch(name string, paths []string) string {
var search []string

if strings.ContainsRune(name, os.PathSeparator) {
if path.IsAbs(name) {
search = []string{name}
} else {
search = []string{"./" + name}
}
} else {
search = []string{}
for _, p := range paths {
search = append(search, path.Join(p, name))
}
}

for _, fPath := range search {
if err := unix.Access(fPath, unix.X_OK); err == nil {
return fPath
}
}

return ""
}

func mksquashfsSupportsZstd() bool {
checkZstdSupported.Do(func() {
var stdoutBuffer strings.Builder
Expand Down
4 changes: 0 additions & 4 deletions test/env.bats
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,6 @@ EOF
touch roots/.lock .stacker/.lock
chmod 777 -R roots .stacker

# this only works in overlay, since the btrfs storage will mount
# btrfs.loop and the roots/.lock won't be on the same fs. since the kernel
# will give us an EBUSY for mounting the same source to the same target
# anyway, that can't race, so it's fine to ignore.
(
flock 9
bad_stacker build
Expand Down