Add list option to unsquashfs

This commit is contained in:
Anders F Björklund
2025-03-15 17:32:27 +01:00
parent 3a48a0bcdc
commit e0c1309ed4
+14
View File
@@ -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