From e0c1309ed4bde952271f59be1760c13ac100502d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Anders=20F=20Bj=C3=B6rklund?= Date: Sat, 15 Mar 2025 17:32:27 +0100 Subject: [PATCH] Add list option to unsquashfs --- cmd/go-unsquashfs/main.go | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/cmd/go-unsquashfs/main.go b/cmd/go-unsquashfs/main.go index 75be53f..9915b0a 100644 --- a/cmd/go-unsquashfs/main.go +++ b/cmd/go-unsquashfs/main.go @@ -3,7 +3,9 @@ package main import ( "flag" "fmt" + "io/fs" "os" + "path/filepath" "time" "github.com/CalebQ42/squashfs" @@ -11,6 +13,7 @@ import ( func main() { verbose := flag.Bool("v", false, "Verbose") + list := flag.Bool("l", false, "List") ignore := flag.Bool("ip", false, "Ignore Permissions and extract all files/folders with 0755") flag.Parse() if len(flag.Args()) < 2 { @@ -25,6 +28,17 @@ func main() { if err != nil { panic(err) } + if *list { + root := flag.Arg(1) + fs.WalkDir(r, ".", func(path string, d fs.DirEntry, err error) error { + if err != nil { + panic(err) + } + fmt.Println(filepath.Join(root, path)) + return nil + }) + return + } op := squashfs.DefaultOptions() op.Verbose = *verbose op.IgnorePerm = *ignore